diff options
Diffstat (limited to 'src/main/java/io')
23 files changed, 550 insertions, 105 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 7fa81a59..c3cb4a73 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -270,7 +270,6 @@ public class NEUEventListener { FairySouls.tick(); XPInformation.getInstance().tick(); ProfileApiSyncer.getInstance().tick(); - DamageCommas.tick(); ItemCustomizeManager.tick(); BackgroundBlur.markDirty(); NPCRetexturing.getInstance().tick(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 4f2e8a93..cfab28e0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1052,7 +1052,7 @@ public class NotEnoughUpdates { } }); - SimpleCommand customizeCommand = new SimpleCommand("neucustomize", new SimpleCommand.ProcessCommandRunnable() { + SimpleCommand.ProcessCommandRunnable customizeRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); @@ -1070,7 +1070,10 @@ public class NotEnoughUpdates { openGui = new GuiItemCustomize(held, heldUUID); } - }); + }; + + SimpleCommand customizeCommand = new SimpleCommand("neucustomize", customizeRunnable); + SimpleCommand customizeCommand2 = new SimpleCommand("neurename", customizeRunnable); SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { @@ -1195,6 +1198,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(dhCommand); ClientCommandHandler.instance.registerCommand(dnCommand); ClientCommandHandler.instance.registerCommand(customizeCommand); + ClientCommandHandler.instance.registerCommand(customizeCommand2); ClientCommandHandler.instance.registerCommand(devTestCommand); ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 560cdf51..1ebf9937 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -14,6 +14,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.shader.Framebuffer; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderWorldEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -49,17 +50,84 @@ public class CapeManager { public JsonObject lastJsonSync = null; - private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", + public static class CapeData { + public String capeName; + public boolean special; + public boolean hidden; + + public boolean canShow() { + return !special && !hidden; + } + + public CapeData(String capeName, boolean special, boolean hidden) { + this.capeName = capeName; + this.special = special; + this.hidden = hidden; + } + } + + public CapeData[] capes = new CapeData[]{ + //Content Creator + new CapeData("jakethybro", false, true), + new CapeData("krusty", false, true), + new CapeData("krusty_day", false, true), + new CapeData("krusty_sunset", false, true), + new CapeData("krusty_night", false, true), + new CapeData("zera", false, true), + new CapeData("soldier", false, true), + new CapeData("alexxoffi", false, false), + + //Patreon + new CapeData("patreon1", false, false), + new CapeData("patreon2", false, false), + new CapeData("fade", false, false), + new CapeData("space", false, false), + new CapeData("mcworld", false, false), + new CapeData("negative", false, false), + new CapeData("void", false, false), + new CapeData("lava", false, false), + new CapeData("tunnel", false, false), + new CapeData("planets", false, false), + + //Admins + new CapeData("nullzee", true, false), + new CapeData("ironmoon", true, false), + new CapeData("gravy", true, false), + + //Partner + new CapeData("thebakery", true, false), + new CapeData("furf", true, false), + new CapeData("dsm", true, false), + new CapeData("skyclient", true, false), + new CapeData("subreddit_dark", true, false), + new CapeData("subreddit_light", true, false), + new CapeData("packshq", true, false), + new CapeData("skytils", true, false), + + //Special Other + new CapeData("contrib", true, false), + new CapeData("mbstaff", true, false) + }; + + /*private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void", "ironmoon", "krusty", "furf", "soldier", "dsm", "zera", "tunnel", "alexxoffi", "parallax", "jakethybro", "planets", "skytils" }; - public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, + public Boolean[] specialCapes = new Boolean[] {true, true, false, true, true, true, false, false, false, true, true, true, false, - false, true, false, true, true, true, true, false, true, true, true, true, true }; + false, true, false, true, true, true, true, false, true, true, true, true, true };*/ public static CapeManager getInstance() { return INSTANCE; } + public void tryUnlockCape(String unlock) { + for(CapeData data : capes) { + if(data.capeName.equalsIgnoreCase(unlock)) { + data.hidden = false; + } + } + } + public void tick() { long currentTime = System.currentTimeMillis(); if(currentTime - lastCapeUpdate > 60*1000) { @@ -227,7 +295,7 @@ public class CapeManager { } if(uuid.equals(clientUuid) && localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null")) { localCape.getLeft().onRenderPlayer(e); - } else if(capeMap.containsKey(uuid)) { + } else if(!Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.blindness) && capeMap.containsKey(uuid)) { capeMap.get(uuid).getLeft().onRenderPlayer(e); } } catch(Exception ignored) {} @@ -301,7 +369,7 @@ public class CapeManager { } } - public String[] getCapes() { + public CapeData[] getCapes() { return capes; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java index 164dfeb8..31eaccb1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.cosmetics; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.GuiElementTextField; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -12,10 +13,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Matrix4f; import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import java.awt.*; +import java.io.IOException; import java.math.BigInteger; import java.util.List; import java.util.*; @@ -27,6 +30,8 @@ public class GuiCosmetics extends GuiScreen { public static final ResourceLocation cosmetics_fg = new ResourceLocation("notenoughupdates:cosmetics_fg.png"); public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png"); + private GuiElementTextField unlockTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT); + private CosmeticsPage currentPage = CosmeticsPage.CAPES; private int sizeX; private int sizeY; @@ -134,6 +139,15 @@ public class GuiCosmetics extends GuiScreen { Utils.drawStringCenteredScaledMaxWidth(equipMsg, Minecraft.getMinecraft().fontRendererObj, guiLeft+sizeX/2f, guiTop+sizeY+5+10, false, 90, 0); } + + if(unlockTextField.getFocus() || !unlockTextField.getText().isEmpty()) { + unlockTextField.setPrependText(""); + } else { + unlockTextField.setPrependText("\u00a77Creator Code"); + } + + unlockTextField.setSize(80, 20); + unlockTextField.render(guiLeft+sizeX-80, guiTop+sizeY+2); } private void renderTabs(boolean renderPressed) { @@ -193,7 +207,29 @@ public class GuiCosmetics extends GuiScreen { } @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + if(unlockTextField.getFocus()) { + if(keyCode == Keyboard.KEY_ESCAPE || keyCode == Keyboard.KEY_RETURN) { + CapeManager.INSTANCE.tryUnlockCape(unlockTextField.getText().trim()); + unlockTextField.setText(""); + unlockTextField.setFocus(false); + } else { + unlockTextField.keyTyped(typedChar, keyCode); + } + } else { + super.keyTyped(typedChar, keyCode); + } + } + + @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { + //guiLeft+sizeX-140, guiTop+sizeY+2 + + if(mouseX > guiLeft+sizeX-140 & mouseX < guiLeft+sizeX && + mouseY > guiTop+sizeY && mouseY < guiTop+sizeY+22) { + unlockTextField.mouseClicked(mouseX, mouseY, mouseButton); + } + for (int i = 0; i < CosmeticsPage.values().length; i++) { CosmeticsPage page = CosmeticsPage.values()[i]; int x = guiLeft + i * 28; @@ -216,9 +252,9 @@ public class GuiCosmetics extends GuiScreen { int index = 0; int displayingCapes = 0; - for(String cape : CapeManager.INSTANCE.getCapes()) { - boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape); - if (!CapeManager.INSTANCE.specialCapes[index++] || equipable) { + for(CapeManager.CapeData cape : CapeManager.INSTANCE.getCapes()) { + boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape.capeName); + if (cape.canShow() || equipable) { displayingCapes++; } } @@ -229,9 +265,9 @@ public class GuiCosmetics extends GuiScreen { index = 0; int displayIndex = 0; - for(String cape : CapeManager.INSTANCE.getCapes()) { - boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape); - if(CapeManager.INSTANCE.specialCapes[index++] && !equipable) continue; + for(CapeManager.CapeData cape : CapeManager.INSTANCE.getCapes()) { + boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape.capeName); + if(!cape.canShow() && !equipable) continue; GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft + 20 + 91 * displayIndex - xOffset, guiTop + 123, 81, 20, @@ -239,20 +275,20 @@ public class GuiCosmetics extends GuiScreen { if(mouseX > guiLeft + 20 + 91 * displayIndex - xOffset && mouseX < guiLeft + 20 + 91 * displayIndex - xOffset+81) { if(mouseY > guiTop + 123 && mouseY < guiTop + 123 + 20) { - if(CapeManager.INSTANCE.localCape != null && CapeManager.INSTANCE.localCape.getRight().equals(cape)) { + if(CapeManager.INSTANCE.localCape != null && CapeManager.INSTANCE.localCape.getRight().equals(cape.capeName)) { CapeManager.INSTANCE.setCape(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""), "null", true); } else { CapeManager.INSTANCE.setCape(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""), - cape, true); + cape.capeName, true); } return; } else if(equipable && mouseY > guiTop + 149 && mouseY < guiTop + 149 + 20) { - if(cape.equals(wantToEquipCape)) { + if(cape.capeName.equals(wantToEquipCape)) { wantToEquipCape = null; } else { - wantToEquipCape = cape; + wantToEquipCape = cape.capeName; } return; } @@ -342,9 +378,9 @@ public class GuiCosmetics extends GuiScreen { int index = 0; int displayingCapes = 0; - for(String cape : CapeManager.INSTANCE.getCapes()) { - boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape); - if (!CapeManager.INSTANCE.specialCapes[index++] || equipable) { + for(CapeManager.CapeData capeData : CapeManager.INSTANCE.getCapes()) { + boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(capeData.capeName); + if (capeData.canShow() || equipable) { displayingCapes++; } } @@ -355,21 +391,21 @@ public class GuiCosmetics extends GuiScreen { index = 0; int displayIndex = 0; - for(String cape : CapeManager.INSTANCE.getCapes()) { - boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(cape); - if(CapeManager.INSTANCE.specialCapes[index++] && !equipable) continue; + for(CapeManager.CapeData capeData : CapeManager.INSTANCE.getCapes()) { + boolean equipable = CapeManager.INSTANCE.getAvailableCapes() == null || CapeManager.INSTANCE.getAvailableCapes().contains(capeData.capeName); + if(!capeData.canShow() && !equipable) continue; - if(cape.equals(CapeManager.INSTANCE.getCape(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "")))) { + if(capeData.capeName.equals(CapeManager.INSTANCE.getCape(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "")))) { GlStateManager.color(250 / 255f, 200 / 255f, 0 / 255f, 1); Utils.drawGradientRect(guiLeft + 20 + 91 * displayIndex - (int) xOffset, guiTop + 10, guiLeft + 20 + 91 * displayIndex - (int) xOffset + 81, guiTop + 10 + 108, new Color(150, 100, 0, 40).getRGB(), new Color(250, 200, 0, 40).getRGB()); - } else if(cape.equals(wantToEquipCape)) { + } else if(capeData.capeName.equals(wantToEquipCape)) { GlStateManager.color(0, 200 / 255f, 250 / 255f, 1); Utils.drawGradientRect(guiLeft + 20 + 91 * displayIndex - (int) xOffset, guiTop + 10, guiLeft + 20 + 91 * displayIndex - (int) xOffset + 81, guiTop + 10 + 108, new Color(0, 100, 150, 40).getRGB(), new Color(0, 200, 250, 40).getRGB()); - } else if(CapeManager.INSTANCE.localCape != null && CapeManager.INSTANCE.localCape.getRight().equals(cape)) { + } else if(CapeManager.INSTANCE.localCape != null && CapeManager.INSTANCE.localCape.getRight().equals(capeData.capeName)) { GlStateManager.color(100/255f, 250/255f, 150/255f, 1); Utils.drawGradientRect(guiLeft+20+91*displayIndex-(int)xOffset, guiTop+10, guiLeft+20+91*displayIndex-(int)xOffset+81, guiTop+10+108, @@ -383,7 +419,7 @@ public class GuiCosmetics extends GuiScreen { Utils.drawTexturedRect(guiLeft+20+91*displayIndex-xOffset, guiTop+123, 81, 20, 0, 81/256f, 216/256f, 236/256f, GL11.GL_NEAREST); - boolean equipPressed = cape.equals(wantToEquipCape); + boolean equipPressed = capeData.capeName.equals(wantToEquipCape); if(!equipable) GlStateManager.color(1, 1, 1, 0.5f); Utils.drawTexturedRect(guiLeft+20+91*displayIndex-xOffset, guiTop+149, 81, 20, equipPressed?81/256f:0, equipPressed?0:81/256f, equipPressed?236/256f:216/256f, equipPressed?216/256f:236/256f, GL11.GL_NEAREST); @@ -399,8 +435,8 @@ public class GuiCosmetics extends GuiScreen { } GlStateManager.color(1, 1, 1, 1); - ResourceLocation capeTexture = capesLocation.computeIfAbsent(cape, - k -> new ResourceLocation("notenoughupdates", "capes/"+cape+"_preview.png")); + ResourceLocation capeTexture = capesLocation.computeIfAbsent(capeData.capeName, + k -> new ResourceLocation("notenoughupdates", "capes/"+capeData.capeName+"_preview.png")); Minecraft.getMinecraft().getTextureManager().bindTexture(capeTexture); Utils.drawTexturedRect(guiLeft+31+91*displayIndex-xOffset, guiTop+24, 59, 84, GL11.GL_NEAREST); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index 163b14dd..c1d36e8f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -87,7 +87,7 @@ public class NEUCape { shaderName = "fade_cape"; } else if(capeName.equalsIgnoreCase("space")) { shaderName = "space_cape"; - } else if(capeName.equalsIgnoreCase("mcworld")) { + } else if(capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { shaderName = "mcworld_cape"; } else if(capeName.equalsIgnoreCase("lava")) { shaderName = "lava_cape"; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java index 48601df3..0aa5e84d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java @@ -51,9 +51,10 @@ public class BetterContainers { private static long clickedSlotMillis = 0; public static long lastRenderMillis = 0; + private static int lastInvHashcode = 0; + private static int lastHashcodeCheck = 0; + public static HashMap<Integer, ItemStack> itemCache = new HashMap<>(); - public static boolean lastUsingCached = false; - public static boolean usingCached = false; public static void clickSlot(int slot) { clickedSlotMillis = System.currentTimeMillis(); @@ -68,22 +69,30 @@ public class BetterContainers { } public static void bindHook(TextureManager textureManager, ResourceLocation location) { + long currentMillis = System.currentTimeMillis(); + if(isChestOpen() && NEUEventListener.inventoryLoaded) { - if((texture != null && lastClickedSlot != getClickedSlot()) || - lastUsingCached != getUsingCache() || !loaded) { - lastUsingCached = getUsingCache(); + int invHashcode = lastInvHashcode; + + if(currentMillis - lastHashcodeCheck > 50) { + Container container = ((GuiChest)Minecraft.getMinecraft().currentScreen).inventorySlots; + invHashcode = container.getInventory().hashCode(); + } + + if((texture != null && lastClickedSlot != getClickedSlot()) || !loaded || lastInvHashcode != invHashcode) { + lastInvHashcode = invHashcode; lastClickedSlot = getClickedSlot(); generateTex(location); } if(texture != null && loaded) { - lastRenderMillis = System.currentTimeMillis(); + lastRenderMillis = currentMillis; GlStateManager.color(1, 1, 1, 1); textureManager.loadTexture(rl, texture); textureManager.bindTexture(rl); return; } - } else if(System.currentTimeMillis() - lastRenderMillis < 200 && texture != null) { + } else if(currentMillis - lastRenderMillis < 200 && texture != null) { GlStateManager.color(1, 1, 1, 1); textureManager.loadTexture(rl, texture); textureManager.bindTexture(rl); @@ -94,7 +103,7 @@ public class BetterContainers { } public static boolean getUsingCache() { - return usingCached && System.currentTimeMillis() - lastRenderMillis < 300; + return false; } public static boolean isBlacklistedInventory() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java index e953ba60..f3a33aa9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java @@ -126,8 +126,6 @@ public class CrystalOverlay { public static HashMap<CrystalType, BlockPos> crystals = new HashMap<>(); - private static ExecutorService es = Executors.newSingleThreadExecutor(); - public static void tick() { if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableCrystalOverlay) return; if(Minecraft.getMinecraft().theWorld == null) return; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index ba96777f..83ad8a0d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureUtil; @@ -30,6 +31,7 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.*; +import net.minecraft.world.World; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -65,6 +67,10 @@ public class CustomItemEffects { public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; + public int tpTime = NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis; + + private int tick; + public long lastMillis = 0; public Vector3f getCurrentPosition() { @@ -84,8 +90,8 @@ public class CustomItemEffects { if(delta <= 0) return; - if(aoteTeleportationMillis > NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis*2) { - aoteTeleportationMillis = NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis*2; + if(aoteTeleportationMillis > tpTime*2) { + aoteTeleportationMillis = tpTime*2; } if(aoteTeleportationMillis < 0) aoteTeleportationMillis = 0; @@ -148,12 +154,21 @@ public class CustomItemEffects { } } - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis <= 0 - || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return; + if(usingEtherwarp) { + lastEtherwarpUse = tick; + } - boolean aote = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothAOTE && (internal.equals("ASPECT_OF_THE_END") || internal.equals("ASPECT_OF_THE_VOID")); + if(tpTime <= 0 || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return; + + boolean aote = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothAOTE && + (internal.equals("ASPECT_OF_THE_END") || internal.equals("ASPECT_OF_THE_VOID")); boolean hyp = NotEnoughUpdates.INSTANCE.config.itemOverlays.enableSmoothHyperion && shadowWarp; - if(aote || hyp) { + if(usingEtherwarp) { + tpTime = NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillisEtherwarp; + } else { + tpTime = NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis; + } + if(usingEtherwarp || aote || hyp) { aoteUseMillis = System.currentTimeMillis(); if(aoteTeleportationCurr == null) { aoteTeleportationCurr = new Vector3f(); @@ -170,6 +185,18 @@ public class CustomItemEffects { public void onGameTick(TickEvent.ClientTickEvent event) { if(event.phase != TickEvent.Phase.END) return; + if(!usingEtherwarp && wasUsingEtherwarp) { + if(Minecraft.getMinecraft().thePlayer.rotationYaw > 0) { + Minecraft.getMinecraft().thePlayer.rotationYaw -= 0.000001; + } else { + Minecraft.getMinecraft().thePlayer.rotationYaw += 0.000001; + } + } + wasUsingEtherwarp = usingEtherwarp; + + tick++; + if(tick > Integer.MAX_VALUE/2) tick = 0; + heldBonemerang = false; bonemerangBreak = false; bonemeragedEntities.clear(); @@ -216,18 +243,92 @@ public class CustomItemEffects { } } } - position.translate(step.x, step.y, step.z); } } + } + + private float lastPartialTicks = 0; + private float currentFOVMult = 1; + private float targetFOVMult = 1; + + private float lastPartialDelta = 0; + + private float currentSensMult = 1; + private float targetSensMult = 1; + + public float getSensMultiplier() { + if(targetSensMult < 0) { + currentSensMult = 1; + } else { + float deltaSens = targetSensMult - currentSensMult; + + currentSensMult += deltaSens*lastPartialDelta*0.1;// (0.05 * ); + if(currentSensMult < 0.25f) currentSensMult = 0.25f; + if(currentSensMult > 1) currentSensMult = 1; + } + return currentSensMult; + } + + public float getFovMultiplier(float partialTicks) { + float partialDelta = partialTicks+tick - lastPartialTicks; + if(partialDelta < 0) partialDelta++; + if(partialDelta > 0) lastPartialDelta = partialDelta; + if(targetFOVMult < 0) { + currentFOVMult = 1; + } else { + float deltaFOV = targetFOVMult - currentFOVMult; + + currentFOVMult += deltaFOV*lastPartialDelta*0.2; + if(currentFOVMult < 0.15f) currentFOVMult = 0.15f; + if(currentFOVMult > 1) currentFOVMult = 1; + } + lastPartialTicks = partialTicks + tick; + return currentFOVMult; } + private boolean wasUsingEtherwarp = false; + private boolean usingEtherwarp = false; + private RaycastResult etherwarpRaycast = null; + private int lastEtherwarpUse = 0; + @SubscribeEvent public void onOverlayDrawn(RenderGameOverlayEvent.Post event) { if(((event.type == null && Loader.isModLoaded("labymod")) || event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS)) { + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + + if(usingEtherwarp) { + String denyTpReason = null; + if(etherwarpRaycast == null) { + denyTpReason = "Too far!"; + } else { + BlockPos pos = etherwarpRaycast.pos; + + if(!etherwarpRaycast.state.getBlock().isCollidable() || + etherwarpRaycast.state.getBlock().getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos, etherwarpRaycast.state) == null) { + denyTpReason = "Not solid!"; + } else { + WorldClient world = Minecraft.getMinecraft().theWorld; + if(world.getBlockState(pos.add(0, 1, 0)).getBlock() != Blocks.air || + world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { + denyTpReason = "No air above!"; + } + } + } + + if(denyTpReason != null) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + Utils.drawStringCentered(EnumChatFormatting.RED+"Can't TP: " + denyTpReason, + Minecraft.getMinecraft().fontRendererObj, + scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); + GlStateManager.color(1, 1, 1, 1); + } + } + if(heldBonemerang) { if(bonemerangBreak) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -243,8 +344,6 @@ public class CustomItemEffects { Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( Minecraft.getMinecraft().objectMouseOver.sideHit, 1)); if(hover.getBlock() == Blocks.air) { - ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); if(heldInternal != null && heldInternal.equals("BUILDERS_WAND")) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -315,6 +414,57 @@ public class CustomItemEffects { } } } + //ethermerge + + private class RaycastResult { + IBlockState state; + BlockPos pos; + + public RaycastResult(IBlockState state, BlockPos pos) { + this.state = state; + this.pos = pos; + } + } + + private RaycastResult raycast(EntityPlayerSP player, float partialTicks, float dist, float step) { + Vector3f pos = new Vector3f((float)player.posX, (float)player.posY+player.getEyeHeight(), (float)player.posZ); + + Vec3 lookVec3 = player.getLook(partialTicks); + + Vector3f look = new Vector3f((float)lookVec3.xCoord, (float)lookVec3.yCoord, (float)lookVec3.zCoord); + look.scale(step / look.length()); + + int stepCount = (int)Math.ceil(dist/step); + + for(int i=0; i<stepCount; i++) { + Vector3f.add(pos, look, pos); + + WorldClient world = Minecraft.getMinecraft().theWorld; + BlockPos position = new BlockPos(pos.x, pos.y, pos.z); + IBlockState state = world.getBlockState(position); + + if(state.getBlock() != Blocks.air) { + //Back-step + Vector3f.sub(pos, look, pos); + look.scale(0.1f); + + for(int j=0; j<10; j++) { + Vector3f.add(pos, look, pos); + + BlockPos position2 = new BlockPos(pos.x, pos.y, pos.z); + IBlockState state2 = world.getBlockState(position2); + + if(state2.getBlock() != Blocks.air) { + return new RaycastResult(state2, position2); + } + } + + return new RaycastResult(state, position); + } + } + + return null; + } public int countItemsInInventoryAndStorage(ItemStack match) { int count = 0; @@ -421,6 +571,12 @@ public class CustomItemEffects { if(aoteTeleportationCurr != null && aoteTeleportationMillis > 0) { event.setCanceled(true); } + usingEtherwarp = false; + etherwarpRaycast = null; + float lastFOVMult = this.targetFOVMult; + this.targetFOVMult = 1; + this.targetSensMult = 1; + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); if(heldInternal != null) { @@ -429,6 +585,53 @@ public class CustomItemEffects { double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)event.partialTicks; + if(tick - lastEtherwarpUse > 10) { + boolean aotv = Minecraft.getMinecraft().thePlayer.isSneaking() && + (heldInternal.equals("ASPECT_OF_THE_VOID") || heldInternal.equals("ASPECT_OF_THE_END")); + if(aotv || heldInternal.equals("ETHERWARP_CONDUIT")) { + usingEtherwarp = !aotv; + + if(aotv) { + NBTTagCompound tag = held.getTagCompound(); + if(tag != null && tag.hasKey("ExtraAttributes", 10)) { + NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes"); + usingEtherwarp = ea.hasKey("ethermerge"); + } + } + + if(usingEtherwarp) { + etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, 60, 0.1f); + + if(etherwarpRaycast != null) { + AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) + .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); + drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + + GlStateManager.disableDepth(); + drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + GlStateManager.enableDepth(); + + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + float distFactor = 1 - (float)Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))/60; + + targetFOVMult = distFactor*distFactor*distFactor*0.75f + 0.25f; + if(targetFOVMult < 0.25f) targetFOVMult = 0.25f; + + targetSensMult = distFactor*0.76f + 0.25f; + } + } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + targetFOVMult = lastFOVMult; + } + + return; + } + } + } + if(heldInternal.equals("BLOCK_ZAPPER")) { boolean privateIs = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); if (!privateIs || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || @@ -494,7 +697,9 @@ public class CustomItemEffects { .expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2), 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.zapperOverlayColour); } - + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableTreecapOverlay && (heldInternal.equals("JUNGLE_AXE") || heldInternal.equals("TREECAPITATOR_AXE"))) { int maxWood = 10; @@ -1006,7 +1211,9 @@ public class CustomItemEffects { public static void drawOutlineBoundingBox(AxisAlignedBB p_181561_0_, float alpha, String special) { Color c = new Color(SpecialColour.specialToChromaRGB(special), true); - GlStateManager.color(c.getRed()/255f, c.getGreen()/255f, c.getBlue()/255f, c.getAlpha()/255f*alpha); + float newAlpha = c.getAlpha()/255f*alpha; + if(newAlpha > 1) newAlpha = 1; + GlStateManager.color(c.getRed()/255f, c.getGreen()/255f, c.getBlue()/255f, newAlpha); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java index 553a5d40..a73320fc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java @@ -1,37 +1,100 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import java.text.NumberFormat; import java.util.HashMap; +import java.util.WeakHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class DamageCommas { - private static final HashMap<Integer, ChatComponentText> replacementMap = new HashMap<>(); + private static final WeakHashMap<EntityLivingBase, ChatComponentText> replacementMap = new WeakHashMap<>(); - //From [MVP++] HY7: private static final EnumChatFormatting[] colours = {EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.WHITE}; - public static void tick() { - replacementMap.clear(); - } + private static final char STAR = '\u2727'; + private static final Pattern PATTERN_CRIT = Pattern.compile("\u00a7f"+STAR+"((?:\u00a7.\\d)+)\u00a7."+STAR+"(.*)"); + private static final Pattern PATTERN_NO_CRIT = Pattern.compile("\u00a77(\\d+)(.*)"); - public static IChatComponent replaceName(IChatComponent name) { - if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 0) return name; + public static IChatComponent replaceName(EntityLivingBase entity) { + if(!entity.hasCustomName()) return entity.getDisplayName(); - String formatted = name.getFormattedText(); - int hashCode = formatted.hashCode(); + IChatComponent name = entity.getDisplayName(); + if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 0) return name; - if(replacementMap.containsKey(hashCode)) { - ChatComponentText component = replacementMap.get(hashCode); + if(replacementMap.containsKey(entity)) { + ChatComponentText component = replacementMap.get(entity); if(component == null) return name; return component; } + String formatted = name.getFormattedText(); + + boolean crit = false; + String numbers; + String prefix; + String suffix; + + Matcher matcherCrit = PATTERN_CRIT.matcher(formatted); + if(matcherCrit.matches()) { + crit = true; + numbers = StringUtils.cleanColour(matcherCrit.group(1)); + prefix = "\u00a7f"+STAR; + suffix = "\u00a7f"+STAR+matcherCrit.group(2); + } else { + Matcher matcherNoCrit = PATTERN_NO_CRIT.matcher(formatted); + if(matcherNoCrit.matches()) { + numbers = matcherNoCrit.group(1); + prefix = "\u00A77"; + suffix = "\u00A7r"+matcherNoCrit.group(2); + } else { + replacementMap.put(entity, null); + return name; + } + } + + StringBuilder newFormatted = new StringBuilder(); + + try { + int number = Integer.parseInt(numbers); + + if(number > 999 && NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2) { + newFormatted.append(Utils.shortNumberFormat(number, 0)); + } else { + newFormatted.append(NumberFormat.getIntegerInstance().format(number)); + } + } catch(NumberFormatException e) { + replacementMap.put(entity, null); + return name; + } + + if(crit) { + StringBuilder newFormattedCrit = new StringBuilder(); + + int colourIndex = 0; + for(char c : newFormatted.toString().toCharArray()) { + newFormattedCrit.append(colours[colourIndex++ % colours.length]); + newFormattedCrit.append(c); + } + + newFormatted = newFormattedCrit; + } + + ChatComponentText finalComponent = new ChatComponentText(prefix+newFormatted.toString()+suffix); + + replacementMap.put(entity, finalComponent); + return finalComponent; + + /*if(formatted.startsWith("\u00A7f\u2727")) System.out.println(formatted); + if(formatted.length() >= 7 && (formatted.startsWith("\u00A7f\u2727") || formatted.startsWith("\u00A7f\u2694")) && (formatted.endsWith("\u2727\u00a7r") || formatted.endsWith("\u2694\u00a7r"))) { @@ -79,7 +142,7 @@ public class DamageCommas { if(numLast) numCount--; numLast = false; colLast = true; - } else if(c >= '0' && c <= '9') { + } else if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) { numLast = true; colLast = false; numCount++; @@ -131,7 +194,7 @@ public class DamageCommas { } } replacementMap.put(hashCode, null); - return name; + return name;*/ } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java index 0a5de509..5b9b3c6b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java @@ -93,7 +93,7 @@ public class EnchantingSolvers { } public static ItemStack overrideStack(IInventory inventory, int slotIndex, ItemStack stack) { - if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { return null; } @@ -196,7 +196,7 @@ public class EnchantingSolvers { } public static boolean onStackRender(ItemStack stack, IInventory inventory, int slotIndex, int x, int y) { - if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { return false; } @@ -228,14 +228,14 @@ public class EnchantingSolvers { if(item.containerIndex == slotIndex) { int meta = 0; if(solveIndex == ultrasequencerReplayIndex) { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqNext; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNext; } else if(solveIndex == ultrasequencerReplayIndex+1) { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqUpcoming; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqUpcoming; } if(meta > 0) { Utils.drawItemStack(new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, meta-1), x, y); } - if(NotEnoughUpdates.INSTANCE.config.enchanting.seqNumbers && + if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNumbers && solveIndex >= ultrasequencerReplayIndex) { int w = Minecraft.getMinecraft().fontRendererObj.getStringWidth((solveIndex+1)+""); GlStateManager.disableDepth(); @@ -254,15 +254,15 @@ public class EnchantingSolvers { if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) && superpairStacks.containsKey(slotIndex)) { if(possibleMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPossible; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPossible; } else { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.supUnmatched; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supUnmatched; } } else { if(powerupMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPower; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPower; } else if(successfulMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchanting.supMatched; + meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supMatched; } } if(meta > 0) { @@ -275,7 +275,7 @@ public class EnchantingSolvers { } public static boolean onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) { - if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { return false; } @@ -368,7 +368,7 @@ public class EnchantingSolvers { public static void processInventoryContents(boolean fromTick) { if(currentSolver != SolverType.CHRONOMATRON && !fromTick) return; - if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { return; } @@ -530,7 +530,7 @@ public class EnchantingSolvers { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { - if(NotEnoughUpdates.INSTANCE.config.enchanting.hideTooltips && + if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.hideTooltips && (currentSolver == SolverType.CHRONOMATRON || currentSolver == SolverType.ULTRASEQUENCER)) { String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if(internal == null && event.toolTip.size() > 0 && !event.toolTip.get(0).trim().replaceAll("\\(#.+\\)$", "").trim().contains(" ")) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java index 3bf75a0f..de7ffe5e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java @@ -49,12 +49,12 @@ public class FishingHelper { } } - private enum PlayerWarningState { + public enum PlayerWarningState { NOTHING, FISH_INCOMING, FISH_HOOKED } - private PlayerWarningState warningState = PlayerWarningState.NOTHING; + public PlayerWarningState warningState = PlayerWarningState.NOTHING; private int hookedWarningStateTicks = 0; public final HashMap<Integer, EntityFishHook> hookEntities = new HashMap<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index a20e5abb..3253f08a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -19,7 +19,6 @@ import net.minecraft.network.play.server.S2DPacketOpenWindow; import net.minecraft.network.play.server.S2EPacketCloseWindow; import net.minecraft.network.play.server.S2FPacketSetSlot; import net.minecraft.network.play.server.S30PacketWindowItems; -import org.lwjgl.input.Keyboard; import java.io.*; import java.lang.reflect.Type; @@ -226,7 +225,7 @@ public class StorageManager { } public boolean shouldRenderStorageOverlay(String containerName) { - if(!NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI2) { + if(!NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3) { shouldRenderStorageOverlayCached = false; return false; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 3cc42d7d..381c8944 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -199,7 +199,12 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { - shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchanting.enableTableGUI && + if(true) { + shouldOverrideFast = false; + return false; + } + + shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableTableGUI && containerName != null && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && containerName.equalsIgnoreCase("Enchant Item"); @@ -466,8 +471,8 @@ public class GuiCustomEnchant extends Gui { } } NEUConfig cfg = NotEnoughUpdates.INSTANCE.config; - int mult = cfg.enchanting.enchantOrdering == 0 ? 1 : -1; - Comparator<Enchantment> comparator = cfg.enchanting.enchantSorting == 0 ? + int mult = cfg.enchantingSolvers.enchantOrdering == 0 ? 1 : -1; + Comparator<Enchantment> comparator = cfg.enchantingSolvers.enchantSorting == 0 ? Comparator.comparingInt(e -> mult*e.xpCost) : (c1, c2) -> mult*c1.enchId.toLowerCase().compareTo(c2.enchId.toLowerCase()); removable.sort(comparator); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index e525117c..5d841885 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -18,10 +18,7 @@ import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -36,11 +33,9 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import org.lwjgl.util.vector.Vector2f; -import org.lwjgl.util.vector.Vector4f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; -import java.awt.event.KeyEvent; import java.util.*; import java.util.List; @@ -1241,6 +1236,7 @@ public class StorageOverlay extends GuiElement { GlStateManager.translate(0, 0, 300); allowTypingInSearchBar = false; if(stackOnMouse != null) { + GlStateManager.enableDepth(); if(hoveringOtherBackpack) { Utils.drawItemStack(new ItemStack(Item.getItemFromBlock(Blocks.barrier)), mouseX - 8, mouseY - 8); } else { @@ -1445,7 +1441,7 @@ public class StorageOverlay extends GuiElement { int dWheel = Mouse.getEventDWheel(); if(!(NotEnoughUpdates.INSTANCE.config.storageGUI.cancelScrollKey != 0 && - Keyboard.isKeyDown(NotEnoughUpdates.INSTANCE.config.storageGUI.cancelScrollKey)) && dWheel != 0) { + KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.storageGUI.cancelScrollKey)) && dWheel != 0) { if(dWheel < 0) { dWheel = -1; if(scrollVelocity > 0) scrollVelocity = 0; @@ -1639,7 +1635,7 @@ public class StorageOverlay extends GuiElement { switch(buttonIndex) { case 0: - NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI2 = false; break; + NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 = false; break; case 1: int size = desiredHeightSwitch != -1 ? desiredHeightSwitch : NotEnoughUpdates.INSTANCE.config.storageGUI.storageHeight; int sizeIndex = Math.round((size-104)/54f); @@ -1649,8 +1645,8 @@ public class StorageOverlay extends GuiElement { sizeIndex++; } size = sizeIndex*54+104; - if(size < 104) size = 104; - if(size > 312) size = 312; + if(size < 104) size = 312; + if(size > 320) size = 104; desiredHeightMX = mouseX; desiredHeightMY = mouseY; desiredHeightSwitch = size; break; @@ -1898,9 +1894,10 @@ public class StorageOverlay extends GuiElement { searchBar.getText().isEmpty()) { searchBar.setFocus(false); } + } else if(Keyboard.getEventKey() == Keyboard.KEY_E) { + return false; } - } return true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java index b4ffa7ff..938e214c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; @@ -15,6 +16,7 @@ import net.minecraftforge.client.ForgeHooksClient; import org.lwjgl.util.Display; import org.lwjgl.util.glu.Project; import org.lwjgl.util.vector.Vector3f; +import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -22,6 +24,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(EntityRenderer.class) public abstract class MixinEntityRenderer { @@ -34,6 +37,20 @@ public abstract class MixinEntityRenderer { @Shadow protected abstract void orientCamera(float partialTicks); + @Inject(method="getFOVModifier", at=@At("RETURN"), cancellable = true) + public void getFOVModifier_mult(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable<Float> cir) { + cir.setReturnValue(cir.getReturnValueF() * CustomItemEffects.INSTANCE.getFovMultiplier(partialTicks)); + } + + @Redirect(method="updateCameraAndRender", at=@At( + value="FIELD", + target="Lnet/minecraft/client/settings/GameSettings;mouseSensitivity:F", + opcode = Opcodes.GETFIELD + )) + public float updateCameraAndRender_mouseSensitivity(GameSettings gameSettings) { + return gameSettings.mouseSensitivity * CustomItemEffects.INSTANCE.getSensMultiplier(); + } + @Redirect(method="renderWorldPass", at=@At( value="INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java index 95f2ab0e..729fd5f4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java @@ -24,8 +24,7 @@ public class MixinNetHandlerPlayClient { @Redirect(method="handlePlayerPosLook", at=@At(value="INVOKE", target=TARGET)) public void handlePlayerPosLook_setPositionAndRotation(EntityPlayer player, double x, double y, double z, float yaw, float pitch) { if(CustomItemEffects.INSTANCE.aoteTeleportationCurr != null) { - CustomItemEffects.INSTANCE.aoteTeleportationMillis += - Math.max(0, Math.min(300, NotEnoughUpdates.INSTANCE.config.itemOverlays.smoothTpMillis)); + CustomItemEffects.INSTANCE.aoteTeleportationMillis += Math.max(0, Math.min(300, CustomItemEffects.INSTANCE.tpTime)); } player.setPositionAndRotation(x, y, z, yaw, pitch); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java index be8ca702..ee4f4cba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java @@ -41,7 +41,8 @@ public abstract class MixinRenderFish extends Render<EntityFishHook> { return; } - if(!NotEnoughUpdates.INSTANCE.config.fishing.enableRodColours || entity == null) return; + if(!(NotEnoughUpdates.INSTANCE.config.fishing.enableRodColours || + FishingHelper.getInstance().warningState != FishingHelper.PlayerWarningState.NOTHING) || entity == null) return; String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(entity.angler.getHeldItem()); if (NotEnoughUpdates.INSTANCE.isOnSkyblock() && internalname != null && entity.angler != null && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java index 1119c571..a71fd6f8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java @@ -21,7 +21,7 @@ public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> { "Lnet/minecraft/entity/EntityLivingBase;getDisplayName()Lnet/minecraft/util/IChatComponent;")) public IChatComponent renderName_getDisplayName(EntityLivingBase entity) { if(entity instanceof EntityArmorStand) { - return DamageCommas.replaceName(entity.getDisplayName()); + return DamageCommas.replaceName(entity); } else { return entity.getDisplayName(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 5b0e0128..58deef74 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -177,7 +177,7 @@ public class NEUConfig extends Config { name = "Enchanting GUI/Solvers", desc = "Enchanting GUI/Solvers" ) - public Enchanting enchanting = new Enchanting(); + public Enchanting enchantingSolvers = new Enchanting(); @Expose @Category( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java index 92e9ca27..f6cc91ec 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -98,7 +98,7 @@ public class ItemOverlays { public String zapperOverlayColour = "0:102:171:5:0";
@ConfigOption(
- name = "Smooth AOTE",
+ name = "Smooth AOTE/AOTV/Hyp",
desc = ""
)
@ConfigEditorAccordion(id = 2)
@@ -133,7 +133,20 @@ public class ItemOverlays { minStep = 25
)
@ConfigAccordionId(id = 2)
- public int smoothTpMillis = 175;
+ public int smoothTpMillis = 125;
+
+ @Expose
+ @ConfigOption(
+ name = "Smooth TP Time (Etherwarp)",
+ desc = "Teleport smoothly to your destination when using AOTV Etherwarp"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 500,
+ minStep = 25
+ )
+ @ConfigAccordionId(id = 2)
+ public int smoothTpMillisEtherwarp = 50;
@Expose
@ConfigOption(
@@ -145,6 +158,31 @@ public class ItemOverlays { public boolean disableHyperionParticles = true;
@ConfigOption(
+ name = "Etherwarp",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 7)
+ public boolean etherwarpAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Etherwarp Zoom",
+ desc = "Zoom in on targeted blocks with etherwarp, making it easier to adjust at a distance"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean etherwarpZoom = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Highlight Colour",
+ desc = "Change the colour of the etherwarp target block outline"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 7)
+ public String etherwarpHighlightColour = "00:70:156:8:96";
+
+ @ConfigOption(
name = "Bonemerang Overlay",
desc = ""
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java index 07e4ef86..114183d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/StorageGUI.java @@ -23,7 +23,7 @@ public class StorageGUI { )
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
- public boolean enableStorageGUI2 = false;
+ public boolean enableStorageGUI3 = true;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 6ce5bb8c..bafd04b6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -177,7 +177,7 @@ public class MiningOverlay extends TextOverlay { if(name.contains("Gemstone Powder:")) { gemstonePowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); } - if(name.equals(RESET.toString()+BLUE+BOLD+"Forges"+RESET)) { + if(name.equals(RESET.toString()+BLUE+BOLD+"Forges "+RESET)) { commissions = false; forges = true; continue; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index df148ec4..af4c354c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1921,8 +1921,13 @@ public class GuiProfileViewer extends GuiScreen { ItemStack[][] inventory = inventories[currentInventoryIndex];
if(inventory == null) {
- Utils.drawStringCentered(EnumChatFormatting.RED+"Inventory API not enabled!"+selectedInventory, Minecraft.getMinecraft().fontRendererObj,
- guiLeft+317, guiTop+101, true, 0);
+ if(selectedInventory.equalsIgnoreCase("personal_vault_contents")) {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Personal Vault API not enabled!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+317, guiTop+101, true, 0);
+ } else {
+ Utils.drawStringCentered(EnumChatFormatting.RED+"Inventory API not enabled!", Minecraft.getMinecraft().fontRendererObj,
+ guiLeft+317, guiTop+101, true, 0);
+ }
return;
}
|