diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTContainerWrapper.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTContainerWrapper.java deleted file mode 100644 index 21a93439..00000000 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTContainerWrapper.java +++ /dev/null @@ -1,174 +0,0 @@ -package mod.acgaming.universaltweaks.tweaks.misc.pickupnotification; - -import java.lang.reflect.Field; -import java.util.List; -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.relauncher.FMLLaunchHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -// Courtesy of gigaherz -public class UTContainerWrapper extends ContainerPlayer -{ - private static final Field f_listeners = ObfuscationReflectionHelper.findField(Container.class, FMLLaunchHandler.isDeobfuscatedEnvironment() ? "listeners" : "field_75149_d"); - private final ContainerPlayer original; - private final Runnable callback; - - @SuppressWarnings("unchecked") - public UTContainerWrapper(ContainerPlayer original, EntityPlayer player, Runnable callback) - { - super(player.inventory, original.isLocalWorld, player); - this.original = original; - this.callback = callback; - this.craftMatrix = original.craftMatrix; - this.craftResult = original.craftResult; - this.isLocalWorld = original.isLocalWorld; - this.inventoryItemStacks = original.inventoryItemStacks; - this.inventorySlots = original.inventorySlots; - this.windowId = original.windowId; - try - { - this.listeners = (List) f_listeners.get(original); - } - catch (IllegalAccessException ignored) {} - } - - @Override - public void onCraftMatrixChanged(IInventory inventoryIn) - { - if (original != null) original.onCraftMatrixChanged(inventoryIn); - } - - @Override - public void onContainerClosed(EntityPlayer playerIn) - { - original.onContainerClosed(playerIn); - } - - @Override - public boolean canInteractWith(EntityPlayer playerIn) - { - return original.canInteractWith(playerIn); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) - { - return original.transferStackInSlot(playerIn, index); - } - - @Override - public boolean canMergeSlot(ItemStack stack, Slot slotIn) - { - return original.canMergeSlot(stack, slotIn); - } - - @Override - protected Slot addSlotToContainer(Slot slotIn) - { - // Ignore -- the original container keeps the list of slots - return slotIn; - } - - @Override - public void addListener(IContainerListener listener) - { - original.addListener(listener); - } - - @Override - public NonNullList getInventory() - { - return original.getInventory(); - } - - @Override - @SideOnly(Side.CLIENT) - public void removeListener(IContainerListener listener) - { - original.removeListener(listener); - } - - @Override - public void detectAndSendChanges() - { - original.detectAndSendChanges(); - } - - @Override - public boolean enchantItem(EntityPlayer playerIn, int id) - { - return original.enchantItem(playerIn, id); - } - - @Override - @Nullable - public Slot getSlotFromInventory(IInventory inv, int slotIn) - { - return original.getSlotFromInventory(inv, slotIn); - } - - @Override - public Slot getSlot(int slotId) - { - return original.getSlot(slotId); - } - - @Override - public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) - { - return original.slotClick(slotId, dragType, clickTypeIn, player); - } - - @Override - public void putStackInSlot(int slotID, ItemStack stack) - { - original.putStackInSlot(slotID, stack); - } - - @Override - public void setAll(List p_190896_1_) - { - original.setAll(p_190896_1_); - callback.run(); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int id, int data) - { - original.updateProgressBar(id, data); - } - - @Override - @SideOnly(Side.CLIENT) - public short getNextTransactionID(InventoryPlayer invPlayer) - { - return original.getNextTransactionID(invPlayer); - } - - @Override - public boolean getCanCraft(EntityPlayer player) - { - return original.getCanCraft(player); - } - - @Override - public void setCanCraft(EntityPlayer player, boolean canCraft) - { - original.setCanCraft(player, canCraft); - } - - @Override - public boolean canDragIntoSlot(Slot slotIn) - { - return original.canDragIntoSlot(slotIn); - } -} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTPickupNotificationOverlay.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTPickupNotificationOverlay.java index c7482fea..175f0e17 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTPickupNotificationOverlay.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/pickupnotification/UTPickupNotificationOverlay.java @@ -16,7 +16,6 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; -import net.minecraft.inventory.ContainerPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -251,13 +250,10 @@ public void utPUNClientTick(TickEvent.ClientTickEvent event) { if (player.inventoryContainer != null) { - player.inventoryContainer = new UTContainerWrapper((ContainerPlayer) player.inventoryContainer, player, () -> { - previous = null; - dimLoadTicks = 0; - }); playerEntity = player; } previous = null; + dimLoadTicks = 0; } if (player.dimension != dim)