Revert "Added a RenderType that allows Map-style rendering w/o inheriting from"

This reverts commit eb4688bf5e.

Conflicts:
	patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch
This commit is contained in:
Christian 2013-09-14 18:43:18 -04:00
parent 635f13f825
commit f9087cb291
2 changed files with 14 additions and 74 deletions

View file

@ -69,17 +69,7 @@ public interface IItemRenderer
* RenderEngine engine - The RenderEngine instance
* MapData mapData - The map data
*/
FIRST_PERSON_MAP,
/**
* The render type used when in first person and an item similar to a map should be rendered.
* All appropriate rotations have been applied.
*
* Data Parameters:
* EntityPlayer player - The player holding the map
* RenderEngine engine - The RenderEngine instance
*/
FIRST_PERSON_HOLDING,
FIRST_PERSON_MAP
}
public enum ItemRendererHelper
@ -112,17 +102,7 @@ public interface IItemRenderer
* Determines if the item should be rendered in GUI inventory slots as a 3D
* block or as a 2D texture.
*/
INVENTORY_BLOCK,
/**
* Determines if hands should be rendered when being held.
*/
HOLD_HANDS,
/**
* Determines if the map background should be rendered when being held.
*/
HOLD_BACKGROUND,
INVENTORY_BLOCK
}
/**

View file

@ -67,48 +67,16 @@
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -266,8 +292,10 @@
@@ -266,7 +292,7 @@
Render render;
RenderPlayer renderplayer;
- if (itemstack != null && itemstack.itemID == Item.map.itemID)
- {
+ IItemRenderer custom = null;
+ if (itemstack != null && (itemstack.getItem() instanceof ItemMap || (custom=MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_HOLDING))!=null))
+ {
+ boolean isMap = itemstack.getItem() instanceof ItemMap;
+ if (itemstack != null && itemstack.getItem() instanceof ItemMap)
{
GL11.glPushMatrix();
f12 = 0.8F;
f7 = entityclientplayermp.getSwingProgress(par1);
@@ -291,6 +319,9 @@
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f7 * -85.0F, 0.0F, 0.0F, 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+
+ if (isMap || custom.shouldUseRenderHelper(FIRST_PERSON_HOLDING, itemstack, HOLD_HANDS)) // No indent for less patching
+ {
this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
for (k = 0; k < 2; ++k)
@@ -309,6 +340,7 @@
renderplayer.renderFirstPersonArm(this.mc.thePlayer);
GL11.glPopMatrix();
}
+ }
f8 = entityclientplayermp.getSwingProgress(par1);
f6 = MathHelper.sin(f8 * f8 * (float)Math.PI);
@@ -323,6 +355,9 @@
GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
f11 = 0.015625F;
GL11.glScalef(f11, f11, f11);
+
+ if (isMap || custom.shouldUseRenderHelper(FIRST_PERSON_HOLDING, itemstack, HOLD_BACKGROUND))
+ {
this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
Tessellator tessellator = Tessellator.instance;
GL11.glNormal3f(0.0F, 0.0F, -1.0F);
@@ -333,11 +368,28 @@
@@ -333,11 +359,20 @@
tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
@ -117,32 +85,24 @@
- if (mapdata != null)
- {
- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata);
+ }
+
+ if (isMap)
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
+ MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld);
+
+ if (custom == null)
+ {
+ custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
+ MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld);
+
+ if (custom == null)
+ if (mapdata != null)
+ {
+ if (mapdata != null)
+ {
+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata);
+ }
+ }
+ else
+ {
+ custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata);
+ }
+ }
+ else
+ {
+ custom.renderItem(FIRST_PERSON_HOLDING, itemstack, mc.thePlayer, mc.renderEngine);
+ custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.getTextureManager(), mapdata);
}
GL11.glPopMatrix();
@@ -439,17 +491,20 @@
@@ -439,17 +474,20 @@
if (itemstack.getItem().requiresMultipleRenderPasses())
{