aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/client
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
committerRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
commit6d1b2216464d4dad449ac6fcfec476832224a55e (patch)
tree526a0c15f7056313c80e6c0386e025e9b3f61781 /src/main/java/gtPlusPlus/core/client
parentb5d35f40afa606ed1b07061dad82e0521a59c186 (diff)
downloadGT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.gz
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.bz2
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.zip
Merge addon sources
Diffstat (limited to 'src/main/java/gtPlusPlus/core/client')
-rw-r--r--src/main/java/gtPlusPlus/core/client/CustomTextureSet.java30
-rw-r--r--src/main/java/gtPlusPlus/core/client/model/ModelDecayChest.java45
-rw-r--r--src/main/java/gtPlusPlus/core/client/model/ModelSickBlaze.java87
-rw-r--r--src/main/java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java117
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java84
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java2469
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/RenderDecayChest.java92
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java111
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/RenderSickBlaze.java96
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java163
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/RenderToxinball.java89
-rw-r--r--src/main/java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java105
12 files changed, 3488 insertions, 0 deletions
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. */