Fix deserialization of EnumDemonWillType

This commit is contained in:
Nicholas Ignoffo 2016-10-18 16:59:50 -07:00
parent b1335f9e9a
commit 66974716ef
12 changed files with 25 additions and 33 deletions

View file

@ -2,10 +2,8 @@ package WayofTime.bloodmagic.api.soul;
import java.util.Locale; import java.util.Locale;
import lombok.Getter;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@Getter
public enum EnumDemonWillType implements IStringSerializable public enum EnumDemonWillType implements IStringSerializable
{ {
DEFAULT("default"), DEFAULT("default"),

View file

@ -14,6 +14,8 @@ import WayofTime.bloodmagic.gson.Serializers;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import java.util.Locale;
public abstract class EntityAspectedDemonBase extends EntityDemonBase public abstract class EntityAspectedDemonBase extends EntityDemonBase
{ {
protected static final DataParameter<EnumDemonWillType> TYPE = EntityDataManager.<EnumDemonWillType>createKey(EntityAspectedDemonBase.class, Serializers.WILL_TYPE_SERIALIZER); protected static final DataParameter<EnumDemonWillType> TYPE = EntityDataManager.<EnumDemonWillType>createKey(EntityAspectedDemonBase.class, Serializers.WILL_TYPE_SERIALIZER);
@ -223,7 +225,7 @@ public abstract class EntityAspectedDemonBase extends EntityDemonBase
setType(EnumDemonWillType.DEFAULT); setType(EnumDemonWillType.DEFAULT);
} else } else
{ {
setType(EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE))); setType(EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH)));
} }
} }

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.entity.mob;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -457,7 +458,7 @@ public class EntitySentientSpecter extends EntityDemonBase
type = EnumDemonWillType.DEFAULT; type = EnumDemonWillType.DEFAULT;
} else } else
{ {
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
wasGivenSentientArmour = tag.getBoolean("sentientArmour"); wasGivenSentientArmour = tag.getBoolean("sentientArmour");

View file

@ -13,6 +13,8 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import java.util.Locale;
public class EntitySentientArrow extends EntityTippedArrow public class EntitySentientArrow extends EntityTippedArrow
{ {
public double reimbursedAmountOnHit = 0; public double reimbursedAmountOnHit = 0;
@ -63,7 +65,7 @@ public class EntitySentientArrow extends EntityTippedArrow
super.readEntityFromNBT(tag); super.readEntityFromNBT(tag);
reimbursedAmountOnHit = tag.getDouble("reimbursement"); reimbursedAmountOnHit = tag.getDouble("reimbursement");
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
@Override @Override

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.item.armour; package WayofTime.bloodmagic.item.armour;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@ -480,7 +477,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor, IMes
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(EnumDemonWillType type, ItemStack stack) public void setCurrentType(EnumDemonWillType type, ItemStack stack)

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.item.soul; package WayofTime.bloodmagic.item.soul;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -263,7 +260,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(ItemStack stack, EnumDemonWillType type) public void setCurrentType(ItemStack stack, EnumDemonWillType type)

View file

@ -33,6 +33,8 @@ import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow; import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import java.util.Locale;
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool//, IMeshProvider public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool//, IMeshProvider
{ {
public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 }; public static int[] soulBracket = new int[] { 16, 60, 200, 400, 1000 };
@ -141,7 +143,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public double getDamageModifier(EnumDemonWillType type, int willBracket) public double getDamageModifier(EnumDemonWillType type, int willBracket)

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.item.soul; package WayofTime.bloodmagic.item.soul;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -263,7 +260,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(ItemStack stack, EnumDemonWillType type) public void setCurrentType(ItemStack stack, EnumDemonWillType type)

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.item.soul; package WayofTime.bloodmagic.item.soul;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -263,7 +260,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(ItemStack stack, EnumDemonWillType type) public void setCurrentType(ItemStack stack, EnumDemonWillType type)

View file

@ -1,9 +1,6 @@
package WayofTime.bloodmagic.item.soul; package WayofTime.bloodmagic.item.soul;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -235,7 +232,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(ItemStack stack, EnumDemonWillType type) public void setCurrentType(ItemStack stack, EnumDemonWillType type)

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.soul;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -255,7 +256,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
return EnumDemonWillType.DEFAULT; return EnumDemonWillType.DEFAULT;
} }
return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); return EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
} }
public void setCurrentType(EnumDemonWillType type, ItemStack soulGemStack) public void setCurrentType(EnumDemonWillType type, ItemStack soulGemStack)

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.tile;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -284,7 +285,7 @@ public class TileInversionPillar extends TileTicking
type = EnumDemonWillType.DEFAULT; type = EnumDemonWillType.DEFAULT;
} }
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE)); type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE).toUpperCase(Locale.ENGLISH));
currentInversion = tag.getDouble("currentInversion"); currentInversion = tag.getDouble("currentInversion");
currentInfectionRadius = tag.getInteger("currentInfectionRadius"); currentInfectionRadius = tag.getInteger("currentInfectionRadius");
consecutiveFailedChecks = tag.getInteger("consecutiveFailedChecks"); consecutiveFailedChecks = tag.getInteger("consecutiveFailedChecks");