From 6d1b2216464d4dad449ac6fcfec476832224a55e Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Fri, 24 May 2024 19:50:35 +0100 Subject: Merge addon sources --- .../gtPlusPlus/core/client/CustomTextureSet.java | 30 + .../core/client/model/ModelDecayChest.java | 45 + .../core/client/model/ModelSickBlaze.java | 87 + .../core/client/model/ModelStaballoyConstruct.java | 117 + .../client/renderer/CustomItemBlockRenderer.java | 84 + .../client/renderer/CustomOreBlockRenderer.java | 2469 ++++++++++++++++++++ .../core/client/renderer/RenderDecayChest.java | 92 + .../renderer/RenderMiningExplosivesPrimed.java | 111 + .../core/client/renderer/RenderSickBlaze.java | 96 + .../client/renderer/RenderStaballoyConstruct.java | 163 ++ .../core/client/renderer/RenderToxinball.java | 89 + .../renderer/particle/EntityDropParticleFX.java | 105 + 12 files changed, 3488 insertions(+) create mode 100644 src/main/java/gtPlusPlus/core/client/CustomTextureSet.java create mode 100644 src/main/java/gtPlusPlus/core/client/model/ModelDecayChest.java create mode 100644 src/main/java/gtPlusPlus/core/client/model/ModelSickBlaze.java create mode 100644 src/main/java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/RenderDecayChest.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/RenderSickBlaze.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/RenderToxinball.java create mode 100644 src/main/java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java (limited to 'src/main/java/gtPlusPlus/core/client') diff --git a/src/main/java/gtPlusPlus/core/client/CustomTextureSet.java b/src/main/java/gtPlusPlus/core/client/CustomTextureSet.java new file mode 100644 index 0000000000..ce4d9a0320 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/CustomTextureSet.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.client; + +import gregtech.api.enums.TextureSet; + +public class CustomTextureSet extends TextureSet { + + public static enum TextureSets { + + REFINED(), + GEM_A(), + ENRICHED(), + NUCLEAR; + + private final CustomTextureSet A; + + private TextureSets() { + A = new CustomTextureSet( + this.name() + .toUpperCase()); + } + + public CustomTextureSet get() { + return A; + } + } + + public CustomTextureSet(String aSetName) { + super(aSetName); + } +} diff --git a/src/main/java/gtPlusPlus/core/client/model/ModelDecayChest.java b/src/main/java/gtPlusPlus/core/client/model/ModelDecayChest.java new file mode 100644 index 0000000000..ef0943684c --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/model/ModelDecayChest.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelDecayChest extends ModelBase { + + /** The chest lid in the chest's model. */ + public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + /** The model of the bottom of the chest. */ + public ModelRenderer chestBelow; + /** The chest's knob in the chest model. */ + public ModelRenderer chestKnob; + + public ModelDecayChest() { + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 8.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } + + /** + * This method renders out all parts of the chest model. + */ + public void renderAll() { + this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; + this.chestLid.render(0.0625F); + this.chestKnob.render(0.0625F); + this.chestBelow.render(0.0625F); + } +} diff --git a/src/main/java/gtPlusPlus/core/client/model/ModelSickBlaze.java b/src/main/java/gtPlusPlus/core/client/model/ModelSickBlaze.java new file mode 100644 index 0000000000..3b5922444d --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/model/ModelSickBlaze.java @@ -0,0 +1,87 @@ +package gtPlusPlus.core.client.model; + +import net.minecraft.client.model.ModelBlaze; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelSickBlaze extends ModelBlaze { + + /** The sticks that fly around the Blaze. */ + private ModelRenderer[] blazeSticks = new ModelRenderer[24]; + + private ModelRenderer blazeHead; + + public ModelSickBlaze() { + for (int i = 0; i < this.blazeSticks.length; ++i) { + this.blazeSticks[i] = new ModelRenderer(this, 0, 16); + this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2); + } + + this.blazeHead = new ModelRenderer(this, 0, 0); + this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + } + + @Override + public int func_78104_a() { + return 8; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + @Override + public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, + float p_78088_6_, float p_78088_7_) { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); + this.blazeHead.render(p_78088_7_); + + for (ModelRenderer blazeStick : this.blazeSticks) { + blazeStick.render(p_78088_7_); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + @Override + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, + float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { + float f6 = p_78087_3_ * (float) Math.PI * -0.1F; + int i; + + for (i = 0; i < 4; ++i) { + this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos((i * 2 + p_78087_3_) * 0.25F); + this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 9.0F; + this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 9.0F; + ++f6; + } + + f6 = ((float) Math.PI / 4F) + p_78087_3_ * (float) Math.PI * 0.03F; + + for (i = 4; i < 8; ++i) { + this.blazeSticks[i].rotationPointY = 2.0F + MathHelper.cos((i * 2 + p_78087_3_) * 0.25F); + this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 7.0F; + this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 7.0F; + ++f6; + } + + f6 = 0.47123894F + p_78087_3_ * (float) Math.PI * -0.05F; + + for (i = 8; i < 12; ++i) { + this.blazeSticks[i].rotationPointY = 11.0F + MathHelper.cos((i * 1.5F + p_78087_3_) * 0.5F); + this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 5.0F; + this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 5.0F; + ++f6; + } + + this.blazeHead.rotateAngleY = p_78087_4_ / (180F / (float) Math.PI); + this.blazeHead.rotateAngleX = p_78087_5_ / (180F / (float) Math.PI); + } +} diff --git a/src/main/java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java b/src/main/java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java new file mode 100644 index 0000000000..457bc7a377 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java @@ -0,0 +1,117 @@ +package gtPlusPlus.core.client.model; + +import net.minecraft.client.model.ModelIronGolem; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelStaballoyConstruct extends ModelIronGolem { + + public ModelStaballoyConstruct() { + this(0.0F); + } + + public ModelStaballoyConstruct(float p_i1161_1_) { + this(p_i1161_1_, -7.0F); + } + + public ModelStaballoyConstruct(float p_i1162_1_, float p_i1162_2_) { + short short1 = 128; + short short2 = 128; + this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.ironGolemHead.setRotationPoint(0.0F, 0.0F + p_i1162_2_, -2.0F); + this.ironGolemHead.setTextureOffset(0, 0) + .addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, p_i1162_1_); + this.ironGolemHead.setTextureOffset(24, 0) + .addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, p_i1162_1_); + this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.ironGolemBody.setRotationPoint(0.0F, 0.0F + p_i1162_2_, 0.0F); + this.ironGolemBody.setTextureOffset(0, 40) + .addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, p_i1162_1_); + this.ironGolemBody.setTextureOffset(0, 70) + .addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, p_i1162_1_ + 0.5F); + this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemRightArm.setTextureOffset(60, 21) + .addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_); + this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemLeftArm.setTextureOffset(60, 58) + .addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_); + this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); + this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + p_i1162_2_, 0.0F); + this.ironGolemLeftLeg.setTextureOffset(37, 0) + .addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_); + this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); + this.ironGolemRightLeg.mirror = true; + this.ironGolemRightLeg.setTextureOffset(60, 0) + .setRotationPoint(5.0F, 18.0F + p_i1162_2_, 0.0F); + this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + @Override + public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, + float p_78088_6_, float p_78088_7_) { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); + this.ironGolemHead.render(p_78088_7_); + this.ironGolemBody.render(p_78088_7_); + this.ironGolemLeftLeg.render(p_78088_7_); + this.ironGolemRightLeg.render(p_78088_7_); + this.ironGolemRightArm.render(p_78088_7_); + this.ironGolemLeftArm.render(p_78088_7_); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + @Override + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, + float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { + this.ironGolemHead.rotateAngleY = p_78087_4_ / (180F / (float) Math.PI); + this.ironGolemHead.rotateAngleX = p_78087_5_ / (180F / (float) Math.PI); + this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; + this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; + this.ironGolemLeftLeg.rotateAngleY = 0.0F; + this.ironGolemRightLeg.rotateAngleY = 0.0F; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + @Override + public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) { + EntityIronGolem entityirongolem = (EntityIronGolem) p_78086_1_; + int i = entityirongolem.getAttackTimer(); + + if (i > 0) { + this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); + this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); + } else { + int j = entityirongolem.getHoldRoseTick(); + + if (j > 0) { + this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a(j, 70.0F); + this.ironGolemLeftArm.rotateAngleX = 0.0F; + } else { + this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) + * p_78086_3_; + this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_; + } + } + } + + private float func_78172_a(float p_78172_1_, float p_78172_2_) { + return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F); + } +} diff --git a/src/main/java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java b/src/main/java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java new file mode 100644 index 0000000000..f83844f3e3 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java @@ -0,0 +1,84 @@ +package gtPlusPlus.core.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + +/** + * Easy way of rendering an item which should look like a block. Borrowed. + * + * @author King Lemming + * + */ +public class CustomItemBlockRenderer implements IItemRenderer { + + public static CustomItemBlockRenderer instance = new CustomItemBlockRenderer(); + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + + double offset = -0.5; + if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + offset = 0; + } else if (type == ItemRenderType.ENTITY) { + GL11.glScalef(0.5F, 0.5F, 0.5F); + } + renderItemAsBlock((RenderBlocks) data[0], item, offset, offset, offset); + } + + public static void renderItemAsBlock(RenderBlocks renderer, ItemStack item, double translateX, double translateY, + double translateZ) { + + renderTextureAsBlock(renderer, item.getIconIndex(), translateX, translateY, translateZ); + } + + public static void renderTextureAsBlock(RenderBlocks renderer, IIcon texture, double translateX, double translateY, + double translateZ) { + + Tessellator tessellator = Tessellator.instance; + Block block = Blocks.stone; + + if (texture == null) { + return; + } + renderer.setRenderBoundsFromBlock(block); + GL11.glTranslated(translateX, translateY, translateZ); + tessellator.startDrawingQuads(); + + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.draw(); + } +} diff --git a/src/main/java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java b/src/main/java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java new file mode 100644 index 0000000000..689f075703 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java @@ -0,0 +1,2469 @@ +package gtPlusPlus.core.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; +import gregtech.api.interfaces.ITexture; +import gtPlusPlus.api.interfaces.ITexturedBlock; +import gtPlusPlus.api.objects.Logger; + +public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler { + + public static CustomOreBlockRenderer INSTANCE; + public final int mRenderID; + + public CustomOreBlockRenderer() { + INSTANCE = this; + this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + Logger.INFO("Registered Custom Ore Block Renderer."); + } + + public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer) { + Block tTileEntity = aBlock; + if ((tTileEntity instanceof ITexturedBlock)) { + return renderStandardBlock( + aWorld, + aX, + aY, + aZ, + aBlock, + aRenderer, + new ITexture[][] { ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.DOWN), + ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.UP), + ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.NORTH), + ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.SOUTH), + ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.WEST), + ((ITexturedBlock) tTileEntity).getTexture(ForgeDirection.EAST) }); + } + return false; + } + + public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, + RenderBlocks aRenderer, ITexture[][] aTextures) { + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + int l = aBlock.colorMultiplier(aWorld, aX, aY, aZ); + float RED = (float) (l >> 16 & 255) / 255.0F; + float GREEN = (float) (l >> 8 & 255) / 255.0F; + float BLUE = (float) (l & 255) / 255.0F; + + if (Minecraft.isAmbientOcclusionEnabled() && aBlock.getLightValue() == 0) { + if (RenderBlocks.getInstance().partialRenderBounds) { + return INSTANCE.renderStandardBlockWithAmbientOcclusionPartial( + aWorld, + aRenderer, + aTextures, + aBlock, + aX, + aY, + aZ, + RED, + GREEN, + BLUE); + } else { + return INSTANCE.renderStandardBlockWithAmbientOcclusion( + aWorld, + aRenderer, + aTextures, + aBlock, + aX, + aY, + aZ, + RED, + GREEN, + BLUE); + } + } else { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); + } + return true; + } + + public static void renderFaceYNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[0], true); + } + + public static void renderFaceYPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[1], true); + } + + public static void renderFaceZNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[2], true); + } + + public static void renderFaceZPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[3], true); + } + + public static void renderFaceXNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[4], true); + } + + public static void renderFaceXPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, + ITexture[][] aIcon) { + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[5], true); + } + + public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); + } + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); + } + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); + } + aRenderer.flipTexture = (!aFullBlock); + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); + } + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); + } + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, + int aZ, ITexture[] aIcon, boolean aFullBlock) { + if (aWorld != null) { + if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5))) { + return; + } + Tessellator.instance + .setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); + } + aRenderer.flipTexture = (!aFullBlock); + if (aIcon != null) { + for (ITexture iTexture : aIcon) { + if (iTexture != null) { + iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); + } + } + } + aRenderer.flipTexture = false; + } + + @Override + public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { + aBlock.setBlockBoundsForItemRender(); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + renderNegativeYFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.DOWN), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + renderPositiveYFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.UP), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + renderNegativeZFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.NORTH), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + renderPositiveZFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.SOUTH), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + renderNegativeXFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.WEST), + true); + Tessellator.instance.draw(); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + renderPositiveXFacing( + null, + aRenderer, + aBlock, + 0, + 0, + 0, + ((ITexturedBlock) aBlock).getTexture(ForgeDirection.EAST), + true); + Tessellator.instance.draw(); + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + aRenderer.setRenderBoundsFromBlock(aBlock); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + @Override + public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, + RenderBlocks aRenderer) { + blockAccess = aWorld; + return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); + } + + @Override + public boolean shouldRender3DInInventory(int aModel) { + return true; + } + + @Override + public int getRenderId() { + return this.mRenderID; + } + + public void setRenderBounds(double p_147782_1_, double p_147782_3_, double p_147782_5_, double p_147782_7_, + double p_147782_9_, double p_147782_11_) { + if (!this.lockBlockBounds) { + this.renderMinX = p_147782_1_; + this.renderMaxX = p_147782_7_; + this.renderMinY = p_147782_3_; + this.renderMaxY = p_147782_9_; + this.renderMinZ = p_147782_5_; + this.renderMaxZ = p_147782_11_; + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 + && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D + || this.renderMinY > 0.0D + || this.renderMaxY < 1.0D + || this.renderMinZ > 0.0D + || this.renderMaxZ < 1.0D); + } + } + + /** + * Like setRenderBounds, but automatically pulling the bounds from the given Block. + */ + public void setRenderBoundsFromBlock(Block block) { + if (!this.lockBlockBounds) { + this.renderMinX = block.getBlockBoundsMinX(); + this.renderMaxX = block.getBlockBoundsMaxX(); + this.renderMinY = block.getBlockBoundsMinY(); + this.renderMaxY = block.getBlockBoundsMaxY(); + this.renderMinZ = block.getBlockBoundsMinZ(); + this.renderMaxZ = block.getBlockBoundsMaxZ(); + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 + && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D + || this.renderMinY > 0.0D + || this.renderMaxY < 1.0D + || this.renderMinZ > 0.0D + || this.renderMaxZ < 1.0D); + } + } + + /** + * Vanilla Variables + */ + + /** The minimum X value for rendering (default 0.0). */ + public double renderMinX; + /** The maximum X value for rendering (default 1.0). */ + public double renderMaxX; + /** The minimum Y value for rendering (default 0.0). */ + public double renderMinY; + /** The maximum Y value for rendering (default 1.0). */ + public double renderMaxY; + /** The minimum Z value for rendering (default 0.0). */ + public double renderMinZ; + /** The maximum Z value for rendering (default 1.0). */ + public double renderMaxZ; + + public boolean lockBlockBounds; + public boolean partialRenderBounds; + public final Minecraft minecraftRB = RenderBlocks.getInstance().minecraftRB; + public int uvRotateEast; + public int uvRotateWest; + public int uvRotateSouth; + public int uvRotateNorth; + public int uvRotateTop; + public int uvRotateBottom; + /** Whether ambient occlusion is enabled or not */ + public boolean enableAO; + /** Used as a scratch variable for ambient occlusion on the north/bottom/east corner. */ + public float aoLightValueScratchXYZNNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the north face. */ + public float aoLightValueScratchXYNN; + /** Used as a scratch variable for ambient occlusion on the north/bottom/west corner. */ + public float aoLightValueScratchXYZNNP; + /** Used as a scratch variable for ambient occlusion between the bottom face and the east face. */ + public float aoLightValueScratchYZNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the west face. */ + public float aoLightValueScratchYZNP; + /** Used as a scratch variable for ambient occlusion on the south/bottom/east corner. */ + public float aoLightValueScratchXYZPNN; + /** Used as a scratch variable for ambient occlusion between the bottom face and the south face. */ + public float aoLightValueScratchXYPN; + /** Used as a scratch variable for ambient occlusion on the south/bottom/west corner. */ + public float aoLightValueScratchXYZPNP; + /** Used as a scratch variable for ambient occlusion on the north/top/east corner. */ + public float aoLightValueScratchXYZNPN; + /** Used as a scratch variable for ambient occlusion between the top face and the north face. */ + public float aoLightValueScratchXYNP; + /** Used as a scratch variable for ambient occlusion on the north/top/west corner. */ + public float aoLightValueScratchXYZNPP; + /** Used as a scratch variable for ambient occlusion between the top face and the east face. */ + public float aoLightValueScratchYZPN; + /** Used as a scratch variable for ambient occlusion on the south/top/east corner. */ + public float aoLightValueScratchXYZPPN; + /** Used as a scratch variable for ambient occlusion between the top face and the south face. */ + public float aoLightValueScratchXYPP; + /** Used as a scratch variable for ambient occlusion between the top face and the west face. */ + public float aoLightValueScratchYZPP; + /** Used as a scratch variable for ambient occlusion on the south/top/west corner. */ + public float aoLightValueScratchXYZPPP; + /** Used as a scratch variable for ambient occlusion between the north face and the east face. */ + public float aoLightValueScratchXZNN; + /** Used as a scratch variable for ambient occlusion between the south face and the east face. */ + public float aoLightValueScratchXZPN; + /** Used as a scratch variable for ambient occlusion between the north face and the west face. */ + public float aoLightValueScratchXZNP; + /** Used as a scratch variable for ambient occlusion between the south face and the west face. */ + public float aoLightValueScratchXZPP; + /** Ambient occlusion brightness XYZNNN */ + public int aoBrightnessXYZNNN; + /** Ambient occlusion brightness XYNN */ + public int aoBrightnessXYNN; + /** Ambient occlusion brightness XYZNNP */ + public int aoBrightnessXYZNNP; + /** Ambient occlusion brightness YZNN */ + public int aoBrightnessYZNN; + /** Ambient occlusion brightness YZNP */ + public int aoBrightnessYZNP; + /** Ambient occlusion brightness XYZPNN */ + public int aoBrightnessXYZPNN; + /** Ambient occlusion brightness XYPN */ + public int aoBrightnessXYPN; + /** Ambient occlusion brightness XYZPNP */ + public int aoBrightnessXYZPNP; + /** Ambient occlusion brightness XYZNPN */ + public int aoBrightnessXYZNPN; + /** Ambient occlusion brightness XYNP */ + public int aoBrightnessXYNP; + /** Ambient occlusion brightness XYZNPP */ + public int aoBrightnessXYZNPP; + /** Ambient occlusion brightness YZPN */ + public int aoBrightnessYZPN; + /** Ambient occlusion brightness XYZPPN */ + public int aoBrightnessXYZPPN; + /** Ambient occlusion brightness XYPP */ + public int aoBrightnessXYPP; + /** Ambient occlusion brightness YZPP */ + public int aoBrightnessYZPP; + /** Ambient occlusion brightness XYZPPP */ + public int aoBrightnessXYZPPP; + /** Ambient occlusion brightness XZNN */ + public int aoBrightnessXZNN; + /** Ambient occlusion brightness XZPN */ + public int aoBrightnessXZPN; + /** Ambient occlusion brightness XZNP */ + public int aoBrightnessXZNP; + /** Ambient occlusion brightness XZPP */ + public int aoBrightnessXZPP; + /** Brightness top left */ + public int brightnessTopLeft; + /** Brightness bottom left */ + public int brightnessBottomLeft; + /** Brightness bottom right */ + public int brightnessBottomRight; + /** Brightness top right */ + public int brightnessTopRight; + /** Red color value for the top left corner */ + public float colorRedTopLeft; + /** Red color value for the bottom left corner */ + public float colorRedBottomLeft; + /** Red color value for the bottom right corner */ + public float colorRedBottomRight; + /** Red color value for the top right corner */ + public float colorRedTopRight; + /** Green color value for the top left corner */ + public float colorGreenTopLeft; + /** Green color value for the bottom left corner */ + public float colorGreenBottomLeft; + /** Green color value for the bottom right corner */ + public float colorGreenBottomRight; + /** Green color value for the top right corner */ + public float colorGreenTopRight; + /** Blue color value for the top left corner */ + public float colorBlueTopLeft; + /** Blue color value for the bottom left corner */ + public float colorBlueBottomLeft; + /** Blue color value for the bottom right corner */ + public float colorBlueBottomRight; + /** Blue color value for the top right corner */ + public float colorBlueTopRight; + /** If set to >=0, all block faces will be rendered using this texture index */ + public IIcon overrideBlockTexture; + + /** + * Clear override block texture + */ + public void clearOverrideBlockTexture() { + this.overrideBlockTexture = null; + } + + public boolean hasOverrideBlockTexture() { + return this.overrideBlockTexture != null; + } + + public IIcon getBlockIcon(Block block, IBlockAccess access, int x, int y, int z, int side) { + return this.getIconSafe(block.getIcon(access, x, y, z, side)); + } + + public IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta) { + return this.getIconSafe(block.getIcon(side, meta)); + } + + public IIcon getBlockIconFromSide(Block block, int side) { + return this.getIconSafe(block.getBlockTextureFromSide(side)); + } + + public IIcon getBlockIcon(Block block) { + return this.getIconSafe(block.getBlockTextureFromSide(1)); + } + + public IIcon getIconSafe(IIcon iicon) { + if (iicon == null) { + iicon = ((TextureMap) Minecraft.getMinecraft() + .getTextureManager() + .getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); + } + + return (IIcon) iicon; + } + + IBlockAccess blockAccess = RenderBlocks.getInstance().blockAccess; + + public boolean renderStandardBlockWithAmbientOcclusion(IBlockAccess aWorld, RenderBlocks aRenderer, + ITexture[][] aTextures, Block block, int xPos, int yPos, int zPos, float R, float G, float B) { + this.enableAO = true; + boolean flag = false; + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + boolean flag1 = true; + int l = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos); + Tessellator tessellator = Tessellator.instance; + tessellator.setBrightness(983055); + + if (this.getBlockIcon(block) + .getIconName() + .equals("grass_top")) { + flag1 = false; + } else if (this.hasOverrideBlockTexture()) { + flag1 = false; + } + + boolean flag2; + boolean flag3; + boolean flag4; + boolean flag5; + int i1; + float f7; + + if (RenderBlocks.getInstance().renderAllFaces + || block.shouldSideBeRendered(blockAccess, xPos, yPos - 1, zPos, 0)) { + if (this.renderMinY <= 0.0D) { + --yPos; + } + + this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); + this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); + this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); + this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); + this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos - 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos + 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + flag2 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos) + .getCanBlockGrass(); + flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos) + .getCanBlockGrass(); + flag4 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1) + .getCanBlockGrass(); + flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1) + .getCanBlockGrass(); + + if (!flag5 && !flag3) { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; + } else { + this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag4 && !flag3) { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; + } else { + this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag5 && !flag2) { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; + } else { + this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag4 && !flag2) { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; + } else { + this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (this.renderMinY <= 0.0D) { + ++yPos; + } + + i1 = l; + + if (this.renderMinY <= 0.0D || !blockAccess.getBlock(xPos, yPos - 1, zPos) + .isOpaqueCube()) { + i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); + } + + f7 = blockAccess.getBlock(xPos, yPos - 1, zPos) + .getAmbientOcclusionLightValue(); + f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) + / 4.0F; + f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) + / 4.0F; + f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) + / 4.0F; + f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) + / 4.0F; + this.brightnessTopLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1); + this.brightnessTopRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1); + this.brightnessBottomRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1); + this.brightnessBottomLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1); + + if (flag1) { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R + * 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G + * 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B + * 0.5F; + } else { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F; + } + + this.colorRedTopLeft *= f3; + this.colorGreenTopLeft *= f3; + this.colorBlueTopLeft *= f3; + this.colorRedBottomLeft *= f4; + this.colorGreenBottomLeft *= f4; + this.colorBlueBottomLeft *= f4; + this.colorRedBottomRight *= f5; + this.colorGreenBottomRight *= f5; + this.colorBlueBottomRight *= f5; + this.colorRedTopRight *= f6; + this.colorGreenTopRight *= f6; + this.colorBlueTopRight *= f6; + CustomOreBlockRenderer.renderFaceYNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); + flag = true; + } + + if (RenderBlocks.getInstance().renderAllFaces + || block.shouldSideBeRendered(blockAccess, xPos, yPos + 1, zPos, 1)) { + if (this.renderMaxY >= 1.0D) { + ++yPos; + } + + this.aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); + this.aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); + this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); + this.aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); + this.aoLightValueScratchXYNP = blockAccess.getBlock(xPos - 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchXYPP = blockAccess.getBlock(xPos + 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + flag2 = blockAccess.getBlock(xPos + 1, yPos + 1, zPos) + .getCanBlockGrass(); + flag3 = blockAccess.getBlock(xPos - 1, yPos + 1, zPos) + .getCanBlockGrass(); + flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos + 1) + .getCanBlockGrass(); + flag5 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1) + .getCanBlockGrass(); + + if (!flag5 && !flag3) { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPN = this.aoBrightnessXYNP; + } else { + this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); + } + + if (!flag5 && !flag2) { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPN = this.aoBrightnessXYPP; + } else { + this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); + } + + if (!flag4 && !flag3) { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXYNP; + } else { + this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); + } + + if (!flag4 && !flag2) { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXYPP; + } else { + this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); + } + + if (this.renderMaxY >= 1.0D) { + --yPos; + } + + i1 = l; + + if (this.renderMaxY >= 1.0D || !blockAccess.getBlock(xPos, yPos + 1, zPos) + .isOpaqueCube()) { + i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); + } + + f7 = blockAccess.getBlock(xPos, yPos + 1, zPos) + .getAmbientOcclusionLightValue(); + f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) + / 4.0F; + f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) + / 4.0F; + f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) + / 4.0F; + f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) + / 4.0F; + this.brightnessTopRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1); + this.brightnessTopLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1); + this.brightnessBottomLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1); + this.brightnessBottomRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B; + this.colorRedTopLeft *= f3; + this.colorGreenTopLeft *= f3; + this.colorBlueTopLeft *= f3; + this.colorRedBottomLeft *= f4; + this.colorGreenBottomLeft *= f4; + this.colorBlueBottomLeft *= f4; + this.colorRedBottomRight *= f5; + this.colorGreenBottomRight *= f5; + this.colorBlueBottomRight *= f5; + this.colorRedTopRight *= f6; + this.colorGreenTopRight *= f6; + this.colorBlueTopRight *= f6; + CustomOreBlockRenderer.renderFaceYPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); + flag = true; + } + + IIcon iicon; + + if (RenderBlocks.getInstance().renderAllFaces + || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos - 1, 2)) { + if (this.renderMinZ <= 0.0D) { + --zPos; + } + + this.aoLightValueScratchXZNN = blockAccess.getBlock(xPos - 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos - 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos + 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchXZPN = blockAccess.getBlock(xPos + 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); + this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); + this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); + this.aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); + flag2 = blockAccess.getBlock(xPos + 1, yPos, zPos - 1) + .getCanBlockGrass(); + flag3 = blockAccess.getBlock(xPos - 1, yPos, zPos - 1) + .getCanBlockGrass(); + flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1) + .getCanBlockGrass(); + flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1) + .getCanBlockGrass(); + + if (!flag3 && !flag5) { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; + } else { + this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos - 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos - 1, zPos); + } + + if (!flag3 && !flag4) { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; + } else { + this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos + 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos + 1, zPos); + } + + if (!flag2 && !flag5) { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; + } else { + this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos - 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos - 1, zPos); + } + + if (!flag2 && !flag4) { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; + } else { + this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos + 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos + 1, zPos); + } + + if (this.renderMinZ <= 0.0D) { + ++zPos; + } + + i1 = l; + + if (this.renderMinZ <= 0.0D || !blockAccess.getBlock(xPos, yPos, zPos - 1) + .isOpaqueCube()) { + i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); + } + + f7 = blockAccess.getBlock(xPos, yPos, zPos - 1) + .getAmbientOcclusionLightValue(); + f3 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) + / 4.0F; + f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) + / 4.0F; + f5 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) + / 4.0F; + f6 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) + / 4.0F; + this.brightnessTopLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); + this.brightnessBottomLeft = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1); + this.brightnessBottomRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1); + this.brightnessTopRight = RenderBlocks.getInstance() + .getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1); + + if (flag1) { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R + * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G + * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B + * 0.8F; + } else { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; + } + + this.colorRedTopLeft *= f3; + this.colorGreenTopLeft *= f3; + this.colorBlueTopLeft *= f3; + this.colorRedBottomLeft *= f4; + this.colorGreenBottomLeft *= f4; + this.colorBlueBottomLeft *= f4; + this.colorRedBottomRight *= f5; + this.colorGreenBottomRight *= f5; + this.colorBlueBottomRight *= f5; + this.colorRedTopRight *= f6; + this.colorGreenTopRight *= f6; + this.colorBlueTopRight *= f6; + iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 2); + CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); + + RenderBlocks.getInstance(); + if (RenderBlocks.fancyGrass && iicon.getIconName() + .equals("grass_side") && !this.hasOverrideBlockTexture()) { + this.colorRedTopLeft *= R; + this.colorRedBottomLeft *= R; + this.colorRedBottomRight *= R; + this.colorRedTopRight *= R; + this.colorGreenTopLeft *= G; + this.colorGreenBottomLeft *= G; + this.colorGreenBottomRight *= G; + this.colorGreenTopRight *= G; + this.colorBlueTopLeft *= B; + this.colorBlueBottomLeft *= B; + this.colorBlueBottomRight *= B; + this.colorBlueTopRight *= B; + CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); + } + + flag = true; + } + + if (RenderBlocks.getInstance().renderAllFaces + || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos + 1, 3)) { + if (this.renderMaxZ >= 1.0D) { + ++zPos; + } + + this.aoLightValueScratchXZNP = blockAccess.getBlock(xPos - 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchXZPP = blockAccess.getBlock(xPos + 1, yPos, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos - 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos + 1, zPos) + .getAmbientOcclusionLightValue(); + this.aoBrightn