// Path: src/main/java/com/corwinjv/mobtotems/blocks/tiles/TotemTileEntity.java
// public class TotemTileEntity extends ModMultiblockTileEntity<TotemType> {
//     private static final String TOTEM_TYPE = "totem_type";
//     private TotemType type = TotemType.NONE;
// 
//     public TotemTileEntity() {
//         super();
//         this.setType(TotemType.NONE);
//     }
// 
//     public TotemTileEntity(TotemType type) {
//         super();
//         this.setType(type);
//     }
// 
//     @Override
//     public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
//         tagCompound = super.writeToNBT(tagCompound);
//         tagCompound.setInteger(TOTEM_TYPE, type.getMeta());
//         return tagCompound;
//     }
// 
//     @Override
//     public void readFromNBT(NBTTagCompound tagCompound) {
//         super.readFromNBT(tagCompound);
//         type = TotemType.fromMeta(tagCompound.getInteger(TOTEM_TYPE));
//     }
// 
//     @Override
//     public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
//         if (newState.getProperties().containsKey(TotemWoodBlock.TOTEM_TYPE)) {
//             return !newState.getValue(TotemWoodBlock.TOTEM_TYPE).equals(oldState.getValue(TotemWoodBlock.TOTEM_TYPE));
//         }
//         return (oldState.getBlock() != newState.getBlock());
//     }
// 
//     @Override
//     public boolean getIsMaster() {
//         return false;
//     }
// 
//     @Override
//     public void verifyMultiblock() {
//         return;
//     }
// 
//     @Override
//     public void invalidateSlaves() {
//     }
// 
//     @Override
//     public List<BlockPos> getSlaves() {
//         return null;
//     }
// 
//     @Override
//     public List<TotemType> getSlaveTypes() {
//         return null;
//     }
// 
//     @Override
//     public TotemType getType() {
//         return type;
//     }
// 
//     @Override
//     public void setType(TotemType type) {
//         this.type = type;
//         markDirty();
//     }
// }
// 
// Path: src/main/java/com/corwinjv/mobtotems/interfaces/IMultiblock.java
// public interface IMultiblock<T> {
//     String IS_MASTER = "isMaster";
//     String SLAVES = "slaves";
//     String MASTER_POS = "masterPos";
// 
//     boolean getIsMaster();
// 
//     void setIsMaster(boolean isMaster);
// 
//     void verifyMultiblock();
// 
//     void setSlaves(List<BlockPos> slaves);
// 
//     void invalidateSlaves();
// 
//     List<BlockPos> getSlaves();
// 
//     List<T> getSlaveTypes();
// 
//     T getType();
// 
//     void setType(T type);
// 
//     void setMaster(IMultiblock<T> master);
// 
//     IMultiblock<T> getMaster();
// }


