Merge pull request #278 from zeng-github01: fix pEffect legacy compatibility

This commit is contained in:
KAMKEEL committed 2026-08-11 05:52:36 -04:00
commit d4b9a18a1a
1 file changed
+12 -1
@@ -4,6 +4,7 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.constants.EnumPotionType;
import noppes.npcs.controllers.data.Line;
import noppes.npcs.controllers.data.Lines;
import noppes.npcs.entity.EntityNPCInterface;
@@ -13,11 +14,21 @@ import java.util.Collection;
import java.util.List;
public class VersionCompatibility {
public static int ModRev = 23;
public static int ModRev = 24;
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound) {
if (npc.npcVersion == ModRev)
return;
if (npc.npcVersion < 24) {
// Fire projectiles used to ignite unconditionally. The ignite check now also requires
// pBurnItem, which reads false when the key is absent, so restore it for anything
// saved before the flag existed.
if (compound.hasKey("pEffect") && !compound.hasKey("pBurnItem")) {
if (EnumPotionType.fromOrdinal(compound.getInteger("pEffect")) == EnumPotionType.Fire) {
compound.setBoolean("pBurnItem", true);
}
}
}
if (npc.npcVersion < 23) {
if (compound.hasKey("AimWhileShooting")) {
boolean aimShot = compound.getBoolean("AimWhileShooting");