use of net.minecraft.item.ItemBlock in project PneumaticCraft by MineMaarten.
the class BlockPneumaticDoorBase method getIcon.
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntityPneumaticDoorBase te = (TileEntityPneumaticDoorBase) world.getTileEntity(x, y, z);
ItemStack camoStack = te.getStackInSlot(TileEntityPneumaticDoorBase.CAMO_SLOT);
if (camoStack != null && camoStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) camoStack.getItem()).field_150939_a;
if (PneumaticCraftUtils.isRenderIDCamo(block.getRenderType())) {
return block.getIcon(side, camoStack.getItemDamage());
}
}
return this.getIcon(side, world.getBlockMetadata(x, y, z));
}
use of net.minecraft.item.ItemBlock in project PneumaticCraft by MineMaarten.
the class TileEntityElevatorBase method onDescUpdate.
@Override
public void onDescUpdate() {
baseCamo = inventory[4] != null && inventory[4].getItem() instanceof ItemBlock ? ((ItemBlock) inventory[4].getItem()).field_150939_a : null;
Block newFrameCamo = inventory[5] != null && inventory[5].getItem() instanceof ItemBlock ? ((ItemBlock) inventory[5].getItem()).field_150939_a : null;
if (newFrameCamo != frameCamo) {
frameCamo = newFrameCamo;
rerenderChunk();
}
}
use of net.minecraft.item.ItemBlock in project MinecraftForge by MinecraftForge.
the class DynBucketTest method preInit.
@SuppressWarnings("unused")
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
if (!ENABLE || !ModelFluidDebug.ENABLE)
return;
GameRegistry.register(new TestItem(), testItemName);
Block tank = new BlockSimpleTank();
GameRegistry.register(tank, simpleTankName);
GameRegistry.register(new ItemBlock(tank), simpleTankName);
GameRegistry.registerTileEntity(TileSimpleTank.class, "simpletank");
FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestFluid.name));
FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(TestGas.name));
//GameRegistry.registerItem(dynBucket, "dynbucket");
GameRegistry.register(dynBottle);
ItemStack filledBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, TestFluid.instance);
GameRegistry.addShapelessRecipe(new ItemStack(Items.DIAMOND), filledBucket);
proxy.setupModels();
//MinecraftForge.EVENT_BUS.register(this);
}
use of net.minecraft.item.ItemBlock in project MinecraftForge by MinecraftForge.
the class ModelLoaderRegistryDebug method preInit.
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
List<Block> blocks = Lists.newArrayList();
blocks.add(CustomModelBlock.instance);
blocks.add(OBJTesseractBlock.instance);
blocks.add(OBJVertexColoring1.instance);
//blocks.add(OBJDirectionEye.instance);
blocks.add(OBJVertexColoring2.instance);
blocks.add(OBJDirectionBlock.instance);
blocks.add(OBJCustomDataBlock.instance);
//blocks.add(OBJDynamicEye.instance);
for (Block block : blocks) {
GameRegistry.register(block);
GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name);
GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name);
//GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name);
if (event.getSide() == Side.CLIENT)
clientPreInit();
}
use of net.minecraft.item.ItemBlock in project MinecraftForge by MinecraftForge.
the class ItemBlockSubstitutionRemoveRestoreTest method testSubstitutionRemovalAndRestore.
@Test
public void testSubstitutionRemovalAndRestore() throws Exception {
GameRegistry.addSubstitutionAlias("minecraft:dirt", GameRegistry.Type.ITEM, myDirtInstance);
PersistentRegistryManager.freezeData();
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
final FMLControlledNamespacedRegistry<Item> itemRegistry = (FMLControlledNamespacedRegistry<Item>) PersistentRegistryManager.findRegistryByType(Item.class);
// TEST 1: Does my substitute take effect? The substitute should be found in the registry
ItemBlock dirtitem = (ItemBlock) itemRegistry.getValue(myDirt);
assertEquals("ItemBlock points at my block", myDirtInstance, dirtitem);
// TEST 2: Does the substitute get removed when told by remote operation? The substitute should NOT be found in the registry
final PersistentRegistryManager.GameDataSnapshot snapshot = PersistentRegistryManager.takeSnapshot();
snapshot.entries.get(PersistentRegistryManager.ITEMS).substitutions.clear();
PersistentRegistryManager.injectSnapshot(snapshot, false, false);
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
dirtitem = (ItemBlock) itemRegistry.getValue(myDirt);
assertEquals("ItemBlock points at vanilla block", originalDirt, dirtitem);
assertNotEquals("ItemBlock points at my block", myDirtInstance, dirtitem);
// TEST 3: Does the substitute get restored when reverting to frozen state? The substitute should be found in the registry again
PersistentRegistryManager.revertToFrozen();
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
dirtitem = (ItemBlock) itemRegistry.getValue(myDirt);
assertEquals("ItemBlock points at my block", myDirtInstance, dirtitem);
}
Aggregations