import com.corwinjv.mobtotems.blocks.tiles.TotemTileEntity;
import com.corwinjv.mobtotems.interfaces.IMultiblock;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLong;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.Constants;
import java.util.ArrayList;
import java.util.List;
        NBTTagList tagList = tagCompound.getTagList(SLAVES, Constants.NBT.TAG_LONG);
        for (int i = 0; i < tagList.tagCount(); i++) {
            NBTBase tag = tagList.get(i);
            if (tag instanceof NBTTagLong) {
                BlockPos blockPos = BlockPos.fromLong(((NBTTagLong) tag).getLong());
                slaves.add(blockPos);
            }
        }
    }

    @Override
    public boolean getIsMaster() {
        return isMaster;
    }

    @Override
    public void setIsMaster(boolean isMaster) {
        this.isMaster = isMaster;
        markDirty();
    }

    public void setSlaves(List<BlockPos> slaves) {
        this.slaves = slaves;
        markDirty();
    }

    public void invalidateSlaves() {
        for (BlockPos slavePos : getSlaves()) {
            TileEntity te = world.getTileEntity(slavePos);
            if (te != null
// Path: src/main/java/com/corwinjv/mobtotems/blocks/tiles/TotemTileEntity.java
// public class TotemTileEntity extends ModMultiblockTileEntity<TotemType> {
//     private static final String TOTEM_TYPE = "totem_type";
//     private TotemType type = TotemType.NONE;
// 
//     public TotemTileEntity() {
//         super();
//         this.setType(TotemType.NONE);
//     }
// 
//     public TotemTileEntity(TotemType type) {
//         super();
//         this.setType(type);
//     }
// 
//     @Override
//     public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
//         tagCompound = super.writeToNBT(tagCompound);
//         tagCompound.setInteger(TOTEM_TYPE, type.getMeta());
//         return tagCompound;
//     }
// 
//     @Override
//     public void readFromNBT(NBTTagCompound tagCompound) {
//         super.readFromNBT(tagCompound);
//         type = TotemType.fromMeta(tagCompound.getInteger(TOTEM_TYPE));
//     }
// 
//     @Override
//     public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
//         if (newState.getProperties().containsKey(TotemWoodBlock.TOTEM_TYPE)) {
//             return !newState.getValue(TotemWoodBlock.TOTEM_TYPE).equals(oldState.getValue(TotemWoodBlock.TOTEM_TYPE));
//         }
//         return (oldState.getBlock() != newState.getBlock());
//     }
// 
//     @Override
//     public boolean getIsMaster() {
//         return false;
//     }
// 
//     @Override
//     public void verifyMultiblock() {
//         return;
//     }
// 
//     @Override
//     public void invalidateSlaves() {
//     }
// 
//     @Override
//     public List<BlockPos> getSlaves() {
//         return null;
//     }
// 
//     @Override
//     public List<TotemType> getSlaveTypes() {
//         return null;
//     }
// 
//     @Override
//     public TotemType getType() {
//         return type;
//     }
// 
//     @Override
//     public void setType(TotemType type) {
//         this.type = type;
//         markDirty();
//     }
// }
// 
// Path: src/main/java/com/corwinjv/mobtotems/interfaces/IMultiblock.java
// public interface IMultiblock<T> {
//     String IS_MASTER = "isMaster";
//     String SLAVES = "slaves";
//     String MASTER_POS = "masterPos";
// 
//     boolean getIsMaster();
// 
//     void setIsMaster(boolean isMaster);
// 
//     void verifyMultiblock();
// 
//     void setSlaves(List<BlockPos> slaves);
// 
//     void invalidateSlaves();
// 
//     List<BlockPos> getSlaves();
// 
//     List<T> getSlaveTypes();
// 
//     T getType();
// 
//     void setType(T type);
// 
//     void setMaster(IMultiblock<T> master);
// 
//     IMultiblock<T> getMaster();
// }


// Path: src/main/java/com/corwinjv/mobtotems/blocks/tiles/base/ModMultiblockInventoryTileEntity.java
import com.corwinjv.mobtotems.blocks.tiles.TotemTileEntity;
import com.corwinjv.mobtotems.interfaces.IMultiblock;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLong;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.util.Constants;
import java.util.ArrayList;
import java.util.List;

        NBTTagList tagList = tagCompound.getTagList(SLAVES, Constants.NBT.TAG_LONG);
        for (int i = 0; i < tagList.tagCount(); i++) {
            NBTBase tag = tagList.get(i);
            if (tag instanceof NBTTagLong) {
                BlockPos blockPos = BlockPos.fromLong(((NBTTagLong) tag).getLong());
                slaves.add(blockPos);
            }
        }
    }

    @Override
    public boolean getIsMaster() {
        return isMaster;
    }

    @Override
    public void setIsMaster(boolean isMaster) {
        this.isMaster = isMaster;
        markDirty();
    }

    public void setSlaves(List<BlockPos> slaves) {
        this.slaves = slaves;
        markDirty();
    }

    public void invalidateSlaves() {
        for (BlockPos slavePos : getSlaves()) {
            TileEntity te = world.getTileEntity(slavePos);
            if (te != null
                    && te instanceof TotemTileEntity) {