Allow for MapDecoration to use alternate rendering, for example a custom spritesheet (#4027)

This commit is contained in:
Vincent Lee 2017-10-02 17:15:17 -05:00 committed by LexManos
parent b361b72515
commit 3511e9ef2e
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/MapItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/MapItemRenderer.java
@@ -139,6 +139,8 @@
{
if (!p_148237_1_ || mapdecoration.func_191180_f())
{
+ if (mapdecoration.render(k)) { k++; continue; }
+ MapItemRenderer.this.field_148251_b.func_110577_a(MapItemRenderer.field_148253_a); // Rebind in case custom render changes it
GlStateManager.func_179094_E();
GlStateManager.func_179109_b(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F, -0.02F);
GlStateManager.func_179114_b((float)(mapdecoration.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F);

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/world/storage/MapDecoration.java
+++ ../src-work/minecraft/net/minecraft/world/storage/MapDecoration.java
@@ -92,6 +92,17 @@
return i;
}
+ /**
+ * Renders this decoration, useful for custom sprite sheets.
+ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting
+ * @return false to run vanilla logic for this decoration, true to skip it
+ */
+ @SideOnly(Side.CLIENT)
+ public boolean render(int index)
+ {
+ return false;
+ }
+
public static enum Type
{
PLAYER(false),