Hopefully finally fixes spawners reset from time to time after using Spawner Changer.

Closes #162
This commit is contained in:
Ellpeck 2016-07-30 17:20:07 +02:00
parent df4bcf05cf
commit 184ecbc786

View file

@ -67,6 +67,14 @@ public class ItemSpawnerChanger extends ItemBase{
String entity = this.getStoredEntity(stack);
if(entity != null){
MobSpawnerBaseLogic logic = ((TileEntityMobSpawner)tile).getSpawnerBaseLogic();
//This is a hacky way to remove the spawn potentials that make the spawner reset from time to time
//Don't judge, there isn't a method for it and it's better than Reflection hackiness
NBTTagCompound compound = new NBTTagCompound();
logic.writeToNBT(compound);
compound.removeTag("SpawnPotentials");
logic.readFromNBT(compound);
logic.setEntityName(entity);
tile.markDirty();