|  | @@ -11,13 +11,20 @@ import net.minecraft.block.FireBlock;
 | 
	
		
			
				|  |  |  import net.minecraft.command.Commands;
 | 
	
		
			
				|  |  |  import net.minecraft.entity.ai.goal.GoalSelector;
 | 
	
		
			
				|  |  |  import net.minecraft.entity.ai.goal.PrioritizedGoal;
 | 
	
		
			
				|  |  | +import net.minecraft.entity.player.PlayerEntity;
 | 
	
		
			
				|  |  |  import net.minecraft.entity.player.ServerPlayerEntity;
 | 
	
		
			
				|  |  | +import net.minecraft.inventory.IInventory;
 | 
	
		
			
				|  |  | +import net.minecraft.inventory.container.Container;
 | 
	
		
			
				|  |  | +import net.minecraft.inventory.container.Slot;
 | 
	
		
			
				|  |  | +import net.minecraft.item.ItemStack;
 | 
	
		
			
				|  |  |  import net.minecraft.resources.DataPackRegistries;
 | 
	
		
			
				|  |  |  import net.minecraft.server.MinecraftServer;
 | 
	
		
			
				|  |  |  import net.minecraft.server.management.PlayerInteractionManager;
 | 
	
		
			
				|  |  |  import net.minecraft.server.management.PlayerList;
 | 
	
		
			
				|  |  |  import net.minecraft.tileentity.SignTileEntity;
 | 
	
		
			
				|  |  |  import net.minecraft.util.FoodStats;
 | 
	
		
			
				|  |  | +import net.minecraft.util.IIntArray;
 | 
	
		
			
				|  |  | +import net.minecraft.util.IntReferenceHolder;
 | 
	
		
			
				|  |  |  import net.minecraft.util.text.ITextComponent;
 | 
	
		
			
				|  |  |  import net.minecraft.world.Explosion;
 | 
	
		
			
				|  |  |  import net.minecraft.world.GameRules;
 | 
	
	
		
			
				|  | @@ -35,7 +42,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      public static Method getMethod(Class<?> c, String name, Class<?>... pars) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              return ObfuscationReflectionHelper.findMethod(c, name, pars);
 | 
	
		
			
				|  |  | -        } catch (Exception ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(name + " - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return null;
 | 
	
	
		
			
				|  | @@ -46,7 +53,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |              Field f = c.getDeclaredField(remapName(INameMappingService.Domain.FIELD, field));
 | 
	
		
			
				|  |  |              f.setAccessible(true);
 | 
	
		
			
				|  |  |              return f;
 | 
	
		
			
				|  |  | -        } catch (Exception ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(field + " - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return null;
 | 
	
	
		
			
				|  | @@ -55,8 +62,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      private static <T> void setInt(T t, Field f, int i) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              f.setInt(t, i);
 | 
	
		
			
				|  |  | -        } catch (SecurityException | IllegalArgumentException | IllegalAccessException
 | 
	
		
			
				|  |  | -                | NullPointerException ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(f + " - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -64,8 +70,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      private static <T> void setFloat(T t, Field f, float fl) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              f.setFloat(t, fl);
 | 
	
		
			
				|  |  | -        } catch (SecurityException | IllegalArgumentException | IllegalAccessException
 | 
	
		
			
				|  |  | -                | NullPointerException ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(f + " - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -73,8 +78,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      private static <T> float getFloat(T t, Field f, float error) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              return f.getFloat(t);
 | 
	
		
			
				|  |  | -        } catch (SecurityException | IllegalArgumentException | IllegalAccessException
 | 
	
		
			
				|  |  | -                | NullPointerException ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(f + " - " + ex);
 | 
	
		
			
				|  |  |              return error;
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -83,7 +87,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      public static <T> T getFieldValue(Class<T> cast, Object o, Field f) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              return cast.cast(f.get(o));
 | 
	
		
			
				|  |  | -        } catch (SecurityException | IllegalAccessException | IllegalArgumentException ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(f + " - " + ex);
 | 
	
		
			
				|  |  |              return null;
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -92,7 +96,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      public static void setFieldValue(Object instance, Field f, Object value) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              f.set(instance, value);
 | 
	
		
			
				|  |  | -        } catch (SecurityException | IllegalAccessException | IllegalArgumentException ex) {
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn(f + " - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -128,7 +132,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |              ServerPlayerEntity source, ServerWorld sw) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              SET_GAMETYPE.invoke(pl, target, source, sw);
 | 
	
		
			
				|  |  | -        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
 | 
	
		
			
				|  |  | +        } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn("setPlayerGameTypeBasedOnOther - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -183,7 +187,7 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |          FireBlock fireblock = (FireBlock) Blocks.FIRE;
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              SET_FIRE_INFO.invoke(fireblock, b, encouragement, flammability);
 | 
	
		
			
				|  |  | -        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
 | 
	
		
			
				|  |  | +        } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
 | 
	
		
			
				|  |  |              LogManager.getLogger().warn("setFireInfo - " + ex);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -215,4 +219,68 @@ public class ReflectionUtils {
 | 
	
		
			
				|  |  |      public static IServerConfiguration getDerivedWorldInfoConfiguration(DerivedWorldInfo info) {
 | 
	
		
			
				|  |  |          return getFieldValue(IServerConfiguration.class, info, DERIVED_WORLD_INFO_CONFIGURATION);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private final static Method ADD_SLOT = getMethod(Container.class, "func_75146_a", Slot.class); // addSlot
 | 
	
		
			
				|  |  | +    private final static Method TRACK_INT =
 | 
	
		
			
				|  |  | +            getMethod(Container.class, "func_216958_a", IntReferenceHolder.class); // trackInt
 | 
	
		
			
				|  |  | +    private final static Method TRACK_INT_ARRAY =
 | 
	
		
			
				|  |  | +            getMethod(Container.class, "func_216961_a", IIntArray.class); // trackIntArray
 | 
	
		
			
				|  |  | +    private final static Method CLEAR_CONTAINER = getMethod(Container.class, "func_193327_a",
 | 
	
		
			
				|  |  | +            PlayerEntity.class, World.class, IInventory.class); // clearContainer
 | 
	
		
			
				|  |  | +    private final static Method MERGE_ITEM_STACK = getMethod(Container.class, "func_75135_a",
 | 
	
		
			
				|  |  | +            ItemStack.class, int.class, int.class, boolean.class); // mergeItemStack
 | 
	
		
			
				|  |  | +    private final static Method RESET_DRAG = getMethod(Container.class, "func_94533_d"); // resetDrag
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static Slot addSlot(Container c, Slot slot) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            return (Slot) ADD_SLOT.invoke(c, slot);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("addSlot - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static IntReferenceHolder trackInt(Container c, IntReferenceHolder i) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            return (IntReferenceHolder) TRACK_INT.invoke(c, i);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("trackInt - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static void trackIntArray(Container c, IIntArray array) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            TRACK_INT_ARRAY.invoke(c, array);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("trackIntArray - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static void clearContainer(Container c, PlayerEntity p, World w, IInventory i) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            CLEAR_CONTAINER.invoke(c, p, w, i);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("clearContainer - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static boolean mergeItemStack(Container c, ItemStack stack, int startIndex, int endIndex,
 | 
	
		
			
				|  |  | +            boolean reverseDirection) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            return (boolean) MERGE_ITEM_STACK.invoke(c, stack, startIndex, endIndex,
 | 
	
		
			
				|  |  | +                    reverseDirection);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("mergeItemStack - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static void resetDrag(Container c) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            RESET_DRAG.invoke(c);
 | 
	
		
			
				|  |  | +        } catch(Exception ex) {
 | 
	
		
			
				|  |  | +            LogManager.getLogger().warn("resetDrag - " + ex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |