public boolean func_72250_d( IBlockAccess p_72250_1_, int p_72250_2_, int p_72250_3_, int p_72250_4_) { int var5 = p_72250_1_.func_72798_a(p_72250_2_, p_72250_3_, p_72250_4_); if (var5 != this.field_71990_ca && var5 != Block.field_71993_bv.field_71990_ca) { Block var6 = Block.field_71973_m[var5]; return var6 != null && var6.field_72018_cp.func_76218_k() && var6.func_71886_c() ? var6.field_72018_cp != Material.field_76266_z : false; } else { return true; } }
public static int GetBlockID(String str) throws Exception { try { int i = Integer.parseInt(str); if (i > 0) return i; } catch (Exception e) { } str = "tile." + str.replace('_', ' ').trim().toLowerCase(); for (int j = 0; j < 256; j++) { Block b = Block.blocksList[j]; if (b == null) continue; if (b.getBlockName().toLowerCase().equals(str)) return j; } throw new Exception("Block not found!"); }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { if (modelID == InfiBlocks.getContentInstance().magicSlabModel) { block.setBlockBounds(0.3125F, 0.1875F, 0.1875F, 0.6875F, 0.8125F, 0.8125F); BlockRenderHelper.renderDo(renderer, block, metadata); } }
/** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed * (coordinates passed are their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { int var6 = par1World.getBlockMetadata(par2, par3, par4); boolean var7 = false; if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) { var7 = true; } if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) { var7 = true; } if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) { var7 = true; } if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) { var7 = true; } if (!var7) { this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); par1World.setBlockWithNotify(par2, par3, par4, 0); } super.onNeighborBlockChange(par1World, par2, par3, par4, par5); }
public static boolean isExcludedFromExtraction(Block block) { if (block == null) return true; for (String excluded : excludedBlocks) if (excluded.equals(block.getBlockName()) || excluded.equals(Integer.toString(block.blockID))) return true; return false; }
public void func_71871_a( World p_71871_1_, int p_71871_2_, int p_71871_3_, int p_71871_4_, AxisAlignedBB p_71871_5_, List p_71871_6_, Entity p_71871_7_) { int var8 = p_71871_1_.func_72805_g(p_71871_2_, p_71871_3_, p_71871_4_); int var9 = var8 & 3; float var10 = 0.0F; float var11 = 0.5F; float var12 = 0.5F; float var13 = 1.0F; if ((var8 & 4) != 0) { var10 = 0.5F; var11 = 1.0F; var12 = 0.0F; var13 = 0.5F; } this.func_71905_a(0.0F, var10, 0.0F, 1.0F, var11, 1.0F); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); if (var9 == 0) { this.func_71905_a(0.5F, var12, 0.0F, 1.0F, var13, 1.0F); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); } else if (var9 == 1) { this.func_71905_a(0.0F, var12, 0.0F, 0.5F, var13, 1.0F); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); } else if (var9 == 2) { this.func_71905_a(0.0F, var12, 0.5F, 1.0F, var13, 1.0F); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); } else if (var9 == 3) { this.func_71905_a(0.0F, var12, 0.0F, 1.0F, var13, 0.5F); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); } this.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
public void func_71871_a( World p_71871_1_, int p_71871_2_, int p_71871_3_, int p_71871_4_, AxisAlignedBB p_71871_5_, List p_71871_6_, Entity p_71871_7_) { this.func_82541_d(p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); boolean var8 = this.func_82542_g(p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); if (var8 && this.func_82544_h(p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_)) { super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); } this.func_71905_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
public void func_71871_a( World p_71871_1_, int p_71871_2_, int p_71871_3_, int p_71871_4_, AxisAlignedBB p_71871_5_, List p_71871_6_, Entity p_71871_7_) { this.func_71902_a(p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_); super.func_71871_a( p_71871_1_, p_71871_2_, p_71871_3_, p_71871_4_, p_71871_5_, p_71871_6_, p_71871_7_); }
public void func_71852_a( World p_71852_1_, int p_71852_2_, int p_71852_3_, int p_71852_4_, int p_71852_5_, int p_71852_6_) { if ((p_71852_6_ & 8) > 0) { int var7 = p_71852_6_ & 7; this.func_82536_d(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, var7); } super.func_71852_a(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_5_, p_71852_6_); }
public void func_214_b(World p_214_1_, int p_214_2_, int p_214_3_, int p_214_4_) { int var5 = p_214_1_.func_602_e(p_214_2_, p_214_3_, p_214_4_); if ((var5 & 8) > 0) { p_214_1_.func_611_g(p_214_2_, p_214_3_, p_214_4_, this.field_376_bc); int var6 = var5 & 7; if (var6 == 1) { p_214_1_.func_611_g(p_214_2_ - 1, p_214_3_, p_214_4_, this.field_376_bc); } else if (var6 == 2) { p_214_1_.func_611_g(p_214_2_ + 1, p_214_3_, p_214_4_, this.field_376_bc); } else if (var6 == 3) { p_214_1_.func_611_g(p_214_2_, p_214_3_, p_214_4_ - 1, this.field_376_bc); } else if (var6 == 4) { p_214_1_.func_611_g(p_214_2_, p_214_3_, p_214_4_ + 1, this.field_376_bc); } else { p_214_1_.func_611_g(p_214_2_, p_214_3_ - 1, p_214_4_, this.field_376_bc); } } super.func_214_b(p_214_1_, p_214_2_, p_214_3_, p_214_4_); }
@Override public void tick() { this.ticks++; int currentBlocksChanged = 0; boolean continueFlag = true; World world = player.worldObj; // Only store the X and Z, since we're considering columns only. int x = this.currentPos.x; int z = this.currentPos.z; int y = 0; int blockID; while (continueFlag) { // Find the y coord of the first exposed, non-air block. y = world.getActualHeight(); while (world.isAirBlock(x, y, z) && y >= 0) { y--; } // If Y goes under the world base, skip this column. (The End, I'm looking at you.) if (0 <= y && y <= world.getActualHeight()) { blockID = world.getBlockId(x, y, z); switch (this.effectMode) { case THAW: if (blockID == Block.ice.blockID) { // Replace ice with water. backup.before.add(new BlockSaveable(world, x, y, z)); world.setBlock(x, y, z, Block.waterMoving.blockID); backup.after.add(new BlockSaveable(world, x, y, z)); currentBlocksChanged++; } else if (blockID == Block.snow.blockID) { // Remove snow. backup.before.add(new BlockSaveable(world, x, y, z)); world.setBlock(x, y, z, 0); backup.after.add(new BlockSaveable(world, x, y, z)); currentBlocksChanged++; } break; case FREEZE: if (blockID == Block.waterMoving.blockID || blockID == Block.waterStill.blockID) { // Both water types become ice. backup.before.add(new BlockSaveable(world, x, y, z)); world.setBlock(x, y, z, Block.ice.blockID); backup.after.add(new BlockSaveable(world, x, y, z)); currentBlocksChanged++; } break; case SNOW: if (Block.isNormalCube(world.getBlockId(x, y, z))) { // Add snow covering to the block above. backup.before.add(new BlockSaveable(world, x, y + 1, z)); world.setBlock(x, y + 1, z, Block.snow.blockID); backup.after.add(new BlockSaveable(world, x, y + 1, z)); currentBlocksChanged++; } break; case TILL: if (blockID == Block.dirt.blockID || blockID == Block.grass.blockID) { backup.before.add(new BlockSaveable(world, x, y, z)); world.setBlock(x, y, z, Block.tilledField.blockID); backup.after.add(new BlockSaveable(world, x, y, z)); currentBlocksChanged++; } break; case UNTILL: if (blockID == Block.tilledField.blockID) { backup.before.add(new BlockSaveable(world, x, y, z)); world.setBlock(x, y, z, Block.dirt.blockID); backup.after.add(new BlockSaveable(world, x, y, z)); currentBlocksChanged++; } break; } } z++; if (z > (this.effectOrigin.z + this.effectRadius)) { x++; z = this.effectOrigin.z - this.effectRadius; if (x > (this.effectOrigin.x + this.effectRadius)) { this.isComplete = true; } } if (this.isComplete || currentBlocksChanged >= ModuleWorldControl.WCblocksPerTick) { this.changed += currentBlocksChanged; this.currentPos = new Point(x, 0, z); continueFlag = false; } } }
// PRECONDITION: worldObj must not be null private void refreshRenderState() { // Only done on server/SSP if (worldObj.isRemote) return; // Pipe connections; for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) { renderState.pipeConnectionMatrix.setConnected(o, this.pipeConnectionsBuffer[o.ordinal()]); } // Pipe Textures renderState.setTextureFile(pipe.getTextureFile()); for (ForgeDirection o : ForgeDirection.values()) { renderState.textureMatrix.setTextureIndex(o, pipe.getTextureIndex(o)); } // WireState for (IPipe.WireColor color : IPipe.WireColor.values()) { renderState.wireMatrix.setWire(color, pipe.wireSet[color.ordinal()]); for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { renderState.wireMatrix.setWireConnected( color, direction, pipe.isWireConnectedTo(this.getTile(direction), color)); } } // Wire Textures if (pipe.wireSet[IPipe.WireColor.Red.ordinal()]) { renderState.wireMatrix.setTextureIndex( WireColor.Red, pipe.signalStrength[IPipe.WireColor.Red.ordinal()] > 0 ? 6 : 5); } else { renderState.wireMatrix.setTextureIndex(WireColor.Red, 0); } if (pipe.wireSet[IPipe.WireColor.Blue.ordinal()]) { renderState.wireMatrix.setTextureIndex( WireColor.Blue, pipe.signalStrength[IPipe.WireColor.Blue.ordinal()] > 0 ? 8 : 7); } else { renderState.wireMatrix.setTextureIndex(WireColor.Blue, 0); } if (pipe.wireSet[IPipe.WireColor.Green.ordinal()]) { renderState.wireMatrix.setTextureIndex( WireColor.Green, pipe.signalStrength[IPipe.WireColor.Green.ordinal()] > 0 ? 10 : 9); } else { renderState.wireMatrix.setTextureIndex(WireColor.Green, 0); } if (pipe.wireSet[IPipe.WireColor.Yellow.ordinal()]) { renderState.wireMatrix.setTextureIndex( WireColor.Yellow, pipe.signalStrength[IPipe.WireColor.Yellow.ordinal()] > 0 ? 12 : 11); } else { renderState.wireMatrix.setTextureIndex(WireColor.Yellow, 0); } // Gate Textures renderState.setHasGate(pipe.hasGate()); renderState.setGateTexture(!pipe.hasGate() ? 0 : pipe.gate.getTexture(pipe.isGateActive())); // Facades for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { int blockId = this.facadeBlocks[direction.ordinal()]; renderState.facadeMatrix.setConnected( direction, blockId != 0 && Block.blocksList[blockId] != null); if (Block.blocksList[blockId] != null) { Block block = Block.blocksList[blockId]; renderState.facadeMatrix.setTextureFile(direction, block.getTextureFile()); renderState.facadeMatrix.setTextureIndex( direction, block.getBlockTextureFromSideAndMetadata( direction.ordinal(), this.facadeMeta[direction.ordinal()])); } } if (renderState.isDirty()) { worldObj.markBlockNeedsUpdate(this.xCoord, this.yCoord, this.zCoord); renderState.clean(); } }
public static boolean renderDoorBlock( Block par1Block, int par2, int par3, int par4, RenderBlocks renderblocks, IBlockAccess iblockaccess) { Tessellator var5 = Tessellator.instance; BlockMTDoor var6 = (BlockMTDoor) par1Block; boolean var7 = false; float var8 = 0.5F; float var9 = 1.0F; float var10 = 0.8F; float var11 = 0.6F; int var12 = par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2, par3, par4); var5.setBrightness( par1Block.minY > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2, par3 - 1, par4)); var5.setColorOpaque_F(var8, var8, var8); renderblocks.renderBottomFace( par1Block, (double) par2, (double) par3, (double) par4, par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 0)); var7 = true; var5.setBrightness( par1Block.maxY < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2, par3 + 1, par4)); var5.setColorOpaque_F(var9, var9, var9); renderblocks.renderTopFace( par1Block, (double) par2, (double) par3, (double) par4, par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 1)); var7 = true; var5.setBrightness( par1Block.minZ > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2, par3, par4 - 1)); var5.setColorOpaque_F(var10, var10, var10); int var13 = par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 2); if (var13 < 0) { renderblocks.flipTexture = true; var13 = -var13; } renderblocks.renderEastFace(par1Block, (double) par2, (double) par3, (double) par4, var13); var7 = true; renderblocks.flipTexture = false; var5.setBrightness( par1Block.maxZ < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2, par3, par4 + 1)); var5.setColorOpaque_F(var10, var10, var10); var13 = par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 3); if (var13 < 0) { renderblocks.flipTexture = true; var13 = -var13; } renderblocks.renderWestFace(par1Block, (double) par2, (double) par3, (double) par4, var13); var7 = true; renderblocks.flipTexture = false; var5.setBrightness( par1Block.minX > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2 - 1, par3, par4)); var5.setColorOpaque_F(var11, var11, var11); var13 = par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 4); if (var13 < 0) { renderblocks.flipTexture = true; var13 = -var13; } renderblocks.renderNorthFace(par1Block, (double) par2, (double) par3, (double) par4, var13); var7 = true; renderblocks.flipTexture = false; var5.setBrightness( par1Block.maxX < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(renderblocks.blockAccess, par2 + 1, par3, par4)); var5.setColorOpaque_F(var11, var11, var11); var13 = par1Block.getBlockTexture(renderblocks.blockAccess, par2, par3, par4, 5); if (var13 < 0) { renderblocks.flipTexture = true; var13 = -var13; } renderblocks.renderSouthFace(par1Block, (double) par2, (double) par3, (double) par4, var13); var7 = true; renderblocks.flipTexture = false; return var7; }
// Redstone ore code public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer) { glow(world, i, j, k); super.onBlockClicked(world, i, j, k, entityplayer); }
@Override public void onNeighborBlockChange(World world, int x, int y, int z, int neigborId) { super.onNeighborBlockChange(world, x, y, z, neigborId); checkFlowerChange(world, x, y, z); }
public void onEntityWalking(World world, int i, int j, int k, Entity entity) { glow(world, i, j, k); super.onEntityWalking(world, i, j, k, entity); }
@Override public int getIconFromDamage(int i) { return metaBlock.getBlockTextureFromSideAndMetadata(2, i); }