diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index b23c7644..52f845ff 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -102,12 +102,12 @@ enderio.itemTravelStaff.notEnoughPower=Not enough power //Painter tile.blockPainter.name=Painting Machine enderio.blockPainter.paintedWith=Painted with: -enderio.blockCustomFence=Painted Fence -enderio.blockCustomFenceGate=Painted Gate -enderio.blockCustomWall=Painted Wall -enderio.blockCustomStair=Painted Stairs -enderio.blockCustomSlab=Painted Slab -enderio.blockCustomDoubleSlab=Painted Slab +tile.blockCustomFence=Painted Fence +tile.blockCustomFenceGate=Painted Gate +tile.blockCustomWall=Painted Wall +tile.blockCustomStair=Painted Stairs +tile.blockCustomSlab=Painted Slab +tile.blockCustomDoubleSlab=Painted Slab //Items item.enderio.itemYetaWrench.name=Yeta Wrench diff --git a/src/main/java/crazypants/enderio/ClientProxy.java b/src/main/java/crazypants/enderio/ClientProxy.java index b393e4ea..ee0ed052 100644 --- a/src/main/java/crazypants/enderio/ClientProxy.java +++ b/src/main/java/crazypants/enderio/ClientProxy.java @@ -15,6 +15,8 @@ import crazypants.enderio.enderface.EnderIoRenderer; import crazypants.enderio.enderface.TileEnderIO; import crazypants.enderio.machine.light.BlockElectricLight; import crazypants.enderio.machine.light.ElectricLightRenderer; +import crazypants.enderio.machine.painter.BlockCustomFenceGate; +import crazypants.enderio.machine.painter.BlockCustomFenceGateRenderer; import crazypants.enderio.machine.painter.PaintedItemRenderer; import crazypants.enderio.machine.power.BlockCapacitorBank; import crazypants.enderio.machine.power.CapBankRenderer2; @@ -84,13 +86,12 @@ public class ClientProxy extends CommonProxy { // Renderers - // BlockCustomFenceGateRenderer bcfgr = new BlockCustomFenceGateRenderer(); - // BlockCustomFenceGate.renderId = RenderingRegistry.getNextAvailableRenderId(); - // RenderingRegistry.registerBlockHandler(bcfgr); - // BlockFusedQuartz.renderId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new FusedQuartzRenderer()); + FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer(); + MinecraftForgeClient.registerItemRenderer(EnderIO.itemFusedQuartzFrame, fqfr); + BlockElectricLight.renderId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new ElectricLightRenderer()); @@ -100,10 +101,7 @@ public class ClientProxy extends CommonProxy { BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId(); CapBankRenderer2 cbr2 = new CapBankRenderer2(); RenderingRegistry.registerBlockHandler(cbr2); - // - FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer(); - MinecraftForgeClient.registerItemRenderer(EnderIO.itemFusedQuartzFrame, fqfr); - // + // ItemConduitRenderer itemConRenderer = new ItemConduitRenderer(); // MinecraftForgeClient.registerItemRenderer(EnderIO.itemLiquidConduit, itemConRenderer); // MinecraftForgeClient.registerItemRenderer(EnderIO.itemPowerConduit, itemConRenderer); @@ -111,18 +109,21 @@ public class ClientProxy extends CommonProxy { // MinecraftForgeClient.registerItemRenderer(EnderIO.itemItemConduit, itemConRenderer); // MinecraftForgeClient.registerItemRenderer(EnderIO.itemMeConduit, itemConRenderer); // + + BlockCustomFenceGateRenderer bcfgr = new BlockCustomFenceGateRenderer(); + BlockCustomFenceGate.renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(bcfgr); + PaintedItemRenderer pir = new PaintedItemRenderer(); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomFence), pir); - // MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomFenceGate), pir); - // MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomWall), pir); - // MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomStair), pir); - - //TODO:1.7 - //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomSlab), pir); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomFenceGate), pir); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomWall), pir); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomStair), pir); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomSlab), pir); MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer()); // MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer()); - // + // cbr = new ConduitBundleRenderer((float) Config.conduitScale); // BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId(); // RenderingRegistry.registerBlockHandler(cbr); diff --git a/src/main/java/crazypants/enderio/EnderIO.java b/src/main/java/crazypants/enderio/EnderIO.java index e515ee74..e7b0439d 100644 --- a/src/main/java/crazypants/enderio/EnderIO.java +++ b/src/main/java/crazypants/enderio/EnderIO.java @@ -27,6 +27,10 @@ import crazypants.enderio.machine.light.BlockLightNode; import crazypants.enderio.machine.monitor.BlockPowerMonitor; import crazypants.enderio.machine.monitor.ItemMJReader; import crazypants.enderio.machine.painter.BlockCustomFence; +import crazypants.enderio.machine.painter.BlockCustomFenceGate; +import crazypants.enderio.machine.painter.BlockCustomSlab; +import crazypants.enderio.machine.painter.BlockCustomStair; +import crazypants.enderio.machine.painter.BlockCustomWall; import crazypants.enderio.machine.painter.BlockPainter; import crazypants.enderio.machine.power.BlockCapacitorBank; import crazypants.enderio.machine.reservoir.BlockReservoir; @@ -79,11 +83,11 @@ public class EnderIO { // Painter public static BlockPainter blockPainter; public static BlockCustomFence blockCustomFence; - // public static BlockCustomFenceGate blockCustomFenceGate; - // public static BlockCustomWall blockCustomWall; - // public static BlockCustomStair blockCustomStair; - // public static BlockCustomSlab blockCustomSlab; - // public static BlockCustomSlab blockCustomDoubleSlab; + public static BlockCustomFenceGate blockCustomFenceGate; + public static BlockCustomWall blockCustomWall; + public static BlockCustomStair blockCustomStair; + public static BlockCustomSlab blockCustomSlab; + public static BlockCustomSlab blockCustomDoubleSlab; // // // Conduits // public static BlockConduitBundle blockConduitBundle; @@ -142,13 +146,13 @@ public class EnderIO { blockPainter = BlockPainter.create(); blockCustomFence = BlockCustomFence.create(); - // blockCustomFenceGate = BlockCustomFenceGate.create(); - // blockCustomWall = BlockCustomWall.create(); - // blockCustomStair = BlockCustomStair.create(); - // blockCustomSlab = new BlockCustomSlab(false); - // blockCustomDoubleSlab = new BlockCustomSlab(true); - // blockCustomSlab.init(); - // blockCustomDoubleSlab.init(); + blockCustomFenceGate = BlockCustomFenceGate.create(); + blockCustomWall = BlockCustomWall.create(); + blockCustomStair = BlockCustomStair.create(); + blockCustomSlab = new BlockCustomSlab(false); + blockCustomDoubleSlab = new BlockCustomSlab(true); + blockCustomSlab.init(); + blockCustomDoubleSlab.init(); blockStirlingGenerator = BlockStirlingGenerator.create(); blockSolarPanel = BlockSolarPanel.create(); diff --git a/src/main/java/crazypants/enderio/machine/painter/BasicPainterTemplate.java b/src/main/java/crazypants/enderio/machine/painter/BasicPainterTemplate.java index 3e14850c..9b77f75a 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BasicPainterTemplate.java +++ b/src/main/java/crazypants/enderio/machine/painter/BasicPainterTemplate.java @@ -26,10 +26,14 @@ public abstract class BasicPainterTemplate implements IMachineRecipe { return block.isOpaqueCube() || (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) || block == Blocks.glass; } - protected final String[] validIds; + protected final Block[] validTargets; - protected BasicPainterTemplate(String... validTargetBlocksIds) { - this.validIds = validTargetBlocksIds; + // protected BasicPainterTemplate(String... validTargetBlocksIds) { + // this.validIds = validTargetBlocksIds; + // } + + protected BasicPainterTemplate(Block... validTargetBlocks) { + this.validTargets = validTargetBlocks; } @Override @@ -50,7 +54,7 @@ public abstract class BasicPainterTemplate implements IMachineRecipe { return null; } ItemStack result = new ItemStack(getResultId(target), 1, target.getItemDamage()); - PainterUtil.setSourceBlock(result, Util.getBlockFromItemId(paintSource).getUnlocalizedName(), paintSource.getItemDamage()); + PainterUtil.setSourceBlock(result, Util.getBlockFromItemId(paintSource), paintSource.getItemDamage()); return new ItemStack[] { result }; } @@ -96,14 +100,14 @@ public abstract class BasicPainterTemplate implements IMachineRecipe { return false; } - for (int i = 0; i < validIds.length; i++) { - if(validIds[i].equals(blk.getUnlocalizedName())) { + for (int i = 0; i < validTargets.length; i++) { + if(validTargets[i] == blk) { return true; } } - for (int i = 0; i < validIds.length; i++) { - if(validIds[i].equals(blk.getUnlocalizedName())) { + for (int i = 0; i < validTargets.length; i++) { + if(validTargets[i] == blk) { return true; } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFence.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFence.java index e4a091ac..f0f4ac32 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFence.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFence.java @@ -54,9 +54,9 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate()); } - public static ItemStack createItemStackForSourceBlock(String id, int damage) { - ItemStack result = new ItemStack(EnderIO.blockCustomFence, 1, damage); - PainterUtil.setSourceBlock(result, id, damage); + public static ItemStack createItemStackForSourceBlock(Block source, int sourceMeta) { + ItemStack result = new ItemStack(EnderIO.blockCustomFence, 1, sourceMeta); + PainterUtil.setSourceBlock(result, source, sourceMeta); return result; } @@ -142,10 +142,8 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() != null) { - - //TODO:1.7 - //return Math.min(super.getLightOpacity(world, x, y, z), Block.lightOpacity[tef.getSourceBlockId()]); + if(tef.getSourceBlock() != null) { + return Math.min(super.getLightOpacity(world, x, y, z), tef.getSourceBlock().getLightOpacity()); } } return super.getLightOpacity(world, x, y, z); @@ -175,8 +173,8 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() != null && getBlockFromName(tef.getSourceBlockId()) != null) { - return getBlockFromName(tef.getSourceBlockId()).getIcon(blockSide, tef.getSourceBlockMetadata()); + if(tef.getSourceBlock() != null) { + return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); } } else { System.out.println("BlockCustFence: No tile entity."); @@ -203,7 +201,7 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(b == null ? null : b.getUnlocalizedName()); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack)); } world.markBlockForUpdate(x, y, z); @@ -221,7 +219,7 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlockId(), tef.getSourceBlockMetadata()); + ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata()); float f = 0.7F; double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -260,13 +258,13 @@ public class BlockCustomFence extends BlockFence implements ITileEntityProvider public static final class PainterTemplate extends BasicPainterTemplate { public PainterTemplate() { - super(Blocks.fence.getUnlocalizedName()/* , Block.netherFence.blockID */); + super(Blocks.fence, Blocks.nether_brick_fence); } @Override public ItemStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) { ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs); - return new ItemStack[] { createItemStackForSourceBlock(getBlockFromItem(paintSource.getItem()).getUnlocalizedName(), paintSource.getItemDamage()) }; + return new ItemStack[] { createItemStackForSourceBlock(getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage()) }; } // @Override diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGate.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGate.java index 7b827650..dd6b9e3c 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGate.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGate.java @@ -1,7 +1,5 @@ package crazypants.enderio.machine.painter; -import java.util.Collections; -import java.util.List; import java.util.Random; import net.minecraft.block.Block; @@ -11,6 +9,7 @@ import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityDiggingFX; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -20,12 +19,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; -import crazypants.enderio.crafting.IEnderIoRecipe; -import crazypants.enderio.crafting.impl.EnderIoRecipe; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; @@ -44,16 +41,14 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP private Random rand = new Random(); public BlockCustomFenceGate() { - super(ModObject.blockCustomFenceGate.id); setCreativeTab(null); - setUnlocalizedName(ModObject.blockCustomFenceGate.unlocalisedName); + setBlockName(ModObject.blockCustomFenceGate.unlocalisedName); setHardness(2.0F); setResistance(5.0F); - setStepSound(soundWoodFootstep); + setStepSound(soundTypeWood); } private void init() { - LanguageRegistry.addName(this, ModObject.blockCustomFenceGate.name); GameRegistry.registerBlock(this, BlockItemCustomFenceGate.class, ModObject.blockCustomFenceGate.unlocalisedName); GameRegistry.registerTileEntity(TileEntityCustomBlock.class, ModObject.blockCustomFenceGate.unlocalisedName + "TileEntity"); MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate()); @@ -61,7 +56,7 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP @SideOnly(Side.CLIENT) @Override - public boolean addBlockHitEffects(World world, MovingObjectPosition target, + public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { IIcon tex = null; @@ -82,7 +77,7 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP @Override @SideOnly(Side.CLIENT) - public boolean addBlockDestroyEffects(World world, int x, int y, int z, int + public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { IIcon tex = lastRemovedComponetIcon; byte b0 = 4; @@ -141,54 +136,43 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP } @Override - public TileEntity createNewTileEntity(World world) { - return null; - } - - @Override - public int getLightOpacity(World world, int x, int y, int z) { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0) { - return Math.min(super.getLightOpacity(world, x, y, z), Block.lightOpacity[tef.getSourceBlockId()]); + if(tef.getSourceBlock() != null) { + return Math.min(super.getLightOpacity(world, x, y, z), tef.getSourceBlock().getLightOpacity(world, x, y, z)); } - } return super.getLightOpacity(world, x, y, z); } @Override - public TileEntity createTileEntity(World world, int metadata) { + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityCustomBlock(); } @Override - public IIcon getBlockTexture(IBlockAccess world, int x, int y, int z, int blockSide) { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0 && tef.getSourceBlockId() < Block.blocksList.length) { - return blocksList[tef.getSourceBlockId()].getIcon(blockSide, tef.getSourceBlockMetadata()); - } + return tef.getSourceBlock() == null ? null : tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); + } else { System.out.println("BlockCustFence: No tile entity."); } - return blocksList[Block.anvil.blockID].getBlockTexture(world, x, y, z, blockSide); + return Blocks.anvil.getIcon(world, x, y, z, blockSide); } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { - int id = -1; - Block b = PainterUtil.getSourceBlock(stack); - if(b != null) { - id = b.blockID; - } + Block b = PainterUtil.getSourceBlock(stack); TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack)); } // world.markBlockForUpdate(x, y, z); @@ -197,9 +181,9 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP world.setBlockMetadataWithNotify(x, y, z, l, 2); } - public static ItemStack createItemStackForSourceBlock(int id, int damage) { - ItemStack result = new ItemStack(ModObject.blockCustomFenceGate.actualId, 1, damage); - PainterUtil.setSourceBlock(result, id, damage); + public static ItemStack createItemStackForSourceBlock(Block source, int damage) { + ItemStack result = new ItemStack(EnderIO.blockCustomFenceGate, 1, damage); + PainterUtil.setSourceBlock(result, source, damage); return result; } @@ -207,7 +191,7 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP * Remove the tile entity too. */ @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { TileEntity te = world.getTileEntity(x, y, z); @@ -215,7 +199,7 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlockId(), tef.getSourceBlockMetadata()); + ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata()); float f = 0.7F; double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -229,7 +213,7 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP } - world.removeBlockTileEntity(x, y, z); + world.removeTileEntity(x, y, z); } @Override @@ -240,22 +224,22 @@ public class BlockCustomFenceGate extends BlockFenceGate implements ITileEntityP public static final class PainterTemplate extends BasicPainterTemplate { public PainterTemplate() { - super(Block.fenceGate.blockID/* , Block.netherFence.blockID */); + super(Blocks.fence_gate/* , Block.netherFence.blockID */); } @Override public ItemStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) { ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs); - return new ItemStack[] { createItemStackForSourceBlock(paintSource.itemID, paintSource.getItemDamage()) }; + return new ItemStack[] { createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage()) }; } - @Override - public List getAllRecipes() { - IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, new ItemStack(Block.fence), new ItemStack( - ModObject.blockCustomFenceGate.actualId, - 1, 0)); - return Collections.singletonList(recipe); - } + // @Override + // public List getAllRecipes() { + // IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, new ItemStack(Block.fence), new ItemStack( + // ModObject.blockCustomFenceGate.actualId, + // 1, 0)); + // return Collections.singletonList(recipe); + // } } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGateRenderer.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGateRenderer.java index 2968bdfa..0044eafc 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGateRenderer.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomFenceGateRenderer.java @@ -4,19 +4,20 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockFenceGate; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import crazypants.enderio.ModObject; +import crazypants.enderio.EnderIO; public class BlockCustomFenceGateRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - renderer.renderBlockAsItem(Block.fenceGate, metadata, 1); + renderer.renderBlockAsItem(Blocks.fence_gate, metadata, 1); } @Override - public boolean shouldRender3DInInventory() { + public boolean shouldRender3DInInventory(int modelId) { return true; } @@ -41,14 +42,14 @@ public class BlockCustomFenceGateRenderer implements ISimpleBlockRenderingHandle float f4 = 0.3125F; float f5 = 1.0F; - if((i1 == 2 || i1 == 0) && rb.blockAccess.getBlockId(par2 - 1, par3, par4) == Block.cobblestoneWall.blockID - && rb.blockAccess.getBlockId(par2 + 1, par3, par4) == Block.cobblestoneWall.blockID || - (i1 == 3 || i1 == 1) && rb.blockAccess.getBlockId(par2, par3, par4 - 1) == Block.cobblestoneWall.blockID - && rb.blockAccess.getBlockId(par2, par3, par4 + 1) == Block.cobblestoneWall.blockID || - (i1 == 2 || i1 == 0) && rb.blockAccess.getBlockId(par2 - 1, par3, par4) == ModObject.blockCustomWall.id - && rb.blockAccess.getBlockId(par2 + 1, par3, par4) == ModObject.blockCustomWall.id || - (i1 == 3 || i1 == 1) && rb.blockAccess.getBlockId(par2, par3, par4 - 1) == ModObject.blockCustomWall.id - && rb.blockAccess.getBlockId(par2, par3, par4 + 1) == ModObject.blockCustomWall.id) + if((i1 == 2 || i1 == 0) && rb.blockAccess.getBlock(par2 - 1, par3, par4) == Blocks.cobblestone_wall + && rb.blockAccess.getBlock(par2 + 1, par3, par4) == Blocks.cobblestone_wall || + (i1 == 3 || i1 == 1) && rb.blockAccess.getBlock(par2, par3, par4 - 1) == Blocks.cobblestone_wall + && rb.blockAccess.getBlock(par2, par3, par4 + 1) == Blocks.cobblestone_wall || + (i1 == 2 || i1 == 0) && rb.blockAccess.getBlock(par2 - 1, par3, par4) == EnderIO.blockCustomWall + && rb.blockAccess.getBlock(par2 + 1, par3, par4) == EnderIO.blockCustomWall || + (i1 == 3 || i1 == 1) && rb.blockAccess.getBlock(par2, par3, par4 - 1) == EnderIO.blockCustomWall + && rb.blockAccess.getBlock(par2, par3, par4 + 1) == EnderIO.blockCustomWall) { f -= 0.1875F; f1 -= 0.1875F; diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomSlab.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomSlab.java index e2cccf3a..842b9ffb 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomSlab.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomSlab.java @@ -1,11 +1,9 @@ package crazypants.enderio.machine.painter; -import java.util.Collections; -import java.util.List; import java.util.Random; import net.minecraft.block.Block; -import net.minecraft.block.BlockHalfSlab; +import net.minecraft.block.BlockSlab; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -14,6 +12,7 @@ import net.minecraft.client.particle.EntityDiggingFX; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -22,21 +21,14 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; -import crazypants.enderio.crafting.IEnderIoRecipe; -import crazypants.enderio.crafting.IRecipeInput; -import crazypants.enderio.crafting.IRecipeOutput; -import crazypants.enderio.crafting.impl.EnderIoRecipe; -import crazypants.enderio.crafting.impl.RecipeInputClass; -import crazypants.enderio.crafting.impl.RecipeOutput; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; -import crazypants.util.Util; -public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvider { +public class BlockCustomSlab extends BlockSlab implements ITileEntityProvider { private IIcon lastRemovedComponetIcon = null; @@ -45,10 +37,10 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide private final boolean isDouble; public BlockCustomSlab(boolean isDouble) { - super(isDouble ? ModObject.blockCustomDoubleSlab.actualId : ModObject.blockCustomSlab.actualId, isDouble, new Material(MapColor.stoneColor)); + super(isDouble, new Material(MapColor.stoneColor)); this.isDouble = isDouble; setCreativeTab(null); - setUnlocalizedName(ModObject.blockCustomSlab.unlocalisedName); + setBlockName(ModObject.blockCustomSlab.unlocalisedName + isDouble); setHardness(0.5F); setResistance(5.0F); setLightOpacity(0); @@ -58,44 +50,42 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide // This is required so it is assigned prior to the BlockItem being // registered. if(isDouble) { - LanguageRegistry.addName(this, ModObject.blockCustomDoubleSlab.name); GameRegistry.registerBlock(this, BlockItemCustomSlab.class, ModObject.blockCustomDoubleSlab.unlocalisedName); GameRegistry.registerTileEntity(TileEntityCustomSlab.class, ModObject.blockCustomDoubleSlab.unlocalisedName + "TileEntity"); } else { - LanguageRegistry.addName(this, ModObject.blockCustomSlab.name); GameRegistry.registerBlock(this, BlockItemCustomSlab.class, ModObject.blockCustomSlab.unlocalisedName); GameRegistry.registerTileEntity(TileEntityCustomBlock.class, ModObject.blockCustomSlab.unlocalisedName + "TileEntity"); MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate()); } } - public static ItemStack createItemStackForSourceBlock(int id, int damage) { - ItemStack result = new ItemStack(ModObject.blockCustomSlab.id, 1, 0); - PainterUtil.setSourceBlock(result, id, damage); + public static ItemStack createItemStackForSourceBlock(Block source, int damage) { + ItemStack result = new ItemStack(EnderIO.blockCustomSlab, 1, 0); + PainterUtil.setSourceBlock(result, source, damage); return result; } @Override - public IIcon getBlockTexture(IBlockAccess world, int x, int y, int z, int blockSide) { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0 && tef.getSourceBlockId() < Block.blocksList.length) { - return blocksList[tef.getSourceBlockId()].getIcon(blockSide, tef.getSourceBlockMetadata()); + if(tef.getSourceBlock() != null) { + return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); } } - return blocksList[Block.anvil.blockID].getBlockTexture(world, x, y, z, blockSide); + return Blocks.anvil.getIcon(world, x, y, z, blockSide); } @SideOnly(Side.CLIENT) @Override - public void registerIcons(IIconRegister IIconRegister) { + public void registerBlockIcons(IIconRegister IIconRegister) { blockIcon = IIconRegister.registerIcon("enderio:conduitConnector"); } @SideOnly(Side.CLIENT) @Override - public boolean addBlockHitEffects(World world, MovingObjectPosition target, + public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { IIcon tex = null; @@ -116,7 +106,7 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide @Override @SideOnly(Side.CLIENT) - public boolean addBlockDestroyEffects(World world, int x, int y, int z, int + public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { IIcon tex = lastRemovedComponetIcon; byte b0 = 4; @@ -170,22 +160,17 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide } @Override - public TileEntity createNewTileEntity(World world) { - return null; - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityCustomSlab(); } @Override - public int getLightOpacity(World world, int x, int y, int z) { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0) { - return Math.min(super.getLightOpacity(world, x, y, z), Block.lightOpacity[tef.getSourceBlockId()]); + if(tef.getSourceBlock() != null) { + return Math.min(super.getLightOpacity(world, x, y, z), tef.getSourceBlock().getLightOpacity(world, x, y, z)); } } @@ -194,16 +179,12 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { - int id = -1; - Block b = PainterUtil.getSourceBlock(stack); - if(b != null) { - id = b.blockID; - } TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + Block b = PainterUtil.getSourceBlock(stack); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack)); } world.markBlockForUpdate(x, y, z); @@ -214,7 +195,7 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide * Remove the tile entity too. */ @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { TileEntity te = world.getTileEntity(x, y, z); @@ -223,7 +204,7 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide TileEntityCustomBlock tef = (TileEntityCustomBlock) te; for (int i = 0; i < super.quantityDropped(null); i++) { - ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlockId(), tef.getSourceBlockMetadata()); + ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata()); float f = 0.7F; double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -235,11 +216,11 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide } } } - world.removeBlockTileEntity(x, y, z); + world.removeTileEntity(x, y, z); } @Override - public String getFullSlabName(int i) { + public String func_150002_b(int var1) { return getUnlocalizedName(); } @@ -248,17 +229,10 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide return 0; // need to do custom dropping to maintain source metadata } - /** - * Returns the ID of the items to drop on destruction. - */ - @Override - public int idDropped(int par1, Random par2Random, int par3) { - return ModObject.blockCustomSlab.id; - } - public static final class PainterTemplate extends BasicPainterTemplate { public PainterTemplate() { + super(Blocks.wooden_slab, Blocks.stone_slab); } @Override @@ -267,26 +241,26 @@ public class BlockCustomSlab extends BlockHalfSlab implements ITileEntityProvide if(paintSource == null) { return new ItemStack[0]; } - return new ItemStack[] { createItemStackForSourceBlock(paintSource.itemID, paintSource.getItemDamage()) }; + return new ItemStack[] { createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage()) }; } - @Override - public boolean isValidTarget(ItemStack target) { - if(target == null) { - return false; - } - Block blk = Util.getBlockFromItemId(target.itemID); - return blk instanceof BlockHalfSlab; - } - - @Override - public List getAllRecipes() { - IRecipeInput input = new RecipeInputClass(new ItemStack(Block.stoneSingleSlab), BlockHalfSlab.class, new ItemStack(Block.woodSingleSlab)); - IRecipeOutput output = new RecipeOutput(new ItemStack(ModObject.blockCustomSlab.actualId, 1, 0)); - - IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output); - return Collections.singletonList(recipe); - } + // @Override + // public boolean isValidTarget(ItemStack target) { + // if(target == null) { + // return false; + // } + // Block blk = Util.getBlockFromItemId(target.itemID); + // return blk instanceof BlockHalfSlab; + // } + // + // @Override + // public List getAllRecipes() { + // IRecipeInput input = new RecipeInputClass(new ItemStack(Block.stoneSingleSlab), BlockHalfSlab.class, new ItemStack(Block.woodSingleSlab)); + // IRecipeOutput output = new RecipeOutput(new ItemStack(ModObject.blockCustomSlab.actualId, 1, 0)); + // + // IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output); + // return Collections.singletonList(recipe); + // } } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomStair.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomStair.java index b7ee19a9..3ed6fcb3 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomStair.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomStair.java @@ -1,7 +1,5 @@ package crazypants.enderio.machine.painter; -import java.util.Collections; -import java.util.List; import java.util.Random; import net.minecraft.block.Block; @@ -12,6 +10,7 @@ import net.minecraft.client.particle.EntityDiggingFX; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -20,19 +19,12 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; -import crazypants.enderio.crafting.IEnderIoRecipe; -import crazypants.enderio.crafting.IRecipeInput; -import crazypants.enderio.crafting.IRecipeOutput; -import crazypants.enderio.crafting.impl.EnderIoRecipe; -import crazypants.enderio.crafting.impl.RecipeInputClass; -import crazypants.enderio.crafting.impl.RecipeOutput; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; -import crazypants.util.Util; public class BlockCustomStair extends BlockStairs implements ITileEntityProvider { @@ -47,28 +39,27 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider private Random rand = new Random(); protected BlockCustomStair() { - super(ModObject.blockCustomStair.actualId, Block.brick, 0); + super(Blocks.stone, 0); setCreativeTab(null); - setUnlocalizedName(ModObject.blockCustomStair.unlocalisedName); + setBlockName(ModObject.blockCustomStair.unlocalisedName); setLightOpacity(0); } private void init() { - LanguageRegistry.addName(this, ModObject.blockCustomStair.name); GameRegistry.registerBlock(this, BlockItemCustomStair.class, ModObject.blockCustomStair.unlocalisedName); GameRegistry.registerTileEntity(TileEntityCustomBlock.class, ModObject.blockCustomStair.unlocalisedName + "TileEntity"); MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate()); } - public static ItemStack createItemStackForSourceBlock(int id, int damage) { - ItemStack result = new ItemStack(ModObject.blockCustomStair.id, 1, damage); - PainterUtil.setSourceBlock(result, id, damage); + public static ItemStack createItemStackForSourceBlock(Block block, int damage) { + ItemStack result = new ItemStack(EnderIO.blockCustomStair, 1, damage); + PainterUtil.setSourceBlock(result, block, damage); return result; } @SideOnly(Side.CLIENT) @Override - public boolean addBlockHitEffects(World world, MovingObjectPosition target, + public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { IIcon tex = null; @@ -89,7 +80,7 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider @Override @SideOnly(Side.CLIENT) - public boolean addBlockDestroyEffects(World world, int x, int y, int z, int + public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { IIcon tex = lastRemovedComponetIcon; byte b0 = 4; @@ -140,50 +131,46 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F); digFX.setParticleIcon(tex); effectRenderer.addEffect(digFX); + } @Override - public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { int meta = world.getBlockMetadata(x, y, z); boolean flipped = ((meta & 4) != 0); return ((meta & 3) + side.ordinal() == 5) || (side == ForgeDirection.UP && flipped); } @Override - public IIcon getBlockTexture(IBlockAccess world, int x, int y, int z, int blockSide) { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0 && tef.getSourceBlockId() < Block.blocksList.length && blocksList[tef.getSourceBlockId()] != null) { - return blocksList[tef.getSourceBlockId()].getIcon(blockSide, tef.getSourceBlockMetadata()); + if(tef.getSourceBlock() != null) { + return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); } } - return blocksList[Block.anvil.blockID].getBlockTexture(world, x, y, z, blockSide); + return Blocks.anvil.getIcon(world, x, y, z, blockSide); } @SideOnly(Side.CLIENT) @Override - public void registerIcons(IIconRegister IIconRegister) { + public void registerBlockIcons(IIconRegister IIconRegister) { blockIcon = IIconRegister.registerIcon("enderio:conduitConnector"); } @Override - public TileEntity createNewTileEntity(World world) { - return null; - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityCustomBlock(); } @Override - public int getLightOpacity(World world, int x, int y, int z) { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0) { - return Math.min(super.getLightOpacity(world, x, y, z), Block.lightOpacity[tef.getSourceBlockId()]); + if(tef.getSourceBlock() != null) { + return Math.min(super.getLightOpacity(world, x, y, z), tef.getSourceBlock().getLightOpacity()); } } @@ -192,16 +179,12 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { - int id = -1; - Block b = PainterUtil.getSourceBlock(stack); - if(b != null) { - id = b.blockID; - } + Block b = PainterUtil.getSourceBlock(stack); TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack)); } world.markBlockForUpdate(x, y, z); @@ -212,7 +195,7 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider * Remove the tile entity too. */ @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { TileEntity te = world.getTileEntity(x, y, z); @@ -220,7 +203,7 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlockId(), tef.getSourceBlockMetadata()); + ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata()); float f = 0.7F; double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -236,7 +219,7 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider } - world.removeBlockTileEntity(x, y, z); + world.removeTileEntity(x, y, z); } @Override @@ -255,7 +238,7 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider if(paintSource == null) { return new ItemStack[0]; } - return new ItemStack[] { createItemStackForSourceBlock(paintSource.itemID, paintSource.getItemDamage()) }; + return new ItemStack[] { createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage()) }; } @Override @@ -263,19 +246,19 @@ public class BlockCustomStair extends BlockStairs implements ITileEntityProvider if(target == null) { return false; } - Block blk = Util.getBlockFromItemId(target.itemID); + Block blk = Block.getBlockFromItem(target.getItem()); return blk instanceof BlockStairs; } - @Override - public List getAllRecipes() { - IRecipeInput input = new RecipeInputClass(new ItemStack(Block.stairsWoodOak), BlockStairs.class, new ItemStack(Block.stairsCobblestone), - new ItemStack(Block.stairsStoneBrick)); - IRecipeOutput output = new RecipeOutput(new ItemStack(ModObject.blockCustomStair.actualId, 1, 0)); - - IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output); - return Collections.singletonList(recipe); - } + // @Override + // public List getAllRecipes() { + // IRecipeInput input = new RecipeInputClass(new ItemStack(Block.stairsWoodOak), BlockStairs.class, new ItemStack(Block.stairsCobblestone), + // new ItemStack(Block.stairsStoneBrick)); + // IRecipeOutput output = new RecipeOutput(new ItemStack(ModObject.blockCustomStair.actualId, 1, 0)); + // + // IEnderIoRecipe recipe = new EnderIoRecipe(getMachineName(), DEFAULT_ENERGY_PER_TASK, input, output); + // return Collections.singletonList(recipe); + // } } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockCustomWall.java b/src/main/java/crazypants/enderio/machine/painter/BlockCustomWall.java index c07b5a14..8badf7bd 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockCustomWall.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockCustomWall.java @@ -1,7 +1,5 @@ package crazypants.enderio.machine.painter; -import java.util.Collections; -import java.util.List; import java.util.Random; import net.minecraft.block.Block; @@ -11,6 +9,7 @@ import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityDiggingFX; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -19,12 +18,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; -import crazypants.enderio.crafting.IEnderIoRecipe; -import crazypants.enderio.crafting.impl.EnderIoRecipe; import crazypants.enderio.machine.MachineRecipeInput; import crazypants.enderio.machine.MachineRecipeRegistry; @@ -41,27 +38,26 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { private Random rand = new Random(); public BlockCustomWall() { - super(ModObject.blockCustomWall.id, Block.cobblestone); + super(Blocks.cobblestone); setCreativeTab(null); - setUnlocalizedName(ModObject.blockCustomWall.unlocalisedName); + setBlockName(ModObject.blockCustomWall.unlocalisedName); } private void init() { - LanguageRegistry.addName(this, ModObject.blockCustomWall.name); GameRegistry.registerBlock(this, BlockItemCustomWall.class, ModObject.blockCustomWall.unlocalisedName); GameRegistry.registerTileEntity(TileEntityCustomBlock.class, ModObject.blockCustomWall.unlocalisedName + "TileEntity"); MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate()); } - public static ItemStack createItemStackForSourceBlock(int id, int damage) { - ItemStack result = new ItemStack(ModObject.blockCustomWall.id, 1, damage); + public static ItemStack createItemStackForSourceBlock(Block id, int damage) { + ItemStack result = new ItemStack(EnderIO.blockCustomWall, 1, damage); PainterUtil.setSourceBlock(result, id, damage); return result; } @SideOnly(Side.CLIENT) @Override - public boolean addBlockHitEffects(World world, MovingObjectPosition target, + public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { IIcon tex = null; @@ -82,7 +78,7 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { @Override @SideOnly(Side.CLIENT) - public boolean addBlockDestroyEffects(World world, int x, int y, int z, int + public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) { IIcon tex = lastRemovedComponetIcon; byte b0 = 4; @@ -136,12 +132,12 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { } @Override - public int getLightOpacity(World world, int x, int y, int z) { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0) { - return Math.min(super.getLightOpacity(world, x, y, z), Block.lightOpacity[tef.getSourceBlockId()]); + if(tef.getSourceBlock() != null) { + return Math.min(super.getLightOpacity(world, x, y, z), tef.getSourceBlock().getLightOpacity(world, x, y, z)); } } return super.getLightOpacity(world, x, y, z); @@ -149,8 +145,8 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { @Override public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { - int id = world.getBlockId(x, y, z); - if(id == this.blockID) { + Block id = world.getBlock(x, y, z); + if(id == this) { return true; } return super.canPlaceTorchOnTop(world, x, y, z); @@ -158,32 +154,27 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { @Override public boolean canConnectWallTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { - int l = par1IBlockAccess.getBlockId(par2, par3, par4); - if(l == ModObject.blockCustomFenceGate.id) { + Block l = par1IBlockAccess.getBlock(par2, par3, par4); + if(l == EnderIO.blockCustomFenceGate) { return true; } return super.canConnectWallTo(par1IBlockAccess, par2, par3, par4); } @Override - public IIcon getBlockTexture(IBlockAccess world, int x, int y, int z, int blockSide) { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - if(tef.getSourceBlockId() > 0 && tef.getSourceBlockId() < Block.blocksList.length && blocksList[tef.getSourceBlockId()] != null) { - return blocksList[tef.getSourceBlockId()].getIcon(blockSide, tef.getSourceBlockMetadata()); + if(tef.getSourceBlock() != null) { + return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata()); } } - return blocksList[Block.anvil.blockID].getBlockTexture(world, x, y, z, blockSide); + return Blocks.anvil.getIcon(world, x, y, z, blockSide); } @Override - public TileEntity createNewTileEntity(World world) { - return null; - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { + public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityCustomBlock(); } @@ -191,14 +182,11 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int id = -1; Block b = PainterUtil.getSourceBlock(stack); - if(b != null) { - id = b.blockID; - } TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(stack)); } world.markBlockForUpdate(x, y, z); @@ -208,7 +196,7 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { * Remove the tile entity too. */ @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { TileEntity te = world.getTileEntity(x, y, z); @@ -216,7 +204,7 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { if(te instanceof TileEntityCustomBlock) { TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlockId(), tef.getSourceBlockMetadata()); + ItemStack itemStack = createItemStackForSourceBlock(tef.getSourceBlock(), tef.getSourceBlockMetadata()); float f = 0.7F; double d0 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -232,7 +220,7 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { } - world.removeBlockTileEntity(x, y, z); + world.removeTileEntity(x, y, z); } @Override @@ -243,21 +231,21 @@ public class BlockCustomWall extends BlockWall implements ITileEntityProvider { public static final class PainterTemplate extends BasicPainterTemplate { public PainterTemplate() { - super(Block.cobblestoneWall.blockID); + super(Blocks.cobblestone_wall); } @Override public ItemStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) { ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs); - return new ItemStack[] { createItemStackForSourceBlock(paintSource.itemID, paintSource.getItemDamage()) }; + return new ItemStack[] { createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage()) }; } - @Override - public List getAllRecipes() { - IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, new ItemStack(Block.cobblestoneWall), new ItemStack( - ModObject.blockCustomWall.actualId, 1, 0)); - return Collections.singletonList(recipe); - } + // @Override + // public List getAllRecipes() { + // IEnderIoRecipe recipe = new EnderIoRecipe(IEnderIoRecipe.PAINTER_ID, DEFAULT_ENERGY_PER_TASK, new ItemStack(Block.cobblestoneWall), new ItemStack( + // ModObject.blockCustomWall.actualId, 1, 0)); + // return Collections.singletonList(recipe); + // } } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomFenceGate.java b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomFenceGate.java index 263ab579..113c60a9 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomFenceGate.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomFenceGate.java @@ -2,6 +2,7 @@ package crazypants.enderio.machine.painter; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -10,8 +11,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockItemCustomFenceGate extends ItemBlock { - public BlockItemCustomFenceGate(int id) { - super(id); + public BlockItemCustomFenceGate(Block block) { + super(block); setHasSubtypes(true); } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomSlab.java b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomSlab.java index 0b233559..9fbd6b2f 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomSlab.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomSlab.java @@ -17,10 +17,10 @@ public class BlockItemCustomSlab extends ItemSlab { private boolean isFullBlock; - public BlockItemCustomSlab(int par1) { - super(par1, EnderIO.blockCustomSlab, EnderIO.blockCustomDoubleSlab, par1 - 256 == ModObject.blockCustomDoubleSlab.id); + public BlockItemCustomSlab(Block blk) { + super(blk, EnderIO.blockCustomSlab, EnderIO.blockCustomDoubleSlab, blk == EnderIO.blockCustomDoubleSlab); setHasSubtypes(true); - isFullBlock = par1 - 256 == ModObject.blockCustomDoubleSlab.id; + isFullBlock = blk == EnderIO.blockCustomDoubleSlab; setUnlocalizedName(ModObject.blockCustomSlab.unlocalisedName); } @@ -47,12 +47,12 @@ public class BlockItemCustomSlab extends ItemSlab { } else if(!player.canPlayerEdit(x, y, z, side, par1ItemStack)) { return false; } else { - int i1 = world.getBlockId(x, y, z); + Block i1 = world.getBlock(x, y, z); int j1 = world.getBlockMetadata(x, y, z); int k1 = j1 & 7; boolean flag = (j1 & 8) != 0; - if((side == 1 && !flag || side == 0 && flag) && i1 == EnderIO.blockCustomSlab.blockID && k1 == par1ItemStack.getItemDamage()) { + if((side == 1 && !flag || side == 0 && flag) && i1 == EnderIO.blockCustomSlab && k1 == par1ItemStack.getItemDamage()) { if(world.checkNoEntityCollision(EnderIO.blockCustomDoubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))) { @@ -61,23 +61,20 @@ public class BlockItemCustomSlab extends ItemSlab { ((TileEntityCustomSlab) te).isConvertingToFullBlock = true; } - if(world.setBlock(x, y, z, EnderIO.blockCustomDoubleSlab.blockID, k1, 3)) { + if(world.setBlock(x, y, z, EnderIO.blockCustomDoubleSlab, k1, 3)) { te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { - int id = -1; + Block b = PainterUtil.getSourceBlock(par1ItemStack); - if(b != null) { - id = b.blockID; - } TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(par1ItemStack)); world.markBlockForUpdate(x, y, z); } world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, - EnderIO.blockCustomDoubleSlab.stepSound.getPlaceSound(), (EnderIO.blockCustomDoubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, + EnderIO.blockCustomDoubleSlab.stepSound.getStepResourcePath(), (EnderIO.blockCustomDoubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, EnderIO.blockCustomDoubleSlab.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } else { @@ -113,11 +110,11 @@ public class BlockItemCustomSlab extends ItemSlab { ++x; } - int i1 = world.getBlockId(x, y, z); + Block i1 = world.getBlock(x, y, z); int j1 = world.getBlockMetadata(x, y, z); int k1 = j1 & 7; - if(i1 == EnderIO.blockCustomSlab.blockID && k1 == par1ItemStack.getItemDamage()) { + if(i1 == EnderIO.blockCustomSlab && k1 == par1ItemStack.getItemDamage()) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomSlab) { @@ -125,23 +122,20 @@ public class BlockItemCustomSlab extends ItemSlab { } if(world.checkNoEntityCollision(EnderIO.blockCustomDoubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z)) - && world.setBlock(x, y, z, EnderIO.blockCustomDoubleSlab.blockID, k1, 3)) { + && world.setBlock(x, y, z, EnderIO.blockCustomDoubleSlab, k1, 3)) { te = world.getTileEntity(x, y, z); if(te instanceof TileEntityCustomBlock) { - int id = -1; + Block b = PainterUtil.getSourceBlock(par1ItemStack); - if(b != null) { - id = b.blockID; - } TileEntityCustomBlock tef = (TileEntityCustomBlock) te; - tef.setSourceBlockId(id); + tef.setSourceBlock(b); tef.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(par1ItemStack)); world.markBlockForUpdate(x, y, z); } world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, - EnderIO.blockCustomDoubleSlab.stepSound.getPlaceSound(), (EnderIO.blockCustomDoubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, + EnderIO.blockCustomDoubleSlab.stepSound.getStepResourcePath(), (EnderIO.blockCustomDoubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, EnderIO.blockCustomDoubleSlab.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomStair.java b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomStair.java index 454feaa5..3366201b 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomStair.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomStair.java @@ -2,6 +2,7 @@ package crazypants.enderio.machine.painter; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -10,8 +11,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockItemCustomStair extends ItemBlock { - public BlockItemCustomStair(int id) { - super(id); + public BlockItemCustomStair(Block block) { + super(block); setHasSubtypes(true); } diff --git a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomWall.java b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomWall.java index 0832e693..37a4577f 100644 --- a/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomWall.java +++ b/src/main/java/crazypants/enderio/machine/painter/BlockItemCustomWall.java @@ -2,6 +2,7 @@ package crazypants.enderio.machine.painter; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -10,8 +11,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockItemCustomWall extends ItemBlock { - public BlockItemCustomWall(int id) { - super(id); + public BlockItemCustomWall(Block block) { + super(block); setHasSubtypes(true); } diff --git a/src/main/java/crazypants/enderio/machine/painter/PainterUtil.java b/src/main/java/crazypants/enderio/machine/painter/PainterUtil.java index 4ef673eb..15b7cfd0 100644 --- a/src/main/java/crazypants/enderio/machine/painter/PainterUtil.java +++ b/src/main/java/crazypants/enderio/machine/painter/PainterUtil.java @@ -52,13 +52,13 @@ public final class PainterUtil { return Lang.localize("blockPainter.paintedWith") + " " + sourceName; } - public static void setSourceBlock(ItemStack item, String sourceId, int meta) { + public static void setSourceBlock(ItemStack item, Block source, int meta) { NBTTagCompound tag = item.getTagCompound(); if(tag == null) { tag = new NBTTagCompound(); item.setTagCompound(tag); } - tag.setString(BlockPainter.KEY_SOURCE_BLOCK_ID, sourceId); + tag.setString(BlockPainter.KEY_SOURCE_BLOCK_ID, Block.blockRegistry.getNameForObject(source)); tag.setInteger(BlockPainter.KEY_SOURCE_BLOCK_META, meta); } diff --git a/src/main/java/crazypants/enderio/machine/painter/TileEntityCustomBlock.java b/src/main/java/crazypants/enderio/machine/painter/TileEntityCustomBlock.java index 25946e17..ea99ea10 100644 --- a/src/main/java/crazypants/enderio/machine/painter/TileEntityCustomBlock.java +++ b/src/main/java/crazypants/enderio/machine/painter/TileEntityCustomBlock.java @@ -2,40 +2,40 @@ package crazypants.enderio.machine.painter; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; -import cpw.mods.fml.common.registry.GameData; import crazypants.enderio.TileEntityEio; public class TileEntityCustomBlock extends TileEntityEio { - private static final String KEY_SOURCE_BLOCK_ID = "sourceBlockId"; + private static final String KEY_SOURCE_BLOCK_ID = "sourceBlock"; private static final String KEY_SOURCE_BLOCK_META = "sourceBlockMeta"; - private String sourceBlockId; + private Block sourceBlock; private int sourceBlockMetadata; public TileEntityCustomBlock() { - this.sourceBlockId = null; + this.sourceBlock = null; } @Override public void readCustomNBT(NBTTagCompound nbtRoot) { - sourceBlockId = nbtRoot.getString(KEY_SOURCE_BLOCK_ID); + String sourceBlockStr = nbtRoot.getString(KEY_SOURCE_BLOCK_ID); + sourceBlock = Block.getBlockFromName(sourceBlockStr); sourceBlockMetadata = nbtRoot.getInteger(KEY_SOURCE_BLOCK_META); } @Override public void writeCustomNBT(NBTTagCompound nbtRoot) { - if(sourceBlockId != null && sourceBlockId.trim().length() > 0) { - nbtRoot.setString(KEY_SOURCE_BLOCK_ID, sourceBlockId); + if(sourceBlock != null) { + nbtRoot.setString(KEY_SOURCE_BLOCK_ID, Block.blockRegistry.getNameForObject(sourceBlock)); } nbtRoot.setInteger(KEY_SOURCE_BLOCK_META, sourceBlockMetadata); } - public String getSourceBlockId() { - return sourceBlockId; + public Block getSourceBlock() { + return sourceBlock; } - public void setSourceBlockId(String sourceBlockId) { - this.sourceBlockId = sourceBlockId; + public void setSourceBlock(Block sourceBlock) { + this.sourceBlock = sourceBlock; } public int getSourceBlockMetadata() { @@ -46,13 +46,6 @@ public class TileEntityCustomBlock extends TileEntityEio { this.sourceBlockMetadata = sourceBlockMetadata; } - public Block getSourceBlock() { - if(sourceBlockId == null) { - return null; - } - return GameData.blockRegistry.get(sourceBlockId); - } - @Override public boolean canUpdate() { return false; diff --git a/src/main/java/crazypants/enderio/machine/power/CapBankRenderer2.java b/src/main/java/crazypants/enderio/machine/power/CapBankRenderer2.java index 8c59c840..d6a180d6 100644 --- a/src/main/java/crazypants/enderio/machine/power/CapBankRenderer2.java +++ b/src/main/java/crazypants/enderio/machine/power/CapBankRenderer2.java @@ -113,10 +113,7 @@ public class CapBankRenderer2 implements ISimpleBlockRenderingHandler { if(colCount > 0) { col.scale(0.25); tes.setColorRGBA_F(col.x, col.y, col.z, col.w); - } else { - tes.setColorOpaque_F(1, 1, 1); } - if(Config.renderCapBankGaugeBackground) { renderGaugeOnFace(gb, EnderIO.blockCapacitorBank.overlayIcon, refVertices, x, y, z); } @@ -156,6 +153,8 @@ public class CapBankRenderer2 implements ISimpleBlockRenderingHandler { if(v != null) { if(v.color != null) { tes.setColorRGBA_F(v.color.x, v.color.y, v.color.z, v.color.w); + } else { + tes.setColorOpaque_F(0.7f, 0.7f, 0.7f); } if(v.brightness > 0) { tes.setBrightness(v.brightness); @@ -213,6 +212,8 @@ public class CapBankRenderer2 implements ISimpleBlockRenderingHandler { if(v != null) { if(v.color != null) { tes.setColorRGBA_F(v.color.x, v.color.y, v.color.z, v.color.w); + } else { + tes.setColorOpaque_F(0.7f, 0.7f, 0.7f); } if(v.brightness > 0) { tes.setBrightness(v.brightness);