@@ -82,6 +82,7 @@ public void onVoidChestPlace(PlayerInteractEvent e) {
8282 Chest chest = new Chest (main .getUtils ().getOppositeDirection (p ));
8383 state .setData (chest );
8484 state .update ();
85+ state = newBlock .getState ();
8586 try {
8687 if (ReflectionUtils .getVersion ().contains ("1_8" ) || ReflectionUtils .getVersion ().contains ("1_9" ) || ReflectionUtils .getVersion ().contains ("1_10" ) || ReflectionUtils .getVersion ().contains ("1_11" )) {
8788 Method getTileEntity = ReflectionUtils .getMethod (state .getClass (), "getTileEntity" );//newBlock.getState().getClass().getDeclaredMethod("getTileEntity");
@@ -99,12 +100,10 @@ public void onVoidChestPlace(PlayerInteractEvent e) {
99100 customName .setAccessible (true );
100101 customName .set (tileEntityObject , main .getConfigValues ().getChestTitle ());
101102 } else {
102- Method getTileEntity = ReflectionUtils .getMethod (state .getClass (), "getTileEntity" );//newBlock.getState().getClass().getDeclaredMethod("getTileEntity");
103- if (!getTileEntity .isAccessible ()) {
104- getTileEntity .setAccessible (true );
105- }
103+ Method getTileEntity = ReflectionUtils .getMethod (state .getClass ().getSuperclass ().getSuperclass ().getSuperclass (), "getTileEntity" );//newBlock.getState().getClass().getDeclaredMethod("getTileEntity");
104+ getTileEntity .setAccessible (true );
106105 Object tileEntityChest = getTileEntity .invoke (newBlock .getState ());
107- Method setDisplayName = ReflectionUtils .getMethod (tileEntityChest .getClass (), "setCustomName" , ReflectionUtils .getNMSClass ("IChatBaseComponent" )); //tileEntityChest.getClass().getMethod("setCustomName", ReflectionUtils.getNMSClass("IChatBaseComponent"));
106+ Method setDisplayName = ReflectionUtils .getMethod (tileEntityChest .getClass (). getSuperclass () , "setCustomName" , ReflectionUtils .getNMSClass ("IChatBaseComponent" )); //tileEntityChest.getClass().getMethod("setCustomName", ReflectionUtils.getNMSClass("IChatBaseComponent"));
108107 Constructor newChatComponentText = ReflectionUtils .getConstructor (ReflectionUtils .getNMSClass ("ChatComponentText" ), String .class ); //ReflectionUtils.getNMSClass("ChatComponentText").getConstructor(String.class);
109108 Object chatComponentText = newChatComponentText .newInstance (main .getConfigValues ().getChestTitle ());
110109 setDisplayName .invoke (tileEntityChest , chatComponentText );
0 commit comments