From 1a9bf1141ccd303fa530fbbd6650336e6cb764fe Mon Sep 17 00:00:00 2001 From: jascotty2 Date: Sat, 12 Oct 2019 22:52:45 -0500 Subject: [PATCH] fix 1.13.2 anvil reflection error --- .../songoda/core/nms/v1_13_R1/AnvilView.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/AnvilView.java b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/AnvilView.java index fbf0dded..726b39be 100644 --- a/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/AnvilView.java +++ b/NMS/NMS-v1_13_R1/src/com/songoda/core/nms/v1_13_R1/AnvilView.java @@ -34,12 +34,21 @@ public class AnvilView extends ContainerAnvil implements CustomAnvil { static { try { - mc_ContainerAnvil_repairInventory = ContainerAnvil.class.getDeclaredField("h"); - mc_ContainerAnvil_repairInventory.setAccessible(true); - mc_ContainerAnvil_resultInventory = ContainerAnvil.class.getDeclaredField("g"); - mc_ContainerAnvil_resultInventory.setAccessible(true); mc_ContainerAnvil_bukkitEntity = ContainerAnvil.class.getDeclaredField("bukkitEntity"); mc_ContainerAnvil_bukkitEntity.setAccessible(true); + mc_ContainerAnvil_repairInventory = ContainerAnvil.class.getDeclaredField("repairInventory"); + mc_ContainerAnvil_repairInventory.setAccessible(true); + mc_ContainerAnvil_resultInventory = ContainerAnvil.class.getDeclaredField("resultInventory"); + mc_ContainerAnvil_resultInventory.setAccessible(true); + } catch (NoSuchFieldException ignore) { + try { + mc_ContainerAnvil_repairInventory = ContainerAnvil.class.getDeclaredField("h"); + mc_ContainerAnvil_repairInventory.setAccessible(true); + mc_ContainerAnvil_resultInventory = ContainerAnvil.class.getDeclaredField("g"); + mc_ContainerAnvil_resultInventory.setAccessible(true); + } catch (Exception ex) { + Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex); + } } catch (Exception ex) { Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex); }