diff options
| author | BuildTools <james.jenour@protonmail.com> | 2021-07-23 02:44:58 +0800 |
|---|---|---|
| committer | BuildTools <james.jenour@protonmail.com> | 2021-07-23 02:44:58 +0800 |
| commit | 9814220f8a621f4c310c5f38c57c6bcab358c707 (patch) | |
| tree | 59377672fad4cb804841f7b5d641c2ba6948f4f4 /src/main | |
| parent | 47438cca0b864602b4faa3b56195aff4278b2094 (diff) | |
| download | NotEnoughUpdates-9814220f8a621f4c310c5f38c57c6bcab358c707.tar.gz NotEnoughUpdates-9814220f8a621f4c310c5f38c57c6bcab358c707.tar.bz2 NotEnoughUpdates-9814220f8a621f4c310c5f38c57c6bcab358c707.zip | |
PRE30
Diffstat (limited to 'src/main')
74 files changed, 546 insertions, 95 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.getAvailableC |
