@Override public void renderWorldBlock( RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) { TileBreaker tb = (TileBreaker) CoreLib.getTileEntity(iba, i, j, k, TileBreaker.class); if (tb != null) { this.context.setDefaults(); this.context.setLocalLights(0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F); int act = tb.Active ? 1 : 0; this.context.setPos(i, j, k); this.context.readGlobalLights(iba, i, j, k); this.context.setIcon( super.block.getIcon(58, md), super.block.getIcon(49 + act, md), super.block.getIcon(51 + act, md), super.block.getIcon(51 + act, md), super.block.getIcon(51 + act, md), super.block.getIcon(51 + act, md)); this.context.setSize(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); this.context.setupBox(); this.context.transform(); this.context.orientTextures(tb.Rotation); // RenderLib.bindTexture("/eloraam/machine/machine1.png"); this.context.renderGlobFaces(63); // RenderLib.unbindTexture(); } }
@Override public void renderWorldBlock( RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) { TileLogic tl = (TileLogic) CoreLib.getTileEntity(iba, i, j, k, TileLogic.class); if (tl != null) { Tessellator tess = Tessellator.instance; tess.draw(); // this.renderCovers(iba, tl); super.context.setBrightness(super.block.getMixedBrightnessForBlock(iba, i, j, k)); this.setMatrixWorld(i, j, k, tl.Rotation); this.renderWorldPart(iba, tl); int ts = this.getTorchState(tl); RenderLogic.TorchPos[] tpv = this.getTorchVectors(tl); if (tpv != null) { for (int n = 0; n < tpv.length; ++n) { // TODO: . // IIcon icon = (ts & 1 << n) > 0 ? super.block.getIcon(0, md) :super.block.getIcon(1, // md); this.renderRedstoneTorch(tpv[n].x, tpv[n].y, tpv[n].z, tpv[n].h, (ts & 1 << n) > 0); } } this.context.bindBlockTexture(); tess.startDrawingQuads(); } }
/** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses * this to count ticks and creates a new spawn inside its implementation. */ public void updateEntity() { super.updateEntity(); if (!CoreLib.isClient(this.worldObj)) { int var1 = 0; int var2 = 0; int var3 = 0; int var4 = 0; this.cacheCon(); for (int var5 = 0; var5 < 6; ++var5) { if ((this.ConCache & 1 << var5) != 0) { WorldCoord var6 = new WorldCoord(this); var6.step(var5); Integer var7 = PipeLib.getPressure(this.worldObj, var6, var5 ^ 1); if (var7 != null) { var3 = Math.min(var7.intValue(), var3); var4 = Math.max(var7.intValue(), var4); var1 += var7.intValue(); ++var2; } } } if (var2 == 0) { this.Pressure = 0; } else { if (var3 < 0) { ++var3; } if (var4 > 0) { --var4; } this.Pressure = Math.max(var3, Math.min(var4, var1 / var2 + Integer.signum(var1))); } PipeLib.movePipeLiquid(this.worldObj, this, new WorldCoord(this), this.ConCache); this.dirtyBlock(); if (!CoreLib.isClient(this.worldObj) && (this.worldObj.getWorldTime() & 16L) == 0L) { this.sendItemUpdate(); } } }
@Override public void randomDisplayTick(World world, int i, int j, int k, Random random) { TileLogic tl = (TileLogic) CoreLib.getTileEntity(world, i, j, k, TileLogic.class); if (tl != null) { int ts = this.getTorchState(tl); if (ts != 0) { this.setMatrixDisplayTick(i, j, k, tl.Rotation, random); RenderLogic.TorchPos[] tpv = this.getTorchVectors(tl); if (tpv != null) { int rv = random.nextInt(tpv.length); if ((ts & 1 << rv) != 0) { this.renderTorchPuff(world, "reddust", tpv[rv].x, tpv[rv].y, tpv[rv].z); } } } } }
public void onHarvestPart(EntityPlayer var1, int var2) { if (var2 == 29) { CoreLib.dropItem( this.worldObj, this.xCoord, this.yCoord, this.zCoord, new ItemStack(RedPowerBase.blockMicro.blockID, 1, this.getExtendedID() << 8)); if (this.CoverSides > 0) { this.replaceWithCovers(); } else { this.deleteBlock(); } this.uncache(); this.updateBlockChange(); } else { super.onHarvestPart(var1, var2); } }
@Override public void updateCurrentStrength() { this.PowerVal2 = (short) RedPowerLib.updateBlockCurrentStrength( super.worldObj, this, super.xCoord, super.yCoord, super.zCoord, RedPowerLib.mapRotToCon(5, super.Rotation), 1); this.PowerVal1 = (short) RedPowerLib.updateBlockCurrentStrength( super.worldObj, this, super.xCoord, super.yCoord, super.zCoord, RedPowerLib.mapRotToCon(10, super.Rotation), 1); CoreLib.markBlockDirty(super.worldObj, super.xCoord, super.yCoord, super.zCoord); }
public boolean onItemUseFirst( ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7, float var8, float var9, float var10) { if (CoreLib.isClient(var3)) { return false; } else { boolean var11 = false; if (var2 != null && var2.isSneaking()) { var11 = true; } int var12 = var3.getBlockId(var4, var5, var6); int var13 = var3.getBlockMetadata(var4, var5, var6); if (var12 != Block.redstoneRepeaterIdle.blockID && var12 != Block.redstoneRepeaterActive.blockID) { if (var12 == Block.dispenser.blockID) { var13 = var13 & 3 ^ var13 >> 2; var13 += 2; var3.setBlock(var4, var5, var6, var13); var1.damageItem(1, var2); return true; } else if (var12 != Block.pistonBase.blockID && var12 != Block.pistonStickyBase.blockID) { IRotatable var14 = (IRotatable) CoreLib.getTileEntity(var3, var4, var5, var6, IRotatable.class); if (var14 == null) { return false; } else { MovingObjectPosition var15 = CoreLib.retraceBlock(var3, var2, var4, var5, var6); if (var15 == null) { return false; } else { int var16 = var14.getPartMaxRotation(var15.subHit, var11); if (var16 == 0) { return false; } else { int var17 = var14.getPartRotation(var15.subHit, var11); ++var17; if (var17 > var16) { var17 = 0; } var14.setPartRotation(var15.subHit, var11, var17); var1.damageItem(1, var2); return true; } } } } else { ++var13; if (var13 > 5) { var13 = 0; } var3.setBlock(var4, var5, var6, var13); var1.damageItem(1, var2); return true; } } else { var3.setBlock(var4, var5, var6, var13 & 12 | var13 + 1 & 3); var1.damageItem(1, var2); return true; } } }
public static void initBlocks() { blockMultiblock = new BlockMultiblock(); GameRegistry.registerBlock(blockMultiblock, "multiblock"); GameRegistry.registerTileEntity(TileMultiblock.class, "RPMulti"); blockAppliance = new BlockAppliance(); GameRegistry.registerBlock(blockAppliance, ItemExtended.class, "appliance"); GameRegistry.registerTileEntity(TileAlloyFurnace.class, "RPAFurnace"); blockAppliance.addTileEntityMapping(0, TileAlloyFurnace.class); blockAppliance.setBlockName(0, "rpafurnace"); GameRegistry.addRecipe( new ItemStack(blockAppliance, 1, 0), new Object[] {"BBB", "B B", "BBB", Character.valueOf('B'), Blocks.brick_block}); GameRegistry.registerTileEntity(TileAdvBench.class, "RPAdvBench"); blockAppliance.addTileEntityMapping(3, TileAdvBench.class); blockAppliance.setBlockName(3, "rpabench"); CraftLib.addOreRecipe( new ItemStack(blockAppliance, 1, 3), new Object[] { "SSS", "WTW", "WCW", Character.valueOf('S'), Blocks.stone, Character.valueOf('W'), "plankWood", Character.valueOf('T'), Blocks.crafting_table, Character.valueOf('C'), Blocks.chest }); itemHandsawIron = new ItemHandsaw(0); itemHandsawIron.setUnlocalizedName("handsawIron"); itemHandsawIron.setTextureName("rpworld:itemHandsawIron"); itemHandsawIron.setMaxDamage(320); itemHandsawDiamond = new ItemHandsaw(2); itemHandsawDiamond.setUnlocalizedName("handsawDiamond"); itemHandsawDiamond.setTextureName("rpworld:itemHandsawDiamond"); itemHandsawDiamond.setMaxDamage(1280); GameRegistry.addRecipe( new ItemStack(itemHandsawIron, 1), new Object[] { "WWW", " II", " II", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Items.stick }); GameRegistry.addRecipe( new ItemStack(itemHandsawDiamond, 1), new Object[] { "WWW", " II", " DD", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('D'), Items.diamond, Character.valueOf('W'), Items.stick }); GameRegistry.addShapelessRecipe( CoreLib.copyStack(itemWaferSilicon, 16), new Object[] {itemBouleSilicon, new ItemStack(itemHandsawDiamond, 1, -1)}); itemScrewdriver = new ItemScrewdriver(); GameRegistry.addRecipe( new ItemStack(itemScrewdriver, 1), new Object[] { "I ", " W", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Items.stick }); GameRegistry.registerItem(itemScrewdriver, "screwdriver"); GameRegistry.addRecipe( new ItemStack(itemDrawplateDiamond, 1), new Object[] { " I ", "IDI", " I ", Character.valueOf('I'), new ItemStack(blockMicro, 1, 5649), Character.valueOf('D'), new ItemStack(blockMicro, 1, 4115) }); GameRegistry.addShapelessRecipe( itemFineIron, new Object[] {Items.iron_ingot, new ItemStack(itemDrawplateDiamond, 1, -1)}); CraftLib.addShapelessOreRecipe( itemFineCopper, new Object[] {"ingotCopper", new ItemStack(itemDrawplateDiamond, 1, -1)}); GameRegistry.addRecipe( CoreLib.copyStack(itemNuggetIron, 9), new Object[] {"I", Character.valueOf('I'), Items.iron_ingot}); CraftLib.addOreRecipe( CoreLib.copyStack(itemNuggetCopper, 9), new Object[] {"I", Character.valueOf('I'), "ingotCopper"}); CraftLib.addOreRecipe( CoreLib.copyStack(itemNuggetTin, 9), new Object[] {"I", Character.valueOf('I'), "ingotTin"}); CraftLib.addOreRecipe( CoreLib.copyStack(itemNuggetSilver, 9), new Object[] {"I", Character.valueOf('I'), "ingotSilver"}); GameRegistry.addRecipe( new ItemStack(Items.iron_ingot, 1, 0), new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetIron}); GameRegistry.addRecipe( itemIngotSilver, new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetSilver}); GameRegistry.addRecipe( itemIngotTin, new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetTin}); GameRegistry.addRecipe( itemIngotCopper, new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetCopper}); GameRegistry.addRecipe( itemCanvas, new Object[] { "SSS", "SWS", "SSS", Character.valueOf('S'), Items.string, Character.valueOf('W'), Items.stick }); GameRegistry.addRecipe( new ItemStack(Items.diamond, 2), new Object[] {"D", Character.valueOf('D'), new ItemStack(blockMicro, 1, 4115)}); GameRegistry.addRecipe( new ItemStack(Items.diamond, 1), new Object[] {"D", Character.valueOf('D'), new ItemStack(blockMicro, 1, 19)}); GameRegistry.addRecipe( new ItemStack(Items.iron_ingot, 2), new Object[] {"I", Character.valueOf('I'), new ItemStack(blockMicro, 1, 4113)}); GameRegistry.addRecipe( new ItemStack(Items.iron_ingot, 1), new Object[] {"I", Character.valueOf('I'), new ItemStack(blockMicro, 1, 17)}); }
public static void initAlloys() { CraftLib.addAlloyResult( itemIngotRed, new Object[] {new ItemStack(Items.redstone, 4), new ItemStack(Items.iron_ingot, 1)}); CraftLib.addAlloyResult( itemIngotRed, new Object[] {new ItemStack(Items.redstone, 4), new OreStack("ingotCopper")}); CraftLib.addAlloyResult( CoreLib.copyStack(itemIngotBrass, 4), new Object[] {new OreStack("ingotTin"), new OreStack("ingotCopper", 3)}); CraftLib.addAlloyResult( CoreLib.copyStack(itemTinplate, 4), new Object[] {new OreStack("ingotTin"), new ItemStack(Items.iron_ingot, 2)}); CraftLib.addAlloyResult( itemIngotBlue, new Object[] {new OreStack("ingotSilver"), new OreStack("dustNikolite", 4)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 3), new Object[] {new ItemStack(Blocks.rail, 8)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 3), new Object[] {new ItemStack(Items.bucket, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 5), new Object[] {new ItemStack(Items.minecart, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 6), new Object[] {new ItemStack(Items.iron_door, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 3), new Object[] {new ItemStack(Blocks.iron_bars, 8)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 31), new Object[] {new ItemStack(Blocks.anvil, 1, 0)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 31), new Object[] {new ItemStack(Blocks.anvil, 1, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 31), new Object[] {new ItemStack(Blocks.anvil, 1, 2)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 2), new Object[] {new ItemStack(Items.iron_sword, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 3), new Object[] {new ItemStack(Items.iron_pickaxe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 3), new Object[] {new ItemStack(Items.iron_axe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 1), new Object[] {new ItemStack(Items.iron_shovel, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 2), new Object[] {new ItemStack(Items.iron_hoe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 2), new Object[] {new ItemStack(Items.golden_sword, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 3), new Object[] {new ItemStack(Items.golden_pickaxe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 3), new Object[] {new ItemStack(Items.golden_axe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 1), new Object[] {new ItemStack(Items.golden_shovel, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 2), new Object[] {new ItemStack(Items.golden_hoe, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 5), new Object[] {new ItemStack(Items.iron_helmet, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 8), new Object[] {new ItemStack(Items.iron_chestplate, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 7), new Object[] {new ItemStack(Items.iron_leggings, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 4), new Object[] {new ItemStack(Items.iron_boots, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 5), new Object[] {new ItemStack(Items.golden_helmet, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 8), new Object[] {new ItemStack(Items.golden_chestplate, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 7), new Object[] {new ItemStack(Items.golden_leggings, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 4), new Object[] {new ItemStack(Items.golden_boots, 1)}); CraftLib.addAlloyResult( new ItemStack(Items.gold_ingot, 1), new Object[] {new ItemStack(Items.gold_nugget, 9)}); CraftLib.addAlloyResult( new ItemStack(Items.iron_ingot, 1), new Object[] {CoreLib.copyStack(itemNuggetIron, 9)}); CraftLib.addAlloyResult(itemIngotSilver, new Object[] {CoreLib.copyStack(itemNuggetSilver, 9)}); CraftLib.addAlloyResult(itemIngotCopper, new Object[] {CoreLib.copyStack(itemNuggetCopper, 9)}); CraftLib.addAlloyResult(itemIngotTin, new Object[] {CoreLib.copyStack(itemNuggetTin, 9)}); CraftLib.addAlloyResult(itemIngotCopper, new Object[] {itemFineCopper}); CraftLib.addAlloyResult(new ItemStack(Items.iron_ingot, 1), new Object[] {itemFineIron}); CraftLib.addAlloyResult( itemBouleSilicon, new Object[] {new ItemStack(Items.coal, 8, 0), new ItemStack(Blocks.sand, 8)}); CraftLib.addAlloyResult( itemBouleSilicon, new Object[] {new ItemStack(Items.coal, 8, 1), new ItemStack(Blocks.sand, 8)}); CraftLib.addAlloyResult( itemWaferBlue, new Object[] {CoreLib.copyStack(itemWaferSilicon, 1), new OreStack("dustNikolite", 4)}); CraftLib.addAlloyResult( itemWaferRed, new Object[] {CoreLib.copyStack(itemWaferSilicon, 1), new ItemStack(Items.redstone, 4)}); }
@Override public void renderWorldBlock( RenderBlocks renderblocks, IBlockAccess iba, int i, int j, int k, int md) { TileMachine tb = (TileMachine) CoreLib.getTileEntity(iba, i, j, k, TileMachine.class); if (tb != null) { Tessellator tess = Tessellator.instance; tess.draw(); this.context.setDefaults(); this.context.setLocalLights(0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F); this.context.setPos(i, j, k); this.context.readGlobalLights(iba, i, j, k); this.context.setBrightness(super.block.getMixedBrightnessForBlock(iba, i, j, k)); int tex; if (md == 0) { tex = tb.Active ? 1 : 0; this.context.setIcon( getIcon(48, md), getIcon(53 + tex, md), getIcon(56, md), getIcon(56, md), getIcon(55, md), getIcon(55, md)); } else { int t2; if (md == 4) { tex = 96 + (tb.Active ? 1 : 0); t2 = tex + 2 + (tb.Powered ? 2 : 0); this.context.setIcon( getIcon(102, md), getIcon(103, md), getIcon(tex, md), getIcon(tex, md), getIcon(t2, md), getIcon(t2, md)); } else if (md == 5) { tex = tb.Charged ? (tb.Active ? 2 : 1) : 0; t2 = 116 + (tb.Charged ? 1 : 0) + (tb.Active ? 2 : 0); this.context.setIcon( getIcon(113 + tex, md), getIcon(112, md), getIcon(t2, md), getIcon(t2, md), getIcon(t2, md), getIcon(t2, md)); } else if (md == 8) { tex = 120 + (tb.Charged ? 1 : 0) + (tb.Delay | tb.Active ? 2 : 0); this.context.setIcon( getIcon(124, md), getIcon(125, md), getIcon(tex, md), getIcon(tex, md), getIcon(tex, md), getIcon(tex, md)); } else if (md == 10) { tex = 104 + (tb.Active ? 1 : 0); t2 = tex + 2 + (tb.Powered ? 2 : 0); this.context.setIcon( getIcon(102, md), getIcon(103, md), getIcon(tex, md), getIcon(tex, md), getIcon(t2, md), getIcon(t2, md)); } else if (md == 12) { tex = tb.Active ? 1 : 0; this.context.setIcon( getIcon(48, md), getIcon(164 + tex, md), getIcon(167, md), getIcon(167, md), getIcon(166, md), getIcon(166, md)); } else if (md == 13) { tex = tb.Active ? 1 : 0; this.context.setIcon( getIcon(172 + tex, md), getIcon(168 + tex, md), getIcon(171, md), getIcon(171, md), getIcon(170, md), getIcon(170, md)); } else if (md == 14) { tex = tb.Active ? 1 : 0; this.context.setIcon( getIcon(58, md), getIcon(89, md), getIcon(91 + tex, md), getIcon(91 + tex, md), getIcon(90, md), getIcon(90, md)); } else if (md == 15) { tex = tb.Active ? 1 : 0; this.context.setIcon( getIcon(58, md), getIcon(89, md), getIcon(93 + tex, md), getIcon(93 + tex, md), getIcon(90, md), getIcon(90, md)); } else { tex = 59 + (tb.Active ? 1 : 0) + (md == 3 ? 2 : 0); this.context.setIcon( getIcon(58, md), getIcon(57, md), getIcon(tex, md), getIcon(tex, md), getIcon(tex, md), getIcon(tex, md)); } } this.context.setSize(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); this.context.setupBox(); this.context.transform(); this.context.orientTextures(tb.Rotation); // RenderLib.bindTexture("/eloraam/machine/machine1.png"); tess.startDrawingQuads(); this.context.renderGlobFaces(63); tess.draw(); // RenderLib.unbindTexture(); this.context.bindBlockTexture(); tess.startDrawingQuads(); } }