From 3511e9ef2e39dab820f94dc10714b6e4a8da2117 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 2 Oct 2017 17:15:17 -0500 Subject: [PATCH] Allow for MapDecoration to use alternate rendering, for example a custom spritesheet (#4027) --- .../client/gui/MapItemRenderer.java.patch | 11 ++++++++++ .../world/storage/MapDecoration.java.patch | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch diff --git a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch new file mode 100644 index 0000000000..64f2b43c64 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch new file mode 100644 index 0000000000..58b9bbe6f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/MapDecoration.java.patch @@ -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),