public int getRenderColor(IBlockState state) { if (state.getBlock() != this) { return super.getRenderColor(state); } else { BlockPlanks.EnumType var2 = (BlockPlanks.EnumType) state.getValue(VARIANT_PROP); return var2 == BlockPlanks.EnumType.SPRUCE ? ColorizerFoliage.getFoliageColorPine() : (var2 == BlockPlanks.EnumType.BIRCH ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(state)); } }
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { IBlockState var4 = worldIn.getBlockState(pos); if (var4.getBlock() == this) { BlockPlanks.EnumType var5 = (BlockPlanks.EnumType) var4.getValue(VARIANT_PROP); if (var5 == BlockPlanks.EnumType.SPRUCE) { return ColorizerFoliage.getFoliageColorPine(); } if (var5 == BlockPlanks.EnumType.BIRCH) { return ColorizerFoliage.getFoliageColorBirch(); } } return super.colorMultiplier(worldIn, pos, renderPass); }
/** Called to update the entity's position/logic. */ public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.materialType == Material.water) { this.particleRed = 0.2F; this.particleGreen = 0.3F; this.particleBlue = 1.0F; } else { this.particleRed = 1.0F; this.particleGreen = 16.0F / (float) (40 - this.bobTimer + 16); this.particleBlue = 4.0F / (float) (40 - this.bobTimer + 8); } this.motionY -= (double) this.particleGravity; if (this.bobTimer-- > 0) { this.motionX *= 0.02D; this.motionY *= 0.02D; this.motionZ *= 0.02D; this.setParticleTextureIndex(113); } else { this.setParticleTextureIndex(112); } this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (this.particleMaxAge-- <= 0) { this.setDead(); } if (this.onGround) { if (this.materialType == Material.water) { this.setDead(); this.worldObj.spawnParticle( EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); } else { this.setParticleTextureIndex(114); } this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } BlockPos var1 = new BlockPos(this); IBlockState var2 = this.worldObj.getBlockState(var1); Material var3 = var2.getBlock().getMaterial(); if (var3.isLiquid() || var3.isSolid()) { double var4 = 0.0D; if (var2.getBlock() instanceof BlockLiquid) { var4 = (double) BlockLiquid.getLiquidHeightPercent( ((Integer) var2.getValue(BlockLiquid.LEVEL)).intValue()); } double var6 = (double) (MathHelper.floor_double(this.posY) + 1) - var4; if (this.posY < var6) { this.setDead(); } } }