From cfa0aa0c9a24aa739d3254b24ef4bf0bea7087a6 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 7 Jan 2021 12:57:35 +0800 Subject: PRE4 --- .../notenoughupdates/BetterContainers.java | 458 --------------------- 1 file changed, 458 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java (limited to 'src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java deleted file mode 100644 index 02ff2164..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java +++ /dev/null @@ -1,458 +0,0 @@ -package io.github.moulberry.notenoughupdates; - -import com.google.gson.JsonObject; -import io.github.moulberry.notenoughupdates.util.TexLoc; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Random; - -public class BetterContainers { - - private static final ResourceLocation TOGGLE_OFF = new ResourceLocation("notenoughupdates:dynamic_54/toggle_off.png"); - private static final ResourceLocation TOGGLE_ON = new ResourceLocation("notenoughupdates:dynamic_54/toggle_on.png"); - - private static final ResourceLocation DYNAMIC_54_BASE = new ResourceLocation("notenoughupdates:dynamic_54/style1/dynamic_54.png"); - private static final ResourceLocation DYNAMIC_54_SLOT = new ResourceLocation("notenoughupdates:dynamic_54/style1/dynamic_54_slot_ctm.png"); - private static final ResourceLocation DYNAMIC_54_BUTTON = new ResourceLocation("notenoughupdates:dynamic_54/style1/dynamic_54_button_ctm.png"); - private static final ResourceLocation rl = new ResourceLocation("notenoughupdates:dynamic_chest_inventory.png"); - private static boolean loaded = false; - private static DynamicTexture texture = null; - private static int textColour = 4210752; - - private static int lastClickedSlot = 0; - private static int clickedSlot = 0; - private static long clickedSlotMillis = 0; - public static long lastRenderMillis = 0; - - public static HashMap itemCache = new HashMap<>(); - public static boolean lastUsingCached = false; - public static boolean usingCached = false; - - public static void clickSlot(int slot) { - clickedSlotMillis = System.currentTimeMillis(); - clickedSlot = slot; - } - - public static int getClickedSlot() { - if(System.currentTimeMillis() - clickedSlotMillis < 500) { - return clickedSlot; - } - return -1; - } - - public static void bindHook(TextureManager textureManager, ResourceLocation location) { - if(isChestOpen()) { - Container container = ((GuiChest)Minecraft.getMinecraft().currentScreen).inventorySlots; - if(container instanceof ContainerChest) { - usingCached = true; - IInventory lower = ((ContainerChest)container).getLowerChestInventory(); - int size = lower.getSizeInventory(); - for(int index=0; index 0 && buttons[xi][yi-1]; - boolean right = xi < buttons.length-1 && buttons[xi+1][yi]; - boolean down = yi < buttons[xi].length-1 && buttons[xi][yi+1]; - boolean left = xi > 0 && buttons[xi-1][yi]; - - boolean upleft = yi > 0 && xi > 0 && buttons[xi-1][yi-1]; - boolean upright = yi > 0 && xi < buttons.length-1 && buttons[xi+1][yi-1]; - boolean downright = xi < buttons.length-1 && yi < buttons[xi+1].length-1 && buttons[xi+1][yi+1]; - boolean downleft = xi > 0 && yi < buttons[xi-1].length-1 && buttons[xi-1][yi+1]; - - int ctmIndex = getCTMIndex(up, right, down, left, upleft, upright, downright, downleft); - int[] rgbs = bufferedImageButton.getRGB((ctmIndex%12)*19*horzTexMult, (ctmIndex/12)*19*vertTexMult, - 18*horzTexMult, 18*vertTexMult, null, 0, 18*vertTexMult); - bufferedImageNew.setRGB(x, y, 18*horzTexMult, 18*vertTexMult, rgbs, 0, 18*vertTexMult); - - } else { - boolean up = yi > 0 && slots[xi][yi-1]; - boolean right = xi < slots.length-1 && slots[xi+1][yi]; - boolean down = yi < slots[xi].length-1 && slots[xi][yi+1]; - boolean left = xi > 0 && slots[xi-1][yi]; - - boolean upleft = yi > 0 && xi > 0 && slots[xi-1][yi-1]; - boolean upright = yi > 0 && xi < slots.length-1 && slots[xi+1][yi-1]; - boolean downright = xi < slots.length-1 && yi < slots[xi+1].length-1 && slots[xi+1][yi+1]; - boolean downleft = xi > 0 && yi < slots[xi-1].length-1 && slots[xi-1][yi+1]; - - int ctmIndex = getCTMIndex(up, right, down, left, upleft, upright, downright, downleft); - int[] rgbs = bufferedImageSlot.getRGB((ctmIndex%12)*19*horzTexMult, (ctmIndex/12)*19*vertTexMult, - 18*horzTexMult, 18*vertTexMult, null, 0, 18*vertTexMult); - bufferedImageNew.setRGB(x, y, 18*horzTexMult, 18*vertTexMult, rgbs, 0, 18*vertTexMult); - } - } - } - texture = new DynamicTexture(bufferedImageNew); - } catch(Exception e) { - e.printStackTrace(); - } - } - } - - public static void reset() { - texture = null; - loaded = false; - clickedSlot = -1; - clickedSlotMillis = 0; - textColour = 4210752; - } - - private static boolean isChestOpen() { - return Minecraft.getMinecraft().currentScreen instanceof GuiChest && - NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && - (NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuBackgroundStyle.value >= 1 && - NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuButtonStyle.value >= 1); - } - - private static boolean hasItem() { - if(!isChestOpen()) return false; - Container container = ((GuiChest)Minecraft.getMinecraft().currentScreen).inventorySlots; - if(container instanceof ContainerChest) { - IInventory lower = ((ContainerChest)container).getLowerChestInventory(); - int size = lower.getSizeInventory(); - for(int index=0; index