#1091 begin clean up for Alveary

Still needs to visually update when slabs are added or removed to the top
This commit is contained in:
mezz committed 2016-03-12 01:07:01 -08:00
1 parent e703536d57
commit dd65d083cc
26 files changed
+192 -187

No files matched your search

@@ -60,7 +60,7 @@ import forestry.api.genetics.IClassification.EnumClassLevel;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.blocks.BlockCandle;
import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.apiculture.blocks.BlockTypeApiculture;
@@ -527,57 +527,58 @@ public class PluginApiculture extends BlankForestryPlugin {
'#', PluginCore.items.beeswax);
// / ALVEARY
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.PLAIN),
ItemStack alvearyPlainBlock = blocks.getAlvearyBlock(BlockAlvearyType.PLAIN);
RecipeUtil.addRecipe(alvearyPlainBlock,
"###",
"#X#",
"###",
'X', PluginCore.items.impregnatedCasing,
'#', PluginCore.items.craftingMaterial.getScentedPaneling());
// SWARMER
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.SWARMER),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
"#G#",
" X ",
"#G#",
'#', PluginCore.items.tubes.get(EnumElectronTube.DIAMOND, 1),
'X', blocks.alveary,
'X', alvearyPlainBlock,
'G', "ingotGold");
// FAN
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.FAN),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.FAN),
"I I",
" X ",
"I#I",
'#', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1),
'X', blocks.alveary,
'X', alvearyPlainBlock,
'I', "ingotIron");
// HEATER
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.HEATER),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
"#I#",
" X ",
"YYY",
'#', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1),
'X', blocks.alveary,
'X', alvearyPlainBlock,
'I', "ingotIron", 'Y', "stone");
// HYGROREGULATOR
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.HYGRO),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
"GIG",
"GXG",
"GIG",
'X', blocks.alveary,
'X', alvearyPlainBlock,
'I', "ingotIron",
'G', "blockGlass");
// STABILISER
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.STABILISER),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
"G G",
"GXG",
"G G",
'X', blocks.alveary,
'X', alvearyPlainBlock,
'G', "gemQuartz");
// SIEVE
RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.AlvearyType.SIEVE),
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
"III",
" X ",
"WWW",
'X', blocks.alveary,
'X', alvearyPlainBlock,
'I', "ingotIron",
'W', PluginCore.items.craftingMaterial.getWovenSilk());
@@ -10,24 +10,22 @@
******************************************************************************/
package forestry.apiculture.blocks;
import com.google.common.collect.Maps;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -40,7 +38,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.apiculture.MaterialBeehive;
import forestry.apiculture.multiblock.TileAlveary;
import forestry.apiculture.multiblock.TileAlvearyClimatiser;
import forestry.apiculture.multiblock.TileAlvearyFan;
import forestry.apiculture.multiblock.TileAlvearyHeater;
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
@@ -50,11 +47,13 @@ import forestry.apiculture.multiblock.TileAlvearyStabiliser;
import forestry.apiculture.multiblock.TileAlvearySwarmer;
import forestry.core.blocks.BlockStructure;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
public class BlockAlveary extends BlockStructure implements IStateMapperRegister {
private static final PropertyEnum<AlvearyType> TYPE = PropertyEnum.create("alveary", AlvearyType.class);
public abstract class BlockAlveary extends BlockStructure implements IStateMapperRegister {
private static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
private static final PropertyEnum<AlvearyLevel> LEVEL = PropertyEnum.create("type", AlvearyLevel.class);
private static final PropertyEnum<AlvearyPlainType> PLAIN_TYPE = PropertyEnum.create("type", AlvearyPlainType.class);
private enum State implements IStringSerializable {
ON, OFF;
@@ -65,52 +64,50 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
}
}
private enum AlvearyLevel implements IStringSerializable {
MIDDLE, LEFT, RIGHT;
private enum AlvearyPlainType implements IStringSerializable {
NORMAL, ENTRANCE, ENTRANCE_LEFT, ENTRANCE_RIGHT;
@Override
public String getName() {
return name().toLowerCase();
}
}
public enum AlvearyType implements IStringSerializable {
PLAIN,
ENTRANCE,
SWARMER,
FAN,
HEATER,
HYGRO,
STABILISER,
SIEVE;
public static final AlvearyType[] VALUES = values();
@Override
public String getName() {
return name().toLowerCase();
public static Map<BlockAlvearyType, BlockAlveary> create() {
Map<BlockAlvearyType, BlockAlveary> blockMap = new EnumMap<>(BlockAlvearyType.class);
for (final BlockAlvearyType type : BlockAlvearyType.VALUES) {
BlockAlveary block = new BlockAlveary() {
@Nonnull
@Override
public BlockAlvearyType getAlvearyType() {
return type;
}
};
blockMap.put(type, block);
}
return blockMap;
}
public BlockAlveary() {
super(new MaterialBeehive(false));
BlockAlvearyType alvearyType = getAlvearyType();
IBlockState defaultState = this.blockState.getBaseState();
if (alvearyType == BlockAlvearyType.PLAIN) {
defaultState = defaultState.withProperty(PLAIN_TYPE, AlvearyPlainType.NORMAL);
} else if (alvearyType.activatable) {
defaultState = defaultState.withProperty(STATE, State.OFF);
}
setDefaultState(defaultState);
setHardness(1.0f);
setCreativeTab(Tabs.tabApiculture);
setHarvestLevel("axe", 0);
setStepSound(soundTypeWood);
setDefaultState(this.blockState.getBaseState().withProperty(TYPE, AlvearyType.PLAIN).withProperty(STATE, State.OFF).withProperty(LEVEL, AlvearyLevel.MIDDLE));
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
for (int i = 0; i < 8; i++) {
if (i == 1) {
continue;
}
list.add(new ItemStack(item, 1, i));
}
}
@Nonnull
public abstract BlockAlvearyType getAlvearyType();
@Override
public boolean isNormalCube() {
@@ -123,22 +120,13 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
int metadata = getMetaFromState(state);
ArrayList<ItemStack> drop = new ArrayList<>();
drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0));
return drop;
public int getMetaFromState(IBlockState state) {
return 0;
}
/* TILE ENTITY CREATION */
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
int metadata = getMetaFromState(state);
if (metadata < 0 || metadata > AlvearyType.VALUES.length) {
return null;
}
AlvearyType type = AlvearyType.VALUES[metadata];
public TileEntity createNewTileEntity(World world, int meta) {
BlockAlvearyType type = getAlvearyType();
switch (type) {
case SWARMER:
return new TileAlvearySwarmer();
@@ -158,118 +146,103 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
}
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return createTileEntity(world, getStateFromMeta(meta));
}
/* ITEM MODELS */
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerItemModel(item, 0, "apiculture/alveary.plain");
manager.registerItemModel(item, 1, "apiculture/alveary.entrance");
manager.registerItemModel(item, 2, "apiculture/alveary.swarmer");
manager.registerItemModel(item, 3, "apiculture/alveary.fan");
manager.registerItemModel(item, 4, "apiculture/alveary.heater");
manager.registerItemModel(item, 5, "apiculture/alveary.hygro");
manager.registerItemModel(item, 6, "apiculture/alveary.stabiliser");
manager.registerItemModel(item, 7, "apiculture/alveary.sieve");
manager.registerItemModel(item, 0, "apiculture/alveary." + getAlvearyType());
}
/* STATES */
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(TYPE, AlvearyType.values()[meta]);
}
@Override
public int getMetaFromState(IBlockState state) {
return ((AlvearyType) state.getValue(TYPE)).ordinal();
}
@Override
protected BlockState createBlockState() {
return new BlockState(this, TYPE, STATE, LEVEL);
BlockAlvearyType alvearyType = getAlvearyType();
if (alvearyType == BlockAlvearyType.PLAIN) {
return new BlockState(this, PLAIN_TYPE);
} else if (alvearyType.activatable) {
return new BlockState(this, STATE);
} else {
return new BlockState(this);
}
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileAlveary) {
if (tile instanceof TileAlvearyClimatiser) {
TileAlvearyClimatiser alveary = (TileAlvearyClimatiser) tile;
if (alveary.isActive()) {
state = state.withProperty(STATE, State.ON);
} else {
state = state.withProperty(STATE, State.OFF);
}
} else if (tile instanceof TileAlvearySwarmer) {
TileAlvearySwarmer alveary = (TileAlvearySwarmer) tile;
if (alveary.isActive()) {
state = state.withProperty(STATE, State.ON);
} else {
state = state.withProperty(STATE, State.OFF);
}
}
TileAlveary tile = TileUtil.getTile(world, pos, TileAlveary.class);
if (tile == null) {
return super.getActualState(state, world, pos);
}
IBlockState stateXP = world.getBlockState(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()));
IBlockState stateXM = world.getBlockState(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()));
Block blockXP = stateXP.getBlock();
Block blockXM = stateXM.getBlock();
state = state.withProperty(LEVEL, AlvearyLevel.MIDDLE);
if (blockXP == this && blockXM != this) {
if (stateXP.getValue(TYPE) == AlvearyType.ENTRANCE) {
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getBlock() != this) {
state = state.withProperty(LEVEL, AlvearyLevel.RIGHT);
} else {
state = state.withProperty(LEVEL, AlvearyLevel.LEFT);
}
if (tile instanceof IActivatable) {
if (((IActivatable) tile).isActive()) {
state = state.withProperty(STATE, State.ON);
} else {
state = state.withProperty(STATE, State.OFF);
}
} else if (blockXP != this && blockXM == this) {
if (stateXM.getValue(TYPE) == AlvearyType.ENTRANCE) {
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1)).getBlock() != this) {
state = state.withProperty(LEVEL, AlvearyLevel.LEFT);
} else if (getAlvearyType() == BlockAlvearyType.PLAIN) {
if (!tile.getMultiblockLogic().getController().isAssembled()) {
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.NORMAL);
} else {
IBlockState blockStateAbove = world.getBlockState(pos.add(0, 1, 0));
Block blockAbove = blockStateAbove.getBlock();
if (BlockUtil.isWoodSlabBlock(blockAbove, world, pos)) {
List<EnumFacing> blocksTouching = getBlocksTouching(world, pos);
switch (blocksTouching.size()) {
case 3:
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.ENTRANCE);
break;
case 2:
if (blocksTouching.contains(EnumFacing.SOUTH) && blocksTouching.contains(EnumFacing.EAST) ||
blocksTouching.contains(EnumFacing.NORTH) && blocksTouching.contains(EnumFacing.WEST)) {
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.ENTRANCE_LEFT);
} else {
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.ENTRANCE_RIGHT);
}
break;
default:
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.NORMAL);
break;
}
} else {
state = state.withProperty(LEVEL, AlvearyLevel.RIGHT);
state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.NORMAL);
}
}
}
return super.getActualState(state, world, pos);
}
@Nonnull
private static List<EnumFacing> getBlocksTouching(IBlockAccess world, BlockPos blockPos) {
List<EnumFacing> touching = new ArrayList<>();
for (EnumFacing direction : EnumFacing.HORIZONTALS) {
IBlockState blockState = world.getBlockState(blockPos.offset(direction));
if (blockState.getBlock() instanceof BlockAlveary) {
touching.add(direction);
}
}
return touching;
}
@Override
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, new AlvearyStateMapper());
Proxies.render.registerStateMapper(this, new AlvearyStateMapper(getAlvearyType()));
}
@SideOnly(Side.CLIENT)
private static class AlvearyStateMapper extends StateMapperBase {
@Nonnull
private final BlockAlvearyType type;
public AlvearyStateMapper(@Nonnull BlockAlvearyType type) {
this.type = type;
}
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
LinkedHashMap<IProperty, Comparable> properties = Maps.newLinkedHashMap(state.getProperties());
if (properties.get(TYPE) != AlvearyType.PLAIN) {
properties.remove(LEVEL);
}
if (properties.get(TYPE) == AlvearyType.SIEVE
|| properties.get(TYPE) == AlvearyType.ENTRANCE
|| properties.get(TYPE) == AlvearyType.STABILISER
|| properties.get(TYPE) == AlvearyType.HYGRO
|| properties.get(TYPE) == AlvearyType.PLAIN) {
properties.remove(STATE);
}
String resourceDomain = Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain();
String resourceLocation = "apiculture/alveary_" + TYPE.getName((AlvearyType) properties.remove(TYPE));
return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, this.getPropertyString(properties));
String resourceLocation = "apiculture/alveary_" + type;
String propertyString = getPropertyString(state.getProperties());
return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString);
}
}
@@ -286,8 +259,4 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister
tileAlveary.getMultiblockLogic().getController().reassemble();
}
}
public ItemStack get(AlvearyType type) {
return new ItemStack(this, 1, type.ordinal());
}
}
@@ -0,0 +1,26 @@
package forestry.apiculture.blocks;
import java.util.Locale;
public enum BlockAlvearyType {
PLAIN(false),
SWARMER(true),
FAN(true),
HEATER(true),
HYGRO(false),
STABILISER(false),
SIEVE(false);
public static final BlockAlvearyType[] VALUES = values();
public final boolean activatable;
BlockAlvearyType(boolean activatable) {
this.activatable = activatable;
}
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
}
}
@@ -10,6 +10,10 @@
******************************************************************************/
package forestry.apiculture.blocks;
import java.util.Map;
import net.minecraft.item.ItemStack;
import forestry.api.core.Tabs;
import forestry.apiculture.items.ItemBlockCandle;
import forestry.core.blocks.BlockBase;
@@ -22,7 +26,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
public final BlockBeehives beehives;
public final BlockCandle candle;
public final BlockStump stump;
public final BlockAlveary alveary;
private final Map<BlockAlvearyType, BlockAlveary> alvearyBlockMap;
public BlockRegistryApiculture() {
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
@@ -36,6 +40,14 @@ public class BlockRegistryApiculture extends BlockRegistry {
candle = registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle");
stump = registerBlock(new BlockStump(), ItemBlockForestry.class, "stump");
alveary = registerBlock(new BlockAlveary(), ItemBlockForestry.class, "alveary");
alvearyBlockMap = BlockAlveary.create();
for (BlockAlveary block : alvearyBlockMap.values()) {
registerBlock(block, new ItemBlockForestry(block), "alveary." + block.getAlvearyType());
}
}
public ItemStack getAlvearyBlock(BlockAlvearyType type) {
BlockAlveary alvearyBlock = alvearyBlockMap.get(type);
return new ItemStack(alvearyBlock);
}
}
@@ -13,9 +13,11 @@ package forestry.apiculture.multiblock;
import java.io.IOException;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.IBeeHousing;
@@ -28,7 +30,7 @@ import forestry.api.core.EnumTemperature;
import forestry.api.core.IErrorLogic;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.api.multiblock.IMultiblockController;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlveary;
import forestry.apiculture.gui.GuiAlveary;
import forestry.core.access.EnumAccess;
@@ -48,12 +50,12 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
private final String unlocalizedTitle;
protected TileAlveary() {
this(BlockAlveary.AlvearyType.PLAIN);
this(BlockAlvearyType.PLAIN);
}
protected TileAlveary(BlockAlveary.AlvearyType type) {
protected TileAlveary(BlockAlvearyType type) {
super(new MultiblockLogicAlveary());
this.unlocalizedTitle = "tile.for.alveary." + type.ordinal() + ".name";
this.unlocalizedTitle = "tile.for.alveary." + type + ".name";
}
@Override
@@ -63,7 +65,11 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
this.worldObj.markBlockForUpdate(getPos());
}
worldObj.notifyBlockOfStateChange(getPos(), getBlockType());
//markDirty();
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
return oldState.getBlock() != newState.getBlock();
}
@Override
@@ -22,7 +22,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import forestry.api.core.IClimateControlled;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
import forestry.apiculture.inventory.InventoryHygroregulator;
@@ -45,7 +45,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
private int transferTime;
public TileAlvearyHygroregulator() {
super(BlockAlveary.AlvearyType.HYGRO);
super(BlockAlvearyType.HYGRO);
this.inventory = new InventoryHygroregulator(this);
@@ -20,7 +20,7 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlvearySieve;
import forestry.apiculture.gui.GuiAlvearySieve;
import forestry.apiculture.inventory.InventoryAlvearySieve;
@@ -33,7 +33,7 @@ public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.B
private final InventoryAlvearySieve inventory;
public TileAlvearySieve() {
super(BlockAlveary.AlvearyType.SIEVE);
super(BlockAlvearyType.SIEVE);
this.inventory = new InventoryAlvearySieve(this);
this.beeListener = new AlvearySieveBeeListener(inventory);
}
@@ -23,7 +23,7 @@ import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBee;
import forestry.api.multiblock.IAlvearyComponent;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockAlvearyType;
import forestry.apiculture.gui.ContainerAlvearySwarmer;
import forestry.apiculture.gui.GuiAlvearySwarmer;
import forestry.apiculture.inventory.InventorySwarmer;
@@ -45,7 +45,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
private boolean active;
public TileAlvearySwarmer() {
super(BlockAlveary.AlvearyType.SWARMER);
super(BlockAlvearyType.SWARMER);
this.inventory = new InventorySwarmer(this);
}
@@ -66,11 +66,6 @@ public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLo
return getMultiblockLogic().getController().getInternalInventory();
}
@Override
public boolean allowsAutomation() {
return false;
}
/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {