Added new Item function to allow for multiple rendering passes.
Fixed a vinella bug where item layters would not line up for EntityItem's Added new IItemRendere helper flag for 3d block translations.
This commit is contained in:
parent
20e264f9ee
commit
0abb4e289a
8 changed files with 182 additions and 14 deletions
|
@ -69,6 +69,7 @@ public interface IItemRenderer
|
|||
|
||||
/**
|
||||
* Determines if an up-and-down bobbing effect should be used when
|
||||
* rendering an EntityItem, like most default items do.
|
||||
*/
|
||||
ENTITY_BOBBING,
|
||||
|
||||
|
@ -77,6 +78,12 @@ public interface IItemRenderer
|
|||
* block or as a 2D texture.
|
||||
*/
|
||||
EQUIPPED_BLOCK,
|
||||
|
||||
/**
|
||||
* Determines if the item should equate to a block that has
|
||||
* RenderBlocks.renderItemIn3d return true
|
||||
*/
|
||||
BLOCK_3D,
|
||||
|
||||
/**
|
||||
* Determines if the item should be rendered in GUI inventory slots as a 3D
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
|
||||
MovingObjectPosition var24 = par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
|
||||
return var24;
|
||||
@@ -579,4 +583,149 @@
|
||||
@@ -579,4 +583,162 @@
|
||||
{
|
||||
StatList.initStats();
|
||||
}
|
||||
|
@ -176,5 +176,18 @@
|
|||
+ }
|
||||
+ */
|
||||
+ return getIconIndex(stack);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the number of render passes/layers this item has.
|
||||
+ * Usually equates to ItemRenderer.renderItem being called for this many passes.
|
||||
+ * Does not get called unless func_46058_c() is true;
|
||||
+ *
|
||||
+ * @param metadata The item's metadata
|
||||
+ * @return The number of passes to run.
|
||||
+ */
|
||||
+ public int getRenderPasses(int metadata)
|
||||
+ {
|
||||
+ return func_46058_c() ? 2 : 1;
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -75,3 +75,25 @@
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (var14 != null)
|
||||
@@ -414,12 +435,15 @@
|
||||
if (var14.getItem().func_46058_c())
|
||||
{
|
||||
this.renderItem(var3, var14, 0);
|
||||
- var9 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), 1);
|
||||
- var10 = (float)(var9 >> 16 & 255) / 255.0F;
|
||||
- var11 = (float)(var9 >> 8 & 255) / 255.0F;
|
||||
- var12 = (float)(var9 & 255) / 255.0F;
|
||||
- GL11.glColor4f(var6 * var10, var6 * var11, var6 * var12, 1.0F);
|
||||
- this.renderItem(var3, var14, 1);
|
||||
+ for (int x = 1; x < var14.getItem().getRenderPasses(var14.getItemDamage()); x++)
|
||||
+ {
|
||||
+ var9 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), 1);
|
||||
+ var10 = (float)(var9 >> 16 & 255) / 255.0F;
|
||||
+ var11 = (float)(var9 >> 8 & 255) / 255.0F;
|
||||
+ var12 = (float)(var9 & 255) / 255.0F;
|
||||
+ GL11.glColor4f(var6 * var10, var6 * var11, var6 * var12, 1.0F);
|
||||
+ this.renderItem(var3, var14, 1);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderBiped.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderBiped.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
+import net.minecraft.src.forge.IItemRenderer;
|
||||
+import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderBiped extends RenderLiving
|
||||
@@ -32,7 +37,10 @@
|
||||
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
|
||||
float var4;
|
||||
|
||||
- if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
|
||||
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
|
||||
+
|
||||
+ if (var3.itemID < 256 && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())))
|
||||
{
|
||||
var4 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
@@ -72,7 +80,10 @@
|
||||
|
||||
if (var3.getItem().func_46058_c())
|
||||
{
|
||||
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1);
|
||||
+ for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++)
|
||||
+ {
|
||||
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1);
|
||||
+ }
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
|
@ -14,7 +14,7 @@
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@@ -55,10 +62,58 @@
|
||||
@@ -55,10 +62,59 @@
|
||||
float var18;
|
||||
float var23;
|
||||
|
||||
|
@ -31,8 +31,9 @@
|
|||
+ {
|
||||
+ GL11.glTranslatef(0.0F, -var11, 0.0F);
|
||||
+ }
|
||||
+ boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, var10, BLOCK_3D);
|
||||
+
|
||||
+ if (var10.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
|
||||
+ if (var10.itemID < 256 && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())))
|
||||
+ {
|
||||
+ this.loadTexture(ForgeHooksClient.getTexture("/terrain.png", var10.getItem()));
|
||||
+ float var21 = 0.25F;
|
||||
|
@ -75,16 +76,21 @@
|
|||
float var21 = 0.25F;
|
||||
var15 = Block.blocksList[var10.itemID].getRenderType();
|
||||
|
||||
@@ -94,7 +149,7 @@
|
||||
@@ -94,10 +150,11 @@
|
||||
if (var10.getItem().func_46058_c())
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
- this.loadTexture("/gui/items.png");
|
||||
+ this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[var10.itemID]));
|
||||
|
||||
for (var14 = 0; var14 <= 1; ++var14)
|
||||
- for (var14 = 0; var14 <= 1; ++var14)
|
||||
+ for (var14 = 0; var14 < var10.getItem().getRenderPasses(var10.getItemDamage()); ++var14)
|
||||
{
|
||||
@@ -120,11 +175,11 @@
|
||||
+ this.random.setSeed(187L); //Fixes Vanilla bug where layers would not render aligns properly.
|
||||
var15 = var10.getItem().func_46057_a(var10.getItemDamage(), var14);
|
||||
var16 = 1.0F;
|
||||
|
||||
@@ -120,11 +177,11 @@
|
||||
|
||||
if (var10.itemID < 256)
|
||||
{
|
||||
|
@ -98,7 +104,7 @@
|
|||
}
|
||||
|
||||
if (this.field_27004_a)
|
||||
@@ -186,10 +241,10 @@
|
||||
@@ -186,10 +243,10 @@
|
||||
float var11;
|
||||
float var12;
|
||||
float var13;
|
||||
|
@ -111,16 +117,19 @@
|
|||
Block var15 = Block.blocksList[par3];
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(par6 - 2), (float)(par7 + 3), -3.0F + this.zLevel);
|
||||
@@ -221,7 +276,7 @@
|
||||
@@ -221,9 +278,9 @@
|
||||
if (Item.itemsList[par3].func_46058_c())
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
|
||||
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[par3])));
|
||||
|
||||
for (var8 = 0; var8 <= 1; ++var8)
|
||||
- for (var8 = 0; var8 <= 1; ++var8)
|
||||
+ for (var8 = 0; var8 < Item.itemsList[par3].getRenderPasses(par4); ++var8)
|
||||
{
|
||||
@@ -247,11 +302,11 @@
|
||||
int var9 = Item.itemsList[par3].func_46057_a(par4, var8);
|
||||
var10 = Item.itemsList[par3].getColorFromDamage(par4, var8);
|
||||
@@ -247,11 +304,11 @@
|
||||
|
||||
if (par3 < 256)
|
||||
{
|
||||
|
@ -134,7 +143,7 @@
|
|||
}
|
||||
|
||||
var8 = Item.itemsList[par3].getColorFromDamage(par4, 0);
|
||||
@@ -279,7 +334,58 @@
|
||||
@@ -279,7 +336,58 @@
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -2,6 +2,7 @@
|
||||
@@ -1,7 +1,12 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
+import net.minecraft.src.forge.IArmorTextureProvider;
|
||||
+import net.minecraft.src.forge.IItemRenderer;
|
||||
+import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
|
||||
public class RenderPlayer extends RenderLiving
|
||||
{
|
||||
@@ -32,7 +33,14 @@
|
||||
@@ -32,7 +37,14 @@
|
||||
if (var5 instanceof ItemArmor)
|
||||
{
|
||||
ItemArmor var6 = (ItemArmor)var5;
|
||||
|
@ -24,3 +29,38 @@
|
|||
ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
|
||||
var7.bipedHead.showModel = par2 == 0;
|
||||
var7.bipedHeadwear.showModel = par2 == 0;
|
||||
@@ -164,7 +176,10 @@
|
||||
GL11.glPushMatrix();
|
||||
this.modelBipedMain.bipedHead.postRender(0.0625F);
|
||||
|
||||
- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
|
||||
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
|
||||
+
|
||||
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
{
|
||||
float var4 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
|
||||
@@ -265,8 +280,11 @@
|
||||
{
|
||||
var20 = var21.getItemUseAction();
|
||||
}
|
||||
-
|
||||
- if (var21.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType()))
|
||||
+
|
||||
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var21, EQUIPPED);
|
||||
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var21, BLOCK_3D));
|
||||
+
|
||||
+ if (var21.itemID < 256 && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())))
|
||||
{
|
||||
var6 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
@@ -319,7 +337,7 @@
|
||||
|
||||
if (var21.getItem().func_46058_c())
|
||||
{
|
||||
- for (int var25 = 0; var25 <= 1; ++var25)
|
||||
+ for (int var25 = 0; var25 < var21.getItem().getRenderPasses(var21.getItemDamage()); ++var25)
|
||||
{
|
||||
int var24 = var21.getItem().getColorFromDamage(var21.getItemDamage(), var25);
|
||||
float var26 = (float)(var24 >> 16 & 255) / 255.0F;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderSnowMan.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderSnowMan.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
+import net.minecraft.src.forge.IItemRenderer;
|
||||
+import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderSnowMan extends RenderLiving
|
||||
@@ -24,7 +29,10 @@
|
||||
GL11.glPushMatrix();
|
||||
this.snowmanModel.field_40305_c.postRender(0.0625F);
|
||||
|
||||
- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
|
||||
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
|
||||
+
|
||||
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
{
|
||||
float var4 = 0.625F;
|
||||
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
|
|
@ -28,7 +28,7 @@
|
|||
Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
|
||||
MovingObjectPosition var24 = par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
|
||||
return var24;
|
||||
@@ -509,4 +517,149 @@
|
||||
@@ -509,4 +517,164 @@
|
||||
{
|
||||
StatList.initStats();
|
||||
}
|
||||
|
@ -176,5 +176,20 @@
|
|||
+ }
|
||||
+ */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the number of render passes/layers this item has.
|
||||
+ * Usually equates to ItemRenderer.renderItem being called for this many passes.
|
||||
+ * Does not get called unless func_46058_c() is true;
|
||||
+ *
|
||||
+ * Not called on the server
|
||||
+ *
|
||||
+ * @param metadata The item's metadata
|
||||
+ * @return The number of passes to run.
|
||||
+ */
|
||||
+ public int getRenderPasses(int metadata)
|
||||
+ {
|
||||
+ return 1; //return func_46058_c() ? 2 : 1;
|
||||
+ }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue