summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/BetterPortals.java209
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java205
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java623
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java34
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java253
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java143
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java54
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java181
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java95
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GlScissorStack.java87
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElement.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java118
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java368
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java519
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiScreenElementWrapper.java35
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/Category.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorBoolean.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorColour.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDropdown.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorSlider.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorText.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java80
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java142
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java132
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java84
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java157
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java124
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/MiscUtils.java104
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/Splitters.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpUtils.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingFloat.java68
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingInteger.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/util/LerpingInteger.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java144
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java215
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java78
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java98
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java513
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/GuiGamemodes.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/ScrollableInfoPane.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java851
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java)31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java)54
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java542
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemRarityHalo.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java)11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StreamerMode.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/StreamerMode.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/SunTzu.java)3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java)5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java)62
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java)36
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java)3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/HelpGUI.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/NEUOverlayPlacements.java)18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java)46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinContainer.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java52
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderGlobal.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java1234
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java390
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/Options.java819
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java205
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java132
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java77
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/GuiQuestLine.java27
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/QuestLine.java226
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/Requirement.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementApi.java108
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementGuiOpen.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementIslandType.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementItemObtained.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocation.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocationRect.java34
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/AllowEmptyHTMLTag.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/AllowEmptyHTMLTag.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java)24
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/NEUResourceManager.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/NEUResourceManager.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/RequestFocusListener.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/RequestFocusListener.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBAIntegration.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java)2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java (renamed from src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java)3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java51
-rw-r--r--src/main/resources/assets/notenoughupdates/capes/furf.pngbin0 -> 10380 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/capes/lightning.pngbin6490 -> 0 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/capes/void.pngbin0 -> 41607 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/bar.pngbin0 -> 2095 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/colour_selector_bar.pngbin0 -> 245 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/colour_selector_bar_alpha.pngbin0 -> 240 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/colour_selector_chroma.pngbin0 -> 211 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/colour_selector_dot.pngbin0 -> 3677 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_off_cap.pngbin0 -> 595 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_off_notch.pngbin0 -> 555 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_off_segment.pngbin0 -> 575 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_on_cap.pngbin0 -> 603 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_on_notch.pngbin0 -> 555 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/slider/slider_on_segment.pngbin0 -> 575 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/toggle_1.pngbin0 -> 592 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/toggle_2.pngbin0 -> 590 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/toggle_3.pngbin0 -> 592 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/toggle_off.pngbin0 -> 594 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/core/toggle_on.pngbin0 -> 593 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/void.frag41
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/void.vert16
-rw-r--r--src/main/resources/assets/notenoughupdates/social/discord.pngbin0 -> 6690 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/social/github.pngbin0 -> 11716 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/social/patreon.pngbin0 -> 3696 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/social/twitter.pngbin0 -> 5816 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/social/youtube.pngbin0 -> 348 bytes
-rw-r--r--src/main/resources/mixins.notenoughupdates.json4
130 files changed, 6702 insertions, 3949 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BetterPortals.java b/src/main/java/io/github/moulberry/notenoughupdates/BetterPortals.java
deleted file mode 100644
index 03003d4b..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/BetterPortals.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package io.github.moulberry.notenoughupdates;
-
-import io.github.moulberry.notenoughupdates.util.TexLoc;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.renderer.*;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityArmorStand;
-import net.minecraft.init.Blocks;
-import net.minecraft.util.BlockPos;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.RenderWorldEvent;
-import net.minecraftforge.client.event.RenderWorldLastEvent;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.util.glu.GLU;
-import org.lwjgl.util.vector.Vector3f;
-
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.util.*;
-
-public class BetterPortals extends Gui {
-
- private Set<Vector3f> loadedPortals = new HashSet<>();
- private HashMap<BlockPos, String> portalNameMap = new HashMap<>();
-
- @SubscribeEvent
- public void onWorldChange(WorldEvent.Load event) {
- portalNameMap.clear();
- loadedPortals.clear();
- }
-
- /** The current GL viewport */
- private static final IntBuffer VIEWPORT = GLAllocation.createDirectIntBuffer(16);
- /** The current GL modelview matrix */
- private static final FloatBuffer MODELVIEW = GLAllocation.createDirectFloatBuffer(16);
- /** The current GL projection matrix */
- private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16);
- private static final FloatBuffer WINCOORDS = GLAllocation.createDirectFloatBuffer(3);
-
- private float getFOVModifier(float partialTicks) {
- Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
-
- float f = Minecraft.getMinecraft().gameSettings.fovSetting;
- //f = f * (this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks);
-
- if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F) {
- float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks;
- f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
- }
-
- Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(Minecraft.getMinecraft().theWorld, entity, partialTicks);
-
- if (block.getMaterial() == Material.water) {
- f = f * 60.0F / 70.0F;
- }
-
- return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(Minecraft.getMinecraft().entityRenderer, entity, block, partialTicks, f);
- }
-
- TexLoc tl = new TexLoc(0, 1, Keyboard.KEY_M);
-
- @SubscribeEvent
- public void renderWorld(RenderGameOverlayEvent event) {
-
- GlStateManager.getFloat(2982, MODELVIEW);
- GlStateManager.getFloat(2983, PROJECTION);
- GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT);
-
- EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
- GlStateManager.disableCull();
-
- tl.handleKeyboardInput();
-
- WINCOORDS.flip().limit(3);
-
- /*float objx = -(float)(0-player.posX);
- float objy = (float)(100-player.posY-player.eyeHeight);
- float objz = (float)(0-player.posZ);*/
-
- float dX = -(float)(0-player.posX);
- float dY = (float)(100-player.posY-player.eyeHeight);
- float dZ = (float)(0-player.posZ);
-
- //GLU.gluProject(objx, objy, objz, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS);
-
- double x = dX*Math.cos(Math.toRadians(player.rotationYawHead))-dZ*Math.sin(Math.toRadians(player.rotationYawHead));
- double z = dX*Math.sin(Math.toRadians(player.rotationYawHead))+dZ*Math.cos(Math.toRadians(player.rotationYawHead));
-
- float fov = getFOVModifier(event.partialTicks);
- x = x / z * Math.toRadians(fov);
- dY = (float)(dY / z * Math.toRadians(fov));
-
- //System.out.println(z);
-
- //GLU.gluProject((float)x, dY, (float)z, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS);
- //x = x / z * 2;
- //dY = (float)(dY / z * 2);
-
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
-
- GL11.glScissor((int)(x*Minecraft.getMinecraft().displayWidth*tl.x/tl.y)+Minecraft.getMinecraft().displayWidth/2,
- (int)(dY+Minecraft.getMinecraft().displayHeight/2), 2, 2);
-
- drawRect(0, 0, 2000, 2000, -1);
-
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
-
- /*for(BlockPos pos : portalNameMap.keySet()) {
- WINCOORDS.flip().limit(3);
-
- /*float objx = -(float)((pos.getX()-player.posX)*Math.cos(Math.toRadians(player.rotationYawHead))*Math.cos(Math.toRadians(player.rotationPitch)));
- float objy = (float)((pos.getY()-player.posY)*Math.sin(Math.toRadians(player.rotationPitch)));
- float objz = (float)((pos.getZ()-player.posZ)*Math.sin(Math.toRadians(player.rotationYawHead)));
-
- float objx = -(float)(pos.getX()-player.posX);
- float objy = (float)(pos.getY()-player.posY-player.eyeHeight);
- float objz = (float)(pos.getZ()-player.posZ);
-
- GLU.gluProject(objx, objy, objz, MODELVIEW, PROJECTION, VIEWPORT, WINCOORDS);
- //GLU.glu
-
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
-
- //System.out.println(WINCOORDS.get(1));
-
- GL11.glScissor((int)WINCOORDS.get(0)*2,
- Minecraft.getMinecraft().displayHeight-(int)WINCOORDS.get(1), (int)50, (int)50);
-
- //0-1
- //-1 - 1
- //0-1920
-
- drawRect(0, 0, 2000, 2000, -1);
-
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- }*/
-
- GlStateManager.enableCull();
- }
-
- @SubscribeEvent
- public void tick(TickEvent.ClientTickEvent event) {
- if(event.phase != TickEvent.Phase.END) {
- return;
- }
- if(Minecraft.getMinecraft().theWorld != null) {
- List<Vector3f> travelToPositions = new ArrayList<>();
- for(Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
- if(entity instanceof EntityArmorStand) {
- EntityArmorStand armorStand = (EntityArmorStand) entity;
- if(armorStand.isInvisible() && armorStand.hasCustomName()) {
- String customName = armorStand.getCustomNameTag();
- if(customName.equals(EnumChatFormatting.AQUA+"Travel to:")) {
- travelToPositions.add(new Vector3f((float)armorStand.posX, (float)armorStand.posY, (float)armorStand.posZ));
- }
- }
- }
- }
- travelToPositions.removeAll(loadedPortals);
- for(Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
- if(entity instanceof EntityArmorStand) {
- EntityArmorStand armorStand = (EntityArmorStand) entity;
- if(armorStand.isInvisible() && armorStand.hasCustomName()) {
- String customName = armorStand.getCustomNameTag();
- for(Vector3f position : travelToPositions) {
- if(position.x == (float)armorStand.posX && position.y-0.375 == (float)armorStand.posY && position.z == (float)armorStand.posZ) {
- float smallestDist = 999;
- BlockPos closestPortal = null;
- for(int xOff=-3; xOff<=3; xOff++) {
- for(int zOff=-3; zOff<=3; zOff++) {
- if(xOff != 0 && zOff != 0) continue;
- BlockPos pos = new BlockPos(armorStand.posX+xOff, armorStand.posY+2, armorStand.posZ+zOff);
- if(Minecraft.getMinecraft().theWorld.getBlockState(pos).getBlock() == Blocks.portal) {
- float dist = (float)(armorStand.posX-(pos.getX()+0.5) + armorStand.posZ-(pos.getZ()+0.5));
- if(closestPortal == null || dist < smallestDist) {
- smallestDist = dist;
- closestPortal = pos;
- }
- }
- }
- }
- if(closestPortal != null) {
- portalNameMap.put(closestPortal, customName);
- }
- }
- }
- }
- }
- }
- loadedPortals.addAll(travelToPositions);
- }
- }
-
- public void tryRegisterPortal() {
-
- }
-
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
new file mode 100644
index 00000000..8d71992e
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
@@ -0,0 +1,205 @@
+package io.github.moulberry.notenoughupdates;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.auction.APIManager;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.input.Keyboard;
+
+import java.text.NumberFormat;
+import java.util.List;
+import java.util.Locale;
+
+public class ItemPriceInformation {
+
+ public static boolean addToTooltip(List<String> tooltip, String internalname) {
+ JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
+ JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname);
+ float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname);
+
+ int lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname);
+ APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname);
+
+ boolean auctionItem = lowestBin > 0 || lowestBinAvg > 0 || auctionInfo != null;
+ boolean bazaarItem = bazaarInfo != null;
+
+ NumberFormat format = NumberFormat.getInstance(Locale.US);
+
+ if(auctionItem) {
+ int[] lines = {
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line1,
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line2,
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line3,
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line4,
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line5,
+ NotEnoughUpdates.INSTANCE.config.priceInfoAuc.line6
+ };
+
+ boolean added = false;
+
+ for(int lineId : lines) {
+ switch (lineId) {
+ case 0:
+ continue;
+ case 1:
+ if(lowestBin > 0) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: " +
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
+ }
+ break;
+ case 2:
+ if(auctionInfo != null) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+
+ if(auctionInfo.has("clean_price")) {
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+ EnumChatFormatting.GOLD+
+ EnumChatFormatting.BOLD+
+ format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
+ } else {
+ int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ EnumChatFormatting.GOLD+
+ EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins");
+ }
+
+ }
+ break;
+ case 3:
+ if(auctionInfo != null) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+ if(auctionInfo.has("clean_price")) {
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+
+ format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
+ } else {
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+
+ format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
+ }
+ }
+ break;
+ case 4:
+ if(craftCost.fromRecipe) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
+ }
+ break;
+ case 5:
+ if(lowestBinAvg > 0) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
+ }
+ break;
+ }
+ }
+
+ return added;
+ } else if(bazaarItem) {
+ int[] lines = {
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line1,
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line2,
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line3,
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line4,
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line5,
+ NotEnoughUpdates.INSTANCE.config.priceInfoBaz.line6
+ };
+
+ boolean added = false;
+
+ boolean shiftPressed = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
+
+ int stackMultiplier = 1;
+ int shiftStackMultiplier = 64;
+ if(shiftPressed) {
+ stackMultiplier = shiftStackMultiplier;
+ }
+
+ //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ for(int lineId : lines) {
+ switch (lineId) {
+ case 0:
+ continue;
+ case 1:
+ if(bazaarInfo.has("avg_buy")) {
+ if(!added) {
+ tooltip.add("");
+ if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ added = true;
+ }
+ int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier;
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
+ }
+ break;
+ case 2:
+ if(bazaarInfo.has("avg_sell")) {
+ if(!added) {
+ tooltip.add("");
+ if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ added = true;
+ }
+ int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier;
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
+ }
+ break;
+ case 3:
+ if(bazaarInfo.has("curr_buy")) {
+ if(!added) {
+ tooltip.add("");
+ if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ added = true;
+ }
+ int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier;
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
+ }
+ break;
+ case 4:
+ if(bazaarInfo.has("curr_sell")) {
+ if(!added) {
+ tooltip.add("");
+ if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
+ added = true;
+ }
+ int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier;
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
+ }
+ break;
+ case 5:
+ if(craftCost.fromRecipe) {
+ if(!added) {
+ tooltip.add("");
+ added = true;
+ }
+ tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
+ }
+ break;
+ }
+ }
+
+ return added;
+ }
+
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 47ea832f..7b08ddf4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -9,9 +9,12 @@ import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes;
+import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
+import io.github.moulberry.notenoughupdates.miscfeatures.StreamerMode;
+import io.github.moulberry.notenoughupdates.miscgui.*;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
-import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
+import io.github.moulberry.notenoughupdates.util.RequestFocusListener;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -21,7 +24,6 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.GlStateManager;
@@ -39,7 +41,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.*;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
-import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -64,7 +66,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static io.github.moulberry.notenoughupdates.GuiTextures.dungeon_chest_worth;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.dungeon_chest_worth;
public class NEUEventListener {
@@ -124,6 +126,11 @@ public class NEUEventListener {
}
}
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Unload event) {
+ NotEnoughUpdates.INSTANCE.saveConfig();
+ }
+
private long notificationDisplayMillis = 0;
private List<String> notificationLines = null;
@@ -146,14 +153,14 @@ public class NEUEventListener {
longUpdate = true;
lastLongUpdate = currentTime;
}
- if(!NotEnoughUpdates.INSTANCE.manager.config.slowDungeonBlocks.value) {
+ if(!neu.config.dungeonBlock.slowDungeonBlocks) {
DungeonBlocks.tick();
}
DungeonWin.tick();
if(longUpdate) {
NotEnoughUpdates.INSTANCE.overlay.redrawItems();
- if(NotEnoughUpdates.INSTANCE.manager.config.slowDungeonBlocks.value) {
+ if(neu.config.dungeonBlock.slowDungeonBlocks) {
DungeonBlocks.tick();
}
@@ -181,11 +188,11 @@ public class NEUEventListener {
SBGamemodes.loadFromFile();
- if(neu.manager.config.showUpdateMsg.value) {
+ if(neu.config.notifications.showUpdateMsg) {
displayUpdateMessageIfOutOfDate();
}
- if(NotEnoughUpdates.INSTANCE.manager.config.doRamNotif.value) {
+ if(neu.config.hidden.doRamNotif) {
long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L;
if(maxMemoryMB > 4100) {
notificationDisplayMillis = System.currentTimeMillis();
@@ -199,9 +206,8 @@ public class NEUEventListener {
}
}
- if(!neu.manager.config.loadedModBefore.value) {
- neu.manager.config.loadedModBefore.value = true;
- try { neu.manager.saveConfig(); } catch(IOException e) {}
+ if(!neu.config.hidden.loadedModBefore) {
+ neu.config.hidden.loadedModBefore = true;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
@@ -283,7 +289,7 @@ public class NEUEventListener {
if(stack != null && stack.hasTagCompound()) {
String internalname = neu.manager.getInternalNameForItem(stack);
if(internalname != null) {
- ArrayList<String> log = neu.manager.config.collectionLog.value.computeIfAbsent(
+ /*ArrayList<String> log = neu.manager.config.collectionLog.value.computeIfAbsent(
neu.manager.getCurrentProfile(), k -> new ArrayList<>());
if(!log.contains(internalname)) {
newItem.add(internalname);
@@ -295,7 +301,7 @@ public class NEUEventListener {
} else {
newItemAddMap.put(internalname, System.currentTimeMillis());
}
- }
+ }*/
}
}
}
@@ -396,16 +402,8 @@ public class NEUEventListener {
if(Minecraft.getMinecraft().currentScreen == null
&& event.gui instanceof GuiContainer) {
neu.overlay.reset();
- neu.manager.loadConfig();
}
- //CLOSE
- if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer
- && event.gui == null) {
- try {
- neu.manager.saveConfig();
- } catch(IOException e) {}
- }
- if(event.gui != null && neu.manager.config.dev.value) {
+ if(event.gui != null && neu.config.hidden.dev) {
if(event.gui instanceof GuiChest) {
GuiChest eventGui = (GuiChest) event.gui;
ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
@@ -540,8 +538,9 @@ public class NEUEventListener {
} else if(unformatted.startsWith("Your profile was changed to: ")) {//Your profile was changed to:
neu.manager.setCurrentProfile(unformatted.substring("Your profile was changed to: ".length()).split(" ")[0].trim());
} else if(unformatted.startsWith("Your new API key is ")) {
- neu.manager.config.apiKey.value = unformatted.substring("Your new API key is ".length());
- try { neu.manager.saveConfig(); } catch(IOException ioe) {}
+ neu.config.apiKey.apiKey = unformatted.substring("Your new API key is ".length());
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+
+ "[NEU] API Key automatically configured"));
}
if(e.message.getFormattedText().equals(EnumChatFormatting.RESET.toString()+
EnumChatFormatting.RED+"You haven't unlocked this recipe!"+EnumChatFormatting.RESET)) {
@@ -566,7 +565,7 @@ public class NEUEventListener {
}
//System.out.println(e.message);
if(unformatted.startsWith("Sending to server") &&
- neu.isOnSkyblock() && neu.manager.config.streamerMode.value && e.message instanceof ChatComponentText) {
+ neu.isOnSkyblock() && neu.config.misc.streamerMode && e.message instanceof ChatComponentText) {
String m = e.message.getFormattedText();
String m2 = StreamerMode.filterChat(e.message.getFormattedText());
if(!m.equals(m2)) {
@@ -633,13 +632,6 @@ public class NEUEventListener {
GL11.glTranslatef(0, 0, 10);
}
}
-
- if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
- renderDungeonChestOverlay(event.gui);
- if(neu.manager.config.accessoryBagOverlay.value) {
- AccessoryBagOverlay.renderOverlay();
- }
- }
}
@SubscribeEvent
@@ -706,10 +698,17 @@ public class NEUEventListener {
GlStateManager.popMatrix();
}
}
+
+ if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
+ renderDungeonChestOverlay(event.gui);
+ if(neu.config.accessoryBag.enableOverlay) {
+ AccessoryBagOverlay.renderOverlay();
+ }
+ }
}
private void renderDungeonChestOverlay(GuiScreen gui) {
- if(gui instanceof GuiChest && !neu.manager.config.dungeonProfitLore.value) {
+ if(gui instanceof GuiChest && neu.config.dungeonProfit.profitDisplayLoc != 2) {
try {
int xSize = (int) Utils.getField(GuiContainer.class, gui, "xSize", "field_146999_f");
int ySize = (int) Utils.getField(GuiContainer.class, gui, "ySize", "field_147000_g");
@@ -722,30 +721,24 @@ public class NEUEventListener {
ItemStack rewardChest = lower.getStackInSlot(31);
if (rewardChest != null && rewardChest.getDisplayName().endsWith(EnumChatFormatting.GREEN+"Open Reward Chest")) {
- Minecraft.getMinecraft().getTextureManager().bindTexture(dungeon_chest_worth);
- GL11.glColor4f(1, 1, 1, 1);
- GlStateManager.disableLighting();
- Utils.drawTexturedRect(guiLeft+xSize+4, guiTop, 180, 101, 0, 180/256f, 0, 101/256f, GL11.GL_NEAREST);
-
int chestCost = 0;
- String line6 = Utils.cleanColour(neu.manager.getLoreFromNBT(rewardChest.getTagCompound())[6]);
- StringBuilder cost = new StringBuilder();
- for(int i=0; i<line6.length(); i++) {
- char c = line6.charAt(i);
- if("0123456789".indexOf(c) >= 0) {
- cost.append(c);
+ try {
+ String line6 = Utils.cleanColour(neu.manager.getLoreFromNBT(rewardChest.getTagCompound())[6]);
+ StringBuilder cost = new StringBuilder();
+ for(int i=0; i<line6.length(); i++) {
+ char c = line6.charAt(i);
+ if("0123456789".indexOf(c) >= 0) {
+ cost.append(c);
+ }
}
- }
- if(cost.length() > 0) {
- chestCost = Integer.parseInt(cost.toString());
- }
+ if(cost.length() > 0) {
+ chestCost = Integer.parseInt(cost.toString());
+ }
+ } catch(Exception ignored) {}
- String missingItemBIN = null;
- String missingItemABIN = null;
- String missingItemAUC = null;
- int totalValueBIN = 0;
- int totalValueABIN = 0;
- int totalValueAUC = 0;
+ String missingItem = null;
+ int totalValue = 0;
+ HashMap<String, Float> itemValues = new HashMap<>();
for(int i=0; i<5; i++) {
ItemStack item = lower.getStackInSlot(11+i);
String internal = neu.manager.getInternalNameForItem(item);
@@ -757,119 +750,128 @@ public class NEUEventListener {
bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat();
}
- float worthBIN;
- float worthABIN;
- float worthAUC = -1;
-
+ float worth = -1;
if(bazaarPrice > 0) {
- worthBIN = bazaarPrice;
- worthABIN = bazaarPrice;
- worthAUC = bazaarPrice;
+ worth = bazaarPrice;
} else {
- worthABIN = neu.manager.auctionManager.getItemAvgBin(internal);
- worthBIN = neu.manager.auctionManager.getLowestBin(internal);
-
- JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
- if(aucInfo != null) {
- worthAUC = aucInfo.get("price").getAsFloat();
+ switch(neu.config.dungeonProfit.profitType) {
+ case 1:
+ worth = neu.manager.auctionManager.getItemAvgBin(internal);
+ break;
+ case 2:
+ JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
+ if(auctionInfo != null) {
+ if(auctionInfo.has("clean_price")) {
+ worth = (int)auctionInfo.get("clean_price").getAsFloat();
+ } else {
+ worth = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
+ }
+ }
+ break;
+ default:
+ worth = neu.manager.auctionManager.getLowestBin(internal);
}
- }
-
- if(worthBIN > 0 && totalValueBIN >= 0) {
- totalValueBIN += worthBIN;
- } else {
- if(totalValueBIN != -1) {
- missingItemBIN = internal;
+ if(worth <= 0) {
+ worth = neu.manager.auctionManager.getLowestBin(internal);
+ if(worth <= 0) {
+ worth = neu.manager.auctionManager.getItemAvgBin(internal);
+ if(worth <= 0) {
+ JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
+ if(auctionInfo != null) {
+ if(auctionInfo.has("clean_price")) {
+ worth = (int)auctionInfo.get("clean_price").getAsFloat();
+ } else {
+ worth = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
+ }
+ }
+ }
+ }
}
- totalValueBIN = -1;
}
- if(worthABIN > 0 && totalValueABIN >= 0) {
- totalValueABIN += worthABIN;
- } else {
- if(totalValueABIN != -1) {
- missingItemABIN = internal;
+ if(worth > 0 && totalValue >= 0) {
+ totalValue += worth;
+ String display = item.getDisplayName();
+
+ if(display.contains("Enchanted Book")) {
+ NBTTagCompound tag = item.getTagCompound();
+ if(tag != null && tag.hasKey("ExtraAttributes", 10)) {
+ NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
+ NBTTagCompound enchants = ea.getCompoundTag("enchantments");
+
+ int highestLevel = -1;
+ for(String enchname : enchants.getKeySet()) {
+ int level = enchants.getInteger(enchname);
+ if(level > highestLevel) {
+ display = EnumChatFormatting.BLUE+WordUtils.capitalizeFully(
+ enchname.replace("_", " ")
+ .replace("Ultimate", "")
+ .trim()) + " " + level;
+ }
+ }
+ }
}
- totalValueABIN = -1;
- }
- if(worthAUC > 0 && totalValueAUC >= 0) {
- totalValueAUC += worthAUC;
+ itemValues.put(display, worth);
} else {
- if(totalValueAUC != -1) {
- missingItemAUC = internal;
+ if(totalValue != -1) {
+ missingItem = internal;
}
- totalValueAUC = -1;
+ totalValue = -1;
}
}
}
NumberFormat format = NumberFormat.getInstance(Locale.US);
- String valueStringBIN;
- String valueStringABIN;
- String valueStringAUC;
- if(totalValueBIN >= 0) {
- valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueBIN) + " coins";
- } else {
- valueStringBIN = EnumChatFormatting.YELLOW+"Can't find BIN: " + missingItemBIN;
- }
- if(totalValueABIN >= 0) {
- valueStringABIN = EnumChatFormatting.YELLOW+"Value (AVG BIN): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueABIN) + " coins";
+ String valueStringBIN1;
+ String valueStringBIN2;
+ if(totalValue >= 0) {
+ valueStringBIN1 = EnumChatFormatting.YELLOW+"Value (BIN): ";
+ valueStringBIN2 = EnumChatFormatting.GOLD + format.format(totalValue) + " coins";
} else {
- valueStringABIN = EnumChatFormatting.YELLOW+"Can't find AVG BIN: " + missingItemABIN;
- }
- if(totalValueAUC >= 0) {
- valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueAUC) + " coins";
- } else {
- valueStringAUC = EnumChatFormatting.YELLOW+"Can't find AUC: " + missingItemAUC;
+ valueStringBIN1 = EnumChatFormatting.YELLOW+"Can't find BIN: ";
+ valueStringBIN2 = missingItem;
}
- String profitPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN
- + EnumChatFormatting.BOLD + "+";
- String lossPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED
- + EnumChatFormatting.BOLD + "-";
+ int profitLossBIN = totalValue - chestCost;
+
+ String profitPrefix = EnumChatFormatting.DARK_GREEN.toString();
+ String lossPrefix = EnumChatFormatting.RED.toString();
+ String prefix = profitLossBIN >= 0 ? profitPrefix : lossPrefix;
- int profitLossBIN = totalValueBIN - chestCost;
String plStringBIN;
if(profitLossBIN >= 0) {
- plStringBIN = profitPrefix + format.format(profitLossBIN) + " coins";
- } else {
- plStringBIN = lossPrefix + format.format(-profitLossBIN) + " coins";
- }
-
- int profitLossABIN = totalValueABIN - chestCost;
- String plStringABIN;
- if(profitLossABIN >= 0) {
- plStringABIN = profitPrefix + format.format(profitLossABIN) + " coins";
+ plStringBIN = prefix + "+" + format.format(profitLossBIN) + " coins";
} else {
- plStringABIN = lossPrefix + format.format(-profitLossABIN) + " coins";
+ plStringBIN = prefix + "-" + format.format(-profitLossBIN) + " coins";
}
- int profitLossAUC = totalValueAUC - chestCost;
- String plStringAUC;
- if(profitLossAUC >= 0) {
- plStringAUC = profitPrefix + format.format(profitLossAUC) + " coins";
- } else {
- plStringAUC = lossPrefix + format.format(-profitLossAUC) + " coins";
+ if(neu.config.dungeonProfit.profitDisplayLoc == 1 && !valueStringBIN2.equals(missingItem)) {
+ int w = Minecraft.getMinecraft().fontRendererObj.getStringWidth(plStringBIN);
+ GlStateManager.disableLighting();
+ Minecraft.getMinecraft().fontRendererObj.drawString(plStringBIN, guiLeft+xSize-5-w, guiTop+5,
+ 0xffffffff, true);
+ return;
}
- drawStringShadow(valueStringBIN, guiLeft+xSize+4+90,
- guiTop+14, 170);
- if(totalValueBIN >= 0) drawStringShadow(plStringBIN, guiLeft+xSize+4+90,
- guiTop+26, 170);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(dungeon_chest_worth);
+ GL11.glColor4f(1, 1, 1, 1);
+ GlStateManager.disableLighting();
+ Utils.drawTexturedRect(guiLeft+xSize+4, guiTop, 180, 101, 0, 180/256f, 0, 101/256f, GL11.GL_NEAREST);
- drawStringShadow(valueStringABIN, guiLeft+xSize+4+90,
- guiTop+44, 170);
- if(totalValueABIN >= 0) drawStringShadow(plStringABIN, guiLeft+xSize+4+90,
- guiTop+56, 170);
+ Utils.renderAlignedString(valueStringBIN1, valueStringBIN2,
+ guiLeft+xSize+4+10, guiTop+14, 160);
+ if(totalValue >= 0) {
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Profit/Loss: ", plStringBIN,
+ guiLeft+xSize+4+10, guiTop+24, 160);
+ }
- drawStringShadow(valueStringAUC, guiLeft+xSize+4+90,
- guiTop+74, 170);
- if(totalValueAUC >= 0) drawStringShadow(plStringAUC, guiLeft+xSize+4+90,
- guiTop+86, 170);
+ int index=0;
+ for(Map.Entry<String, Float> entry : itemValues.entrySet()) {
+ Utils.renderAlignedString(entry.getKey(), prefix+
+ format.format(entry.getValue().intValue()),
+ guiLeft+xSize+4+10, guiTop+29+(++index)*10, 160);
+ }
}
} catch(Exception e) {
e.printStackTrace();
@@ -918,7 +920,7 @@ public class NEUEventListener {
return;
}
if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
- if(!neu.manager.config.accessoryBagOverlay.value || !AccessoryBagOverlay.mouseClick()) {
+ if(!neu.config.accessoryBag.enableOverlay || !AccessoryBagOverlay.mouseClick()) {
if(!(hoverInv && focusInv)) {
if(neu.overlay.mouseInput()) {
event.setCanceled(true);
@@ -964,7 +966,7 @@ public class NEUEventListener {
event.setCanceled(true);
}
}
- if(neu.manager.config.dev.value && neu.manager.config.enableItemEditing.value && Minecraft.getMinecraft().theWorld != null &&
+ if(neu.config.hidden.dev && neu.config.hidden.enableItemEditing && Minecraft.getMinecraft().theWorld != null &&
Keyboard.getEventKey() == Keyboard.KEY_O && Keyboard.getEventKeyState()) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui instanceof GuiChest) {
@@ -1052,7 +1054,7 @@ public class NEUEventListener {
JsonObject enchantsConst = Constants.ENCHANTS;
JsonArray allItemEnchs = null;
Set<String> ignoreFromPool = new HashSet<>();
- if(enchantsConst != null && hasEnchantments && NotEnoughUpdates.INSTANCE.manager.config.missingEnchantList.value) {
+ if(enchantsConst != null && hasEnchantments && neu.config.tooltipTweaks.missingEnchantList) {
try {
JsonArray enchantPools = enchantsConst.get("enchant_pools").getAsJsonArray();
for(JsonElement element : enchantPools) {
@@ -1104,7 +1106,7 @@ public class NEUEventListener {
line = line.replace("\u00A7cR\u00A76a\u00A7ei\u00A7an\u00A7bb\u00A79o\u00A7dw\u00A79 Rune",
Utils.chromaString("Rainbow Rune", index, false)+EnumChatFormatting.BLUE);
} else if(hasEnchantments) {
- if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && NotEnoughUpdates.INSTANCE.manager.config.missingEnchantList.value) {
+ if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && neu.config.tooltipTweaks.missingEnchantList) {
boolean lineHasEnch = false;
for(String s : enchantIds) {
String enchantName = WordUtils.capitalizeFully(s.replace("_", " "));
@@ -1147,7 +1149,7 @@ public class NEUEventListener {
}
}
}
- for(String op : neu.manager.config.enchantColours.value) {
+ for(String op : neu.config.hidden.enchantColours) {
List<String> colourOps = GuiEnchantColour.splitter.splitToList(op);
String enchantName = GuiEnchantColour.getColourOpIndex(colourOps, 0);
String comparator = GuiEnchantColour.getColourOpIndex(colourOps, 1);
@@ -1264,63 +1266,21 @@ public class NEUEventListener {
newTooltip.add(line);
- if(neu.manager.config.auctionPriceInfo.value) {
+ if(neu.config.tooltipTweaks.showPriceInfoAucItem) {
if(line.contains(EnumChatFormatting.GRAY+"Buy it now: ") ||
line.contains(EnumChatFormatting.GRAY+"Bidder: ") ||
line.contains(EnumChatFormatting.GRAY+"Starting bid: ")) {
- if(internalname != null) {
- newTooltip.add("");
- if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
- newTooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]");
- } else {
- JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname);
- float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname);
-
- int lowestBin = neu.manager.auctionManager.getLowestBin(internalname);
- APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname);
-
- boolean hasAuctionPrice = auctionInfo != null;
- boolean hasLowestBinPrice = lowestBin > 0 && neu.manager.config.advancedPriceInfo.value;
- boolean hasLowestBinAvgPrice = lowestBinAvg > 0;
-
- NumberFormat format = NumberFormat.getInstance(Locale.US);
- if(hasLowestBinPrice) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
- }
- if(hasLowestBinAvgPrice) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
- }
- if(hasAuctionPrice) {
- int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
- }
- if(auctionInfo.has("clean_price")) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
- }
- }
-
- }
- if(hasAuctionPrice && craftCost.fromRecipe) {
- newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
- }
- }
+ if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
+ newTooltip.add("");
+ newTooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]");
+ } else {
+ ItemPriceInformation.addToTooltip(newTooltip, internalname);
}
}
}
- if(neu.manager.config.dungeonProfitLore.value && Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ if(neu.config.dungeonProfit.profitDisplayLoc == 2 && Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
if(line.contains(EnumChatFormatting.GREEN+"Open Reward Chest")) {
dungeonProfit = true;
} else if(index == 7 && dungeonProfit) {
@@ -1329,141 +1289,141 @@ public class NEUEventListener {
IInventory lower = cc.getLowerChestInventory();
int chestCost = 0;
- String line6 = Utils.cleanColour(line);
- StringBuilder cost = new StringBuilder();
- for(int i=0; i<line6.length(); i++) {
- char c = line6.charAt(i);
- if("0123456789".indexOf(c) >= 0) {
- cost.append(c);
+ try {
+ String line6 = Utils.cleanColour(line);
+ StringBuilder cost = new StringBuilder();
+ for(int i=0; i<line6.length(); i++) {
+ char c = line6.charAt(i);
+ if("0123456789".indexOf(c) >= 0) {
+ cost.append(c);
+ }
}
- }
- if(cost.length() > 0) {
- chestCost = Integer.parseInt(cost.toString());
- }
+ if(cost.length() > 0) {
+ chestCost = Integer.parseInt(cost.toString());
+ }
+ } catch(Exception ignored) {}
- String missingItemBIN = null;
- String missingItemABIN = null;
- String missingItemAUC = null;
- int totalValueBIN = 0;
- int totalValueABIN = 0;
- int totalValueAUC = 0;
+ String missingItem = null;
+ int totalValue = 0;
+ HashMap<String, Float> itemValues = new HashMap<>();
for(int i=0; i<5; i++) {
ItemStack item = lower.getStackInSlot(11+i);
String internal = neu.manager.getInternalNameForItem(item);
if(internal != null) {
+ internal = internal.replace("\u00CD", "I").replace("\u0130", "I");
float bazaarPrice = -1;
JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internal);
if(bazaarInfo != null && bazaarInfo.has("avg_sell")) {
bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat();
}
- float worthBIN;
- float worthABIN;
- float worthAUC = -1;
-
+ float worth = -1;
if(bazaarPrice > 0) {
- worthBIN = bazaarPrice;
- worthABIN = bazaarPrice;
- worthAUC = bazaarPrice;
+ worth = bazaarPrice;
} else {
- worthABIN = neu.manager.auctionManager.getItemAvgBin(internal);
- worthBIN = neu.manager.auctionManager.getLowestBin(internal);
-
- JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
- if(aucInfo != null) {
- worthAUC = aucInfo.get("price").getAsFloat();
+ switch(neu.config.dungeonProfit.profitType) {
+ case 1:
+ worth = neu.manager.auctionManager.getItemAvgBin(internal);
+ break;
+ case 2:
+ JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
+ if(auctionInfo != null) {
+ if(auctionInfo.has("clean_price")) {
+ worth = (int)auctionInfo.get("clean_price").getAsFloat();
+ } else {
+ worth = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
+ }
+ }
+ break;
+ default:
+ worth = neu.manager.auctionManager.getLowestBin(internal);
}
- }
-
- if(worthBIN > 0 && totalValueBIN >= 0) {
- totalValueBIN += worthBIN;
- } else {
- if(totalValueBIN != -1) {
- missingItemBIN = internal;
+ if(worth <= 0) {
+ worth = neu.manager.auctionManager.getLowestBin(internal);
+ if(worth <= 0) {
+ worth = neu.manager.auctionManager.getItemAvgBin(internal);
+ if(worth <= 0) {
+ JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
+ if(auctionInfo != null) {
+ if(auctionInfo.has("clean_price")) {
+ worth = (int)auctionInfo.get("clean_price").getAsFloat();
+ } else {
+ worth = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
+ }
+ }
+ }
+ }
}
- totalValueBIN = -1;
}
- if(worthABIN > 0 && totalValueABIN >= 0) {
- totalValueABIN += worthABIN;
- } else {
- if(totalValueABIN != -1) {
- missingItemABIN = internal;
+ if(worth > 0 && totalValue >= 0) {
+ totalValue += worth;
+
+ String display = item.getDisplayName();
+
+ if(display.contains("Enchanted Book")) {
+ NBTTagCompound tag = item.getTagCompound();
+ if(tag != null && tag.hasKey("ExtraAttributes", 10)) {
+ NBTTagCompound ea = tag.getCompoundTag("ExtraAttributes");
+ NBTTagCompound enchants = ea.getCompoundTag("enchantments");
+
+ int highestLevel = -1;
+ for(String enchname : enchants.getKeySet()) {
+ int level = enchants.getInteger(enchname);
+ if(level > highestLevel) {
+ display = EnumChatFormatting.BLUE+WordUtils.capitalizeFully(
+ enchname.replace("_", " ")
+ .replace("Ultimate", "")
+ .trim()) + " " + level;
+ }
+ }
+ }
}
- totalValueABIN = -1;
- }
- if(worthAUC > 0 && totalValueAUC >= 0) {
- totalValueAUC += worthAUC;
+ itemValues.put(display, worth);
} else {
- if(totalValueAUC != -1) {
- missingItemAUC = internal;
+ if(totalValue != -1) {
+ missingItem = internal;
}
- totalValueAUC = -1;
+ totalValue = -1;
}
}
}
NumberFormat format = NumberFormat.getInstance(Locale.US);
- String valueStringBIN;
- String valueStringABIN;
- String valueStringAUC;
- if(totalValueBIN >= 0) {
- valueStringBIN = EnumChatFormatting.YELLOW+"Value (BIN): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueBIN) + " coins";
+ String valueStringBIN1;
+ String valueStringBIN2;
+ if(totalValue >= 0) {
+ valueStringBIN1 = EnumChatFormatting.YELLOW+"Value (BIN): ";
+ valueStringBIN2 = EnumChatFormatting.GOLD + format.format(totalValue) + " coins";
} else {
- valueStringBIN = EnumChatFormatting.YELLOW+"Can't find BIN: " + missingItemBIN;
- }
- if(totalValueABIN >= 0) {
- valueStringABIN = EnumChatFormatting.YELLOW+"Value (AVG BIN): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueABIN) + " coins";
- } else {
- valueStringABIN = EnumChatFormatting.YELLOW+"Can't find AVG BIN: " + missingItemABIN;
- }
- if(totalValueAUC >= 0) {
- valueStringAUC = EnumChatFormatting.YELLOW+"Value (AUC): " + EnumChatFormatting.GOLD
- + EnumChatFormatting.BOLD + format.format(totalValueAUC) + " coins";
- } else {
- valueStringAUC = EnumChatFormatting.YELLOW+"Can't find AUC: " + missingItemAUC;
+ valueStringBIN1 = EnumChatFormatting.YELLOW+"Can't find BIN: ";
+ valueStringBIN2 = missingItem;
}
- String profitPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.DARK_GREEN
- + EnumChatFormatting.BOLD + "+";
- String lossPrefix = EnumChatFormatting.YELLOW+"Profit/Loss: " + EnumChatFormatting.RED
- + EnumChatFormatting.BOLD + "-";
+ int profitLossBIN = totalValue - chestCost;
+ String profitPrefix = EnumChatFormatting.DARK_GREEN.toString();
+ String lossPrefix = EnumChatFormatting.RED.toString();
+ String prefix = profitLossBIN >= 0 ? profitPrefix : lossPrefix;
- int profitLossBIN = totalValueBIN - chestCost;
String plStringBIN;
if(profitLossBIN >= 0) {
- plStringBIN = profitPrefix + format.format(profitLossBIN) + " coins";
+ plStringBIN = prefix + "+" + format.format(profitLossBIN) + " coins";
} else {
- plStringBIN = lossPrefix + format.format(-profitLossBIN) + " coins";
+ plStringBIN = prefix + "-"+ format.format(-profitLossBIN) + " coins";
}
- int profitLossABIN = totalValueABIN - chestCost;
- String plStringABIN;
- if(profitLossABIN >= 0) {
- plStringABIN = profitPrefix + format.format(profitLossABIN) + " coins";
- } else {
- plStringABIN = lossPrefix + format.format(-profitLossABIN) + " coins";
- }
+ String neu = EnumChatFormatting.YELLOW + "[NEU] ";
- int profitLossAUC = totalValueAUC - chestCost;
- String plStringAUC;
- if(profitLossAUC >= 0) {
- plStringAUC = profitPrefix + format.format(profitLossAUC) + " coins";
- } else {
- plStringAUC = lossPrefix + format.format(-profitLossAUC) + " coins";
+ newTooltip.add(neu + valueStringBIN1 + " " + valueStringBIN2);
+ if(totalValue >= 0) {
+ newTooltip.add(neu + EnumChatFormatting.YELLOW+"Profit/Loss: " + plStringBIN);
}
- String neu = EnumChatFormatting.YELLOW + "[NEU] ";
-
- newTooltip.add(neu + valueStringBIN);
- if(totalValueBIN >= 0) newTooltip.add(neu + plStringBIN);
- newTooltip.add(neu + valueStringABIN);
- if(totalValueABIN >= 0) newTooltip.add(neu + plStringABIN);
- newTooltip.add(neu + valueStringAUC);
- if(totalValueAUC >= 0) newTooltip.add(neu + plStringAUC);
+ for(Map.Entry<String, Float> entry : itemValues.entrySet()) {
+ newTooltip.add(neu + entry.getKey() + prefix+"+"+
+ format.format(entry.getValue().intValue()));
+ }
}
}
@@ -1473,83 +1433,8 @@ public class NEUEventListener {
event.toolTip.clear();
event.toolTip.addAll(newTooltip);
- if(neu.manager.config.invAuctionPrice.value || neu.manager.config.invBazaarPrice.value) {
- if(internalname != null) {
- JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname);
- JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internalname);
- float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname);
-
- int lowestBin = neu.manager.auctionManager.getLowestBin(internalname);
- APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname);
-
- boolean hasAuctionPrice = neu.manager.config.invAuctionPrice.value && auctionInfo != null;
- boolean hasBazaarPrice = neu.manager.config.invBazaarPrice.value && bazaarInfo != null;
- boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0 && neu.manager.config.advancedPriceInfo.value;
- boolean hasLowestBinAvgPrice = neu.manager.config.invAuctionPrice.value && lowestBinAvg > 0;
-
- NumberFormat format = NumberFormat.getInstance(Locale.US);
-
- if(hasAuctionPrice || hasBazaarPrice || hasLowestBinAvgPrice || hasLowestBinPrice) event.toolTip.add("");
- if(hasLowestBinPrice) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
- }
- if(hasLowestBinAvgPrice) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
- }
- if(hasAuctionPrice) {
- int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
- }
- if(auctionInfo.has("clean_price")) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
- if(neu.manager.config.advancedPriceInfo.value) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
- }
- }
- } else if(hasBazaarPrice) {
- int stackMultiplier = 1;
- int shiftStackMultiplier = event.itemStack.stackSize > 1 ? event.itemStack.stackSize : 64;
- if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- stackMultiplier = shiftStackMultiplier;
- } else {
- event.toolTip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
- }
- if(bazaarInfo.has("avg_buy")) {
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- }
- if(bazaarInfo.has("avg_sell")) {
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- }
- if(neu.manager.config.advancedPriceInfo.value) {
- if(bazaarInfo.has("curr_buy")) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- }
- if(bazaarInfo.has("curr_sell")) {
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier;
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
- }
- }
- }
- if((hasAuctionPrice || hasBazaarPrice) && craftCost.fromRecipe) {
- event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
- }
- }
+ if(neu.config.tooltipTweaks.showPriceInfoInvItem) {
+ ItemPriceInformation.addToTooltip(event.toolTip, internalname);
}
}
@@ -1560,7 +1445,7 @@ public class NEUEventListener {
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent event) {
if(!neu.isOnSkyblock()) return;
- if(neu.manager.config.hideEmptyPanes.value &&
+ if(neu.config.improvedSBMenu.hideEmptyPanes &&
event.itemStack.getItem().equals(Item.getItemFromBlock(Blocks.stained_glass_pane))) {
String first = Utils.cleanColour(event.toolTip.get(0));
first = first.replaceAll("\\(.*\\)", "").trim();
@@ -1617,7 +1502,7 @@ public class NEUEventListener {
}
}
}*/
- if(!Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || !neu.manager.config.dev.value) return;
+ if(!Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)/* || /*!neu.config.hidden.dev*/) return;
if(event.toolTip.size()>0&&event.toolTip.get(event.toolTip.size()-1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) {
event.toolTip.remove(event.toolTip.size()-1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index d2467176..668ac1fe 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -3,8 +3,7 @@ package io.github.moulberry.notenoughupdates;
import com.google.common.collect.Lists;
import com.google.gson.*;
import io.github.moulberry.notenoughupdates.auction.APIManager;
-import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
-import io.github.moulberry.notenoughupdates.options.Options;
+import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.HypixelApi;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -25,12 +24,9 @@ import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -77,19 +73,13 @@ public class NEUManager {
public File configFile;
public File itemRenameFile;
public JsonObject itemRenameJson;
- public Options config;
public NEUManager(NotEnoughUpdates neu, File configLocation) {
this.neu = neu;
this.configLocation = configLocation;
this.auctionManager = new APIManager(this);
- GsonBuilder gsonBuilder = new GsonBuilder().setPrettyPrinting();
- gsonBuilder.registerTypeAdapter(Options.Option.class, Options.createSerializer());
- gsonBuilder.registerTypeAdapter(Options.Option.class, Options.createDeserializer());
- gson = gsonBuilder.create();
-
- this.loadConfig();
+ gson = new GsonBuilder().setPrettyPrinting().create();
this.repoLocation = new File(configLocation, "repo");
repoLocation.mkdir();
@@ -130,20 +120,6 @@ public class NEUManager {
try { writeJson(itemRenameJson, itemRenameFile); } catch(IOException ignored) {}
}
- public void saveConfig() throws IOException {
- config.saveToFile(gson, configFile);
- }
-
- public void loadConfig() {
- this.configFile = new File(configLocation, "config.json");
- try {
- configFile.createNewFile();
- config = Options.loadFromFile(gson, configFile);
- } catch(Exception e) {
- config = new Options();
- }
- }
-
/**
* Parses a file in to a JsonObject.
*/
@@ -201,11 +177,11 @@ public class NEUManager {
Thread thread = new Thread(() -> {
JDialog dialog = null;
try {
- if(config.autoupdate.value) {
+ if(NotEnoughUpdates.INSTANCE.config.hidden.autoupdate) {
JOptionPane pane = new JOptionPane("Getting items to download from remote repository.");
dialog = pane.createDialog("NotEnoughUpdates Remote Sync");
dialog.setModal(false);
- if(config.dev.value) dialog.setVisible(true);
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev) dialog.setVisible(true);
if (Display.isActive()) dialog.toFront();
@@ -239,7 +215,7 @@ public class NEUManager {
pane.setMessage("Downloading NEU Master Archive. (DL# >20)");
dialog.pack();
- if(config.dev.value) dialog.setVisible(true);
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev) dialog.setVisible(true);
if (Display.isActive()) dialog.toFront();
File itemsZip = new File(repoLocation, "neu-items-master.zip");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 94302007..69cda23a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -4,13 +4,17 @@ import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.auction.APIManager;
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import io.github.moulberry.notenoughupdates.infopanes.*;
import io.github.moulberry.notenoughupdates.itemeditor.NEUItemEditor;
import io.github.moulberry.notenoughupdates.mbgui.MBAnchorPoint;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned;
import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating;
+import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
+import io.github.moulberry.notenoughupdates.miscgui.HelpGUI;
+import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
import io.github.moulberry.notenoughupdates.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
@@ -47,16 +51,12 @@ import org.lwjgl.util.vector.Vector2f;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.text.NumberFormat;
import java.util.List;
import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
public class NEUOverlay extends Gui {
@@ -82,8 +82,6 @@ public class NEUOverlay extends Gui {
};
//Various constants used for GUI structure
- private int searchBarXSize = 200;
- private final int searchBarYSize = 40;
private final int searchBarYOffset = 10;
private final int searchBarPadding = 2;
@@ -265,12 +263,7 @@ public class NEUOverlay extends Gui {
@Override
public void mouseClick(float x, float y, int mouseX, int mouseY) {
if(Mouse.getEventButtonState()) {
- if(activeInfoPane instanceof SettingsInfoPane) {
- displayInformationPane(null);
- } else {
- displayInformationPane(new SettingsInfoPane(overlay, manager));
- }
- Utils.playPressSound();
+ Minecraft.getMinecraft().displayGuiScreen(new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config)));
}
}
@@ -364,10 +357,10 @@ public class NEUOverlay extends Gui {
@Override
public void mouseClick(float x, float y, int mouseX, int mouseY) {
- if(!manager.config.showQuickCommands.value) return;
+ if(!NotEnoughUpdates.INSTANCE.config.toolbar.quickCommands) return;
- if((manager.config.quickcommandMousePress.value && Mouse.getEventButtonState()) ||
- (!manager.config.quickcommandMousePress.value && !Mouse.getEventButtonState() && Mouse.getEventButton() != -1)) {
+ if((NotEnoughUpdates.INSTANCE.config.toolbar.quickCommandsClickType != 0 && Mouse.getEventButtonState()) ||
+ (NotEnoughUpdates.INSTANCE.config.toolbar.quickCommandsClickType == 0 && !Mouse.getEventButtonState() && Mouse.getEventButton() != -1)) {
if(quickCommandStr.contains(":")) {
String command = quickCommandStr.split(":")[0].trim();
if(command.startsWith("/")) {
@@ -386,7 +379,7 @@ public class NEUOverlay extends Gui {
@Override
public void render(float x, float y) {
- if(!manager.config.showQuickCommands.value) return;
+ if(!NotEnoughUpdates.INSTANCE.config.toolbar.quickCommands) return;
int paddingUnscaled = getPaddingUnscaled();
int bigItemSize = getSearchBarYSize();
@@ -461,7 +454,7 @@ public class NEUOverlay extends Gui {
private MBGuiGroupAligned createQuickCommandGroup() {
List<MBGuiElement> children = new ArrayList<>();
- for(String quickCommand : manager.config.quickCommands.value) {
+ for(String quickCommand : NotEnoughUpdates.INSTANCE.config.hidden.quickCommands) {
children.add(createQuickCommand(quickCommand));
}
return new MBGuiGroupAligned(children, false) {
@@ -477,14 +470,28 @@ public class NEUOverlay extends Gui {
public int getPadding() {
return getPaddingUnscaled()*4;
}
+
+ @Override
+ public void mouseClick(float x, float y, int mouseX, int mouseY) {
+ if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
+ super.mouseClick(x, y, mouseX, mouseY);
+ }
+ }
+
+ @Override
+ public void render(float x, float y) {
+ if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
+ super.render(x, y);
+ }
+ }
};
}
private MBGuiGroupFloating createGuiGroup() {
LinkedHashMap<MBGuiElement, MBAnchorPoint> map = new LinkedHashMap<>();
- MBAnchorPoint searchBarAnchor = MBAnchorPoint.createFromString(manager.config.overlaySearchBar.value);
- MBAnchorPoint quickCommandAnchor = MBAnchorPoint.createFromString(manager.config.overlayQuickCommand.value);
+ MBAnchorPoint searchBarAnchor = MBAnchorPoint.createFromString(NotEnoughUpdates.INSTANCE.config.hidden.overlaySearchBar);
+ MBAnchorPoint quickCommandAnchor = MBAnchorPoint.createFromString(NotEnoughUpdates.INSTANCE.config.hidden.overlayQuickCommand);
searchBarAnchor = searchBarAnchor != null ? searchBarAnchor :
new MBAnchorPoint(MBAnchorPoint.AnchorPoint.BOTMID, new Vector2f(0, -searchBarYOffset));
@@ -499,8 +506,8 @@ public class NEUOverlay extends Gui {
}
public void resetAnchors(boolean onlyIfNull) {
- MBAnchorPoint searchBarAnchor = MBAnchorPoint.createFromString(manager.config.overlaySearchBar.value);
- MBAnchorPoint quickCommandAnchor = MBAnchorPoint.createFromString(manager.config.overlayQuickCommand.value);
+ MBAnchorPoint searchBarAnchor = MBAnchorPoint.createFromString(NotEnoughUpdates.INSTANCE.config.hidden.overlaySearchBar);
+ MBAnchorPoint quickCommandAnchor = MBAnchorPoint.createFromString(NotEnoughUpdates.INSTANCE.config.hidden.overlayQuickCommand);
if(onlyIfNull) {
searchBarAnchor = searchBarAnchor != null ? null :
@@ -541,12 +548,13 @@ public class NEUOverlay extends Gui {
*/
public void reset() {
searchBarHasFocus = false;
- if(!(searchMode || (manager.config.keepopen.value && itemPaneOpen))) {
+ if(!(searchMode || (NotEnoughUpdates.INSTANCE.config.itemlist.keepopen && itemPaneOpen))) {
itemPaneOpen = false;
itemPaneOffsetFactor.setValue(1);
itemPaneTabOffset.setValue(20);
}
if(activeInfoPane != null) activeInfoPane.reset();
+ guiGroup.recalculate();
}
/**
@@ -600,7 +608,7 @@ public class NEUOverlay extends Gui {
return false;
}
- Utils.pushGuiScale(manager.config.paneGuiScale.value.intValue());
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
int width = Utils.peekGuiScale().getScaledWidth();
int height = Utils.peekGuiScale().getScaledHeight();
@@ -721,11 +729,12 @@ public class NEUOverlay extends Gui {
int orderIconX = leftSide+i*scaledItemPaddedSize;
if(mouseX >= orderIconX && mouseX <= orderIconX+scaledITEM_SIZE) {
if(Mouse.getEventButton() == 0) {
- manager.config.compareMode.value = new Double(i);
+ NotEnoughUpdates.INSTANCE.config.hidden.compareMode = i;
updateSearch();
Utils.playPressSound();
} else if(Mouse.getEventButton() == 1) {
- manager.config.compareAscending.value.set(i, !manager.config.compareAscending.value.get(i));
+ NotEnoughUpdates.INSTANCE.config.hidden.compareAscending.set(i,
+ !NotEnoughUpdates.INSTANCE.config.hidden.compareAscending.get(i));
updateSearch();
Utils.playPressSound();
}
@@ -735,7 +744,7 @@ public class NEUOverlay extends Gui {
for(int i=0; i<sortIcons.length; i++) {
int sortIconX = rightSide-scaledITEM_SIZE-i*scaledItemPaddedSize;
if(mouseX >= sortIconX && mouseX <= sortIconX+scaledITEM_SIZE) {
- manager.config.sortMode.value = new Double(i);
+ NotEnoughUpdates.INSTANCE.config.hidden.sortMode = i;
updateSearch();
Utils.playPressSound();
}
@@ -747,35 +756,12 @@ public class NEUOverlay extends Gui {
}
//Clicking on "close info pane" button
- if(activeInfoPane instanceof SettingsInfoPane) {
- Utils.pushGuiScale(2);
-
- int widthN = Utils.peekGuiScale().getScaledWidth();
- int heightN = Utils.peekGuiScale().getScaledHeight();
- int mouseXN = Mouse.getX() * widthN / Minecraft.getMinecraft().displayWidth;
- int mouseYN = heightN - Mouse.getY() * heightN / Minecraft.getMinecraft().displayHeight - 1;
-
- if(mouseXN > widthN*getInfoPaneOffsetFactor()-getBoxPadding()-8 && mouseXN < widthN*getInfoPaneOffsetFactor()-getBoxPadding()+8) {
- if(mouseYN > getBoxPadding()-8 && mouseYN < getBoxPadding()+8) {
- if(Mouse.getEventButtonState() && Mouse.getEventButton() < 2) { //Left or right click up
- displayInformationPane(null);
-
- Utils.pushGuiScale(-1);
- Utils.pushGuiScale(-1);
- return true;
- }
- }
- }
-
- Utils.pushGuiScale(-1);
- } else {
- if(mouseX > width*getInfoPaneOffsetFactor()-getBoxPadding()-8 && mouseX < width*getInfoPaneOffsetFactor()-getBoxPadding()+8) {
- if(mouseY > getBoxPadding()-8 && mouseY < getBoxPadding()+8) {
- if(Mouse.getEventButtonState() && Mouse.getEventButton() < 2) { //Left or right click up
- displayInformationPane(null);
- Utils.pushGuiScale(-1);
- return true;
- }
+ if(mouseX > width*getInfoPaneOffsetFactor()-getBoxPadding()-8 && mouseX < width*getInfoPaneOffsetFactor()-getBoxPadding()+8) {
+ if(mouseY > getBoxPadding()-8 && mouseY < getBoxPadding()+8) {
+ if(Mouse.getEventButtonState() && Mouse.getEventButton() < 2) { //Left or right click up
+ displayInformationPane(null);
+ Utils.pushGuiScale(-1);
+ return true;
}
}
}
@@ -805,8 +791,9 @@ public class NEUOverlay extends Gui {
* Returns searchBarXSize, scaled by 0.8 if gui scale == AUTO.
*/
public int getSearchBarXSize() {
+ int searchBarXSize = NotEnoughUpdates.INSTANCE.config.toolbar.searchBarWidth;
if(Utils.peekGuiScale().getScaleFactor()==4) return (int)(searchBarXSize*0.8);
- return (int)(searchBarXSize);
+ return searchBarXSize;
}
/**
@@ -871,12 +858,14 @@ public class NEUOverlay extends Gui {
return false;
}
- if(Keyboard.isKeyDown(Keyboard.KEY_Y) && manager.config.dev.value) {
+ if(Keyboard.isKeyDown(Keyboard.KEY_Y) && NotEnoughUpdates.INSTANCE.config.hidden.dev) {
displayInformationPane(new DevInfoPane(this, manager));
- //displayInformationPane(new QOLInfoPane(this, manager));
}
if(Keyboard.getEventKeyState()) {
+ if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
+ searchBarHasFocus = false;
+ }
if(searchBarHasFocus) {
if(keyPressed == 1) {
searchBarHasFocus = false;
@@ -915,7 +904,7 @@ public class NEUOverlay extends Gui {
itemstack.set(hover);
}
} else if(!hoverInv) {
- Utils.pushGuiScale(manager.config.paneGuiScale.value.intValue());
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
int width = Utils.peekGuiScale().getScaledWidth();
int height = Utils.peekGuiScale().getScaledHeight();
@@ -950,7 +939,7 @@ public class NEUOverlay extends Gui {
}
if(internalname.get() != null) {
if(itemstack.get() != null) {
- if(manager.config.enableItemEditing.value && Keyboard.getEventCharacter() == 'k') {
+ if(NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing && Keyboard.getEventCharacter() == 'k') {
Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(manager,
internalname.get(), manager.getJsonForItem(itemstack.get())));
return true;
@@ -972,7 +961,7 @@ public class NEUOverlay extends Gui {
Minecraft.getMinecraft().thePlayer.inventory.addItemStackToInventory(
manager.jsonToStack(item));
}
- } else if(manager.config.enableItemEditing.value && Keyboard.getEventCharacter() == 'k') {
+ } else if(NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing && Keyboard.getEventCharacter() == 'k') {
Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(manager,
internalname.get(), item));
return true;
@@ -1034,16 +1023,16 @@ public class NEUOverlay extends Gui {
* Convenience functions that get various compare/sort modes from the config.
*/
private int getCompareMode() {
- return manager.config.compareMode.value.intValue();
+ return NotEnoughUpdates.INSTANCE.config.hidden.compareMode;
}
private int getSortMode() {
- return manager.config.sortMode.value.intValue();
+ return NotEnoughUpdates.INSTANCE.config.hidden.sortMode;
}
private List<Boolean> getCompareAscending() {
- return manager.config.compareAscending.value;
+ return NotEnoughUpdates.INSTANCE.config.hidden.compareAscending;
}
private List<String> getFavourites() {
- return manager.config.favourites.value;
+ return NotEnoughUpdates.INSTANCE.config.hidden.favourites;
}
/**
@@ -1133,7 +1122,7 @@ public class NEUOverlay extends Gui {
* Checks whether an item matches the current sort mode.
*/
public boolean checkMatchesSort(String internalname, JsonObject item) {
- if(!manager.config.showVanillaItems.value && item.has("vanilla") && item.get("vanilla").getAsBoolean()) {
+ if(!NotEnoughUpdates.INSTANCE.config.itemlist.showVanillaItems && item.has("vanilla") && item.get("vanilla").getAsBoolean()) {
return false;
}
@@ -1271,7 +1260,7 @@ public class NEUOverlay extends Gui {
}
public int getBoxPadding() {
- double panePadding = Math.max(0, Math.min(20, manager.config.panePadding.value));
+ double panePadding = Math.max(0, Math.min(20, NotEnoughUpdates.INSTANCE.config.itemlist.panePadding));
return (int)(panePadding*2/Utils.peekGuiScale().getScaleFactor()+5);
}
@@ -1315,7 +1304,7 @@ public class NEUOverlay extends Gui {
float scaleFMult = 1;
if(Utils.peekGuiScale().getScaleFactor()==4) scaleFMult *= 0.9f;
if(manager.auctionManager.customAH.isRenderOverAuctionView()) scaleFMult *= 0.8f;
- return (float)Math.max(0.5, Math.min(1.5, manager.config.paneWidthMult.value.floatValue()))*scaleFMult;
+ return (float)Math.max(0.5, Math.min(1.5, NotEnoughUpdates.INSTANCE.config.itemlist.paneWidthMult))*scaleFMult;
}
/**
@@ -1351,6 +1340,7 @@ public class NEUOverlay extends Gui {
}
public int getSearchBarYSize() {
+ int searchBarYSize = NotEnoughUpdates.INSTANCE.config.toolbar.searchBarHeight;
return Math.max(searchBarYSize/Utils.peekGuiScale().getScaleFactor(), ITEM_SIZE);
}
@@ -1596,7 +1586,7 @@ public class NEUOverlay extends Gui {
int width = Minecraft.getMinecraft().displayWidth;
int height = Minecraft.getMinecraft().displayHeight;
- if(manager.config.bgBlurFactor.value <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
if(blurOutputHorz == null) {
blurOutputHorz = new Framebuffer(width, height, false);
@@ -1634,8 +1624,11 @@ public class NEUOverlay extends Gui {
} catch(Exception e) { }
}
if(blurShaderHorz != null && blurShaderVert != null) {
- if(manager.config.bgBlurFactor.value != lastBgBlurFactor) {
- lastBgBlurFactor = Math.max(0, Math.min(50, manager.config.bgBlurFactor.value));
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor != lastBgBlurFactor) {
+ if(blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) {
+ return;
+ }
+ lastBgBlurFactor = Math.max(0, Math.min(50, NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor));
blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)lastBgBlurFactor);
blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)lastBgBlurFactor);
}
@@ -1654,7 +1647,7 @@ public class NEUOverlay extends Gui {
* Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
*/
public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) {
- if(manager.config.bgBlurFactor.value <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor <= 0 || !OpenGlHelper.isFramebufferEnabled()) return;
float uMin = x/(float)width;
float uMax = (x+blurWidth)/(float)width;
@@ -1670,7 +1663,7 @@ public class NEUOverlay extends Gui {
}
public void updateGuiGroupSize() {
- Utils.pushGuiScale(manager.config.paneGuiScale.value.intValue());
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
int width = Utils.peekGuiScale().getScaledWidth();
int height = Utils.peekGuiScale().getScaledHeight();
@@ -1702,15 +1695,15 @@ public class NEUOverlay extends Gui {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
Utils.resetGuiScale();
- Utils.pushGuiScale(manager.config.paneGuiScale.value.intValue());
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.itemlist.paneGuiScale);
int width = Utils.peekGuiScale().getScaledWidth();
int height = Utils.peekGuiScale().getScaledHeight();
int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
- if(showVanillaLast != manager.config.showVanillaItems.value) {
- showVanillaLast = manager.config.showVanillaItems.value;
+ if(showVanillaLast != NotEnoughUpdates.INSTANCE.config.itemlist.showVanillaItems) {
+ showVanillaLast = NotEnoughUpdates.INSTANCE.config.itemlist.showVanillaItems;
updateSearch();
}
@@ -1740,11 +1733,11 @@ public class NEUOverlay extends Gui {
yaw++;
yaw %= 360;
- bg = new Color(SpecialColour.specialToChromaRGB(manager.config.paneBackgroundColour.value), true);
- fg = new Color(SpecialColour.specialToChromaRGB(manager.config.itemBackgroundColour.value));
- Color fgCustomOpacity = new Color(SpecialColour.specialToChromaRGB(manager.config.itemBackgroundColour.value), true);
+ bg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.backgroundColour), true);
+ fg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour));
+ Color fgCustomOpacity = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour), true);
- Color fgFavourite2 = new Color(SpecialColour.specialToChromaRGB(manager.config.itemFavouriteColour.value), true);
+ Color fgFavourite2 = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.favouriteColour), true);
Color fgFavourite = new Color((int)(fgFavourite2.getRed()*0.8f), (int)(fgFavourite2.getGreen()*0.8f),
(int)(fgFavourite2.getBlue()*0.8f), fgFavourite2.getAlpha());
@@ -1791,7 +1784,7 @@ public class NEUOverlay extends Gui {
int rightSide = leftSide+paneWidth-getBoxPadding()-getItemBoxXPadding();
//Tab
- if(!manager.config.disableItemTabOpen.value) {
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.tabOpen) {
Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow);
GlStateManager.color(1f, 1f, 1f, 0.3f);
Utils.drawTexturedRect(width-itemPaneTabOffset.getValue()*64/20f, height/2f - 32, 64, 64);
@@ -1945,7 +1938,7 @@ public class NEUOverlay extends Gui {
checkFramebufferSizes(width, height);
- if(redrawItems || !manager.config.cacheRenderedItempane.value) {
+ if(redrawItems || !NotEnoughUpdates.INSTANCE.config.hidden.cacheRenderedItempane) {
renderItemsToImage(width, height, fgFavourite2, fgFavourite, fgCustomOpacity, true, true);
redrawItems = false;
}
@@ -2014,17 +2007,7 @@ public class NEUOverlay extends Gui {
GlStateManager.color(1f, 1f, 1f, 1f);
Minecraft.getMinecraft().getTextureManager().bindTexture(close);
- if(activeInfoPane instanceof SettingsInfoPane) {
- Utils.pushGuiScale(2);
-
- int widthN = Utils.peekGuiScale().getScaledWidth();
- int rightSideN = (int)(widthN*getInfoPaneOffsetFactor());
- Utils.drawTexturedRect(rightSideN-getBoxPadding()-8, getBoxPadding()-8, 16, 16);
-
- Utils.pushGuiScale(-1);
- } else {
- Utils.drawTexturedRect(rightSide-getBoxPadding()-8, getBoxPadding()-8, 16, 16);
- }
+ Utils.drawTexturedRect(rightSide-getBoxPadding()-8, getBoxPadding()-8, 16, 16);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}
@@ -2034,80 +2017,8 @@ public class NEUOverlay extends Gui {
List<String> text = manager.jsonToStack(json).getTooltip(Minecraft.getMinecraft().thePlayer, false);
String internalname = json.get("internalname").getAsString();
- JsonObject auctionInfo = manager.auctionManager.getItemAuctionInfo(internalname);
- JsonObject bazaarInfo = manager.auctionManager.getBazaarInfo(internalname);
- float lowestBinAvg = manager.auctionManager.getItemAvgBin(internalname);
-
- int lowestBin = manager.auctionManager.getLowestBin(internalname);
- APIManager.CraftInfo craftCost = manager.auctionManager.getCraftCost(internalname);
-
- boolean hasAuctionPrice = !manager.config.invAuctionPrice.value && auctionInfo != null;
- boolean hasBazaarPrice = !manager.config.invBazaarPrice.value && bazaarInfo != null;
- boolean hasLowestBinPrice = !manager.config.invAuctionPrice.value && lowestBin > 0 && manager.config.advancedPriceInfo.value;
- boolean hasLowestBinAvgPrice = !manager.config.invAuctionPrice.value && lowestBinAvg > 0;
-
- NumberFormat format = NumberFormat.getInstance(Locale.US);
-
- if(hasAuctionPrice || hasBazaarPrice || hasLowestBinAvgPrice || hasLowestBinPrice) text.add("");
- if(hasLowestBinPrice) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
- }
- if(hasLowestBinAvgPrice) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
- }
- if(hasAuctionPrice) {
- int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins");
- if(manager.config.advancedPriceInfo.value) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
- }
- if(auctionInfo.has("clean_price")) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
- if(manager.config.advancedPriceInfo.value) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
- }
- }
-
- } else if(hasBazaarPrice) {
- int stackMultiplier = 1;
- int shiftStackMultiplier = 64;
- if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- stackMultiplier = shiftStackMultiplier;
- } else {
- text.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]");
- }
- if(bazaarInfo.has("avg_buy")) {
- int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins");
- }
- if(bazaarInfo.has("avg_sell")) {
- int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins");
- }
- if(manager.config.advancedPriceInfo.value) {
- if(bazaarInfo.has("curr_buy")) {
- int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins");
- }
- if(bazaarInfo.has("curr_sell")) {
- int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier;
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins");
- }
- }
- }
- if((hasAuctionPrice || hasBazaarPrice) && craftCost.fromRecipe) {
- text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
+ if(!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) {
+ ItemPriceInformation.addToTooltip(text, internalname);
}
boolean hasClick = false;
@@ -2345,7 +2256,7 @@ public class NEUOverlay extends Gui {
Minecraft.getMinecraft().getTextureManager().bindTexture(item_mask);
if (getFavourites().contains(json.get("internalname").getAsString())) {
- if(manager.config.itemStyle.value) {
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.itemStyle == 0) {
GlStateManager.color(fgFavourite2.getRed() / 255f, fgFavourite2.getGreen() / 255f,
fgFavourite2.getBlue() / 255f, fgFavourite2.getAlpha() / 255f);
Utils.drawTexturedRect(x - 1, y - 1, ITEM_SIZE + 2, ITEM_SIZE + 2, GL11.GL_NEAREST);
@@ -2358,7 +2269,7 @@ public class NEUOverlay extends Gui {
drawRect(x, y, x+ITEM_SIZE, y+ITEM_SIZE, fgFavourite.getRGB());
}
} else {
- if(manager.config.itemStyle.value) {
+ if(NotEnoughUpdates.INSTANCE.config.itemlist.itemStyle == 0) {
GlStateManager.color(fgCustomOpacity.getRed() / 255f, fgCustomOpacity.getGreen() / 255f,
fgCustomOpacity.getBlue() / 255f, fgCustomOpacity.getAlpha() / 255f);
Utils.drawTexturedRect(x - 1, y - 1, ITEM_SIZE + 2, ITEM_SIZE + 2, GL11.GL_NEAREST);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index a7f37935..897db723 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -1,14 +1,14 @@
package io.github.moulberry.notenoughupdates;
import com.google.common.collect.Sets;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import com.mojang.authlib.Agent;
-import com.mojang.authlib.exceptions.AuthenticationException;
-import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
-import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.commands.SimpleCommand;
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
+import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics;
import io.github.moulberry.notenoughupdates.dungeons.DungeonMap;
@@ -17,12 +17,19 @@ import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor;
import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes;
import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes;
import io.github.moulberry.notenoughupdates.infopanes.CollectionLogInfoPane;
-import io.github.moulberry.notenoughupdates.infopanes.SettingsInfoPane;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
+import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
+import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay;
+import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
+import io.github.moulberry.notenoughupdates.miscgui.HelpGUI;
+import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
-import io.github.moulberry.notenoughupdates.questing.GuiQuestLine;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.block.material.MapColor;
@@ -59,14 +66,10 @@ import org.apache.commons.lang3.text.translate.UnicodeUnescaper;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
-import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.io.*;
import java.lang.management.ManagementFactory;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.List;
@@ -86,6 +89,9 @@ public class NotEnoughUpdates {
public NEUManager manager;
public NEUOverlay overlay;
+ public NEUConfig config;
+
+ private File configFile;
private static final long CHAT_MSG_COOLDOWN = 200;
private long lastChatMessage = 0;
@@ -201,13 +207,6 @@ public class NotEnoughUpdates {
}
});
-
- SimpleCommand questingCommand = new SimpleCommand("neuquest", new SimpleCommand.ProcessCommandRunnable() {
- public void processCommand(ICommandSender sender, String[] args) {
- openGui = new GuiQuestLine();
- }
- });
-
SimpleCommand gamemodesCommand = new SimpleCommand("neugamemodes", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
boolean upgradeOverride = args.length == 1 && args[0].equals("upgradeOverride");
@@ -519,7 +518,7 @@ public class NotEnoughUpdates {
builder.append("[Loaded Mods]").append("[").append(activeModCount).append("/").append(modCount).append("]").append("\n");
builder.append("[Forge]").append("[").append(ForgeVersion.getVersion()).append("]").append("\n");
builder.append("# Neu Settings").append("\n");
- builder.append("[API Key]").append("[").append(!INSTANCE.manager.config.apiKey.value.isEmpty()).append("]").append("\n");
+ builder.append("[API Key]").append("[").append(!config.apiKey.apiKey.isEmpty()).append("]").append("\n");
builder.append("[On Skyblock]").append("[").append(hasSkyblockScoreboard).append("]").append("\n");
builder.append("[Mod Version]").append("[").append(Loader.instance().getIndexedModList().get(MODID).getSource().getName()).append("]").append("\n");
builder.append("# Repo Stats").append("\n");
@@ -566,7 +565,7 @@ public class NotEnoughUpdates {
} catch(Exception e) {
}
}
- if (manager.config.apiKey.value == null || manager.config.apiKey.value.trim().isEmpty()) {
+ if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
"Can't view profile, apikey is not set. Run /api new and put the result in settings."));
} else if (args.length == 0) {
@@ -717,7 +716,7 @@ public class NotEnoughUpdates {
} catch(Exception ignored) { }
}
- if(!manager.config.dev.value) {
+ if(!config.hidden.dev) {
openGui = new GuiDungeonMapEditor();
return;
}
@@ -802,28 +801,19 @@ public class NotEnoughUpdates {
SimpleCommand settingsCommand = new SimpleCommand("neu", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- overlay.displayInformationPane(new SettingsInfoPane(overlay, manager));
- if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
- openGui = new GuiInventory(Minecraft.getMinecraft().thePlayer);
- }
+ openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config));
}
});
SimpleCommand settingsCommand2 = new SimpleCommand("neusettings", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- overlay.displayInformationPane(new SettingsInfoPane(overlay, manager));
- if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
- openGui = new GuiInventory(Minecraft.getMinecraft().thePlayer);
- }
+ openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config));
}
});
SimpleCommand settingsCommand3 = new SimpleCommand("neuconfig", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
- overlay.displayInformationPane(new SettingsInfoPane(overlay, manager));
- if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
- openGui = new GuiInventory(Minecraft.getMinecraft().thePlayer);
- }
+ openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config));
}
});
@@ -841,7 +831,7 @@ public class NotEnoughUpdates {
if(!hasSkyblockScoreboard()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+
"You must be on Skyblock to use this feature."));
- } else if(manager.config.apiKey.value == null || manager.config.apiKey.value.trim().isEmpty()) {
+ } else if(config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+
"Can't open NeuAH, apikey is not set. Run /api new and put the result in settings."));
} else {
@@ -855,6 +845,8 @@ public class NotEnoughUpdates {
}
});
+ private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
+
/**
* Instantiates NEUIo, NEUManager and NEUOverlay instances. Registers keybinds and adds a shutdown hook to clear tmp folder.
* @param event
@@ -863,20 +855,33 @@ public class NotEnoughUpdates {
public void preinit(FMLPreInitializationEvent event) {
INSTANCE = this;
+ File f = new File(event.getModConfigurationDirectory(), "notenoughupdates");
+ f.mkdirs();
+
+ configFile = new File(f, "configNew.json");
+
+ if(configFile.exists()) {
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) {
+ config = gson.fromJson(reader, NEUConfig.class);
+ } catch(Exception e) { }
+ }
+
+ if(config == null) {
+ config = new NEUConfig();
+ saveConfig();
+ }
+
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new NEUEventListener(this));
MinecraftForge.EVENT_BUS.register(CapeManager.getInstance());
MinecraftForge.EVENT_BUS.register(new SBGamemodes());
+ MinecraftForge.EVENT_BUS.register(new EnchantingSolvers());
MinecraftForge.EVENT_BUS.register(new CalendarOverlay());
MinecraftForge.EVENT_BUS.register(SBInfo.getInstance());
MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE);
MinecraftForge.EVENT_BUS.register(new DungeonMap());
MinecraftForge.EVENT_BUS.register(new SunTzu());
- //MinecraftForge.EVENT_BUS.register(new BetterPortals());
-
- File f = new File(event.getModConfigurationDirectory(), "notenoughupdates");
- f.mkdirs();
ClientCommandHandler.instance.registerCommand(collectionLogCommand);
ClientCommandHandler.instance.registerCommand(cosmeticsCommand);
ClientCommandHandler.instance.registerCommand(linksCommand);
@@ -900,6 +905,8 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(dungeonWinTest);
ClientCommandHandler.instance.registerCommand(calendarCommand);
+ BackgroundBlur.registerListener();
+
manager = new NEUManager(this, f);
manager.loadItemInformation();
overlay = new NEUOverlay(manager);
@@ -910,54 +917,26 @@ public class NotEnoughUpdates {
}
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
- try {
- File tmp = new File(f, "tmp");
- if(tmp.exists()) {
- for(File tmpFile : tmp.listFiles()) {
- tmpFile.delete();
- }
- tmp.delete();
+ File tmp = new File(f, "tmp");
+ if(tmp.exists()) {
+ for(File tmpFile : tmp.listFiles()) {
+ tmpFile.delete();
}
+ tmp.delete();
+ }
- manager.saveConfig();
- } catch(IOException e) {}
+ saveConfig();
}));
+ }
- //TODO: login code. Ignore this, used for testing.
- if(manager.config.dev.value) {
- try {
- Field field = Minecraft.class.getDeclaredField("session");
- YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication)
- new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString())
- .createUserAuthentication(Agent.MINECRAFT);
- auth.setUsername("james.jenour@protonmail.com");
- auth.setPassword("Miranda728%");
-
- JPasswordField pf = new JPasswordField();
- JOptionPane.showConfirmDialog(null,
- pf,
- "Enter password:",
- JOptionPane.DEFAULT_OPTION,
- JOptionPane.PLAIN_MESSAGE);
- auth.setPassword(new String(pf.getPassword()));
- System.out.print("Attempting login...");
-
- auth.logIn();
-
- Session session = new Session(auth.getSelectedProfile().getName(),
- auth.getSelectedProfile().getId().toString().replace("-", ""),
- auth.getAuthenticatedToken(),
- auth.getUserType().getName());
-
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
-
- field.setAccessible(true);
- field.set(Minecraft.getMinecraft(), session);
- } catch (NoSuchFieldException | AuthenticationException | IllegalAccessException e) {
+ public void saveConfig() {
+ try {
+ configFile.createNewFile();
+
+ try(BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) {
+ writer.write(gson.toJson(config));
}
- }
+ } catch(IOException ignored) {}
}
/**
@@ -1037,7 +1016,7 @@ public class NotEnoughUpdates {
}
public boolean isOnSkyblock() {
- if(!manager.config.onlyShowOnSkyblock.value) return true;
+ if(!config.misc.onlyShowOnSkyblock) return true;
return hasSkyblockScoreboard();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index 4013a790..32592397 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -4,6 +4,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -173,8 +174,9 @@ public class APIManager {
public void tick() {
customAH.tick();
long currentTime = System.currentTimeMillis();
- if(manager.config.neuAuctionHouse.value && manager.config.apiKey.value != null &&
- !manager.config.apiKey.value.isEmpty()) {
+ if(NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse &&
+ NotEnoughUpdates.INSTANCE.config.apiKey.apiKey != null &&
+ !NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty()) {
if(currentTime - lastAuctionUpdate > 60*1000) {
lastAuctionUpdate = currentTime;
updatePageTick();
@@ -250,13 +252,13 @@ public class APIManager {
private void ahNotification() {
playerBidsNotified.retainAll(playerBids);
playerBidsFinishedNotified.retainAll(playerBids);
- if(manager.config.ahNotification.value <= 0) {
+ if(NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.ahNotification <= 0) {
return;
}
for(String aucid : playerBids) {
Auction auc = auctionMap.get(aucid);
if(!playerBidsNotified.contains(aucid)) {
- if(auc != null && auc.end - System.currentTimeMillis() < 1000*60*manager.config.ahNotification.value) {
+ if(auc != null && auc.end - System.currentTimeMillis() < 1000*60*NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.ahNotification) {
ChatComponentText message = new ChatComponentText(
EnumChatFormatting.YELLOW+"The " + auc.getStack().getDisplayName() + EnumChatFormatting.YELLOW + " you have bid on is ending soon! Click here to view.");
ChatStyle clickEvent = new ChatStyle().setChatClickEvent(
@@ -618,7 +620,7 @@ public class APIManager {
}
public void updateBazaar() {
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/bazaar", new HashMap<>(), (jsonObject) -> {
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/bazaar", new HashMap<>(), (jsonObject) -> {
if(!jsonObject.get("success").getAsBoolean()) return;
craftCost.clear();
@@ -890,7 +892,7 @@ public class APIManager {
args.put("page", "0");
AtomicInteger totalPages = new AtomicInteger(1);
AtomicInteger currentPages = new AtomicInteger(0);
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/auctions",
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/auctions",
args, jsonObject -> {
if (jsonObject.get("success").getAsBoolean()) {
pages.put(0, jsonObject);
@@ -901,7 +903,7 @@ public class APIManager {
int j = i;
HashMap<String, String> args2 = new HashMap<>();
args2.put("page", "" + i);
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/auctions",
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/auctions",
args2, jsonObject2 -> {
if (jsonObject2.get("success").getAsBoolean()) {
pages.put(j, jsonObject2);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
index f7b22db0..aad69686 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.auction;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.ItemPriceInformation;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -41,7 +42,7 @@ import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
public class CustomAH extends Gui {
@@ -206,7 +207,7 @@ public class CustomAH extends Gui {
}
public void tick() {
- if(!manager.config.neuAuctionHouse.value) return;
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) return;
if(Minecraft.getMinecraft().currentScreen instanceof CustomAHGui || renderOverAuctionView) {
if(shouldUpdateSearch) updateSearch();
if(shouldSortItems) {
@@ -340,43 +341,14 @@ public class CustomAH extends Gui {
}
}
- if(manager.config.auctionPriceInfo.value) {
+ if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) {
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(auc.getStack());
if(internalname != null) {
- tooltip.add("");
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
+ tooltip.add("");
tooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]");
} else {
- JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
-
- boolean hasAuctionPrice = auctionInfo != null;
-
- int lowestBin = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname);
-
- APIManager.CraftInfo craftCost = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(internalname);
-
- if(lowestBin > 0) {
- tooltip.add(EnumChatFormatting.GRAY+"Lowest BIN: "+
- EnumChatFormatting.GOLD+format.format(lowestBin)+" coins");
- }
- if(hasAuctionPrice) {
- int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
- tooltip.add(EnumChatFormatting.GRAY+"AH Price: "+
- EnumChatFormatting.GOLD+format.format(auctionPrice)+" coins");
- tooltip.add(EnumChatFormatting.GRAY+"AH Sales: "+
- EnumChatFormatting.GOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
- if(auctionInfo.has("clean_price")) {
- tooltip.add(EnumChatFormatting.GRAY+"AH Price (Clean): "+
- EnumChatFormatting.GOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
- tooltip.add(EnumChatFormatting.GRAY+"AH Sales (Clean): "+
- EnumChatFormatting.GOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
- }
-
- }
- if(craftCost.fromRecipe) {
- tooltip.add(EnumChatFormatting.GRAY+"Raw Craft Cost: "+
- EnumChatFormatting.GOLD+format.format((int)craftCost.craftCost)+" coins");
- }
+ ItemPriceInformation.addToTooltip(tooltip, internalname);
}
}
}
@@ -858,7 +830,7 @@ public class CustomAH extends Gui {
int maxItemScroll = Math.max(0, totalItems - (5+splits)*9);
itemsScroll = Math.min(itemsScroll, maxItemScroll);
- if(manager.config.neuAuctionHouse.value) {
+ if(NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
out:
for(int i=0; i<5+splits; i++) {
int itemY = guiTop + i*18 + 18;
@@ -904,7 +876,7 @@ public class CustomAH extends Gui {
this.drawTexturedModalRect(guiLeft+175, guiTop+18+(int)((95+ySplitSize*2)*scrollAmount),
256-(scrollClicked?12:24), 0, 12, 15);
- if(!manager.config.neuAuctionHouse.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
Utils.drawStringCentered(EnumChatFormatting.RED+"NEUAH is DISABLED! Enable in /neusettings.",
Minecraft.getMinecraft().fontRendererObj, guiLeft+getXSize()/2, guiTop+getYSize()/2-5, true, 0);
}
@@ -1052,7 +1024,7 @@ public class CustomAH extends Gui {
}
public void handleMouseInput() {
- if(!manager.config.neuAuctionHouse.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
return;
}
@@ -1076,7 +1048,7 @@ public class CustomAH extends Gui {
mouseClickMove(mouseX, mouseY, this.eventButton, l);
}
- if(!manager.config.disableAhScroll.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.disableAhScroll) {
int dWheel = Mouse.getEventDWheel();
dWheel = Math.max(-1, Math.min(1, dWheel));
@@ -1213,7 +1185,7 @@ public class CustomAH extends Gui {
private ExecutorService es = Executors.newSingleThreadExecutor();
public void updateSearch() {
- if(!manager.config.neuAuctionHouse.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
return;
}
@@ -1321,7 +1293,7 @@ public class CustomAH extends Gui {
}
public void sortItems() throws ConcurrentModificationException {
- if(!manager.config.neuAuctionHouse.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
return;
}
@@ -1372,7 +1344,7 @@ public class CustomAH extends Gui {
}
public boolean keyboardInput() {
- if(!manager.config.neuAuctionHouse.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.enableNeuAuctionHouse) {
return false;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
new file mode 100644
index 00000000..30d056b4
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
@@ -0,0 +1,181 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.shader.Framebuffer;
+import net.minecraft.client.shader.Shader;
+import net.minecraft.util.Matrix4f;
+import net.minecraftforge.client.event.EntityViewRenderEvent;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL30;
+
+public class BackgroundBlur {
+
+ private static int fogColour = 0;
+ private static boolean registered = false;
+ public static void registerListener() {
+ if(!registered) {
+ MinecraftForge.EVENT_BUS.register(new BackgroundBlur());
+ }
+ }
+
+ private boolean shouldBlur = true;
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if(Minecraft.getMinecraft().theWorld != null) {
+ shouldBlur = true;
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onScreenRender(RenderGameOverlayEvent.Pre event) {
+ if(shouldBlur && event.type == RenderGameOverlayEvent.ElementType.ALL) {
+ shouldBlur = false;
+ blurBackground();
+ }
+ }
+
+ @SubscribeEvent
+ public void onFogColour(EntityViewRenderEvent.FogColors event) {
+ fogColour = 0xff000000;
+ fogColour |= ((int)(event.red*255) & 0xFF) << 16;
+ fogColour |= ((int)(event.green*255) & 0xFF) << 8;
+ fogColour |= (int)(event.blue*255) & 0xFF;
+ }
+
+ private static Shader blurShaderHorz = null;
+ private static Framebuffer blurOutputHorz = null;
+ private static Shader blurShaderVert = null;
+ private static Framebuffer blurOutputVert = null;
+
+ /**
+ * Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
+ * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis).
+ *
+ * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
+ * apply scales and translations manually.
+ */
+ private static Matrix4f createProjectionMatrix(int width, int height) {
+ Matrix4f projMatrix = new Matrix4f();
+ projMatrix.setIdentity();
+ projMatrix.m00 = 2.0F / (float)width;
+ projMatrix.m11 = 2.0F / (float)(-height);
+ projMatrix.m22 = -0.0020001999F;
+ projMatrix.m33 = 1.0F;
+ projMatrix.m03 = -1.0F;
+ projMatrix.m13 = 1.0F;
+ projMatrix.m23 = -1.0001999F;
+ return projMatrix;
+ }
+
+ private static double lastBgBlurFactor = -1;
+ private static void blurBackground() {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+
+ int width = Minecraft.getMinecraft().displayWidth;
+ int height = Minecraft.getMinecraft().displayHeight;
+
+ GlStateManager.matrixMode(GL11.GL_PROJECTION);
+ GlStateManager.loadIdentity();
+ GlStateManager.ortho(0.0D, width, height, 0.0D, 1000.0D, 3000.0D);
+ GlStateManager.matrixMode(GL11.GL_MODELVIEW);
+ GlStateManager.loadIdentity();
+ GlStateManager.translate(0.0F, 0.0F, -2000.0F);
+
+ if(blurOutputHorz == null) {
+ blurOutputHorz = new Framebuffer(width, height, false);
+ blurOutputHorz.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputVert == null) {
+ blurOutputVert = new Framebuffer(width, height, false);
+ blurOutputVert.setFramebufferFilter(GL11.GL_NEAREST);
+ }
+ if(blurOutputHorz == null || blurOutputVert == null) {
+ return;
+ }
+ if(blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
+ blurOutputHorz.createBindFramebuffer(width, height);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ if(blurOutputVert.framebufferWidth != width || blurOutputVert.framebufferHeight != height) {
+ blurOutputVert.createBindFramebuffer(width, height);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+
+ if(blurShaderHorz == null) {
+ try {
+ blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ blurOutputVert, blurOutputHorz);
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderVert == null) {
+ try {
+ blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
+ blurOutputHorz, blurOutputVert);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
+ } catch(Exception e) { }
+ }
+ if(blurShaderHorz != null && blurShaderVert != null) {
+ if(blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) {
+ //Corrupted shader?
+ return;
+ }
+ if(15 != lastBgBlurFactor) {
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set((float)15);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set((float)15);
+ lastBgBlurFactor = 15;
+ }
+ GL11.glPushMatrix();
+ GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
+ GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, blurOutputVert.framebufferObject);
+ GL30.glBlitFramebuffer(0, 0, width, height,
+ 0, 0, width, height,
+ GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
+
+ blurShaderHorz.loadShader(0);
+ blurShaderVert.loadShader(0);
+ GlStateManager.enableDepth();
+ GL11.glPopMatrix();
+
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
+ }
+ }
+
+ /**
+ * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen.
+ * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight]
+ */
+ public static void renderBlurredBackground(int screenWidth, int screenHeight,
+ int x, int y, int blurWidth, int blurHeight) {
+ if(!OpenGlHelper.isFramebufferEnabled()) return;
+ if(blurOutputVert == null) return;
+
+ float uMin = x/(float)screenWidth;
+ float uMax = (x+blurWidth)/(float)screenWidth;
+ float vMin = (screenHeight-y)/(float)screenHeight;
+ float vMax = (screenHeight-y-blurHeight)/(float)screenHeight;
+
+ GlStateManager.depthMask(false);
+ Gui.drawRect(x, y, x+blurWidth, y+blurHeight, fogColour);
+ blurOutputVert.bindFramebufferTexture();
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ RenderUtils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax);
+ blurOutputVert.unbindFramebufferTexture();
+ GlStateManager.depthMask(true);
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java
new file mode 100644
index 00000000..9509c332
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java
@@ -0,0 +1,95 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import java.awt.*;
+
+public class ChromaColour {
+
+ public static String special(int chromaSpeed, int alpha, int rgb) {
+ return special(chromaSpeed, alpha, (rgb & 0xFF0000) >> 16, (rgb & 0x00FF00) >> 8, (rgb & 0x0000FF));
+ }
+
+ private static final int RADIX = 10;
+
+ public static String special(int chromaSpeed, int alpha, int r, int g, int b) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Integer.toString(chromaSpeed, RADIX)).append(":");
+ sb.append(Integer.toString(alpha, RADIX)).append(":");
+ sb.append(Integer.toString(r, RADIX)).append(":");
+ sb.append(Integer.toString(g, RADIX)).append(":");
+ sb.append(Integer.toString(b, RADIX));
+ return sb.toString();
+ }
+
+ private static int[] decompose(String csv) {
+ String[] split = csv.split(":");
+
+ int[] arr = new int[split.length];
+
+
+ for(int i=0; i<split.length; i++) {
+ arr[i] = Integer.parseInt(split[split.length-1-i], RADIX);
+ }
+ return arr;
+ }
+
+ public static int specialToSimpleRGB(String special) {
+ int[] d = decompose(special);
+ int r = d[2];
+ int g = d[1];
+ int b = d[0];
+ int a = d[3];
+ int chr = d[4];
+
+ return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
+ }
+
+ public static int getSpeed(String special) {
+ return decompose(special)[4];
+ }
+
+ public static float getSecondsForSpeed(int speed) {
+ return (255-speed)/254f*(MAX_CHROMA_SECS-MIN_CHROMA_SECS)+MIN_CHROMA_SECS;
+ }
+
+ private static final int MIN_CHROMA_SECS = 1;
+ private static final int MAX_CHROMA_SECS = 60;
+
+ public static long startTime = -1;
+ public static int specialToChromaRGB(String special) {
+ if(startTime < 0) startTime = System.currentTimeMillis();
+
+ int[] d = decompose(special);
+ int chr = d[4];
+ int a = d[3];
+ int r = d[2];
+ int g = d[1];
+ int b = d[0];
+
+ float[] hsv = Color.RGBtoHSB(r, g, b, null);
+
+ if(chr > 0) {
+ float seconds = getSecondsForSpeed(chr);
+ hsv[0] += (System.currentTimeMillis()-startTime)/1000f/seconds;
+ hsv[0] %= 1;
+ if(hsv[0] < 0) hsv[0] += 1;
+ }
+
+ return (a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF);
+ }
+
+ public static int rotateHue(int argb, int degrees) {
+ int a = (argb >> 24) & 0xFF;
+ int r = (argb >> 16) & 0xFF;
+ int g = (argb >> 8) & 0xFF;
+ int b = (argb) & 0xFF;
+
+ float[] hsv = Color.RGBtoHSB(r, g, b, null);
+
+ hsv[0] += degrees/360f;
+ hsv[0] %= 1;
+
+ return (a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF);
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GlScissorStack.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GlScissorStack.java
new file mode 100644
index 00000000..f70bec40
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GlScissorStack.java
@@ -0,0 +1,87 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import org.lwjgl.opengl.GL11;
+
+import java.util.LinkedList;
+
+public class GlScissorStack {
+
+ private static class Bounds {
+ int left;
+ int top;
+ int right;
+ int bottom;
+
+ public Bounds(int left, int top, int right, int bottom) {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+
+ public Bounds createSubBound(int left, int top, int right, int bottom) {
+ left = Math.max(left, this.left);
+ top = Math.max(top, this.top);
+ right = Math.min(right, this.right);
+ bottom = Math.min(bottom, this.bottom);
+
+ if(top > bottom) {
+ top = bottom;
+ }
+ if(left > right) {
+ left = right;
+ }
+
+ return new Bounds(left, top, right, bottom);
+ }
+
+ public void set(ScaledResolution scaledResolution) {
+ int height = Minecraft.getMinecraft().displayHeight;
+ int scale = scaledResolution.getScaleFactor();
+ GL11.glScissor(left*scale, height-bottom*scale, (right-left)*scale, (bottom-top)*scale);
+ }
+ }
+
+ private static LinkedList<Bounds> boundsStack = new LinkedList<>();
+
+ public static void push(int left, int top, int right, int bottom, ScaledResolution scaledResolution) {
+ if(right < left) {
+ int temp = right;
+ right = left;
+ left = temp;
+ }
+ if(bottom < top) {
+ int temp = bottom;
+ bottom = top;
+ top = temp;
+ }
+ if(boundsStack.isEmpty()) {
+ boundsStack.push(new Bounds(left, top, right, bottom));
+ } else {
+ boundsStack.push(boundsStack.peek().createSubBound(left, top, right, bottom));
+ }
+ if(!boundsStack.isEmpty()) {
+ boundsStack.peek().set(scaledResolution);
+ }
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
+ }
+
+ public static void pop(ScaledResolution scaledResolution) {
+ if(!boundsStack.isEmpty()) {
+ boundsStack.pop();
+ }
+ if(boundsStack.isEmpty()) {
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ } else {
+ boundsStack.peek().set(scaledResolution);
+ }
+ }
+
+ public static void clear() {
+ boundsStack.clear();
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElement.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElement.java
new file mode 100644
index 00000000..9210d1fb
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElement.java
@@ -0,0 +1,8 @@
+package io.github.moulberry.notenoughupdates.core;
+
+public abstract class GuiElement {
+
+ public abstract void render();
+ public abstract boolean mouseInput(int mouseX, int mouseY);
+ public abstract boolean keyboardInput();
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java
new file mode 100644
index 00000000..97fc3dcc
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java
@@ -0,0 +1,118 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.util.GuiTextures;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Mouse;
+
+import java.util.function.Consumer;
+
+public class GuiElementBoolean extends GuiElement {
+
+ public int x;
+ public int y;
+ private boolean value;
+ private int clickRadius;
+ private Consumer<Boolean> toggleCallback;
+
+ private boolean previewValue;
+ private int animation = 0;
+ private long lastMillis = 0;
+
+ private static final int xSize = 48;
+ private static final int ySize = 14;
+
+ public GuiElementBoolean(int x, int y, boolean value, Consumer<Boolean> toggleCallback) {
+ this(x, y, value, 0, toggleCallback);
+ }
+
+ public GuiElementBoolean(int x, int y, boolean value, int clickRadius, Consumer<Boolean> toggleCallback) {
+ this.x = x;
+ this.y = y;
+ this.value = value;
+ this.previewValue = value;
+ this.clickRadius = clickRadius;
+ this.toggleCallback = toggleCallback;
+ }
+
+ @Override
+ public void render() {
+ GlStateManager.color(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.BAR);
+ RenderUtils.drawTexturedRect(x, y, xSize, ySize);
+
+ ResourceLocation buttonLoc = GuiTextures.ON;
+ long currentMillis = System.currentTimeMillis();
+ long deltaMillis = currentMillis - lastMillis;
+ lastMillis = currentMillis;
+ boolean passedLimit = false;
+ if(previewValue != value) {
+ if((previewValue && animation > 12) ||
+ (!previewValue && animation < 24)) {
+ passedLimit = true;
+ }
+ }
+ if(previewValue != passedLimit) {
+ animation += deltaMillis/10;
+ } else {
+ animation -= deltaMillis/10;
+ }
+ lastMillis -= deltaMillis%10;
+
+ if(previewValue == value) {
+ animation = Math.max(0, Math.min(36, animation));
+ } else if(!passedLimit) {
+ if(previewValue) {
+ animation = Math.max(0, Math.min(12, animation));
+ } else {
+ animation = Math.max(24, Math.min(36, animation));
+ }
+ } else {
+ if(previewValue) {
+ animation = Math.max(12, animation);
+ } else {
+ animation = Math.min(24, animation);
+ }
+ }
+
+ int animation = (int)(LerpUtils.sigmoidZeroOne(this.animation/36f)*36);
+ if(animation < 3) {
+ buttonLoc = GuiTextures.OFF;
+ } else if(animation < 13) {
+ buttonLoc = GuiTextures.ONE;
+ } else if(animation < 23) {
+ buttonLoc = GuiTextures.TWO;
+ } else if(animation < 33) {
+ buttonLoc = GuiTextures.THREE;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(buttonLoc);
+ RenderUtils.drawTexturedRect(x+animation, y, 12, 14);
+ }
+
+ @Override
+ public boolean mouseInput(int mouseX, int mouseY) {
+ if(mouseX > x-clickRadius && mouseX < x+xSize+clickRadius &&
+ mouseY > y-clickRadius && mouseY < y+ySize+clickRadius) {
+ if(Mouse.getEventButton() == 0) {
+ if(Mouse.getEventButtonState()) {
+ previewValue = !value;
+ } else {
+ value = !value;
+ toggleCallback.accept(value);
+ }
+ }
+ } else {
+ previewValue = value;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ return false;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
new file mode 100644
index 00000000..8de2205d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
@@ -0,0 +1,368 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.texture.DynamicTexture;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.util.function.Consumer;
+
+public class GuiElementColour extends GuiElement {
+
+ public static final ResourceLocation colour_selector_dot = new ResourceLocation("notenoughupdates:core/colour_selector_dot.png");
+ public static final ResourceLocation colour_selector_bar = new ResourceLocation("notenoughupdates:core/colour_selector_bar.png");
+ public static final ResourceLocation colour_selector_bar_alpha = new ResourceLocation("notenoughupdates:core/colour_selector_bar_alpha.png");
+ public static final ResourceLocation colour_selector_chroma = new ResourceLocation("notenoughupdates:core/colour_selector_chroma.png");
+
+ private static final ResourceLocation colourPickerLocation = new ResourceLocation("mbcore:dynamic/colourpicker");
+ private static final ResourceLocation colourPickerBarValueLocation = new ResourceLocation("mbcore:dynamic/colourpickervalue");
+ private static final ResourceLocation colourPickerBarOpacityLocation = new ResourceLocation("mbcore:dynamic/colourpickeropacity");
+ private final GuiElementTextField hexField = new GuiElementTextField("",
+ GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE);
+
+ private int x;
+ private int y;
+ private final int xSize = 119;
+ private final int ySize = 89;
+
+ private float wheelAngle = 0;
+ private float wheelRadius = 0;
+
+ private int clickedComponent = -1;
+
+ private Consumer<String> colourChangedCallback;
+ private Runnable closeCallback;
+ private String colour;
+
+ public GuiElementColour(int x, int y, String initialColour, Consumer<String> colourChangedCallback,
+ Runnable closeCallback) {
+
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+
+ this.y = Math.max(10, Math.min(scaledResolution.getScaledHeight()-ySize-10, y));
+ this.x = Math.max(10, Math.min(scaledResolution.getScaledWidth()-xSize-10, x));
+
+ this.colour = initialColour;
+ this.colourChangedCallback = colourChangedCallback;
+ this.closeCallback = closeCallback;
+
+ int colour = ChromaColour.specialToSimpleRGB(initialColour);
+ Color c = new Color(colour);
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ updateAngleAndRadius(hsv);
+ }
+
+ public void updateAngleAndRadius(float[] hsv) {
+ this.wheelRadius = hsv[1];
+ this.wheelAngle = hsv[0]*360;
+ }
+
+ public void render() {
+ RenderUtils.drawFloatingRectDark(x, y, xSize, ySize);
+
+ int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ Color c = new Color(currentColour, true);
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+
+ BufferedImage bufferedImage = new BufferedImage(288, 288, BufferedImage.TYPE_INT_ARGB);
+ float borderRadius = 0.05f;
+ if(Keyboard.isKeyDown(Keyboard.KEY_N)) borderRadius = 0;
+ for(int x=-16; x<272; x++) {
+ for(int y=-16; y<272; y++) {
+ float radius = (float) Math.sqrt(((x-128)*(x-128)+(y-128)*(y-128))/16384f);
+ float angle = (float) Math.toDegrees(Math.atan((128-x)/(y-128+1E-5))+Math.PI/2);
+ if(y < 128) angle += 180;
+ if(radius <= 1) {
+ int rgb = Color.getHSBColor(angle/360f, (float)Math.pow(radius, 1.5f), hsv[2]).getRGB();
+ bufferedImage.setRGB(x+16, y+16, rgb);
+ } else if(radius <= 1+borderRadius) {
+ float invBlackAlpha = Math.abs(radius-1-borderRadius/2)/borderRadius*2;
+ float blackAlpha = 1-invBlackAlpha;
+
+ if(radius > 1+borderRadius/2) {
+ bufferedImage.setRGB(x+16, y+16, (int)(blackAlpha*255) << 24);
+ } else {
+ Color col = Color.getHSBColor(angle/360f, 1, hsv[2]);
+ int rgb = (int)(col.getRed()*invBlackAlpha) << 16 |
+ (int)(col.getGreen()*invBlackAlpha) << 8 |
+ (int)(col.getBlue()*invBlackAlpha);
+ bufferedImage.setRGB(x+16, y+16, 0xff000000 | rgb);
+ }
+
+ }
+ }
+ }
+
+ BufferedImage bufferedImageValue = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
+ for(int x=0; x<10; x++) {
+ for(int y=0; y<64; y++) {
+ if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
+
+ int rgb = Color.getHSBColor(wheelAngle/360, wheelRadius, (64-y)/64f).getRGB();
+ bufferedImageValue.setRGB(x, y, rgb);
+ }
+ }
+
+ BufferedImage bufferedImageOpacity = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
+ for(int x=0; x<10; x++) {
+ for(int y=0; y<64; y++) {
+ if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
+
+ int rgb = (currentColour & 0x00FFFFFF) | (Math.min(255, (64-y)*4) << 24);
+ bufferedImageOpacity.setRGB(x, y, rgb);
+ }
+ }
+
+ float selradius = (float)Math.pow(wheelRadius, 1/1.5f)*32;
+ int selx = (int)(Math.cos(Math.toRadians(wheelAngle))*selradius);
+ int sely = (int)(Math.sin(Math.toRadians(wheelAngle))*selradius);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar_alpha);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+5+64+5+10+5, y+5, 10, 64, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarValueLocation);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+5+64+5, y+5, 10, 64, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarOpacityLocation);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+5+64+5+10+5, y+5, 10, 64, GL11.GL_NEAREST);
+
+ int chromaSpeed = ChromaColour.getSpeed(colour);
+ int currentColourChroma = ChromaColour.specialToChromaRGB(colour);
+ Color cChroma = new Color(currentColourChroma, true);
+ float hsvChroma[] = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null);
+
+ if(chromaSpeed > 0) {
+ Gui.drawRect(x+5+64+5+10+5+10+5+1, y+5+1,
+ x+5+64+5+10+5+10+5+10-1, y+5+64-1,
+ Color.HSBtoRGB(hsvChroma[0], 0.8f, 0.8f));
+ } else {
+ Gui.drawRect(x+5+64+5+10+5+10+5+1, y+5+27+1,
+ x+5+64+5+10+5+10+5+10-1, y+5+37-1,
+ Color.HSBtoRGB((hsvChroma[0]+(System.currentTimeMillis()-ChromaColour.startTime)/1000f)%1, 0.8f, 0.8f));
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+5+64+5, y+5, 10, 64, GL11.GL_NEAREST);
+ RenderUtils.drawTexturedRect(x+5+64+5+10+5, y+5, 10, 64, GL11.GL_NEAREST);
+
+ if(chromaSpeed > 0) {
+ RenderUtils.drawTexturedRect(x+5+64+5+10+5+10+5, y+5, 10, 64, GL11.GL_NEAREST);
+ } else {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_chroma);
+ RenderUtils.drawTexturedRect(x+5+64+5+10+5+10+5, y+5+27, 10, 10, GL11.GL_NEAREST);
+ }
+
+ Gui.drawRect(x+5+64+5, y+5+64-(int)(64*hsv[2]),
+ x+5+64+5+10, y+5+64-(int)(64*hsv[2])+1, 0xFF000000);
+ Gui.drawRect(x+5+64+5+10+5, y+5+64-c.getAlpha()/4,
+ x+5+64+5+10+5+10, y+5+64-c.getAlpha()/4-1, 0xFF000000);
+ if(chromaSpeed > 0) {
+ Gui.drawRect(x+5+64+5+10+5+10+5,
+ y+5+64-(int)(chromaSpeed/255f*64),
+ x+5+64+5+10+5+10+5+10,
+ y+5+64-(int)(chromaSpeed/255f*64)+1, 0xFF000000);
+ }
+
+ Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerLocation);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+1, y+1, 72, 72, GL11.GL_LINEAR);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_dot);
+ GlStateManager.color(1, 1, 1, 1);
+ RenderUtils.drawTexturedRect(x+5+32+selx-4, y+5+32+sely-4, 8, 8, GL11.GL_NEAREST);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(hsv[2]*100)+"",
+ Minecraft.getMinecraft().fontRendererObj,
+ x+5+64+5+5-(Math.round(hsv[2]*100)==100?1:0), y+5+64+5+5, true, 13, -1);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(c.getAlpha()/255f*100)+"",
+ Minecraft.getMinecraft().fontRendererObj,
+ x+5+64+5+15+5, y+5+64+5+5, true, 13, -1);
+ if(chromaSpeed > 0) {
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+
+ (int)ChromaColour.getSecondsForSpeed(chromaSpeed)+"s",
+ Minecraft.getMinecraft().fontRendererObj,
+ x+5+64+5+30+6, y+5+64+5+5, true, 13, -1);
+ }
+
+ hexField.setSize(48, 10);
+ if(!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase());
+
+ StringBuilder sb = new StringBuilder(EnumChatFormatting.GRAY+"#");
+ for(int i=0; i<6-hexField.getText().length(); i++) {
+ sb.append("0");
+ }
+ sb.append(EnumChatFormatting.WHITE);
+
+ hexField.setPrependText(sb.toString());
+ hexField.render(x+5+8, y+5+64+5);
+ }
+
+ public boolean mouseInput(int mouseX, int mouseY) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ float mouseXF = (float)(Mouse.getX() * scaledResolution.getScaledWidth_double() /
+ Minecraft.getMinecraft().displayWidth);
+ float mouseYF = (float)(scaledResolution.getScaledHeight_double() - Mouse.getY() *
+ scaledResolution.getScaledHeight_double() / Minecraft.getMinecraft().displayHeight - 1);
+
+ if((Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) && Mouse.getEventButtonState()) {
+ if(mouseX > x+5+8 && mouseX < x+5+8+48) {
+ if(mouseY > y+5+64+5 && mouseY < y+5+64+5+10) {
+ hexField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
+ clickedComponent = -1;
+ return true;
+ }
+ }
+ }
+ if(!Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
+ clickedComponent = -1;
+ }
+ if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
+ if(mouseX >= x && mouseX <= x+119 &&
+ mouseY >= y && mouseY <= y+89) {
+ hexField.unfocus();
+
+ int xWheel = mouseX - x - 5;
+ int yWheel = mouseY - y - 5;
+
+ if(xWheel > 0 && xWheel < 64) {
+ if(yWheel > 0 && yWheel < 64) {
+ clickedComponent = 0;
+ }
+ }
+
+ int xValue = mouseX - (x+5+64+5);
+ int y = mouseY - this.y - 5;
+
+ if(y > -5 && y <= 69) {
+ if(xValue > 0 && xValue < 10) {
+ clickedComponent = 1;
+ }
+
+ int xOpacity = mouseX - (x+5+64+5+10+5);
+
+ if(xOpacity > 0 && xOpacity < 10) {
+ clickedComponent = 2;
+ }
+ }
+
+ int chromaSpeed = ChromaColour.getSpeed(colour);
+ int xChroma = mouseX - (x+5+64+5+10+5+10+5);
+ if(xChroma > 0 && xChroma < 10) {
+ if(chromaSpeed > 0) {
+ if(y > -5 && y <= 69) {
+ clickedComponent = 3;
+ }
+ } else if(mouseY > this.y+5+27 && mouseY < this.y+5+37) {
+ int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ Color c = new Color(currentColour, true);
+ colour = ChromaColour.special(200, c.getAlpha(), currentColour);
+ colourChangedCallback.accept(colour);
+ }
+ }
+ } else {
+ hexField.unfocus();
+ closeCallback.run();
+ return false;
+ }
+ }
+ if(Mouse.isButtonDown(0) && clickedComponent >= 0) {
+ int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ Color c = new Color(currentColour, true);
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+
+ float xWheel = mouseXF - x - 5;
+ float yWheel = mouseYF - y - 5;
+
+ if(clickedComponent == 0) {
+ float angle = (float) Math.toDegrees(Math.atan((32-xWheel)/(yWheel-32+1E-5))+Math.PI/2);
+ xWheel = Math.max(0, Math.min(64, xWheel));
+ yWheel = Math.max(0, Math.min(64, yWheel));
+ float radius = (float) Math.sqrt(((xWheel-32)*(xWheel-32)+(yWheel-32)*(yWheel-32))/1024f);
+ if(yWheel < 32) angle += 180;
+
+ this.wheelAngle = angle;
+ this.wheelRadius = (float)Math.pow(Math.min(1, radius), 1.5f);
+ int rgb = Color.getHSBColor(angle/360f, wheelRadius, hsv[2]).getRGB();
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
+ colourChangedCallback.accept(colour);
+ return true;
+ }
+
+ float y = mouseYF - this.y - 5;
+ y = Math.max(0, Math.min(64, y));
+ System.out.println(y);
+
+ if(clickedComponent == 1) {
+ int rgb = Color.getHSBColor(wheelAngle/360, wheelRadius, 1-y/64f).getRGB();
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
+ colourChangedCallback.accept(colour);
+ return true;
+ }
+
+ if(clickedComponent == 2) {
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour),
+ 255-Math.round(y/64f*255), currentColour);
+ colourChangedCallback.accept(colour);
+ return true;
+ }
+
+ if(clickedComponent == 3) {
+ colour = ChromaColour.special(255-Math.round(y/64f*255), c.getAlpha(), currentColour);
+ colourChangedCallback.accept(colour);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public boolean keyboardInput() {
+ if(Keyboard.getEventKeyState() && hexField.getFocus()) {
+ if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ hexField.unfocus();
+ return true;
+ }
+ String old = hexField.getText();
+
+ hexField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
+
+ if(hexField.getText().length() > 6) {
+ hexField.setText(old);
+ } else {
+ try {
+ String text = hexField.getText().toLowerCase();
+
+ int rgb = Integer.parseInt(text, 16);
+ int alpha = (ChromaColour.specialToSimpleRGB(colour) >> 24) & 0xFF;
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), alpha, rgb);
+ colourChangedCallback.accept(colour);
+
+ Color c = new Color(rgb);
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ updateAngleAndRadius(hsv);
+ } catch(Exception e) {};
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
new file mode 100644
index 00000000..56dbe77d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
@@ -0,0 +1,519 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+
+import java.awt.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class GuiElementTextField {
+
+ public static final int SCALE_TEXT = 0b100000;
+ public static final int NUM_ONLY = 0b10000;
+ public static final int NO_SPACE = 0b01000;
+ public static final int FORCE_CAPS = 0b00100;
+ public static final int COLOUR = 0b00010;
+ public static final int MULTILINE = 0b00001;
+
+ private int searchBarYSize;
+ private int searchBarXSize;
+ private static final int searchBarPadding = 2;
+
+ private int options;
+
+ private boolean focus = false;
+
+ private int x;
+ private int y;
+
+ private String prependText = "";
+
+ private final GuiTextField textField = new GuiTextField(0, Minecraft.getMinecraft().fontRendererObj,
+ 0 , 0, 0, 0);
+
+ private int customBorderColour = -1;
+
+ public GuiElementTextField(String initialText, int options) {
+ this(initialText, 100, 20, options);
+ }
+
+ public GuiElementTextField(String initialText, int sizeX, int sizeY, int options) {
+ textField.setFocused(true);
+ textField.setCanLoseFocus(false);
+ textField.setMaxStringLength(999);
+ textField.setText(initialText);
+ this.searchBarXSize = sizeX;
+ this.searchBarYSize = sizeY;
+ this.options = options;
+ }
+
+ public void setMaxStringLength(int len) {
+ textField.setMaxStringLength(len);
+ }
+
+ public void setCustomBorderColour(int colour) {
+ this.customBorderColour = colour;
+ }
+
+ public String getText() {
+ return textField.getText();
+ }
+
+ public void setPrependText(String text) {
+ this.prependText = text;
+ }
+
+ public void setText(String text) {
+ if(textField.getText() == null || !textField.getText().equals(text)) {
+ textField.setText(text);
+ }
+ }
+
+ public void setSize(int searchBarXSize, int searchBarYSize) {
+ this.searchBarXSize = searchBarXSize;
+ this.searchBarYSize = searchBarYSize;
+ }
+
+ public void setOptions(int options) {
+ this.options = options;
+ }
+
+ @Override
+ public String toString() {
+ return textField.getText();
+ }
+
+ public boolean getFocus() {
+ return focus;
+ }
+
+ public int getHeight() {
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int paddingUnscaled = searchBarPadding/scaledresolution.getScaleFactor();
+
+ int numLines = org.apache.commons.lang3.StringUtils.countMatches(textField.getText(), "\n")+1;
+ int extraSize = (searchBarYSize-8)/2+8;
+ int bottomTextBox = searchBarYSize + extraSize*(numLines-1);
+
+ return bottomTextBox + paddingUnscaled*2;
+ }
+
+ public int getWidth() {
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int paddingUnscaled = searchBarPadding/scaledresolution.getScaleFactor();
+
+ return searchBarXSize + paddingUnscaled*2;
+ }
+
+ private float getScaleFactor(String str) {
+ return Math.min(1, (searchBarXSize-2)/(float)Minecraft.getMinecraft().fontRendererObj.getStringWidth(str));
+ }
+
+ private boolean isScaling() {
+ return (options & SCALE_TEXT) != 0;
+ }
+
+ private float getStringWidth(String str) {
+ if(isScaling()) {
+ return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str)*getScaleFactor(str);
+ } else {
+ return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str);
+ }
+ }
+
+ public int getCursorPos(int mouseX, int mouseY) {
+ int xComp = mouseX - x;
+ int yComp = mouseY - y;
+
+ int extraSize = (searchBarYSize-8)/2+8;
+
+ String renderText = prependText + textField.getText();
+
+ int lineNum = Math.round(((yComp - (searchBarYSize-8)/2))/extraSize);
+
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6])(?!\\u00B6)");
+ String text = renderText;
+ String textNoColour = renderText;
+ if((options & COLOUR) != 0) {
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(text);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ text = matcher.replaceFirst("\u00A7"+code+"\u00B6"+code);
+ }
+ }
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(textNoColour);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ textNoColour = matcher.replaceFirst("\u00B6"+code);
+ }
+
+ int currentLine = 0;
+ int cursorIndex = 0;
+ for(; cursorIndex<textNoColour.length(); cursorIndex++) {
+ if(currentLine == lineNum) break;
+ if(textNoColour.charAt(cursorIndex) == '\n') {
+ currentLine++;
+ }
+ }
+
+
+ String textNC = textNoColour.substring(0, cursorIndex);
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNC, "\u00B6");
+ String line = text.substring(cursorIndex+(((options & COLOUR) != 0)?colorCodes*2:0)).split("\n")[0];
+ int padding = Math.min(5, searchBarXSize-strLenNoColor(line))/2;
+ String trimmed = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(line, xComp-padding);
+ int linePos = strLenNoColor(trimmed);
+ if(linePos != strLenNoColor(line)) {
+ char after = line.charAt(linePos);
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
+ if(trimmedWidth + charWidth/2 < xComp-padding) {
+ linePos++;
+ }
+ }
+ cursorIndex += linePos;
+
+ int pre = StringUtils.cleanColour(prependText).length();
+ if(cursorIndex < pre) {
+ cursorIndex = 0;
+ } else {
+ cursorIndex -= pre;
+ }
+
+ return cursorIndex;
+ }
+
+ public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+ if(mouseButton == 1) {
+ textField.setText("");
+ } else {
+ textField.setCursorPosition(getCursorPos(mouseX, mouseY));
+ }
+ focus = true;
+ }
+
+ public void unfocus() {
+ focus = false;
+ textField.setSelectionPos(textField.getCursorPosition());
+ }
+
+ public int strLenNoColor(String str) {
+ return str.replaceAll("(?i)\\u00A7.", "").length();
+ }
+
+ public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ if(focus) {
+ textField.setSelectionPos(getCursorPos(mouseX, mouseY));
+ }
+ }
+
+ public void keyTyped(char typedChar, int keyCode) {
+ if(focus) {
+ if((options & MULTILINE) != 0) { //Carriage return
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)");
+
+ String text = textField.getText();
+ String textNoColour = textField.getText();
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(text);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ text = matcher.replaceFirst("\u00A7"+code+"\u00B6"+code);
+ }
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(textNoColour);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ textNoColour = matcher.replaceFirst("\u00B6"+code);
+ }
+
+ if(keyCode == 28) {
+ String before = textField.getText().substring(0, textField.getCursorPosition());
+ String after = textField.getText().substring(textField.getCursorPosition());
+ int pos = textField.getCursorPosition();
+ textField.setText(before + "\n" + after);
+ textField.setCursorPosition(pos+1);
+ return;
+ } else if(keyCode == 200) { //Up
+ String textNCBeforeCursor = textNoColour.substring(0, textField.getSelectionEnd());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
+ String textBeforeCursor = text.substring(0, textField.getSelectionEnd()+colorCodes*2);
+
+ int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n");
+
+ String[] split = textBeforeCursor.split("\n");
+ int textBeforeCursorWidth;
+ String lineBefore;
+ String thisLineBeforeCursor;
+ if(split.length == numLinesBeforeCursor && split.length > 0) {
+ textBeforeCursorWidth = 0;
+ lineBefore = split[split.length-1];
+ thisLineBeforeCursor = "";
+ } else if(split.length > 1) {
+ thisLineBeforeCursor = split[split.length-1];
+ lineBefore = split[split.length-2];
+ textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
+ } else {
+ return;
+ }
+ String trimmed = Minecraft.getMinecraft().fontRendererObj
+ .trimStringToWidth(lineBefore, textBeforeCursorWidth);
+ int linePos = strLenNoColor(trimmed);
+ if(linePos != strLenNoColor(lineBefore)) {
+ char after = lineBefore.charAt(linePos);
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
+ if(trimmedWidth + charWidth/2 < textBeforeCursorWidth) {
+ linePos++;
+ }
+ }
+ int newPos = textField.getSelectionEnd()-strLenNoColor(thisLineBeforeCursor)
+ -strLenNoColor(lineBefore)-1+linePos;
+
+ if(GuiScreen.isShiftKeyDown()) {
+ textField.setSelectionPos(newPos);
+ } else {
+ textField.setCursorPosition(newPos);
+ }
+ } else if(keyCode == 208) { //Down
+ String textNCBeforeCursor = textNoColour.substring(0, textField.getSelectionEnd());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
+ String textBeforeCursor = text.substring(0, textField.getSelectionEnd()+colorCodes*2);
+
+ int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n");
+
+ String[] split = textBeforeCursor.split("\n");
+ String thisLineBeforeCursor;
+ int textBeforeCursorWidth;
+ if(split.length == numLinesBeforeCursor) {
+ thisLineBeforeCursor = "";
+ textBeforeCursorWidth = 0;
+ } else if(split.length > 0) {
+ thisLineBeforeCursor = split[split.length-1];
+ textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
+ } else {
+ return;
+ }
+
+ String[] split2 = textNoColour.split("\n");
+ if(split2.length > numLinesBeforeCursor+1) {
+ String lineAfter = split2[numLinesBeforeCursor+1];
+ String trimmed = Minecraft.getMinecraft().fontRendererObj
+ .trimStringToWidth(lineAfter, textBeforeCursorWidth);
+ int linePos = strLenNoColor(trimmed);
+ if(linePos != strLenNoColor(lineAfter)) {
+ char after = lineAfter.charAt(linePos);
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
+ if(trimmedWidth + charWidth/2 < textBeforeCursorWidth) {
+ linePos++;
+ }
+ }
+ int newPos = textField.getSelectionEnd()-strLenNoColor(thisLineBeforeCursor)
+ +strLenNoColor(split2[numLinesBeforeCursor])+1+linePos;
+
+ if(GuiScreen.isShiftKeyDown()) {
+ textField.setSelectionPos(newPos);
+ } else {
+ textField.setCursorPosition(newPos);
+ }
+ }
+ }
+ }
+
+ String old = textField.getText();
+ if((options & FORCE_CAPS) != 0) typedChar = Character.toUpperCase(typedChar);
+ if((options & NO_SPACE) != 0 && typedChar == ' ') return;
+
+ textField.setFocused(true);
+ textField.textboxKeyTyped(typedChar, keyCode);
+
+ if((options & COLOUR) != 0) {
+ if(typedChar == '&') {
+ int pos = textField.getCursorPosition()-2;
+ if(pos >= 0 && pos < textField.getText().length()) {
+ if(textField.getText().charAt(pos) == '&') {
+ String before = textField.getText().substring(0, pos);
+ String after = "";
+ if(pos+2 < textField.getText().length()) {
+ after = textField.getText().substring(pos+2);
+ }
+ textField.setText(before + "\u00A7" + after);
+ textField.setCursorPosition(pos+1);
+ }
+ }
+ }
+ }
+
+ if((options & NUM_ONLY) != 0 && textField.getText().matches("[^0-9.]")) textField.setText(old);
+ }
+ }
+
+ public void render(int x, int y) {
+ this.x = x;
+ this.y = y;
+ drawTextbox(x, y, searchBarXSize, searchBarYSize, searchBarPadding, textField, focus);
+ }
+
+ private void drawTextbox(int x, int y, int searchBarXSize, int searchBarYSize, int searchBarPadding,
+ GuiTextField textField, boolean focus) {
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ String renderText = prependText + textField.getText();
+
+ GlStateManager.disableLighting();
+
+ /**
+ * Search bar
+ */
+ int paddingUnscaled = searchBarPadding/scaledresolution.getScaleFactor();
+ if(paddingUnscaled < 1) paddingUnscaled = 1;
+
+ int numLines = org.apache.commons.lang3.StringUtils.countMatches(renderText, "\n")+1;
+ int extraSize = (searchBarYSize-8)/2+8;
+ int bottomTextBox = y + searchBarYSize + extraSize*(numLines-1);
+
+ int borderColour = focus ? Color.GREEN.getRGB() : Color.WHITE.getRGB();
+ if(customBorderColour != -1) {
+ borderColour = customBorderColour;
+ }
+ //bar background
+ Gui.drawRect(x - paddingUnscaled,
+ y - paddingUnscaled,
+ x + searchBarXSize + paddingUnscaled,
+ bottomTextBox + paddingUnscaled, borderColour);
+ Gui.drawRect(x,
+ y,
+ x + searchBarXSize,
+ bottomTextBox, Color.BLACK.getRGB());
+
+ //bar text
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)");
+
+ String text = renderText;
+ String textNoColor = renderText;
+ if((options & COLOUR) != 0) {
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(text);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ text = matcher.replaceFirst("\u00A7"+code+"\u00B6"+code);
+ }
+ }
+ while(true) {
+ Matcher matcher = patternControlCode.matcher(textNoColor);
+ if(!matcher.find() || matcher.groupCount() < 1) break;
+ String code = matcher.group(1);
+ textNoColor = matcher.replaceFirst("\u00B6"+code);
+ }
+
+ int xStartOffset = 5;
+ float scale = 1;
+ String[] texts = text.split("\n");
+ for(int yOffI = 0; yOffI < texts.length; yOffI++) {
+ int yOff = yOffI*extraSize;
+
+ if(isScaling() && Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI])>searchBarXSize-10) {
+ scale = (searchBarXSize-2)/(float)Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]);
+ if(scale > 1) scale=1;
+ float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI])*scale;
+ xStartOffset = (int)((searchBarXSize-newLen)/2f);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(texts[yOffI], Minecraft.getMinecraft().fontRendererObj, x+searchBarXSize/2f,
+ y+searchBarYSize/2f+yOff, false,
+ searchBarXSize-2, Color.WHITE.getRGB());
+ } else {
+ Minecraft.getMinecraft().fontRendererObj.drawString(StringUtils.trimToWidth(texts[yOffI], searchBarXSize-10), x + 5,
+ y+(searchBarYSize-8)/2+yOff, Color.WHITE.getRGB());
+ }
+ }
+
+ if(focus && System.currentTimeMillis()%1000>500) {
+ String textNCBeforeCursor = textNoColor.substring(0, textField.getCursorPosition()+prependText.length());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
+ String textBeforeCursor = text.substring(0, textField.getCursorPosition()+prependText.length()+(((options & COLOUR) != 0) ? colorCodes*2 : 0));
+
+ int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n");
+ int yOff = numLinesBeforeCursor*extraSize;
+
+ String[] split = textBeforeCursor.split("\n");
+ int textBeforeCursorWidth;
+ if(split.length <= numLinesBeforeCursor || split.length == 0) {
+ textBeforeCursorWidth = 0;
+ } else {
+ textBeforeCursorWidth = (int)(Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length-1])*scale);
+ }
+ Gui.drawRect(x + xStartOffset + textBeforeCursorWidth,
+ y+(searchBarYSize-8)/2-1 + yOff,
+ x + xStartOffset + textBeforeCursorWidth+1,
+ y+(searchBarYSize-8)/2+9 + yOff, Color.WHITE.getRGB());
+ }
+
+ String selectedText = textField.getSelectedText();
+ if(!selectedText.isEmpty()) {
+ int leftIndex = Math.min(textField.getCursorPosition()+prependText.length(), textField.getSelectionEnd()+prependText.length());
+ int rightIndex = Math.max(textField.getCursorPosition()+prependText.length(), textField.getSelectionEnd()+prependText.length());
+
+ float texX = 0;
+ int texY = 0;
+ boolean sectionSignPrev = false;
+ boolean bold = false;
+ for(int i=0; i<textNoColor.length(); i++) {
+ char c = textNoColor.charAt(i);
+ if(sectionSignPrev) {
+ if(c != 'k' && c != 'K'
+ && c != 'm' && c != 'M'
+ && c != 'n' && c != 'N'
+ && c != 'o' && c != 'O') {
+ bold = c == 'l' || c == 'L';
+ }
+ }
+ sectionSignPrev = false;
+ if(c == '\u00B6') sectionSignPrev = true;
+
+ if(c == '\n') {
+ if(i >= leftIndex && i < rightIndex) {
+ Gui.drawRect(x + xStartOffset + (int)texX,
+ y+(searchBarYSize-8)/2-1 + texY,
+ x + xStartOffset + (int)texX + 3,
+ y+(searchBarYSize-8)/2+9 + texY, Color.LIGHT_GRAY.getRGB());
+ }
+
+ texX = 0;
+ texY += extraSize;
+ continue;
+ }
+
+ //String c2 = bold ? EnumChatFormatting.BOLD.toString() : "" + c;
+
+ int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c));
+ if(bold) len++;
+ if(i >= leftIndex && i < rightIndex) {
+ Gui.drawRect(x + xStartOffset + (int)texX,
+ y+(searchBarYSize-8)/2-1 + texY,
+ x + xStartOffset + (int)(texX + len*scale),
+ y+(searchBarYSize-8)/2+9 + texY, Color.LIGHT_GRAY.getRGB());
+
+ TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ x + xStartOffset + texX,
+ y+searchBarYSize/2f-scale*8/2f + texY, false, Color.BLACK.getRGB(), scale);
+ if(bold) {
+ TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj,
+ x + xStartOffset + texX + 1,
+ y+searchBarYSize/2f-scale*8/2f + texY, false, Color.BLACK.getRGB(), scale);
+ }
+ }
+
+ texX += len*scale;
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiScreenElementWrapper.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiScreenElementWrapper.java
new file mode 100644
index 00000000..c270397b
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiScreenElementWrapper.java
@@ -0,0 +1,35 @@
+package io.github.moulberry.notenoughupdates.core;
+
+import net.minecraft.client.gui.GuiScreen;
+import org.lwjgl.input.Mouse;
+
+import java.io.IOException;
+
+public class GuiScreenElementWrapper extends GuiScreen {
+
+ private final GuiElement element;
+
+ public GuiScreenElementWrapper(GuiElement element) {
+ this.element = element;
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ super.drawScreen(mouseX, mouseY, partialTicks);
+ element.render();
+ }
+
+ @Override
+ public void handleMouseInput() throws IOException {
+ super.handleMouseInput();
+ int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
+ int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
+ element.mouseInput(i, j);
+ }
+
+ @Override
+ public void handleKeyboardInput() throws IOException {
+ super.handleKeyboardInput();
+ element.keyboardInput();
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java
new file mode 100644
index 00000000..572c9af6
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Config.java
@@ -0,0 +1,4 @@
+package io.github.moulberry.notenoughupdates.core.config;
+
+public class Config {
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/Category.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/Category.java
new file mode 100644
index 00000000..6a91cae5
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/Category.java
@@ -0,0 +1,15 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Category {
+
+ String name();
+ String desc();
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorBoolean.java
new file mode 100644
index 00000000..3c6465e6
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorBoolean.java
@@ -0,0 +1,12 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorBoolean {
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorColour.java
new file mode 100644
index 00000000..d1dd5808
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorColour.java
@@ -0,0 +1,13 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorColour {
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDropdown.java
new file mode 100644
index 00000000..d9d2235b
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorDropdown.java
@@ -0,0 +1,16 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorDropdown {
+
+ String[] values();
+ int initialIndex() default 0;
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorSlider.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorSlider.java
new file mode 100644
index 00000000..d671f65c
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorSlider.java
@@ -0,0 +1,18 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorSlider {
+
+ float minValue();
+ float maxValue();
+
+ float minStep();
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorText.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorText.java
new file mode 100644
index 00000000..9227cf50
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigEditorText.java
@@ -0,0 +1,13 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigEditorText {
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java
new file mode 100644
index 00000000..63c3366a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/annotations/ConfigOption.java
@@ -0,0 +1,17 @@
+package io.github.moulberry.notenoughupdates.core.config.annotations;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ConfigOption {
+
+ String name();
+ String desc();
+ int subcategoryId() default -1;
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
new file mode 100644
index 00000000..5b9509a3
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditor.java
@@ -0,0 +1,61 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+
+public abstract class GuiOptionEditor {
+
+ protected final ConfigProcessor.ProcessedOption option;
+ private static final int HEIGHT = 45;
+
+ public GuiOptionEditor(ConfigProcessor.ProcessedOption option) {
+ this.option = option;
+ }
+
+ public void render(int x, int y, int width) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ RenderUtils.drawFloatingRectDark(x, y, width, HEIGHT, true);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(option.name,
+ fr, x+width/6, y+13, true, width/3-10, 0xc0c0c0);
+
+ int height = getHeight();
+
+ int maxLines = 5;
+ float scale = 1;
+ int lineCount = fr.listFormattedStringToWidth(option.desc, width*2/3-10).size();
+
+ if(lineCount <= 0) return;
+
+ float paraHeight = 9 * lineCount - 1;
+
+ while(paraHeight >= height-10) {
+ scale -= 1/8f;
+ lineCount = fr.listFormattedStringToWidth(option.desc, (int)(width*2/3/scale-10)).size();
+ paraHeight = (int)(9*scale * lineCount - 1*scale);
+ }
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(x+5+width/3f, y+HEIGHT/2f-paraHeight/2, 0);
+ GlStateManager.scale(scale, scale, 1);
+
+ fr.drawSplitString(option.desc, 0, 0, (int)(width*2/3/scale-10), 0xc0c0c0);
+
+ GlStateManager.popMatrix();
+ }
+
+ public int getHeight() {
+ return HEIGHT;
+ }
+
+ public abstract boolean mouseInput(int x, int y, int width, int mouseX, int mouseY);
+ public abstract boolean keyboardInput();
+
+ public boolean mouseInputGlobal(int x, int y, int width, int mouseX, int mouseY) {
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java
new file mode 100644
index 00000000..ba2c9be9
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java
@@ -0,0 +1,38 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.GuiElementBoolean;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+
+public class GuiOptionEditorBoolean extends GuiOptionEditor {
+
+ private final GuiElementBoolean bool;
+
+ public GuiOptionEditorBoolean(ConfigProcessor.ProcessedOption option) {
+ super(option);
+
+ bool = new GuiElementBoolean(0, 0, (boolean)option.get(), 10, option::set);
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+ int height = getHeight();
+
+ bool.x = x+width/6-24;
+ bool.y = y+height-7-14;
+ bool.render();
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+ bool.x = x+width/6-24;
+ bool.y = y+height-7-14;
+ return bool.mouseInput(mouseX, mouseY);
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ return false;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java
new file mode 100644
index 00000000..482f6823
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java
@@ -0,0 +1,80 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.ChromaColour;
+import io.github.moulberry.notenoughupdates.core.GlScissorStack;
+import io.github.moulberry.notenoughupdates.core.GuiElementBoolean;
+import io.github.moulberry.notenoughupdates.core.GuiElementColour;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
+
+public class GuiOptionEditorColour extends GuiOptionEditor {
+
+ private String chromaColour;
+ private GuiElementColour colourElement = null;
+
+ public GuiOptionEditorColour(ConfigProcessor.ProcessedOption option) {
+ super(option);
+
+ this.chromaColour = (String)option.get();
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+ int height = getHeight();
+
+ int argb = ChromaColour.specialToChromaRGB(chromaColour);
+ int r = (argb >> 16) & 0xFF;
+ int g = (argb >> 8) & 0xFF;
+ int b = argb & 0xFF;
+ GlStateManager.color(r/255f, g/255f, b/255f, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(button_white);
+ RenderUtils.drawTexturedRect(x+width/6-24, y+height-7-14, 48, 16);
+
+ if(colourElement != null) {
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ colourElement.render();
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
+ }
+ }
+
+ @Override
+ public boolean mouseInputGlobal(int x, int y, int width, int mouseX, int mouseY) {
+ if(colourElement != null && colourElement.mouseInput(mouseX, mouseY)) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+
+ if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0 &&
+ mouseX > x+width/6-24 && mouseX < x+width/6+24 &&
+ mouseY > y+height-7-14 && mouseY < y+height-7+2) {
+ colourElement = new GuiElementColour(mouseX, mouseY, (String) option.get(), (val) -> {
+ option.set(val);
+ chromaColour = val;
+ }, () -> colourElement = null);
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if(colourElement != null && colourElement.keyboardInput()) {
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
new file mode 100644
index 00000000..8b0d5eb3
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
@@ -0,0 +1,142 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+public class GuiOptionEditorDropdown extends GuiOptionEditor {
+
+ private final String[] values;
+ private final boolean useOrdinal;
+ private int selected;
+ private boolean open = false;
+
+ public GuiOptionEditorDropdown(ConfigProcessor.ProcessedOption option, String[] values, int selected, boolean useOrdinal) {
+ super(option);
+ this.values = values;
+ this.selected = selected;
+ this.useOrdinal = useOrdinal;
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+ int height = getHeight();
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ int dropdownWidth = Math.min(width/3-10, 80);
+ int left = x+width/6-dropdownWidth/2;
+ int top = y+height-7-14;
+
+ String selectedString = " - Select - ";
+ if(selected >= 0 && selected < values.length) {
+ selectedString = values[selected];
+ }
+
+ if(open) {
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ GlStateManager.translate(0, 0, 10);
+
+ int dropdownHeight = 13 + 12*values.length;
+
+ int main = 0xffc0c0c0;
+ int blue = 0xff3365bd;
+ Gui.drawRect(left, top, left+1, top+dropdownHeight, blue); //Left
+ Gui.drawRect(left+1, top, left+dropdownWidth, top+1, blue); //Top
+ Gui.drawRect(left+dropdownWidth-1, top+1, left+dropdownWidth, top+dropdownHeight, blue); //Right
+ Gui.drawRect(left+1, top+dropdownHeight-1, left+dropdownWidth-1, top+dropdownHeight, blue); //Bottom
+ Gui.drawRect(left+1, top+1, left+dropdownWidth-1, top+dropdownHeight-1, main); //Middle
+
+ Gui.drawRect(left+1, top+14-1, left+dropdownWidth-1, top+14, blue); //Bar
+
+ int dropdownY = 13;
+ for(String option : values) {
+ if(option.isEmpty()) {
+ option = "<NONE>";
+ }
+ TextRenderUtils.drawStringScaledMaxWidth(option, fr, left+3, top+3+dropdownY, false, dropdownWidth-6, 0xff404040);
+ //fr.drawString(option, left+3, top+3+dropdownY, 0xff404040);
+ dropdownY += 12;
+ }
+
+ TextRenderUtils.drawStringScaled("\u25B2", fr, left+dropdownWidth-10, y+height-7-15, false, 0xff404040, 2);
+
+
+ TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left+3, top+3, false,
+ dropdownWidth-16, 0xff404040);
+ //fr.drawString(selectedString, left+3, top+3, 0xff404040);
+
+ GlStateManager.translate(0, 0, -10);
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
+ } else {
+ RenderUtils.drawFloatingRectWithAlpha(left, top, dropdownWidth, 14, 0xff, false);
+ TextRenderUtils.drawStringScaled("\u25BC", fr, left+dropdownWidth-10, y+height-7-15, false, 0xff404040, 2);
+
+ TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left+3, top+3, false,
+ dropdownWidth-16, 0xff404040);
+ //fr.drawString(selectedString, left+3, top+3, 0xff404040);
+ }
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+
+ int left = x+width/6-40;
+ int top = y+height-7-14;
+
+ if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
+ if(mouseX >= left && mouseX <= left+80 &&
+ mouseY >= top && mouseY <= top+14) {
+ open = !open;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean mouseInputGlobal(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+
+ int left = x+width/6-40;
+ int top = y+height-7-14;
+
+ if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
+ if(!(mouseX >= left && mouseX <= left+80 &&
+ mouseY >= top && mouseY <= top+14) && open) {
+ open = false;
+ if(mouseX >= left && mouseX <= left+80) {
+ int dropdownY = 13;
+ for(int ordinal=0; ordinal < values.length; ordinal++) {
+ if(mouseY >= top+3+dropdownY && mouseY <= top+3+dropdownY+12) {
+ selected = ordinal;
+ if(useOrdinal) {
+ option.set(selected);
+ } else {
+ option.set(values[selected]);
+ }
+ return true;
+ }
+ dropdownY += 12;
+ }
+ }
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ return false;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java
new file mode 100644
index 00000000..a3665436
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java
@@ -0,0 +1,132 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.GuiElementBoolean;
+import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.GuiElementSlider;
+import net.minecraft.client.Minecraft;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+
+public class GuiOptionEditorSlider extends GuiOptionEditor {
+
+ private final GuiElementSlider slider;
+ private final GuiElementTextField textField;
+
+ public GuiOptionEditorSlider(ConfigProcessor.ProcessedOption option, float minValue, float maxValue, float minStep) {
+ super(option);
+ if(minStep < 0) minStep = 0.01f;
+
+ float floatVal = ((Number)option.get()).floatValue();
+ {
+ String strVal;
+ if(floatVal % 1 == 0) {
+ strVal = Integer.toString((int)floatVal);
+ } else {
+ strVal = Float.toString(floatVal);
+ }
+ textField = new GuiElementTextField(strVal,
+ GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT);
+ }
+
+ slider = new GuiElementSlider(0, 0, 80, minValue, maxValue, minStep, floatVal, (val) -> {
+ option.set(val);
+
+ String strVal;
+ if(val % 1 == 0) {
+ strVal = Integer.toString(val.intValue());
+ } else {
+ strVal = Float.toString(val);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ textField.setText(strVal);
+ });
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+ int height = getHeight();
+
+ int fullWidth = Math.min(width/3-10, 80);
+ int sliderWidth = (fullWidth-5)*3/4;
+ int textFieldWidth = (fullWidth-5)/4;
+
+ slider.x = x+width/6-fullWidth/2;
+ slider.y = y+height-7-14;
+ slider.width = sliderWidth;
+ slider.render();
+
+ if(textField.getFocus()) {
+ textField.setOptions(GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY);
+ textField.setSize(Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText())+10,
+ 16);
+ } else {
+ textField.setSize(textFieldWidth, 16);
+ textField.setOptions(GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT);
+ }
+
+ textField.render(x+width/6-fullWidth/2+sliderWidth+5, y+height-7-14);
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+
+ int fullWidth = Math.min(width/3-10, 80);
+ int sliderWidth = (fullWidth-5)*3/4;
+ int textFieldWidth = (fullWidth-5)/4;
+
+ slider.x = x+width/6-fullWidth/2;
+ slider.y = y+height-7-14;
+ slider.width = sliderWidth;
+ if(slider.mouseInput(mouseX, mouseY)) {
+ textField.unfocus();
+ return true;
+ }
+
+ if(textField.getFocus()) {
+ textFieldWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText())+10;
+ }
+
+ int textFieldX = x+width/6-fullWidth/2+sliderWidth+5;
+ int textFieldY = y+height-7-14;
+ textField.setSize(textFieldWidth, 16);
+
+ if(Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) {
+ if(mouseX > textFieldX && mouseX < textFieldX+textFieldWidth &&
+ mouseY > textFieldY && mouseY < textFieldY+16) {
+ textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
+ return true;
+ }
+ textField.unfocus();
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if(Keyboard.getEventKeyState() && textField.getFocus()) {
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
+
+ try {
+ textField.setCustomBorderColour(0xffffffff);
+ float f = Float.parseFloat(textField.getText());
+ if(option.set(f)) {
+ slider.setValue(f);
+ } else {
+ textField.setCustomBorderColour(0xff0000ff);
+ }
+ } catch(Exception e) {
+ textField.setCustomBorderColour(0xffff0000);
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
new file mode 100644
index 00000000..bf50bda8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
@@ -0,0 +1,84 @@
+package io.github.moulberry.notenoughupdates.core.config.gui;
+
+import io.github.moulberry.notenoughupdates.core.GuiElementBoolean;
+import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.GuiElementSlider;
+import net.minecraft.client.Minecraft;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+
+public class GuiOptionEditorText extends GuiOptionEditor {
+
+ private final GuiElementTextField textField;
+
+ public GuiOptionEditorText(ConfigProcessor.ProcessedOption option) {
+ super(option);
+
+ textField = new GuiElementTextField((String)option.get(), 0);
+ }
+
+ @Override
+ public void render(int x, int y, int width) {
+ super.render(x, y, width);
+ int height = getHeight();
+
+ int fullWidth = Math.min(width/3-10, 80);
+
+ int textFieldX = x+width/6-fullWidth/2;
+ if(textField.getFocus()) {
+ fullWidth = Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText())+10);
+ }
+
+ textField.setSize(fullWidth, 16);
+
+ textField.render(textFieldX, y+height-7-14);
+ }
+
+ @Override
+ public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
+ int height = getHeight();
+
+ int fullWidth = Math.min(width/3-10, 80);
+
+ int textFieldX = x+width/6-fullWidth/2;
+
+ if(textField.getFocus()) {
+ fullWidth = Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText())+10);
+ }
+
+ int textFieldY = y+height-7-14;
+ textField.setSize(fullWidth, 16);
+
+ if(Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) {
+ if(mouseX > textFieldX && mouseX < textFieldX+fullWidth &&
+ mouseY > textFieldY && mouseY < textFieldY+16) {
+ textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
+ return true;
+ }
+ textField.unfocus();
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if(Keyboard.getEventKeyState() && textField.getFocus()) {
+ Keyboard.enableRepeatEvents(true);
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
+
+ try {
+ textField.setCustomBorderColour(0xffffffff);
+ option.set(textField.getText());
+ } catch(Exception e) {
+ textField.setCustomBorderColour(0xffff0000);
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
new file mode 100644
index 00000000..f91b8410
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
@@ -0,0 +1,157 @@
+package io.github.moulberry.notenoughupdates.core.config.struct;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Config;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import io.github.moulberry.notenoughupdates.core.config.gui.*;
+import io.github.moulberry.notenoughupdates.core.config.Config;
+
+import java.lang.reflect.Field;
+import java.util.LinkedHashMap;
+
+public class ConfigProcessor {
+
+ public static class ProcessedCategory {
+ public final String name;
+ public final String desc;
+ public final LinkedHashMap<String, ProcessedOption> options = new LinkedHashMap<>();
+
+ public ProcessedCategory(String name, String desc) {
+ this.name = name;
+ this.desc = desc;
+ }
+ }
+
+ public static class ProcessedOption {
+ public final String name;
+ public final String desc;
+ public final int subcategoryId;
+ public GuiOptionEditor editor;
+
+ private final Field field;
+ private final Object container;
+
+ public ProcessedOption(String name, String desc, int subcategoryId, Field field, Object container) {
+ this.name = name;
+ this.desc = desc;
+ this.subcategoryId = subcategoryId;
+
+ this.field = field;
+ this.container = container;
+ }
+
+ public Object get() {
+ try {
+ return field.get(container);
+ } catch(Exception e) {
+ return null;
+ }
+ }
+
+ public boolean set(Object value) {
+ try {
+ if(field.getType() == int.class && value instanceof Number) {
+ field.set(container, ((Number)value).intValue());
+ } else {
+ field.set(container, value);
+ }
+ return true;
+ } catch(Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ }
+
+ public static LinkedHashMap<String, ProcessedCategory> create(Config config) {
+ LinkedHashMap<String, ProcessedCategory> processedConfig = new LinkedHashMap<>();
+ for(Field categoryField : config.getClass().getDeclaredFields()) {
+ boolean exposePresent = categoryField.isAnnotationPresent(Expose.class);
+ boolean categoryPresent = categoryField.isAnnotationPresent(Category.class);
+
+ if(exposePresent && categoryPresent) {
+ Object categoryObj;
+ try {
+ categoryObj = categoryField.get(config);
+ } catch(Exception e) {
+ //System.err.printf("Failed to load config category %s. Field was not accessible.\n", categoryField.getName());
+ continue;
+ }
+
+ Category categoryAnnotation = categoryField.getAnnotation(Category.class);
+ ProcessedCategory cat = new ProcessedCategory(
+ categoryAnnotation.name(),
+ categoryAnnotation.desc()
+ );
+ processedConfig.put(categoryField.getName(), cat);
+
+ for(Field optionField : categoryObj.getClass().getDeclaredFields()) {
+ boolean optionExposePresent = optionField.isAnnotationPresent(Expose.class);
+ boolean optionPresent = optionField.isAnnotationPresent(ConfigOption.class);
+
+ if(optionExposePresent && optionPresent) {
+ ConfigOption optionAnnotation = optionField.getAnnotation(ConfigOption.class);
+ ProcessedOption option = new ProcessedOption(
+ optionAnnotation.name(),
+ optionAnnotation.desc(),
+ optionAnnotation.subcategoryId(),
+ optionField,
+ categoryObj
+ );
+
+ GuiOptionEditor editor = null;
+ Class<?> optionType = optionField.getType();
+ if(optionType.isAssignableFrom(boolean.class) &&
+ optionField.isAnnotationPresent(ConfigEditorBoolean.class)) {
+ editor = new GuiOptionEditorBoolean(option);
+ }
+ if(optionType.isAssignableFrom(int.class)) {
+ if(optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
+ ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class);
+ editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), (int)option.get(), true);
+ }
+ }
+ if(optionType.isAssignableFrom(String.class)) {
+ if(optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
+ ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class);
+ editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(),
+ configEditorAnnotation.initialIndex(), false);
+ } else if(optionField.isAnnotationPresent(ConfigEditorColour.class)) {
+ editor = new GuiOptionEditorColour(option);
+ } else if(optionField.isAnnotationPresent(ConfigEditorText.class)) {
+ editor = new GuiOptionEditorText(option);
+ }
+ }
+ if(optionType.isAssignableFrom(int.class) ||
+ optionType.isAssignableFrom(float.class) ||
+ optionType.isAssignableFrom(double.class)) {
+ if(optionField.isAnnotationPresent(ConfigEditorSlider.class)) {
+ ConfigEditorSlider configEditorAnnotation = optionField.getAnnotation(ConfigEditorSlider.class);
+ editor = new GuiOptionEditorSlider(option, configEditorAnnotation.minValue(),
+ configEditorAnnotation.maxValue(), configEditorAnnotation.minStep());
+ }
+ }
+ if(optionType.isAssignableFrom(String.class)) {
+ if(optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
+ ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class);
+ editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), 0,false);
+ }
+ }
+ if(editor == null) {
+ //System.err.printf("Failed to load config option %s. Could not find suitable editor.\n", optionField.getName());
+ continue;
+ }
+ option.editor = editor;
+ cat.options.put(optionField.getName(), option);
+ } else if(optionExposePresent || optionPresent) {
+ //System.err.printf("Failed to load config option %s. Both @Expose and @ConfigOption must be present.\n", optionField.getName());
+ }
+ }
+ } else if(exposePresent || categoryPresent) {
+ //System.err.printf("Failed to load config category %s. Both @Expose and @Category must be present.\n", categoryField.getName());
+ }
+ }
+ return processedConfig;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java
new file mode 100644
index 00000000..4cffb479
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/GuiElementSlider.java
@@ -0,0 +1,124 @@
+package io.github.moulberry.notenoughupdates.core.util;
+
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+
+import java.util.function.Consumer;
+
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
+
+public class GuiElementSlider extends GuiElement {
+
+ public int x;
+ public int y;
+ public int width;
+ private static final int HEIGHT = 16;
+
+ private float minValue;
+ private float maxValue;
+ private float minStep;
+
+ private float value;
+ private Consumer<Float> setCallback;
+
+ private boolean clicked = false;
+
+ public GuiElementSlider(int x, int y, int width, float minValue, float maxValue, float minStep,
+ float value, Consumer<Float> setCallback) {
+ if(minStep < 0) minStep = 0.01f;
+
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.minStep = minStep;
+ this.value = value;
+ this.setCallback = setCallback;
+ }
+
+ public void setValue(float value) {
+ this.value = value;
+ }
+
+ @Override
+ public void render() {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int mouseX = Mouse.getX() * scaledResolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth;
+
+ float value = this.value;
+ if(clicked) {
+ value = (mouseX-x)*(maxValue-minValue)/width+minValue;
+ value = Math.max(minValue, Math.min(maxValue, value));
+ value = Math.round(value/minStep)*minStep;
+ }
+
+ float sliderAmount = Math.max(0, Math.min(1, (value-minValue)/(maxValue-minValue)));
+ int sliderAmountI = (int)(width*sliderAmount);
+
+ GlStateManager.color(1f, 1f, 1f, 1f);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_cap);
+ Utils.drawTexturedRect(x, y, 4, HEIGHT, GL11.GL_NEAREST);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_cap);
+ Utils.drawTexturedRect(x+width-4, y, 4, HEIGHT, GL11.GL_NEAREST);
+
+ if(sliderAmountI > 5) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_segment);
+ Utils.drawTexturedRect(x+4, y, sliderAmountI-4, HEIGHT, GL11.GL_NEAREST);
+ }
+
+ if(sliderAmountI < width-5) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_segment);
+ Utils.drawTexturedRect(x+sliderAmountI, y, width-4-sliderAmountI, HEIGHT, GL11.GL_NEAREST);
+ }
+
+ for(int i=1; i<4; i++) {
+ int notchX = x+width*i/4-1;
+ Minecraft.getMinecraft().getTextureManager().bindTexture(notchX > x+sliderAmountI ? slider_off_notch : slider_on_notch);
+ Utils.drawTexturedRect(notchX, y+(HEIGHT-4)/2, 2, 4, GL11.GL_NEAREST);
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button);
+ Utils.drawTexturedRect(x+sliderAmountI-4, y, 8, HEIGHT, GL11.GL_NEAREST);
+ }
+
+ @Override
+ public boolean mouseInput(int mouseX, int mouseY) {
+ if(!Mouse.isButtonDown(0)) {
+ clicked = false;
+ }
+
+ if(Mouse.getEventButton() == 0) {
+ clicked = Mouse.getEventButtonState() && mouseX > x && mouseX < x+width && mouseY > y && mouseY < y+HEIGHT;
+ if(clicked) {
+ value = (mouseX-x)*(maxValue-minValue)/width+minValue;
+ value = Math.max(minValue, Math.min(maxValue, value));
+ value = (float)(Math.round(value/minStep)*(double)minStep);
+ setCallback.accept(value);
+ return true;
+ }
+ }
+
+ if(!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && clicked) {
+ value = (mouseX-x)*(maxValue-minValue)/width+minValue;
+ value = Math.max(minValue, Math.min(maxValue, value));
+ value = Math.round(value/minStep)*minStep;
+ setCallback.accept(value);
+ return true;
+ }
+
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/MiscUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/MiscUtils.java
new file mode 100644
index 00000000..3e9fc4ca
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/MiscUtils.java
@@ -0,0 +1,104 @@
+package io.github.moulberry.notenoughupdates.core.util;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.BufferUtils;
+import org.lwjgl.input.Cursor;
+import org.lwjgl.input.Mouse;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.IntBuffer;
+import java.nio.file.Files;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class MiscUtils {
+
+ public static void copyToClipboard(String str) {
+ Toolkit.getDefaultToolkit().getSystemClipboard()
+ .setContents(new StringSelection(str), null);
+ }
+ private static void unzip(InputStream src, File dest) {
+ //buffer for read and write data to file
+ byte[] buffer = new byte[1024];
+ try {
+ ZipInputStream zis = new ZipInputStream(src);
+ ZipEntry ze = zis.getNextEntry();
+ while(ze != null){
+ if(!ze.isDirectory()) {
+ String fileName = ze.getName();
+ File newFile = new File(dest, fileName);
+ //create directories for sub directories in zip
+ new File(newFile.getParent()).mkdirs();
+ FileOutputStream fos = new FileOutputStream(newFile);
+ int len;
+ while ((len = zis.read(buffer)) > 0) {
+ fos.write(buffer, 0, len);
+ }
+ fos.close();
+ }
+ //close this ZipEntry
+ zis.closeEntry();
+ ze = zis.getNextEntry();
+ }
+ //close last ZipEntry
+ zis.closeEntry();
+ zis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void recursiveDelete(File file) {
+ if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) {
+ for(File child : file.listFiles()) {
+ recursiveDelete(child);
+ }
+ }
+ file.delete();
+ }
+
+ private static String currentCursor = null;
+
+ public static void resetCursor() {
+ if(currentCursor == null) {
+ return;
+ }
+ currentCursor = null;
+ try { Mouse.setNativeCursor(null); } catch(Exception ignored) {}
+ }
+
+ public static void setCursor(ResourceLocation loc, int hotspotX, int hotspotY) {
+ if(currentCursor != null && loc.getResourcePath().equals(currentCursor)) {
+ return;
+ }
+ currentCursor = loc.getResourcePath();
+ try {
+ BufferedImage image = ImageIO.read(Minecraft.getMinecraft()
+ .getResourceManager().getResource(loc).getInputStream());
+ int maxSize = Cursor.getMaxCursorSize();
+ IntBuffer buffer = BufferUtils.createIntBuffer(maxSize*maxSize);
+ for(int i=0; i<maxSize*maxSize; i++) {
+ int cursorX = i%maxSize;
+ int cursorY = i/maxSize;
+ if(cursorX >= image.getWidth() || cursorY >= image.getHeight()) {
+ buffer.put(0x00000000);
+ } else {
+ buffer.put(image.getRGB(cursorX, image.getHeight()-1-cursorY));
+ }
+ }
+ buffer.flip();
+ Mouse.setNativeCursor(new Cursor(maxSize, maxSize, hotspotX, hotspotY, 1,
+ buffer, null));
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/Splitters.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/Splitters.java
new file mode 100644
index 00000000..555e0d79
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/Splitters.java
@@ -0,0 +1,10 @@
+package io.github.moulberry.notenoughupdates.core.util;
+
+import com.google.common.base.Splitter;
+
+public class Splitters {
+
+ public static final Splitter NEWLINE_SPLITTER = Splitter.on('\n');
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java
new file mode 100644
index 00000000..a3d8204a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java
@@ -0,0 +1,39 @@
+package io.github.moulberry.notenoughupdates.core.util;
+
+import com.google.common.collect.Sets;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+
+import java.util.Set;
+
+public class StringUtils {
+
+ public static final Set<String> PROTOCOLS = Sets.newHashSet("http", "https");
+
+ public static String cleanColour(String in) {
+ return in.replaceAll("(?i)\\u00A7.", "");
+ }
+
+ public static String cleanColourNotModifiers(String in) {
+ return in.replaceAll("(?i)\\u00A7[0-9a-f]", "\u00A7r");
+ }
+
+ public static String trimToWidth(String str, int len) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ String trim = fr.trimStringToWidth(str, len);
+
+ if(str.length() != trim.length() && !trim.endsWith(" ")) {
+ char next = str.charAt(trim.length());
+ if(next != ' ') {
+ String[] split = trim.split(" ");
+ String last = split[split.length-1];
+ if(last.length() < 8) {
+ trim = trim.substring(0, trim.length()-last.length());
+ }
+ }
+ }
+
+ return trim;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpUtils.java
new file mode 100644
index 00000000..b7e05009
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpUtils.java
@@ -0,0 +1,22 @@
+package io.github.moulberry.notenoughupdates.core.util.lerp;
+
+public class LerpUtils {
+
+ public static float clampZeroOne(float f) {
+ return Math.max(0, Math.min(1, f));
+ }
+
+ public static float sigmoid(float val) {
+ return (float)(1/(1 + Math.exp(-val)));
+ }
+
+ private static final float sigmoidStr = 8;
+ private static final float sigmoidA = -1/(sigmoid(-0.5f * sigmoidStr) - sigmoid(0.5f * sigmoidStr));
+ private static final float sigmoidB = sigmoidA*sigmoid(-0.5f * sigmoidStr);
+ public static float sigmoidZeroOne(float f) {
+ f = clampZeroOne(f);
+ return sigmoidA*sigmoid(sigmoidStr*(f-0.5f))-sigmoidB;
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingFloat.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingFloat.java
new file mode 100644
index 00000000..250facfc
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingFloat.java
@@ -0,0 +1,68 @@
+package io.github.moulberry.notenoughupdates.core.util.lerp;
+
+public class LerpingFloat {
+
+ private int timeSpent;
+ private long lastMillis;
+ private int timeToReachTarget;
+
+ private float targetValue;
+ private float lerpValue;
+
+ public LerpingFloat(float initialValue, int timeToReachTarget) {
+ this.targetValue = this.lerpValue = initialValue;
+ this.timeToReachTarget = timeToReachTarget;
+ }
+
+ public LerpingFloat(int initialValue) {
+ this(initialValue, 200);
+ }
+
+ public void tick() {
+ int lastTimeSpent = timeSpent;
+ this.timeSpent += System.currentTimeMillis() - lastMillis;
+
+ float lastDistPercentToTarget = lastTimeSpent/(float)timeToReachTarget;
+ float distPercentToTarget = timeSpent/(float)timeToReachTarget;
+ float fac = (1-lastDistPercentToTarget)/lastDistPercentToTarget;
+
+ float startValue = lerpValue - (targetValue - lerpValue)/fac;
+
+ float dist = targetValue - startValue;
+ if(dist == 0) return;
+
+ float oldLerpValue = lerpValue;
+ if(distPercentToTarget >= 1) {
+ lerpValue = targetValue;
+ } else {
+ lerpValue = startValue + dist*distPercentToTarget;
+ }
+
+ if(lerpValue == oldLerpValue) {
+ timeSpent = lastTimeSpent;
+ } else {
+ this.lastMillis = System.currentTimeMillis();
+ }
+ }
+
+ public void resetTimer() {
+ this.timeSpent = 0;
+ this.lastMillis = System.currentTimeMillis();
+ }
+
+ public void setTarget(float targetValue) {
+ this.targetValue = targetValue;
+ }
+
+ public void setValue(float value) {
+ this.targetValue = this.lerpValue = value;
+ }
+
+ public float getValue() {
+ return lerpValue;
+ }
+
+ public float getTarget() {
+ return targetValue;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/LerpingInteger.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingInteger.java
index 93c011e1..cdc2c4fd 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/LerpingInteger.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/lerp/LerpingInteger.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates.util;
+package io.github.moulberry.notenoughupdates.core.util.lerp;
public class LerpingInteger {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
new file mode 100644
index 00000000..0cc34fa4
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java
@@ -0,0 +1,144 @@
+package io.github.moulberry.notenoughupdates.core.util.render;
+
+import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+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.vertex.DefaultVertexFormats;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+public class RenderUtils {
+
+ public static void drawFloatingRectDark(int x, int y, int width, int height) {
+ drawFloatingRectDark(x, y, width, height, true);
+ }
+
+ public static void drawFloatingRectDark(int x, int y, int width, int height, boolean shadow) {
+ int alpha = 0xf0000000;
+
+ if(OpenGlHelper.isFramebufferEnabled()) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ BackgroundBlur.renderBlurredBackground(scaledResolution.getScaledWidth(),
+ scaledResolution.getScaledHeight(), x, y, width, height);
+ } else {
+ alpha = 0xff000000;
+ }
+
+ int main = alpha | 0x202026;
+ int light = 0xff303036;
+ int dark = 0xff101016;
+ Gui.drawRect(x, y, x+1, y+height, light); //Left
+ Gui.drawRect(x+1, y, x+width, y+1, light); //Top
+ Gui.drawRect(x+width-1, y+1, x+width, y+height, dark); //Right
+ Gui.drawRect(x+1, y+height-1, x+width-1, y+height, dark); //Bottom
+ Gui.drawRect(x+1, y+1, x+width-1, y+height-1, main); //Middle
+ if(shadow) {
+ Gui.drawRect(x+width, y+2, x+width+2, y+height+2, 0x70000000); //Right shadow
+ Gui.drawRect(x+2, y+height, x+width, y+height+2, 0x70000000); //Bottom shadow
+ }
+ }
+
+ public static void drawFloatingRect(int x, int y, int width, int height) {
+ drawFloatingRectWithAlpha(x, y, width, height, 0xFF, true);
+ }
+
+ public static void drawFloatingRectWithAlpha(int x, int y, int width, int height, int alpha, boolean shadow) {
+ int main = (alpha << 24) | 0xc0c0c0;
+ int light = (alpha << 24) | 0xf0f0f0;
+ int dark = (alpha << 24) | 0x909090;
+ Gui.drawRect(x, y, x+1, y+height, light); //Left
+ Gui.drawRect(x+1, y, x+width, y+1, light); //Top
+ Gui.drawRect(x+width-1, y+1, x+width, y+height, dark); //Right
+ Gui.drawRect(x+1, y+height-1, x+width-1, y+height, dark); //Bottom
+ Gui.drawRect(x+1, y+1, x+width-1, y+height-1, main); //Middle
+ if(shadow) {
+ Gui.drawRect(x+width, y+2, x+width+2, y+height+2, (alpha*3/5) << 24); //Right shadow
+ Gui.drawRect(x+2, y+height, x+width, y+height+2, (alpha*3/5) << 24); //Bottom shadow
+ }
+ }
+
+ public static void drawTexturedRect(float x, float y, float width, float height) {
+ drawTexturedRect(x, y, width, height, 0, 1, 0 , 1);
+ }
+
+ public static void drawTexturedRect(float x, float y, float width, float height, int filter) {
+ drawTexturedRect(x, y, width, height, 0, 1, 0 , 1, filter);
+ }
+
+ public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax) {
+ drawTexturedRect(x, y, width, height, uMin, uMax, vMin , vMax, GL11.GL_NEAREST);
+ }
+
+ public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) {
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+ drawTexturedRectNoBlend(x, y, width, height, uMin, uMax, vMin, vMax, filter);
+
+ GlStateManager.disableBlend();
+ }
+
+ public static void drawTexturedRectNoBlend(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) {
+ GlStateManager.enableTexture2D();
+
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter);
+
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
+ worldrenderer
+ .pos(x, y+height, 0.0D)
+ .tex(uMin, vMax).endVertex();
+ worldrenderer
+ .pos(x+width, y+height, 0.0D)
+ .tex(uMax, vMax).endVertex();
+ worldrenderer
+ .pos(x+width, y, 0.0D)
+ .tex(uMax, vMin).endVertex();
+ worldrenderer
+ .pos(x, y, 0.0D)
+ .tex(uMin, vMin).endVertex();
+ tessellator.draw();
+
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
+ }
+
+ public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
+ float startAlpha = (float)(startColor >> 24 & 255) / 255.0F;
+ float startRed = (float)(startColor >> 16 & 255) / 255.0F;
+ float startGreen = (float)(startColor >> 8 & 255) / 255.0F;
+ float startBlue = (float)(startColor & 255) / 255.0F;
+ float endAlpha = (float)(endColor >> 24 & 255) / 255.0F;
+ float endRed = (float)(endColor >> 16 & 255) / 255.0F;
+ float endGreen = (float)(endColor >> 8 & 255) / 255.0F;
+ float endBlue = (float)(endColor & 255) / 255.0F;
+
+ GlStateManager.disableTexture2D();
+ GlStateManager.enableBlend();
+ GlStateManager.disableAlpha();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.shadeModel(7425);
+
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
+ worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
+ worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
+ worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
+ worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
+ tessellator.draw();
+
+ GlStateManager.shadeModel(7424);
+ GlStateManager.disableBlend();
+ GlStateManager.enableAlpha();
+ GlStateManager.enableTexture2D();
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java
new file mode 100644
index 00000000..541fd67a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/TextRenderUtils.java
@@ -0,0 +1,215 @@
+package io.github.moulberry.notenoughupdates.core.util.render;
+
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TextRenderUtils {
+
+ public static int getCharVertLen(char c) {
+ if("acegmnopqrsuvwxyz".indexOf(c) >= 0) {
+ return 5;
+ } else {
+ return 7;
+ }
+ }
+
+ public static float getVerticalHeight(String str) {
+ str = StringUtils.cleanColour(str);
+ float height = 0;
+ for(int i=0; i<str.length(); i++) {
+ char c = str.charAt(i);
+ int charHeight = getCharVertLen(c);
+ height += charHeight + 1.5f;
+ }
+ return height;
+ }
+
+ public static void drawStringVertical(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
+ String format = FontRenderer.getFormatFromString(str);
+ str = StringUtils.cleanColour(str);
+ for(int i=0; i<str.length(); i++) {
+ char c = str.charAt(i);
+
+ int charHeight = getCharVertLen(c);
+ int charWidth = fr.getCharWidth(c);
+ fr.drawString(format+c, x+(5-charWidth)/2f, y-7+charHeight, colour, shadow);
+
+ y += charHeight + 1.5f;
+ }
+ }
+
+ public static void drawStringScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) {
+ int strLen = fr.getStringWidth(str);
+ float factor = len/(float)strLen;
+ factor = Math.min(1, factor);
+
+ drawStringScaled(str, fr, x, y, shadow, colour, factor);
+ }
+
+ public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
+ int strLen = fr.getStringWidth(str);
+
+ float x2 = x - strLen/2f;
+ float y2 = y - fr.FONT_HEIGHT/2f;
+
+ GL11.glTranslatef(x2, y2, 0);
+ fr.drawString(str, 0, 0, colour, shadow);
+ GL11.glTranslatef(-x2, -y2, 0);
+ }
+
+ public static void drawStringScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int colour, float factor) {
+ GlStateManager.scale(factor, factor, 1);
+ fr.drawString(str, x/factor, y/factor, colour, shadow);
+ GlStateManager.scale(1/factor, 1/factor, 1);
+ }
+
+ public static void drawStringCenteredScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) {
+ int strLen = fr.getStringWidth(str);
+ float factor = len/(float)strLen;
+ factor = Math.min(1, factor);
+ int newLen = Math.min(strLen, len);
+
+ float fontHeight = 8*factor;
+
+ drawStringScaled(str, fr, x-newLen/2, y-fontHeight/2, shadow, colour, factor);
+ }
+
+ public static void renderToolTip(ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontStd) {
+ List<String> list = stack.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+
+ for (int i = 0; i < list.size(); ++i) {
+ if (i == 0) {
+ list.set(i, stack.getRarity().rarityColor + list.get(i));
+ } else {
+ list.set(i, EnumChatFormatting.GRAY + list.get(i));
+ }
+ }
+
+ FontRenderer font = stack.getItem().getFontRenderer(stack);
+ drawHoveringText(list, mouseX, mouseY, screenWidth, screenHeight, -1, font == null ? fontStd : font);
+ }
+
+ public static void drawHoveringText(List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font) {
+ if (!textLines.isEmpty()) {
+ GlStateManager.disableRescaleNormal();
+ RenderHelper.disableStandardItemLighting();
+ GlStateManager.disableLighting();
+ GlStateManager.disableDepth();
+ int tooltipTextWidth = 0;
+
+ for (String textLine : textLines) {
+ int textLineWidth = font.getStringWidth(textLine);
+
+ if (textLineWidth > tooltipTextWidth) {
+ tooltipTextWidth = textLineWidth;
+ }
+ }
+
+ boolean needsWrap = false;
+
+ int titleLinesCount = 1;
+ int tooltipX = mouseX + 12;
+ if (tooltipX + tooltipTextWidth + 4 > screenWidth) {
+ tooltipX = mouseX - 16 - tooltipTextWidth;
+ if (tooltipX < 4) // if the tooltip doesn't fit on the screen
+ {
+ if (mouseX > screenWidth / 2) {
+ tooltipTextWidth = mouseX - 12 - 8;
+ } else {
+ tooltipTextWidth = screenWidth - 16 - mouseX;
+ }
+ needsWrap = true;
+ }
+ }
+
+ if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) {
+ tooltipTextWidth = maxTextWidth;
+ needsWrap = true;
+ }
+
+ if (needsWrap) {
+ int wrappedTooltipWidth = 0;
+ List<String> wrappedTextLines = new ArrayList<String>();
+ for (int i = 0; i < textLines.size(); i++) {
+ String textLine = textLines.get(i);
+ List<String> wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth);
+ if (i == 0) {
+ titleLinesCount = wrappedLine.size();
+ }
+
+ for (String line : wrappedLine) {
+ int lineWidth = font.getStringWidth(line);
+ if (lineWidth > wrappedTooltipWidth) {
+ wrappedTooltipWidth = lineWidth;
+ }
+ wrappedTextLines.add(line);
+ }
+ }
+ tooltipTextWidth = wrappedTooltipWidth;
+ textLines = wrappedTextLines;
+
+ if (mouseX > screenWidth / 2) {
+ tooltipX = mouseX - 16 - tooltipTextWidth;
+ } else {
+ tooltipX = mouseX + 12;
+ }
+ }
+
+ int tooltipY = mouseY - 12;
+ int tooltipHeight = 8;
+
+ if (textLines.size() > 1) {
+ tooltipHeight += (textLines.size() - 1) * 10;
+ if (textLines.size() > titleLinesCount) {
+ tooltipHeight += 2; // gap between title lines and next lines
+ }
+ }
+
+ if (tooltipY + tooltipHeight + 6 > screenHeight) {
+ tooltipY = screenHeight - tooltipHeight - 6;
+ }
+
+ final int zLevel = 300;
+ final int backgroundColor = 0xF0100010;
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor);
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor);
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
+ RenderUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
+ final int borderColorStart = 0x505000FF;
+ final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000;
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
+ RenderUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd);
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart);
+ RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
+
+ for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
+ String line = textLines.get(lineNumber);
+ font.drawStringWithShadow(line, (float) tooltipX, (float) tooltipY, -1);
+
+ if (lineNumber + 1 == titleLinesCount) {
+ tooltipY += 2;
+ }
+
+ tooltipY += 10;
+ }
+
+ GlStateManager.enableLighting();
+ GlStateManager.enableDepth();
+ RenderHelper.enableStandardItemLighting();
+ GlStateManager.enableRescaleNormal();
+ }
+ GlStateManager.disableLighting();
+ }
+
+}
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 76885703..6f2ab3f1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java
@@ -1,14 +1,22 @@
package io.github.moulberry.notenoughupdates.cosmetics;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.HypixelApi;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+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.minecraftforge.client.event.RenderPlayerEvent;
+import net.minecraftforge.client.event.RenderWorldEvent;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.commons.lang3.ArrayUtils;
@@ -36,8 +44,8 @@ public class CapeManager {
private HashSet<String> availableCapes = new HashSet<>();
private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee",
- "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative" };
- public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false };
+ "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void" };
+ public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false, false };
public static CapeManager getInstance() {
return INSTANCE;
@@ -109,8 +117,7 @@ public class CapeManager {
updateConfig = updateConfig && playerUUID.equals(Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""));
if(updateConfig) {
- NotEnoughUpdates.INSTANCE.manager.config.selectedCape.value = String.valueOf(capename);
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
+ NotEnoughUpdates.INSTANCE.config.hidden.selectedCape = String.valueOf(capename);
}
if(updateConfig) {
@@ -138,13 +145,14 @@ public class CapeManager {
return null;
}
+ private static BiMap<String, EntityPlayer> playerMap = null;
+
public EntityPlayer getPlayerForUUID(String uuid) {
- if(Minecraft.getMinecraft().theWorld != null) {
- for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
- if(player.getUniqueID().toString().replace("-", "").equals(uuid)) {
- return player;
- }
- }
+ if(playerMap == null) {
+ return null;
+ }
+ if(playerMap.containsKey(uuid)) {
+ return playerMap.get(uuid);
}
return null;
}
@@ -161,21 +169,26 @@ public class CapeManager {
return framebuffer;
}
+ public boolean updateWorldFramebuffer = false;
public Framebuffer backgroundFramebuffer = null;
- @SubscribeEvent
- public void onRenderPlayer(RenderPlayerEvent.Pre e) {
+
+ public void postRenderBlocks() {
int width = Minecraft.getMinecraft().displayWidth;
int height = Minecraft.getMinecraft().displayHeight;
backgroundFramebuffer = checkFramebufferSizes(backgroundFramebuffer,
width, height);
- GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
- GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, backgroundFramebuffer.framebufferObject);
- GL30.glBlitFramebuffer(0, 0, width, height,
- 0, 0, width, height,
- GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
+ if(OpenGlHelper.isFramebufferEnabled() && updateWorldFramebuffer) {
+ GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
+ GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, backgroundFramebuffer.framebufferObject);
+ GL30.glBlitFramebuffer(0, 0, width, height,
+ 0, 0, width, height,
+ GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
+ }
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
+ updateWorldFramebuffer = false;
}
@SubscribeEvent
@@ -186,7 +199,7 @@ public class CapeManager {
String clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "");
if(Minecraft.getMinecraft().thePlayer != null && uuid.equals(clientUuid)) {
- String selCape = NotEnoughUpdates.INSTANCE.manager.config.selectedCape.value;
+ String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape;
if(selCape != null && !selCape.isEmpty()) {
if(localCape == null) {
localCape = new MutablePair<>(new NEUCape(selCape), selCape);
@@ -205,20 +218,41 @@ public class CapeManager {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase != TickEvent.Phase.END) return;
+ if(Minecraft.getMinecraft().theWorld == null) return;
String clientUuid = null;
if(Minecraft.getMinecraft().thePlayer != null) {
clientUuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "");
}
+ if(playerMap == null) {
+ playerMap = HashBiMap.create(Minecraft.getMinecraft().theWorld.playerEntities.size());
+ }
+ HashSet<String> contains = new HashSet<>();
+ for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
+ String uuid = player.getUniqueID().toString().replace("-", "");
+ contains.add(uuid);
+ if(!playerMap.containsValue(player)) {
+ playerMap.put(uuid, player);
+ }
+ }
+ playerMap.keySet().retainAll(contains);
+
+ boolean hasLocalCape = localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null");
+
Set<String> toRemove = new HashSet<>();
try {
for(String playerUUID : capeMap.keySet()) {
- EntityPlayer player = getPlayerForUUID(playerUUID);
+ EntityPlayer player;
+ if(playerUUID.equals(clientUuid)) {
+ player = Minecraft.getMinecraft().thePlayer;
+ } else {
+ player = getPlayerForUUID(playerUUID);
+ }
if(player != null) {
String capeName = capeMap.get(playerUUID).getRight();
if(capeName != null && !capeName.equals("null")) {
- if(playerUUID.equals(clientUuid) && localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null")) {
+ if(player == Minecraft.getMinecraft().thePlayer && hasLocalCape) {
continue;
}
capeMap.get(playerUUID).getLeft().setCapeTexture(capeName);
@@ -230,7 +264,7 @@ public class CapeManager {
}
} catch(Exception e) {}
- if(localCape != null) {
+ if(hasLocalCape) {
localCape.getLeft().setCapeTexture(localCape.getValue());
localCape.getLeft().onTick(event, Minecraft.getMinecraft().thePlayer);
}
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 9de2731c..d93b8bb0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
@@ -88,6 +88,8 @@ public class NEUCape {
shaderName = "biscuit_cape";
} else if(capeName.equalsIgnoreCase("negative")) {
shaderName = "negative";
+ } else if(capeName.equalsIgnoreCase("void")) {
+ shaderName = "void";
} else {
shaderName = "shiny_cape";
}
@@ -119,7 +121,10 @@ public class NEUCape {
private void bindTexture() {
if(capeName.equalsIgnoreCase("negative")) {
- CapeManager.getInstance().backgroundFramebuffer.bindFramebufferTexture();
+ CapeManager.getInstance().updateWorldFramebuffer = true;
+ if(CapeManager.getInstance().backgroundFramebuffer != null) {
+ CapeManager.getInstance().backgroundFramebuffer.bindFramebufferTexture();
+ }
} else if(capeTextures != null && capeTextures.length>0) {
long currentTime = System.currentTimeMillis();
if(currentTime - lastFrameUpdate > 100) {
@@ -325,6 +330,12 @@ public class NEUCape {
Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight
));
+ } else if(shaderName.equalsIgnoreCase("void")) {
+ shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderName, "screensize", new Vector2f(
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayHeight
+ ));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java
index fb9de198..6fd3db78 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonBlocks.java
@@ -1,7 +1,7 @@
package io.github.moulberry.notenoughupdates.dungeons;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -9,17 +9,12 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.*;
-import net.minecraft.client.resources.IResourceManager;
-import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.BufferUtils;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.*;
-import java.awt.*;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -47,8 +42,8 @@ public class DungeonBlocks {
}
public static boolean isOverriding() {
- return OpenGlHelper.isFramebufferEnabled() && !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value &&
- (NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value ||
+ return OpenGlHelper.isFramebufferEnabled() && NotEnoughUpdates.INSTANCE.config.dungeonBlock.enableDungBlockOverlay &&
+ (NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungeonBlocksEverywhere ||
(SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon")));
}
@@ -146,15 +141,15 @@ public class DungeonBlocks {
static {
dynamicPreloadMap.put(new ResourceLocation("textures/entity/bat.png"),
- NotEnoughUpdates.INSTANCE.manager.config.dungBatColour.value);
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungBatColour);
dynamicPreloadMap.put(new ResourceLocation("textures/entity/chest/normal.png"),
- NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value);
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungChestColour);
dynamicPreloadMap.put(new ResourceLocation("textures/entity/chest/normal_double.png"),
- NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value);
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungChestColour);
dynamicPreloadMap.put(new ResourceLocation("textures/entity/chest/trapped.png"),
- NotEnoughUpdates.INSTANCE.manager.config.dungTrappedChestColour.value);
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungTrappedChestColour);
dynamicPreloadMap.put(new ResourceLocation("textures/entity/chest/trapped_double.png"),
- NotEnoughUpdates.INSTANCE.manager.config.dungTrappedChestColour.value);
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungTrappedChestColour);
}
public static void tick() {
@@ -197,13 +192,13 @@ public class DungeonBlocks {
HashMap<TextureAtlasSprite, Integer> spriteMap = new HashMap<>();
spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/stonebrick_cracked"),
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dungCrackedColour.value));
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungCrackedColour));
spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/dispenser_front_horizontal"),
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dungDispenserColour.value));
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungDispenserColour));
spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/lever"),
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dungLeverColour.value));
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungLeverColour));
spriteMap.put(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/trip_wire"),
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dungTripWireColour.value));
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungTripWireColour));
for(Map.Entry<TextureAtlasSprite, Integer> entry : spriteMap.entrySet()) {
if(((entry.getValue() >> 24) & 0xFF) < 10) continue;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index 4a209cd9..bbb5fd31 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -1,30 +1,23 @@
package io.github.moulberry.notenoughupdates.dungeons;
import com.google.common.collect.Iterables;
-import com.google.common.math.BigIntegerMath;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NEUResourceManager;
+import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.block.material.MapColor;
-import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.MapItemRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.*;
-import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
@@ -35,19 +28,12 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
-import org.lwjgl.opengl.GL30;
-import org.lwjgl.opengl.GL45;
import java.awt.*;
-import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.InputStreamReader;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.List;
@@ -198,7 +184,7 @@ public class DungeonMap {
float x = 0;
float y = 0;
- if(NotEnoughUpdates.INSTANCE.manager.config.dmCenterCheck.value) {
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterCheck) {
if(fillCorner) {
x += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation-45))*1.414f;
y += (roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation-45))*1.414;
@@ -212,17 +198,17 @@ public class DungeonMap {
}
}
GlStateManager.translate(x, y, 0);
- if(!NotEnoughUpdates.INSTANCE.manager.config.dmOrientCheck.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmOrientCheck) {
GlStateManager.rotate(-rotation+180, 0, 0, 1);
}
GlStateManager.pushMatrix();
- GlStateManager.scale(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value,
- NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, 1);
+ GlStateManager.scale(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale,
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale, 1);
Utils.drawTexturedRect(-5, -5, 10, 10, GL11.GL_NEAREST);
GlStateManager.popMatrix();
- if(!NotEnoughUpdates.INSTANCE.manager.config.dmOrientCheck.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmOrientCheck) {
GlStateManager.rotate(rotation-180, 0, 0, 1);
}
GlStateManager.translate(-x, -y, 0);
@@ -361,23 +347,23 @@ public class DungeonMap {
}
public int getRenderRoomSize() {
- double roomSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value;
+ double roomSizeOption = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRoomSize;
if(roomSizeOption <= 0) return 12;
return 12 + (int)Math.round(roomSizeOption*4);
}
public int getRenderConnSize() {
- int roomSizeOption = (int)Math.round(NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value);
+ int roomSizeOption = (int)Math.round(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRoomSize);
if(roomSizeOption <= 0) return 3;
return 3 + roomSizeOption;
}
private HashMap<Integer, Float> borderRadiusCache = new HashMap<>();
public float getBorderRadius() {
- int borderSizeOption = (int)Math.round(NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize.value.doubleValue());
+ int borderSizeOption = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize;
String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium";
- int style = NotEnoughUpdates.INSTANCE.manager.config.dmBorderStyle.value.intValue();
+ int style = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle;
if(borderRadiusCache.containsKey(style)) {
return borderRadiusCache.get(style);
}
@@ -396,8 +382,8 @@ public class DungeonMap {
}
public void render(int centerX, int centerY) {
- boolean useFb = NotEnoughUpdates.INSTANCE.manager.config.dmCompat.value <= 1;
- boolean useShd = NotEnoughUpdates.INSTANCE.manager.config.dmCompat.value <= 0;
+ boolean useFb = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCompat <= 1;
+ boolean useShd = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCompat <= 0;
if((useFb && !OpenGlHelper.isFramebufferEnabled()) || (useShd && !OpenGlHelper.areShadersSupported())) {
Utils.drawStringCentered(EnumChatFormatting.RED+"NEU Dungeon Map requires framebuffers & shaders",
@@ -422,7 +408,7 @@ public class DungeonMap {
maxRoomY = Math.max(offset.y, maxRoomY);
}
- int borderSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize.value.intValue();
+ int borderSizeOption = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize;
int renderRoomSize = getRenderRoomSize();
int renderConnSize = getRenderConnSize();
@@ -435,14 +421,14 @@ public class DungeonMap {
}
int rotation = 180;
- if(playerPos != null && NotEnoughUpdates.INSTANCE.manager.config.dmRotatePlayer.value) {
+ if(playerPos != null && NotEnoughUpdates.INSTANCE.config.dungeonMap.dmRotatePlayer) {
rotation = (int)playerPos.rotation;
}
int mapSizeX;
int mapSizeY;
- if(NotEnoughUpdates.INSTANCE.manager.config.dmBorderStyle.value <= 1) {
- mapSizeX = 80 + (int)Math.round(40*NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize.value);
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle <= 1) {
+ mapSizeX = 80 + (int)Math.round(40*NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderSize);
} else {
mapSizeX = borderSizeOption == 0 ? 90 : borderSizeOption == 1 ? 120 : borderSizeOption == 2 ? 160 : 240;
}
@@ -470,7 +456,7 @@ public class DungeonMap {
return;
}
- int backgroundColour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundColour.value);
+ int backgroundColour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundColour);
mapFramebuffer1.framebufferColor[0] = ((backgroundColour >> 16) & 0xFF)/255f;
mapFramebuffer1.framebufferColor[1] = ((backgroundColour >> 8) & 0xFF)/255f;
@@ -506,7 +492,7 @@ public class DungeonMap {
GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 100);
}
- if(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) {
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.translate(-centerX+mapSizeX/2, -centerY+mapSizeY/2, 0);
renderBlurredBackground(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(),
centerX-mapSizeX/2, centerY-mapSizeY/2, mapSizeX, mapSizeY);
@@ -515,7 +501,7 @@ public class DungeonMap {
GlStateManager.translate(mapCenterX, mapCenterY, 10);
- if(!useFb || NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) {
+ if(!useFb || NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
@@ -523,7 +509,7 @@ public class DungeonMap {
GlStateManager.rotate(-rotation+180, 0, 0, 1);
- if(NotEnoughUpdates.INSTANCE.manager.config.dmCenterPlayer.value && playerPos != null) {
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterPlayer && playerPos != null) {
float x = playerPos.getRenderX();
float y = playerPos.getRenderY();
x -= minRoomX*(renderRoomSize+renderConnSize);
@@ -597,7 +583,7 @@ public class DungeonMap {
float y = pos.getRenderY();
float angle = pos.rotation;
- boolean doInterp = NotEnoughUpdates.INSTANCE.manager.config.dmPlayerInterp.value;
+ boolean doInterp = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerInterp;
if(playerEntityMapPositions.containsKey(name)) {
MapPosition entityPos = playerEntityMapPositions.get(name);
angle = entityPos.rotation;
@@ -605,7 +591,7 @@ public class DungeonMap {
float deltaX = entityPos.getRenderX() - pos.getRenderX();
float deltaY = entityPos.getRenderY() - pos.getRenderY();
- if(deltaX > (renderRoomSize + renderConnSize)/2) {
+ /*if(deltaX > (renderRoomSize + renderConnSize)/2) {
deltaX -= (renderRoomSize + renderConnSize);
} else if(deltaX < -(renderRoomSize + renderConnSize)/2) {
deltaX += (renderRoomSize + renderConnSize);
@@ -614,7 +600,7 @@ public class DungeonMap {
deltaY -= (renderRoomSize + renderConnSize);
} else if(deltaY < -(renderRoomSize + renderConnSize)/2) {
deltaY += (renderRoomSize + renderConnSize);
- }
+ }*/
x += deltaX;
y += deltaY;
@@ -661,7 +647,7 @@ public class DungeonMap {
pixelWidth = pixelHeight = 12;
}
GlStateManager.color(1, 1, 1, 1);
- if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 1 &&
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerHeads >= 1 &&
playerSkinMap.containsKey(entry.getKey())) {
Minecraft.getMinecraft().getTextureManager().bindTexture(playerSkinMap.get(entry.getKey()));
@@ -671,7 +657,7 @@ public class DungeonMap {
maxV = 16/64f;
headLayer = true;
- if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 2) {
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmPlayerHeads >= 2) {
blackBorder = true;
}
} else {
@@ -688,8 +674,8 @@ public class DungeonMap {
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.translate(x, y, -0.02F);
- GlStateManager.scale(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value,
- NotEnoughUpdates.INSTANCE.manager.config.dmIconScale.value, 1);
+ GlStateManager.scale(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale,
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmIconScale, 1);
GlStateManager.rotate(angle, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(-0.5F, 0.5F, 0.0F);
@@ -757,8 +743,8 @@ public class DungeonMap {
GlStateManager.translate(centerX, centerY, 100);
- if(NotEnoughUpdates.INSTANCE.manager.config.dmChromaBorder.value) {
- int colour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value);
+ if(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmChromaBorder) {
+ int colour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour);
Gui.drawRect(-mapCenterX-2, -mapCenterY-2, -mapCenterX, -mapCenterY,
colour); //topleft
@@ -789,19 +775,19 @@ public class DungeonMap {
} else {
Gui.drawRect(-mapCenterX-2, -mapCenterY, -mapCenterX, mapCenterY,
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //left
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //left
Gui.drawRect(mapCenterX, -mapCenterY, mapCenterX+2, mapCenterY,
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //right
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //right
Gui.drawRect(-mapCenterX-2, -mapCenterY-2, mapCenterX+2, -mapCenterY,
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //top
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //top
Gui.drawRect(-mapCenterX-2, mapCenterY, mapCenterX+2, mapCenterY+2,
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //bottom
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderColour)); //bottom
}
String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium";
ResourceLocation rl = new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+
- NotEnoughUpdates.INSTANCE.manager.config.dmBorderStyle.value.intValue()+".png");
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBorderStyle+".png");
if(Minecraft.getMinecraft().getTextureManager().getTexture(rl) != TextureUtil.missingTexture) {
Minecraft.getMinecraft().getTextureManager().bindTexture(rl);
GlStateManager.color(1, 1, 1, 1);
@@ -1010,7 +996,7 @@ public class DungeonMap {
private long lastClearCache = 0;
public void renderMap(int centerX, int centerY, Color[][] colourMap, Map<String, Vec4b> mapDecorations,
int roomSizeBlocks, Set<String> actualPlayers, boolean usePlayerPositions, float partialTicks) {
- if(!NotEnoughUpdates.INSTANCE.manager.config.dmEnable.value) return;
+ if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable) return;
if(colourMap == null) return;
if(colourMap.length != 128) return;
if(colourMap[0].length != 128) return;
@@ -1364,8 +1350,8 @@ public class DungeonMap {
@SubscribeEvent(priority=EventPriority.HIGH)
public void onRenderOverlayPre(RenderGameOverlayEvent.Pre event) {
if(event.type == RenderGameOverlayEvent.ElementType.ALL &&
- NotEnoughUpdates.INSTANCE.manager.config.dmEnable.value &&
- NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) {
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable &&
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur > 0.1) {
blurBackground();
GlStateManager.enableBlend();
GlStateManager.enableTexture2D();
@@ -1378,9 +1364,9 @@ public class DungeonMap {
}
@SubscribeEvent
- public void onRenderOverlay(RenderGameOverlayEvent event) {
+ public void onRenderOverlay(RenderGameOverlayEvent.Post event) {
if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
- if(!NotEnoughUpdates.INSTANCE.manager.config.dmEnable.value) return;
+ if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable) return;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo ||
(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.isKeyDown() &&
@@ -1489,8 +1475,8 @@ public class DungeonMap {
}
}
- renderMap((int)(NotEnoughUpdates.INSTANCE.manager.config.dmCenterX.value/100*Minecraft.getMinecraft().displayWidth/2),
- (int)(NotEnoughUpdates.INSTANCE.manager.config.dmCenterY.value/100*Minecraft.getMinecraft().displayHeight/2),
+ renderMap((int)(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterX/100*Minecraft.getMinecraft().displayWidth/2),
+ (int)(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterY/100*Minecraft.getMinecraft().displayHeight/2),
colourMap, decorations, roomSizeBlocks, actualPlayers, true, event.partialTicks);
}
}
@@ -1591,7 +1577,7 @@ public class DungeonMap {
} catch(Exception e) { }
}
if(blurShaderHorz != null && blurShaderVert != null) {
- float blur = NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value.floatValue();
+ float blur = NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur;
blur = Math.max(0, Math.min(50, blur));
if(blur != lastBgBlurFactor) {
blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blur);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
index fec10027..284ec1a3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
@@ -77,13 +77,13 @@ public class DungeonWin {
}
public static void displayWin() {
- if(NotEnoughUpdates.INSTANCE.manager.config.dungeonWinMillis.value < 100) return;
+ if(NotEnoughUpdates.INSTANCE.config.dungeonWin.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeonWin.enableDungeonWin) return;
startTime = System.currentTimeMillis();
confetti.clear();
}
public static void tick() {
- if(NotEnoughUpdates.INSTANCE.manager.config.dungeonWinMillis.value < 100) return;
+ if(NotEnoughUpdates.INSTANCE.config.dungeonWin.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeonWin.enableDungeonWin) return;
if(System.currentTimeMillis() - startTime > 5000) return;
int deltaTime = (int)(System.currentTimeMillis() - startTime);
@@ -140,7 +140,7 @@ public class DungeonWin {
}
public static void onChatMessage(ClientChatReceivedEvent e) {
- if(NotEnoughUpdates.INSTANCE.manager.config.dungeonWinMillis.value < 100) return;
+ if(NotEnoughUpdates.INSTANCE.config.dungeonWin.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeonWin.enableDungeonWin) return;
long currentTime = System.currentTimeMillis();
String unformatted = Utils.cleanColour(e.message.getUnformattedText());
if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+" ")) {
@@ -195,8 +195,8 @@ public class DungeonWin {
}
public static void render(float partialTicks) {
- if(NotEnoughUpdates.INSTANCE.manager.config.dungeonWinMillis.value < 100) return;
- int maxTime = Math.min(30000, NotEnoughUpdates.INSTANCE.manager.config.dungeonWinMillis.value.intValue());
+ if(NotEnoughUpdates.INSTANCE.config.dungeonWin.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeonWin.enableDungeonWin) return;
+ int maxTime = Math.min(30000, NotEnoughUpdates.INSTANCE.config.dungeonWin.dungeonWinMillis);
if(System.currentTimeMillis() - startTime > maxTime) return;
int deltaTime = (int)(System.currentTimeMillis() - startTime);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
index 0bd7ed6f..e962f793 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -1,18 +1,18 @@
package io.github.moulberry.notenoughupdates.dungeons;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.GuiElementColour;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.options.Options;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
import net.minecraft.util.EnumChatFormatting;
@@ -24,14 +24,11 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
-import java.awt.image.BufferedImage;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.util.*;
import java.util.List;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
-
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
-import static io.github.moulberry.notenoughupdates.GuiTextures.colour_selector_dot;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
public class GuiDungeonMapEditor extends GuiScreen {
@@ -57,23 +54,9 @@ public class GuiDungeonMapEditor extends GuiScreen {
private GuiElementTextField xField = new GuiElementTextField("", GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE);
private GuiElementTextField yField = new GuiElementTextField("", GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE);
private GuiElementTextField blurField = new GuiElementTextField("", GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE);
- private ColourEditor activeColourEditor = null;
-
- private Options.Option<Double> clickedSlider = null;
-
- private class ColourEditor {
- public int x;
- public int y;
- public Options.Option<String> option;
- public String special;
+ private GuiElementColour activeColourEditor = null;
- public ColourEditor(int x, int y, Options.Option<String> option, String special) {
- this.x = x;
- this.y = y;
- this.option = option;
- this.special = special;
- }
- }
+ private Field clickedSlider;
class Button {
private int id;
@@ -81,18 +64,26 @@ public class GuiDungeonMapEditor extends GuiScreen {
private int y;
private String text;
private Color colour = new Color(-1, true);
- private Options.Option<?> option;
+ private Field option;
+ private String displayName;
+ private String desc;
public Button(int id, int x, int y, String text) {
this(id, x, y, text, null);
}
- public Button(int id, int x, int y, String text, Options.Option<?> option) {
+ public Button(int id, int x, int y, String text, Field option) {
this.id = id;
this.x = x;
this.y = y;
this.text = text;
this.option = option;
+
+ if(option != null) {
+ ConfigOption optionAnnotation = option.getAnnotation(ConfigOption.class);
+ displayName = optionAnnotation.name();
+ desc = optionAnnotation.desc();
+ }
}
public List<String> getTooltip() {
@@ -101,8 +92,8 @@ public class GuiDungeonMapEditor extends GuiScreen {
}
List<String> tooltip = new ArrayList<>();
- tooltip.add(EnumChatFormatting.YELLOW+option.displayName);
- for(String line : option.desc.split("\n")) {
+ tooltip.add(EnumChatFormatting.YELLOW+displayName);
+ for(String line : desc.split("\n")) {
tooltip.add(EnumChatFormatting.AQUA+line);
}
return tooltip;
@@ -129,7 +120,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
}
public GuiDungeonMapEditor() {
- Options options = NotEnoughUpdates.INSTANCE.manager.config;
+ NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
//Map Border Size
//buttons.add(new Button(0, 6, 37, "Small", options.dmBorderSize));
//buttons.add(new Button(1, 52, 37, "Medium", options.dmBorderSize));
@@ -154,42 +145,41 @@ public class GuiDungeonMapEditor extends GuiScreen {
buttons.add(new Button(16, 52, 154+30, "Ornate"));
buttons.add(new Button(17, 98, 154+30, "Dragon"));
- //Dungeon Map
- buttons.add(new Button(18, 20+139, 36, "Yes/No", options.dmEnable));
- //Center
- buttons.add(new Button(19, 84+139, 36, "Player/Map", options.dmCenterPlayer));
- //Rotate
- buttons.add(new Button(20, 20+139, 65, "Player/No Rotate", options.dmRotatePlayer));
- //Icon Style
- buttons.add(new Button(21, 84+139, 65, "Default/Heads", options.dmPlayerHeads));
- //Check Orient
- buttons.add(new Button(22, 20+139, 94, "Normal/Reorient", options.dmOrientCheck));
- //Check Center
- buttons.add(new Button(23, 84+139, 94, "Yes/No", options.dmCenterCheck));
- //Interpolation
- buttons.add(new Button(24, 20+139, 123, "Yes/No", options.dmPlayerInterp));
- //Compatibility
- buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD", options.dmCompat));
-
- //Background
- buttons.add(new Button(26, 20+139, 152, "", options.dmBackgroundColour));
- //Border
- buttons.add(new Button(27, 84+139, 152, "", options.dmBorderColour));
-
- //Chroma Mode
- buttons.add(new Button(28, 84+139, 181, "Normal/Scroll", options.dmChromaBorder));
+ try {
+ //Dungeon Map
+ buttons.add(new Button(18, 20+139, 36, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmEnable")));
+ //Center
+ buttons.add(new Button(19, 84+139, 36, "Player/Map", NEUConfig.DungeonMap.class.getDeclaredField("dmCenterPlayer")));
+ //Rotate
+ buttons.add(new Button(20, 20+139, 65, "Player/No Rotate", NEUConfig.DungeonMap.class.getDeclaredField("dmRotatePlayer")));
+ //Icon Style
+ buttons.add(new Button(21, 84+139, 65, "Default/Heads", NEUConfig.DungeonMap.class.getDeclaredField("dmPlayerHeads")));
+ //Check Orient
+ buttons.add(new Button(22, 20+139, 94, "Normal/Reorient", NEUConfig.DungeonMap.class.getDeclaredField("dmOrientCheck")));
+ //Check Center
+ buttons.add(new Button(23, 84+139, 94, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmCenterCheck")));
+ //Interpolation
+ buttons.add(new Button(24, 20+139, 123, "Yes/No", NEUConfig.DungeonMap.class.getDeclaredField("dmPlayerInterp")));
+ //Compatibility
+ buttons.add(new Button(25, 84+139, 123, "Normal/No SHD/No FB/SHD", NEUConfig.DungeonMap.class.getDeclaredField("dmCompat")));
+
+ //Background
+ buttons.add(new Button(26, 20+139, 152, "", NEUConfig.DungeonMap.class.getDeclaredField("dmBackgroundColour")));
+ //Border
+ buttons.add(new Button(27, 84+139, 152, "", NEUConfig.DungeonMap.class.getDeclaredField("dmBorderColour")));
+
+ //Chroma Mode
+ buttons.add(new Button(28, 84+139, 181, "Normal/Scroll", NEUConfig.DungeonMap.class.getDeclaredField("dmChromaBorder")));
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
//buttons.add(new Button(29, 52, 86+19, "XLarge", options.dmRoomSize));
//buttons.add(new Button(30, 52, 56, "XLarge", options.dmBorderSize));
- xField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.manager.config.dmCenterX.value));
- yField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.manager.config.dmCenterY.value));
- blurField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value));
- }
-
- private void showColourEditor(int mouseX, int mouseY, Options.Option<String> option, String special) {
- activeColourEditor = new ColourEditor(mouseX, mouseY, option, special);
- hexField.otherComponentClick();
+ xField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterX));
+ yField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterY));
+ blurField.setText(String.valueOf(NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur));
}
@Override
@@ -311,24 +301,28 @@ public class GuiDungeonMapEditor extends GuiScreen {
Utils.drawStringCenteredScaledMaxWidth("Y (%)", Minecraft.getMinecraft().fontRendererObj,
guiLeft+108, guiTop+209, false, 60, 0xFFB4B4B4);
- drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize, guiLeft+76, guiTop+45);
- drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize, guiLeft+76, guiTop+75);
- drawSlider(NotEnoughUpdates.INSTANCE.manager.config.dmIconScale, guiLeft+76, guiTop+105);
+ try {
+ drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmBorderSize"), guiLeft+76, guiTop+45);
+ drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmRoomSize"), guiLeft+76, guiTop+75);
+ drawSlider(NEUConfig.DungeonMap.class.getDeclaredField("dmIconScale"), guiLeft+76, guiTop+105);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
- Options options = NotEnoughUpdates.INSTANCE.manager.config;
- buttons.get(18-6).text = options.dmEnable.value ? "Enabled" : "Disabled";
- buttons.get(19-6).text = options.dmCenterPlayer.value ? "Player" : "Map";
- buttons.get(20-6).text = options.dmRotatePlayer.value ? "Player" : "Vertical";
- buttons.get(21-6).text = options.dmPlayerHeads.value <= 0 ? "Default" : options.dmPlayerHeads.value == 1 ? "Heads" : "Heads w/ Border";
- buttons.get(22-6).text = options.dmOrientCheck.value ? "Orient" : "Off";
- buttons.get(23-6).text = options.dmCenterCheck.value ? "Center" : "Off";
- buttons.get(24-6).text = options.dmPlayerInterp.value ? "Interp" : "No Interp";
- buttons.get(25-6).text = options.dmCompat.value <= 0 ? "Normal" : options.dmCompat.value >= 2 ? "No FB/SHD" : "No SHD";
+ NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
+ buttons.get(18-6).text = options.dmEnable ? "Enabled" : "Disabled";
+ buttons.get(19-6).text = options.dmCenterPlayer ? "Player" : "Map";
+ buttons.get(20-6).text = options.dmRotatePlayer ? "Player" : "Vertical";
+ buttons.get(21-6).text = options.dmPlayerHeads <= 0 ? "Default" : options.dmPlayerHeads == 1 ? "Heads" : "Heads w/ Border";
+ buttons.get(22-6).text = options.dmOrientCheck ? "Orient" : "Off";
+ buttons.get(23-6).text = options.dmCenterCheck ? "Center" : "Off";
+ buttons.get(24-6).text = options.dmPlayerInterp ? "Interp" : "No Interp";
+ buttons.get(25-6).text = options.dmCompat <= 0 ? "Normal" : options.dmCompat >= 2 ? "No FB/SHD" : "No SHD";
- buttons.get(26-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBackgroundColour.value));
- buttons.get(27-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBorderColour.value));
+ buttons.get(26-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBackgroundColour));
+ buttons.get(27-6).colour = new Color(SpecialColour.specialToChromaRGB(options.dmBorderColour));
- buttons.get(28-6).text = options.dmChromaBorder.value ? "Scroll" : "Normal";
+ buttons.get(28-6).text = options.dmChromaBorder ? "Scroll" : "Normal";
blurField.setSize(48, 16);
xField.setSize(48, 16);
@@ -358,140 +352,28 @@ public class GuiDungeonMapEditor extends GuiScreen {
}
if(activeColourEditor != null) {
- Gui.drawRect(activeColourEditor.x, activeColourEditor.y, activeColourEditor.x+119, activeColourEditor.y+89, colourEditorBG);
-
- int currentColour = SpecialColour.specialToSimpleRGB(activeColourEditor.special);
- Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
-
- BufferedImage bufferedImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<256; x++) {
- for(int y=0; y<256; y++) {
- float radius = (float) Math.sqrt(((x-128)*(x-128)+(y-128)*(y-128))/16384f);
- float angle = (float) Math.toDegrees(Math.atan((128-x)/(y-128+1E-5))+Math.PI/2);
- if(y < 128) angle += 180;
- if(radius <= 1) {
- int rgb = Color.getHSBColor(angle/360f, (float)Math.pow(radius, 1.5f), hsv[2]).getRGB();
- bufferedImage.setRGB(x, y, rgb);
- }
- }
- }
-
- BufferedImage bufferedImageValue = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<10; x++) {
- for(int y=0; y<64; y++) {
- if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
-
- int rgb = Color.getHSBColor(hsv[0], hsv[1], (64-y)/64f).getRGB();
- bufferedImageValue.setRGB(x, y, rgb);
- }
- }
-
- BufferedImage bufferedImageOpacity = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<10; x++) {
- for(int y=0; y<64; y++) {
- if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
-
- int rgb = (currentColour & 0x00FFFFFF) | (Math.min(255, (64-y)*4) << 24);
- bufferedImageOpacity.setRGB(x, y, rgb);
- }
- }
-
- float selradius = (float) Math.pow(hsv[1], 1/1.5f)*32;
- int selx = (int)(Math.cos(Math.toRadians(hsv[0]*360))*selradius);
- int sely = (int)(Math.sin(Math.toRadians(hsv[0]*360))*selradius);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar_alpha);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarValueLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarOpacityLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- int chromaSpeed = SpecialColour.getSpeed(activeColourEditor.special);
- int currentColourChroma = SpecialColour.specialToChromaRGB(activeColourEditor.special);
- Color cChroma = new Color(currentColourChroma, true);
- float hsvChroma[] = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null);
-
- if(chromaSpeed > 0) {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5+1, activeColourEditor.y+5+1,
- activeColourEditor.x+5+64+5+10+5+10+5+10-1, activeColourEditor.y+5+64-1,
- Color.HSBtoRGB(hsvChroma[0], 0.8f, 0.8f));
- } else {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5+1, activeColourEditor.y+5+27+1,
- activeColourEditor.x+5+64+5+10+5+10+5+10-1, activeColourEditor.y+5+37-1,
- Color.HSBtoRGB((hsvChroma[0]+(System.currentTimeMillis()-SpecialColour.startTime)/1000f)%1, 0.8f, 0.8f));
- }
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- if(chromaSpeed > 0) {
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
- } else {
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_chroma);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5+10+5, activeColourEditor.y+5+27, 10, 10, GL11.GL_NEAREST);
- }
-
- Gui.drawRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5+64-(int)(64*hsv[2]),
- activeColourEditor.x+5+64+5+10, activeColourEditor.y+5+64-(int)(64*hsv[2])+1, 0xFF000000);
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5+64-c.getAlpha()/4,
- activeColourEditor.x+5+64+5+10+5+10, activeColourEditor.y+5+64-c.getAlpha()/4-1, 0xFF000000);
- if(chromaSpeed > 0) {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5,
- activeColourEditor.y+5+64-(int)(chromaSpeed/255f*64),
- activeColourEditor.x+5+64+5+10+5+10+5+10,
- activeColourEditor.y+5+64-(int)(chromaSpeed/255f*64)+1, 0xFF000000);
- }
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5, activeColourEditor.y+5, 64, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_dot);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+32+selx-4, activeColourEditor.y+5+32+sely-4, 8, 8, GL11.GL_NEAREST);
-
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(hsv[2]*100)+"",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+5-(Math.round(hsv[2]*100)==100?1:0), activeColourEditor.y+5+64+5+5, true, 13, -1);
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(c.getAlpha()/255f*100)+"",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+15+5, activeColourEditor.y+5+64+5+5, true, 13, -1);
- if(chromaSpeed > 0) {
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+(int)SpecialColour.getSecondsForSpeed(chromaSpeed)+"s",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+30+6, activeColourEditor.y+5+64+5+5, true, 13, -1);
- }
-
- hexField.setSize(48, 10);
- if(!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase());
-
- StringBuilder sb = new StringBuilder(EnumChatFormatting.GRAY+"#");
- for(int i=0; i<6-hexField.getText().length(); i++) {
- sb.append("0");
- }
- sb.append(EnumChatFormatting.WHITE);
-
- hexField.setPrependText(sb.toString());
- hexField.render(activeColourEditor.x+5+8, activeColourEditor.y+5+64+5);
+ activeColourEditor.render();
}
Utils.pushGuiScale(-1);
}
- public void drawSlider(Options.Option<Double> option, int centerX, int centerY) {
- float sliderAmount = (float)Math.max(0, Math.min(1, (option.value-option.minValue)/(option.maxValue-option.minValue)));
+ public void drawSlider(Field option, int centerX, int centerY) {
+ float value;
+ float minValue;
+ float maxValue;
+ try {
+ value = ((Number)option.get(NotEnoughUpdates.INSTANCE.config.dungeonMap)).floatValue();
+
+ ConfigEditorSlider sliderAnnotation = option.getAnnotation(ConfigEditorSlider.class);
+ minValue = sliderAnnotation.minValue();
+ maxValue = sliderAnnotation.maxValue();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return;
+ }
+
+ float sliderAmount = Math.max(0, Math.min(1, (value-minValue)/(maxValue-minValue)));
int sliderAmountI = (int)(96*sliderAmount);
GlStateManager.color(1f, 1f, 1f, 1f);
@@ -513,12 +395,32 @@ public class GuiDungeonMapEditor extends GuiScreen {
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
if(clickedSlider != null) {
+ float minValue;
+ float maxValue;
+ try {
+ ConfigEditorSlider sliderAnnotation = clickedSlider.getAnnotation(ConfigEditorSlider.class);
+ minValue = sliderAnnotation.minValue();
+ maxValue = sliderAnnotation.maxValue();
+ } catch(Exception e) {
+ e.printStackTrace();
+ return;
+ }
+
float sliderAmount = (mouseX - (guiLeft+76-48))/96f;
- double val = clickedSlider.minValue+(clickedSlider.maxValue-clickedSlider.minValue)*sliderAmount;
+ double val = minValue+(maxValue-minValue)*sliderAmount;
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
val = Math.round(val);
}
- clickedSlider.value = Math.max(clickedSlider.minValue, Math.min(clickedSlider.maxValue, val));
+ float value = (float)Math.max(minValue, Math.min(maxValue, val));
+ try {
+ if(clickedSlider.getType() == int.class) {
+ clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, Math.round(value));
+ } else {
+ clickedSlider.set(NotEnoughUpdates.INSTANCE.config.dungeonMap, value);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
}
}
@@ -539,15 +441,19 @@ public class GuiDungeonMapEditor extends GuiScreen {
clickedSlider = null;
if(mouseX >= guiLeft+76-48 && mouseX <= guiLeft+76+48) {
- if(mouseY > guiTop+45-8 && mouseY < guiTop+45+8) {
- clickedSlider = NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize;
- return;
- } else if(mouseY > guiTop+75-8 && mouseY < guiTop+75+8) {
- clickedSlider = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize;
- return;
- } else if(mouseY > guiTop+105-8 && mouseY < guiTop+105+8) {
- clickedSlider = NotEnoughUpdates.INSTANCE.manager.config.dmIconScale;
- return;
+ try {
+ if(mouseY > guiTop+45-8 && mouseY < guiTop+45+8) {
+ clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmBorderSize");
+ return;
+ } else if(mouseY > guiTop+75-8 && mouseY < guiTop+75+8) {
+ clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmRoomSize");
+ return;
+ } else if(mouseY > guiTop+105-8 && mouseY < guiTop+105+8) {
+ clickedSlider = NEUConfig.DungeonMap.class.getDeclaredField("dmIconScale");
+ return;
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
}
}
@@ -583,83 +489,8 @@ public class GuiDungeonMapEditor extends GuiScreen {
int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
- if(activeColourEditor != null && (Mouse.isButtonDown(0) || Mouse.isButtonDown(1))) {
- if(mouseX >= activeColourEditor.x && mouseX <= activeColourEditor.x+119) {
- if(mouseY >= activeColourEditor.y && mouseY <= activeColourEditor.y+89) {
- if(Mouse.getEventButtonState()) {
- if(mouseX > activeColourEditor.x+5+8 && mouseX < activeColourEditor.x+5+8+48) {
- if(mouseY > activeColourEditor.y+5+64+5 && mouseY < activeColourEditor.y+5+64+5+10) {
- hexField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- hexField.otherComponentClick();
-
- int currentColour = SpecialColour.specialToSimpleRGB(activeColourEditor.special);
- Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
-
- int xWheel = mouseX - activeColourEditor.x - 5;
- int yWheel = mouseY - activeColourEditor.y - 5;
-
- if(xWheel > 0 && xWheel < 64) {
- if(yWheel > 0 && yWheel < 64) {
- float radius = (float) Math.sqrt(((xWheel-32)*(xWheel-32)+(yWheel-32)*(yWheel-32))/1024f);
- float angle = (float) Math.toDegrees(Math.atan((32-xWheel)/(yWheel-32+1E-5))+Math.PI/2);
- if(yWheel < 32) angle += 180;
-
- int rgb = Color.getHSBColor(angle/360f, (float)Math.pow(Math.min(1, radius), 1.5f), hsv[2]).getRGB();
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), c.getAlpha(), rgb);
- activeColourEditor.option.value = (String) activeColourEditor.special;
- }
- }
-
- int xValue = mouseX - (activeColourEditor.x+5+64+5);
- int y = mouseY - activeColourEditor.y - 5;
-
- if(y > -5 && y <= 69) {
- y = Math.max(0, Math.min(64, y));
- if(xValue > 0 && xValue < 10) {
- int rgb = Color.getHSBColor(hsv[0], hsv[1], 1-y/64f).getRGB();
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), c.getAlpha(), rgb);
- activeColourEditor.option.value = activeColourEditor.special;
- }
-
- int xOpacity = mouseX - (activeColourEditor.x+5+64+5+10+5);
-
- if(xOpacity > 0 && xOpacity < 10) {
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special),
- 255-(int)(y/64f*255), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- }
-
- int chromaSpeed = SpecialColour.getSpeed(activeColourEditor.special);
-
- int xChroma = mouseX - (activeColourEditor.x+5+64+5+10+5+10+5);
- if(xChroma > 0 && xChroma < 10) {
- if(chromaSpeed > 0) {
- if(y > -5 && y <= 69) {
- y = Math.max(0, Math.min(64, y));
- activeColourEditor.special = SpecialColour.special(255-Math.round(y/64f*255), c.getAlpha(), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- } else if(mouseY > activeColourEditor.y+5+27 && mouseY < activeColourEditor.y+5+37) {
- activeColourEditor.special = SpecialColour.special(200, c.getAlpha(), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- }
-
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
- return;
- }
- }
- if(Mouse.getEventButtonState()) {
- activeColourEditor = null;
- hexField.otherComponentClick();
- }
+ if(activeColourEditor != null) {
+ activeColourEditor.mouseInput(mouseX, mouseY);
}
}
@@ -667,23 +498,8 @@ public class GuiDungeonMapEditor extends GuiScreen {
public void handleKeyboardInput() throws IOException {
super.handleKeyboardInput();
- if(activeColourEditor != null && hexField.getFocus()) {
- String old = hexField.getText();
-
- hexField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
-
- if(hexField.getText().length() > 6) {
- hexField.setText(old);
- } else {
- try {
- String text = hexField.getText().toLowerCase();
-
- int rgb = Integer.parseInt(text, 16);
- int alpha = (SpecialColour.specialToSimpleRGB(activeColourEditor.special) >> 24) & 0xFF;
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), alpha, rgb);
- activeColourEditor.option.value = activeColourEditor.special;
- } catch(Exception e) {};
- }
+ if(activeColourEditor != null) {
+ activeColourEditor.keyboardInput();
}
}
@@ -696,8 +512,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
try {
xField.setCustomBorderColour(-1);
- NotEnoughUpdates.INSTANCE.manager.config.dmCenterX.setValue(xField.getText());
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterX = Float.parseFloat(xField.getText());
} catch(Exception e) {
xField.setCustomBorderColour(Color.RED.getRGB());
}
@@ -706,8 +521,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
try {
yField.setCustomBorderColour(-1);
- NotEnoughUpdates.INSTANCE.manager.config.dmCenterY.setValue(yField.getText());
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmCenterY = Float.parseFloat(yField.getText());
} catch(Exception e) {
yField.setCustomBorderColour(Color.RED.getRGB());
}
@@ -716,8 +530,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
try {
blurField.setCustomBorderColour(-1);
- NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.setValue(blurField.getText());
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
+ NotEnoughUpdates.INSTANCE.config.dungeonMap.dmBackgroundBlur = (int)Float.parseFloat(blurField.getText());
} catch(Exception e) {
blurField.setCustomBorderColour(Color.RED.getRGB());
}
@@ -725,71 +538,73 @@ public class GuiDungeonMapEditor extends GuiScreen {
}
private void buttonClicked(int mouseX, int mouseY, int id) {
- Options options = NotEnoughUpdates.INSTANCE.manager.config;
+ NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
switch (id) {
case 0:
- options.dmBorderSize.value = 0.0; break;
+ options.dmBorderSize = 0; break;
case 1:
- options.dmBorderSize.value = 1.0; break;
+ options.dmBorderSize = 1; break;
case 2:
- options.dmBorderSize.value = 2.0; break;
+ options.dmBorderSize = 2; break;
case 30:
- options.dmBorderSize.value = 3.0; break;
+ options.dmBorderSize = 3; break;
case 3:
- options.dmRoomSize.value = 0.0; break;
+ options.dmRoomSize = 0; break;
case 4:
- options.dmRoomSize.value = 1.0; break;
+ options.dmRoomSize = 1; break;
case 5:
- options.dmRoomSize.value = 2.0; break;
+ options.dmRoomSize = 2; break;
case 29:
- options.dmRoomSize.value = 3.0; break;
+ options.dmRoomSize = 3; break;
case 18:
- options.dmEnable.value = !options.dmEnable.value; break;
+ options.dmEnable = !options.dmEnable; break;
case 19:
- options.dmCenterPlayer.value = !options.dmCenterPlayer.value; break;
+ options.dmCenterPlayer = !options.dmCenterPlayer; break;
case 20:
- options.dmRotatePlayer.value = !options.dmRotatePlayer.value; break;
+ options.dmRotatePlayer = !options.dmRotatePlayer; break;
case 21:
- options.dmPlayerHeads.value++;
- if(options.dmPlayerHeads.value > 2) options.dmPlayerHeads.value = 0.0; break;
+ options.dmPlayerHeads++;
+ if(options.dmPlayerHeads > 2) options.dmPlayerHeads = 0; break;
case 22:
- options.dmOrientCheck.value = !options.dmOrientCheck.value; break;
+ options.dmOrientCheck = !options.dmOrientCheck; break;
case 23:
- options.dmCenterCheck.value = !options.dmCenterCheck.value; break;
+ options.dmCenterCheck = !options.dmCenterCheck; break;
case 24:
- options.dmPlayerInterp.value = !options.dmPlayerInterp.value; break;
+ options.dmPlayerInterp = !options.dmPlayerInterp; break;
case 25:
- options.dmCompat.value++;
- if(options.dmCompat.value > 2) options.dmCompat.value = 0.0;
+ options.dmCompat++;
+ if(options.dmCompat > 2) options.dmCompat = 0;
break;
case 26:
- showColourEditor(mouseX, mouseY, options.dmBackgroundColour, options.dmBackgroundColour.value); break;
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBackgroundColour,
+ (col) -> options.dmBackgroundColour = col, () -> activeColourEditor = null);
+ break;
case 27:
- showColourEditor(mouseX, mouseY, options.dmBorderColour, options.dmBorderColour.value); break;
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBorderColour,
+ (col) -> options.dmBorderColour = col, () -> activeColourEditor = null);
+ break;
case 28:
- options.dmChromaBorder.value = !options.dmChromaBorder.value; break;
+ options.dmChromaBorder = !options.dmChromaBorder; break;
default:
if(id >= 6 && id <= 17) {
- options.dmBorderStyle.value = (double)id-6; break;
+ options.dmBorderStyle = id-6; break;
}
- }
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {};
-
+ };
}
private boolean isButtonPressed(int id) {
- Options options = NotEnoughUpdates.INSTANCE.manager.config;
+ NEUConfig.DungeonMap options = NotEnoughUpdates.INSTANCE.config.dungeonMap;
if(id >= 0 && id <= 2) {
- return options.dmBorderSize.value == id;
+ return options.dmBorderSize == id;
} else if(id >= 3 && id <= 5) {
- return options.dmRoomSize.value == id-3;
+ return options.dmRoomSize == id-3;
} else if(id >= 6 && id <= 17) {
- return options.dmBorderStyle.value == id-6;
+ return options.dmBorderStyle == id-6;
} else if(id == 29) {
- return options.dmRoomSize.value == 3;
+ return options.dmRoomSize == 3;
} else if(id == 30) {
- return options.dmBorderSize.value == 3;
+ return options.dmBorderSize == 3;
}
return false;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/GuiGamemodes.java b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/GuiGamemodes.java
index 0f479f53..ff010fc7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/GuiGamemodes.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/GuiGamemodes.java
@@ -10,7 +10,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
index 692c1d4f..0c645255 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
@@ -3,7 +3,7 @@ package io.github.moulberry.notenoughupdates.gamemodes;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiChest;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java
index d0600796..fadb148d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java
@@ -4,7 +4,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NEUOverlay;
-import io.github.moulberry.notenoughupdates.NEUResourceManager;
+import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -14,7 +14,6 @@ import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.Matrix4f;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -25,7 +24,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import static io.github.moulberry.notenoughupdates.GuiTextures.item_mask;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.item_mask;
public class CollectionLogInfoPane extends ScrollableInfoPane {
@@ -114,7 +113,7 @@ public class CollectionLogInfoPane extends ScrollableInfoPane {
}
private Map<String, ArrayList<String>> getAcquiredItems() {
- return manager.config.collectionLog.value;
+ return null;//manager.config.collectionLog.value;
}
private Comparator<String> getItemComparator() {
@@ -267,13 +266,13 @@ public class CollectionLogInfoPane extends ScrollableInfoPane {
itemFramebufferGrayscale = checkFramebufferSizes(itemFramebufferGrayscale, width, height,
scaledresolution.getScaleFactor());
- if(!manager.config.cacheRenderedItempane.value || previousAcquiredCount != getCurrentAcquiredCount() ||
+ /*if(!manager.config.cacheRenderedItempane.value || previousAcquiredCount != getCurrentAcquiredCount() ||
previousScroll != scrollHeight.getValue() || previousX != left || previousFilter != filterMode ||
System.currentTimeMillis() - lastUpdate > 5000) {
lastUpdate = System.currentTimeMillis();
renderItemsToImage(itemFramebuffer, fg, left+5, right, top+1, bottom);
renderItemBGToImage(itemBGFramebuffer, fg, left+5, right, top+1, bottom);
- }
+ }*/
previousAcquiredCount = getCurrentAcquiredCount();
previousScroll = scrollHeight.getValue();
previousX = left;
@@ -396,8 +395,8 @@ public class CollectionLogInfoPane extends ScrollableInfoPane {
}
private void renderItemBackgrounds(Color fg, int left, int right, int top, int bottom) {
- Color fgCustomOpacity = new Color(SpecialColour.specialToChromaRGB(manager.config.itemBackgroundColour.value), true);
- Color fgGold = new Color(SpecialColour.specialToChromaRGB(manager.config.itemFavouriteColour.value), true);
+ Color fgCustomOpacity = null;//new Color(SpecialColour.specialToChromaRGB(manager.config.itemBackgroundColour.value), true);
+ Color fgGold = null;//new Color(SpecialColour.specialToChromaRGB(manager.config.itemFavouriteColour.value), true);
String[] items = getItemList();
iterateItemSlots(new ItemSlotConsumer() {
@@ -413,13 +412,13 @@ public class CollectionLogInfoPane extends ScrollableInfoPane {
}
Minecraft.getMinecraft().getTextureManager().bindTexture(item_mask);
- if(manager.config.itemStyle.value) {
+ /*if(manager.config.itemStyle.value) {
GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f,
color.getBlue() / 255f, color.getAlpha() / 255f);
Utils.drawTexturedRect(x - 1, y - 1, overlay.ITEM_SIZE + 2, overlay.ITEM_SIZE + 2, GL11.GL_NEAREST);
} else {
drawRect(x-1, y-1, x+overlay.ITEM_SIZE+1, y+overlay.ITEM_SIZE+1, color.getRGB());
- }
+ }*/
GlStateManager.bindTexture(0);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
index b5d20a97..b6db53f3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/FlipperInfoPane.java
@@ -9,7 +9,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.*;
import java.awt.*;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java
index c03b98fb..9981e6f9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/HTMLInfoPane.java
@@ -8,7 +8,7 @@ import info.bliki.wiki.model.WikiModel;
import info.bliki.wiki.tags.HTMLBlockTag;
import info.bliki.wiki.tags.HTMLTag;
import info.bliki.wiki.tags.IgnoreTag;
-import io.github.moulberry.notenoughupdates.AllowEmptyHTMLTag;
+import io.github.moulberry.notenoughupdates.util.AllowEmptyHTMLTag;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NEUOverlay;
import io.github.moulberry.notenoughupdates.util.Utils;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/ScrollableInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/ScrollableInfoPane.java
index 056aeaf1..12d42551 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/ScrollableInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/ScrollableInfoPane.java
@@ -1,8 +1,8 @@
package io.github.moulberry.notenoughupdates.infopanes;
-import io.github.moulberry.notenoughupdates.util.LerpingInteger;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NEUOverlay;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import org.lwjgl.input.Mouse;
public abstract class ScrollableInfoPane extends InfoPane {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java
deleted file mode 100644
index 4938770d..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/SettingsInfoPane.java
+++ /dev/null
@@ -1,851 +0,0 @@
-package io.github.moulberry.notenoughupdates.infopanes;
-
-import io.github.moulberry.notenoughupdates.BetterContainers;
-import io.github.moulberry.notenoughupdates.NEUManager;
-import io.github.moulberry.notenoughupdates.NEUOverlay;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.util.SpecialColour;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.options.Options;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.texture.DynamicTexture;
-import net.minecraft.entity.item.EntityXPOrb;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-import scala.tools.cmd.Spec;
-
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
-
-public class SettingsInfoPane extends InfoPane {
-
- private int currentCategory = Options.CAT_ALL;
- private final String[] CATEGORY_NAMES = {"All", "Misc", "Features", "Sliders", "Colours"};
-
- private GuiElementTextField searchBar = new GuiElementTextField("", 0);
-
- private final Map<Options.Option<?>, GuiElementTextField> textConfigMap = new HashMap<>();
- private int page = 0;
- private int maxPages = 1;
-
- private Options.Option clickedSlider = null;
- private int clickedSliderX = 0;
- private float clickedSliderMult = 0;
-
- private static final int colourEditorBG = new Color(80, 80, 80, 220).getRGB();
- private static ResourceLocation colourPickerLocation = new ResourceLocation("notenoughupdates:dynamic/colourpicker");
- private static ResourceLocation colourPickerBarValueLocation = new ResourceLocation("notenoughupdates:dynamic/colourpickervalue");
- private static ResourceLocation colourPickerBarOpacityLocation = new ResourceLocation("notenoughupdates:dynamic/colourpickeropacity");
-
- private GuiElementTextField hexField = new GuiElementTextField("",
- GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE);
- private ColourEditor activeColourEditor = null;
-
- private class ColourEditor {
- public int x;
- public int y;
- public Options.Option<String> option;
- public String special;
-
- public ColourEditor(int x, int y, Options.Option<String> option, String special) {
- this.x = x;
- this.y = y;
- this.option = option;
- this.special = special;
- }
- }
-
- public SettingsInfoPane(NEUOverlay overlay, NEUManager manager) {
- super(overlay, manager);
- }
-
- public void reset() {
- textConfigMap.clear();
- activeColourEditor = null;
- hexField.otherComponentClick();
- }
-
- private void showColourEditor(int mouseX, int mouseY, Options.Option<String> option, String special) {
- activeColourEditor = new ColourEditor(mouseX, mouseY, option, special);
- hexField.otherComponentClick();
- }
-
- public void render(int width, int height, Color bg, Color fg, ScaledResolution scaledResolution, int mouseX,
- int mouseY) {
- Utils.pushGuiScale(2);
-
- int widthN = Utils.peekGuiScale().getScaledWidth();
- int heightN = Utils.peekGuiScale().getScaledHeight();
- int mouseXN = Mouse.getX() * widthN / Minecraft.getMinecraft().displayWidth;
- int mouseYN = heightN - Mouse.getY() * heightN / Minecraft.getMinecraft().displayHeight - 1;
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
-
- int paneWidth = (int)(widthN/3*overlay.getWidthMult());
- int rightSide = (int)(widthN*overlay.getInfoPaneOffsetFactor());
- int leftSide = rightSide - paneWidth;
-
- this.renderDefaultBackground(widthN, heightN, bg);
-
- if(page > maxPages-1) page = maxPages-1;
- if(page < 0) page = 0;
-
- overlay.renderNavElement(leftSide+overlay.getBoxPadding(), rightSide-overlay.getBoxPadding(),
- maxPages,page+1,"Settings: ");
-
- int area = rightSide-leftSide-overlay.getBoxPadding()*2;
- int categoryArea = (area-3*4)/5;
- int ySize = overlay.getSearchBarYSize();
- int yStartCat = overlay.getBoxPadding()+overlay.getSearchBarYSize()+3;
- for(int i=0; i<5; i++) {
- boolean pressed = currentCategory == i;
- drawRect(leftSide+overlay.getBoxPadding()+i*(categoryArea+3), yStartCat,
- leftSide+overlay.getBoxPadding()+i*(categoryArea+3)+categoryArea, yStartCat+ySize, fg.getRGB());
- GlStateManager.color(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(rightarrow_overlay);
- Utils.drawTexturedRect(leftSide+overlay.getBoxPadding()+i*(categoryArea+3),
- yStartCat, categoryArea, ySize, pressed?0:1, pressed?1:0, pressed?0:1, pressed?1:0, GL11.GL_NEAREST);
-
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.BOLD+CATEGORY_NAMES[i],
- Minecraft.getMinecraft().fontRendererObj,
- leftSide+overlay.getBoxPadding()+i*(categoryArea+3)+categoryArea/2f,
- yStartCat+ySize/2f, false, categoryArea-6, 0);
- }
-
- searchBar.setSize(area-5, ySize);
- searchBar.setMaxStringLength(45);
- searchBar.render(leftSide+overlay.getBoxPadding()+1, overlay.getBoxPadding()+overlay.getSearchBarYSize()*2+7);
-
- AtomicReference<List<String>> textToDisplay = new AtomicReference<>(null);
- AtomicReference<GuiElementTextField> tfTop = new AtomicReference<>();
- AtomicInteger tfTopX = new AtomicInteger();
- AtomicInteger tfTopY = new AtomicInteger();
- iterateSettingTile(new SettingsTileConsumer() {
- public void consume(int x, int y, int tileWidth, int tileHeight, Options.Option<?> option, Options.Button button) {
- float mult = tileWidth/90f;
-
- drawRect(x+2, y+2, x+tileWidth-2, y+tileHeight-2, fg.getRGB());
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(setting_border);
- GlStateManager.color(1, 1, 1, 1);
-
- Utils.drawTexturedRect(x, y, tileWidth, 5, 0, 1, 0, 5/75f, GL11.GL_NEAREST);
- Utils.drawTexturedRect(x, y+tileHeight-5, tileWidth, 5, 0, 1, 70/75f, 1, GL11.GL_NEAREST);
- Utils.drawTexturedRect(x, y+5, tileWidth, tileHeight-10, 0, 1, 5/75f, 70/75f, GL11.GL_NEAREST);
- Utils.drawTexturedRect(x+5, y, tileWidth-10, tileHeight, 5/100f, 95/100f, 0, 1, GL11.GL_NEAREST);
-
- if(manager.config.hideApiKey.value && option==manager.config.apiKey) return;
-
- if(option == null) {
- Utils.renderStringTrimWidth(button.displayName, fr, true, x+(int)(8*mult), y+(int)(8*mult),
- tileWidth-(int)(16*mult), new Color(100,255,150).getRGB(), 3,
- 2f/Utils.peekGuiScale().getScaleFactor());
-
- GlStateManager.color(1f, 1f, 1f, 1f);
- Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
- Utils.drawTexturedRect(x + tileWidth/2f - (int) (32 * mult), y + tileHeight - (int) (20 * mult), (int) (48 * mult), (int) (16 * mult));
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(help);
- Utils.drawTexturedRect(x + tileWidth/2f + (int) (19 * mult), y + tileHeight - (int) (19 * mult), (int) (14 * mult), (int) (14 * mult));
- GlStateManager.bindTexture(0);
-
- if (mouseXN > x + tileWidth / 2 + (int) (19 * mult) && mouseXN < x + tileWidth / 2 + (int) (19 * mult) + (int) (14 * mult)) {
- if (mouseYN > y + tileHeight - (int) (19 * mult) && mouseYN < y + tileHeight - (int) (19 * mult) + (int) (14 * mult)) {
- List<String> textLines = new ArrayList<>();
- textLines.add(button.displayName);
- textLines.add(EnumChatFormatting.GRAY + button.desc);
- textToDisplay.set(textLines);
- }
- }
- return;
- }
-
- Utils.renderStringTrimWidth(option.displayName, fr, true, x+(int)(8*mult), y+(int)(8*mult),
- tileWidth-(int)(16*mult), new Color(100,255,150).getRGB(), 3,
- 2f/Utils.peekGuiScale().getScaleFactor());
-
- if(option.value instanceof Boolean) {
- GlStateManager.color(1f, 1f, 1f, 1f);
- Minecraft.getMinecraft().getTextureManager().bindTexture(((Boolean) option.value) ? on : off);
- Utils.drawTexturedRect(x + tileWidth/2f - (int) (32 * mult), y + tileHeight - (int) (20 * mult), (int) (48 * mult), (int) (16 * mult));
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(help);
- Utils.drawTexturedRect(x + tileWidth/2f + (int) (19 * mult), y + tileHeight - (int) (19 * mult), (int) (14 * mult), (int) (14 * mult));
- GlStateManager.bindTexture(0);
-
- if (mouseXN > x + tileWidth / 2 + (int) (19 * mult) && mouseXN < x + tileWidth / 2 + (int) (19 * mult) + (int) (14 * mult)) {
- if (mouseYN > y + tileHeight - (int) (19 * mult) && mouseYN < y + tileHeight - (int) (19 * mult) + (int) (14 * mult)) {
- List<String> textLines = new ArrayList<>();
- textLines.add(option.displayName);
- textLines.add(EnumChatFormatting.GRAY + option.desc);
- textToDisplay.set(textLines);
- }
- }
- } else if(option.value instanceof Double) {
- if(!textConfigMap.containsKey(option)) {
- textConfigMap.put(option, new GuiElementTextField(String.valueOf(option.value),
- GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE | GuiElementTextField.SCALE_TEXT));
- }
-
- GuiElementTextField tf = textConfigMap.get(option);
- if(tf.getText().trim().endsWith(".0")) {
- tf.setText(tf.getText().trim().substring(0, tf.getText().trim().length()-2));
- }
- if(tf.getFocus()) {
- tf.setSize(Math.max((int)(20*mult), fr.getStringWidth(tf.getText())+10), (int)(16*mult));
- tfTop.set(tf);
- tfTopX.set(x+(int)(65*mult));
- tfTopY.set(y+tileHeight-(int)(20*mult));
- } else {
- tf.setSize((int)(20*mult), (int)(16*mult));
- tf.render(x+(int)(65*mult), y+tileHeight-(int)(20*mult));
- }
-
- double sliderAmount = (((Options.Option<Double>)option).value-option.minValue)/(option.maxValue-option.minValue);
- sliderAmount = Math.max(0, Math.min(1, sliderAmount));
-
- GlStateManager.color(1f, 1f, 1f, 1f);
- Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on);
- Utils.drawTexturedRect(x+5*mult, y + tileHeight-20*mult, (float)(54*mult*sliderAmount), 16*mult,
- 0, (float)sliderAmount, 0, 1);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off);
- Utils.drawTexturedRect((float)(x+5*mult+54*mult*sliderAmount), y + tileHeight - 20*mult,
- (float)(54*mult*(1-sliderAmount)), 16*mult,
- (float)(sliderAmount), 1, 0, 1);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button);
- Utils.drawTexturedRect(x+1*mult+(float)(54*sliderAmount*mult), y + tileHeight - 20*mult,
- 8*mult, 16*mult);
- } else {
- if((option.flags & Options.FLAG_COLOUR) != 0) {
- Utils.renderStringTrimWidth(option.displayName, fr, true, x+(int)(8*mult), y+(int)(8*mult),
- tileWidth-(int)(16*mult), new Color(100,255,150).getRGB(), 3,
- 2f/Utils.peekGuiScale().getScaleFactor());
-
- Color c = new Color(SpecialColour.specialToChromaRGB((String)option.value));
- GlStateManager.color(
- Math.min(1f, c.getRed()/255f),
- Math.min(1f, c.getGreen()/255f),
- Math.min(1f, c.getBlue()/255f), 1f);
- Minecraft.getMinecraft().getTextureManager().bindTexture(button_white);
- Utils.drawTexturedRect(x + tileWidth/2f - (int) (32 * mult), y + tileHeight - (int) (20 * mult), (int) (48 * mult), (int) (16 * mult));
-
- GlStateManager.color(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(help);
- Utils.drawTexturedRect(x + tileWidth/2f + (int) (19 * mult), y + tileHeight - (int) (19 * mult), (int) (14 * mult), (int) (14 * mult));
- GlStateManager.bindTexture(0);
-
- if (mouseXN > x + tileWidth / 2 + (int) (19 * mult) && mouseXN < x + tileWidth / 2 + (int) (19 * mult) + (int) (14 * mult)) {
- if (mouseYN > y + tileHeight - (int) (19 * mult) && mouseYN < y + tileHeight - (int) (19 * mult) + (int) (14 * mult)) {
- List<String> textLines = new ArrayList<>();
- textLines.add(option.displayName);
- textLines.add(EnumChatFormatting.GRAY + option.desc);
- textToDisplay.set(textLines);
- }
- }
- } else {
- if(!textConfigMap.containsKey(option)) {
- textConfigMap.put(option, new GuiElementTextField(String.valueOf(option.value), 0));
- }
- GuiElementTextField tf = textConfigMap.get(option);
- if(tf.getFocus()) {
- tf.setSize(Math.max(tileWidth-(int)(20*mult), fr.getStringWidth(tf.getText())+10), (int)(16*mult));
- tfTop.set(tf);
- tfTopX.set(x+(int)(10*mult));
- tfTopY.set(y+tileHeight-(int)(20*mult));
- } else {
- tf.setSize(tileWidth-(int)(20*mult), (int)(16*mult));
- tf.render(x+(int)(10*mult), y+tileHeight-(int)(20*mult));
- }
- }
- }
- }
- });
- if(tfTop.get() != null) {
- tfTop.get().render(tfTopX.get(), tfTopY.get());
- }
-
- if(activeColourEditor != null) {
- Gui.drawRect(activeColourEditor.x, activeColourEditor.y, activeColourEditor.x+119, activeColourEditor.y+89, colourEditorBG);
-
- int currentColour = SpecialColour.specialToSimpleRGB(activeColourEditor.special);
- Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
-
- BufferedImage bufferedImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<256; x++) {
- for(int y=0; y<256; y++) {
- float radius = (float) Math.sqrt(((x-128)*(x-128)+(y-128)*(y-128))/16384f);
- float angle = (float) Math.toDegrees(Math.atan((128-x)/(y-128+1E-5))+Math.PI/2);
- if(y < 128) angle += 180;
- if(radius <= 1) {
- int rgb = Color.getHSBColor(angle/360f, (float)Math.pow(radius, 1.5f), hsv[2]).getRGB();
- bufferedImage.setRGB(x, y, rgb);
- }
- }
- }
-
- BufferedImage bufferedImageValue = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<10; x++) {
- for(int y=0; y<64; y++) {
- if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
-
- int rgb = Color.getHSBColor(hsv[0], hsv[1], (64-y)/64f).getRGB();
- bufferedImageValue.setRGB(x, y, rgb);
- }
- }
-
- BufferedImage bufferedImageOpacity = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
- for(int x=0; x<10; x++) {
- for(int y=0; y<64; y++) {
- if((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
-
- int rgb = (currentColour & 0x00FFFFFF) | (Math.min(255, (64-y)*4) << 24);
- bufferedImageOpacity.setRGB(x, y, rgb);
- }
- }
-
- float selradius = (float) Math.pow(hsv[1], 1/1.5f)*32;
- int selx = (int)(Math.cos(Math.toRadians(hsv[0]*360))*selradius);
- int sely = (int)(Math.sin(Math.toRadians(hsv[0]*360))*selradius);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar_alpha);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarValueLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarOpacityLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- int chromaSpeed = SpecialColour.getSpeed(activeColourEditor.special);
- int currentColourChroma = SpecialColour.specialToChromaRGB(activeColourEditor.special);
- Color cChroma = new Color(currentColourChroma, true);
- float hsvChroma[] = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null);
-
- if(chromaSpeed > 0) {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5+1, activeColourEditor.y+5+1,
- activeColourEditor.x+5+64+5+10+5+10+5+10-1, activeColourEditor.y+5+64-1,
- Color.HSBtoRGB(hsvChroma[0], 0.8f, 0.8f));
- } else {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5+1, activeColourEditor.y+5+27+1,
- activeColourEditor.x+5+64+5+10+5+10+5+10-1, activeColourEditor.y+5+37-1,
- Color.HSBtoRGB((hsvChroma[0]+(System.currentTimeMillis()-SpecialColour.startTime)/1000f)%1, 0.8f, 0.8f));
- }
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
-
- if(chromaSpeed > 0) {
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5+10+5, activeColourEditor.y+5, 10, 64, GL11.GL_NEAREST);
- } else {
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_chroma);
- Utils.drawTexturedRect(activeColourEditor.x+5+64+5+10+5+10+5, activeColourEditor.y+5+27, 10, 10, GL11.GL_NEAREST);
- }
-
- Gui.drawRect(activeColourEditor.x+5+64+5, activeColourEditor.y+5+64-(int)(64*hsv[2]),
- activeColourEditor.x+5+64+5+10, activeColourEditor.y+5+64-(int)(64*hsv[2])+1, 0xFF000000);
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5, activeColourEditor.y+5+64-c.getAlpha()/4,
- activeColourEditor.x+5+64+5+10+5+10, activeColourEditor.y+5+64-c.getAlpha()/4-1, 0xFF000000);
- if(chromaSpeed > 0) {
- Gui.drawRect(activeColourEditor.x+5+64+5+10+5+10+5,
- activeColourEditor.y+5+64-(int)(chromaSpeed/255f*64),
- activeColourEditor.x+5+64+5+10+5+10+5+10,
- activeColourEditor.y+5+64-(int)(chromaSpeed/255f*64)+1, 0xFF000000);
- }
-
- Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage));
- Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerLocation);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5, activeColourEditor.y+5, 64, 64, GL11.GL_NEAREST);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_dot);
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawTexturedRect(activeColourEditor.x+5+32+selx-4, activeColourEditor.y+5+32+sely-4, 8, 8, GL11.GL_NEAREST);
-
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(hsv[2]*100)+"",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+5-(Math.round(hsv[2]*100)==100?1:0), activeColourEditor.y+5+64+5+5, true, 13, -1);
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+Math.round(c.getAlpha()/255f*100)+"",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+15+5, activeColourEditor.y+5+64+5+5, true, 13, -1);
- if(chromaSpeed > 0) {
- Utils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString()+(int)SpecialColour.getSecondsForSpeed(chromaSpeed)+"s",
- Minecraft.getMinecraft().fontRendererObj,
- activeColourEditor.x+5+64+5+30+6, activeColourEditor.y+5+64+5+5, true, 13, -1);
- }
-
- hexField.setSize(48, 10);
- if(!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase());
-
- StringBuilder sb = new StringBuilder(EnumChatFormatting.GRAY+"#");
- for(int i=0; i<6-hexField.getText().length(); i++) {
- sb.append("0");
- }
- sb.append(EnumChatFormatting.WHITE);
-
- hexField.setPrependText(sb.toString());
- hexField.render(activeColourEditor.x+5+8, activeColourEditor.y+5+64+5);
- }
-
- if(textToDisplay.get() != null) {
- Utils.drawHoveringText(textToDisplay.get(), mouseXN, mouseYN, widthN, heightN, 200, fr);
- }
-
- Utils.pushGuiScale(-1);
- }
-
- private void onTextfieldChange(GuiElementTextField tf, Options.Option<?> option) {
- try {
- tf.setCustomBorderColour(-1);
- option.setValue(tf.getText());
- overlay.redrawItems();
- BetterContainers.reset();
- } catch(Exception e) {
- tf.setCustomBorderColour(Color.RED.getRGB());
- }
- }
-
- @Override
- public void mouseInputOutside() {
- for(GuiElementTextField tf : textConfigMap.values()) {
- tf.otherComponentClick();
- }
- activeColourEditor = null;
- hexField.otherComponentClick();
- searchBar.otherComponentClick();
- }
-
- public void mouseInput(int width, int height, int mouseX, int mouseY, boolean mouseDown) {
- Utils.pushGuiScale(2);
-
- int widthN = Utils.peekGuiScale().getScaledWidth();
- int heightN = Utils.peekGuiScale().getScaledHeight();
- int mouseXN = Mouse.getX() * widthN / Minecraft.getMinecraft().displayWidth;
- int mouseYN = heightN - Mouse.getY() * heightN / Minecraft.getMinecraft().displayHeight - 1;
-
- int paneWidth = (int)(widthN/3*overlay.getWidthMult());
- int rightSide = (int)(widthN*overlay.getInfoPaneOffsetFactor());
- int leftSide = rightSide - paneWidth;
-
- int area = rightSide-leftSide-overlay.getBoxPadding()*2;
- int categoryArea = (area-3*4)/5;
- int ySize = overlay.getSearchBarYSize();
- int yStartCat = overlay.getBoxPadding()+overlay.getSearchBarYSize()+3;
- for(int i=0; i<5; i++) {
- if(mouseDown && mouseXN > leftSide + overlay.getBoxPadding() + i * (categoryArea + 3) &&
- mouseXN < leftSide + overlay.getBoxPadding() + i * (categoryArea + 3) + categoryArea &&
- mouseYN > yStartCat && mouseYN < yStartCat + ySize) {
- currentCategory = i;
- searchBar.otherComponentClick();
- Utils.pushGuiScale(-1);
- return;
- }
- }
-
- if(mouseDown) {
- if(mouseXN > leftSide+overlay.getBoxPadding() && mouseXN < leftSide+overlay.getBoxPadding()+area-3) {
- if(mouseYN > overlay.getBoxPadding()+overlay.getSearchBarYSize()*2+7 &&
- mouseYN < overlay.getBoxPadding()+overlay.getSearchBarYSize()*2+7+ySize) {
- searchBar.mouseClicked(mouseXN, mouseYN, Mouse.getEventButton());
- Utils.pushGuiScale(-1);
- return;
- }
- }
- searchBar.otherComponentClick();
- }
-
- if(activeColourEditor != null && (Mouse.isButtonDown(0) || Mouse.isButtonDown(1))) {
- if(mouseXN >= activeColourEditor.x && mouseXN <= activeColourEditor.x+119) {
- if(mouseYN >= activeColourEditor.y && mouseYN <= activeColourEditor.y+89) {
- if(Mouse.getEventButtonState()) {
- if(mouseXN > activeColourEditor.x+5+8 && mouseXN < activeColourEditor.x+5+8+48) {
- if(mouseYN > activeColourEditor.y+5+64+5 && mouseYN < activeColourEditor.y+5+64+5+10) {
- hexField.mouseClicked(mouseXN, mouseYN, Mouse.getEventButton());
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- hexField.otherComponentClick();
-
- int currentColour = SpecialColour.specialToSimpleRGB(activeColourEditor.special);
- Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
-
- int xWheel = mouseXN - activeColourEditor.x - 5;
- int yWheel = mouseYN - activeColourEditor.y - 5;
-
- if(xWheel > 0 && xWheel < 64) {
- if(yWheel > 0 && yWheel < 64) {
- float radius = (float) Math.sqrt(((xWheel-32)*(xWheel-32)+(yWheel-32)*(yWheel-32))/1024f);
- float angle = (float) Math.toDegrees(Math.atan((32-xWheel)/(yWheel-32+1E-5))+Math.PI/2);
- if(yWheel < 32) angle += 180;
-
- int rgb = Color.getHSBColor(angle/360f, (float)Math.pow(Math.min(1, radius), 1.5f), hsv[2]).getRGB();
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), c.getAlpha(), rgb);
- activeColourEditor.option.value = (String) activeColourEditor.special;
- }
- }
-
- int xValue = mouseXN - (activeColourEditor.x+5+64+5);
- int y = mouseYN - activeColourEditor.y - 5;
-
- if(y > -5 && y <= 69) {
- y = Math.max(0, Math.min(64, y));
- if(xValue > 0 && xValue < 10) {
- int rgb = Color.getHSBColor(hsv[0], hsv[1], 1-y/64f).getRGB();
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), c.getAlpha(), rgb);
- activeColourEditor.option.value = activeColourEditor.special;
- }
-
- int xOpacity = mouseXN - (activeColourEditor.x+5+64+5+10+5);
-
- if(xOpacity > 0 && xOpacity < 10) {
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special),
- 255-(int)(y/64f*255), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- }
-
- int chromaSpeed = SpecialColour.getSpeed(activeColourEditor.special);
-
- int xChroma = mouseXN - (activeColourEditor.x+5+64+5+10+5+10+5);
- if(xChroma > 0 && xChroma < 10) {
- if(chromaSpeed > 0) {
- if(y > -5 && y <= 69) {
- y = Math.max(0, Math.min(64, y));
- activeColourEditor.special = SpecialColour.special(255-Math.round(y/64f*255), c.getAlpha(), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- } else if(mouseYN > activeColourEditor.y+5+27 && mouseYN < activeColourEditor.y+5+37) {
- activeColourEditor.special = SpecialColour.special(200, c.getAlpha(), currentColour);
- activeColourEditor.option.value = activeColourEditor.special;
- }
- }
-
- Utils.pushGuiScale(-1);
- return;
- }
- }
- if(Mouse.getEventButtonState()) activeColourEditor = null;
- }
- iterateSettingTile(new SettingsTileConsumer() {
- @Override
- public void consume(int x, int y, int tileWidth, int tileHeight, Options.Option<?> option, Options.Button button) {
- float mult = tileWidth/90f;
- if(option == null) {
- if(Mouse.getEventButtonState()) {
- if(mouseXN > x+tileWidth/2-(int)(32*mult) && mouseXN < x+tileWidth/2-(int)(32*mult)+(int)(48*mult)) {
- if(mouseYN > y+tileHeight-(int)(20*mult) && mouseYN < y+tileHeight-(int)(20*mult)+(int)(16*mult)) {
- button.click.run();
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- } else if(option.value instanceof Boolean) {
- if(Mouse.getEventButtonState()) {
- if(mouseXN > x+tileWidth/2-(int)(32*mult) && mouseXN < x+tileWidth/2-(int)(32*mult)+(int)(48*mult)) {
- if(mouseYN > y+tileHeight-(int)(20*mult) && mouseYN < y+tileHeight-(int)(20*mult)+(int)(16*mult)) {
- ((Options.Option<Boolean>)option).value = !((Boolean)option.value);
- overlay.redrawItems();
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- } else if(option.value instanceof Double) {
- if(!textConfigMap.containsKey(option)) {
- textConfigMap.put(option, new GuiElementTextField(String.valueOf(option.value),
- GuiElementTextField.NUM_ONLY | GuiElementTextField.NO_SPACE | GuiElementTextField.SCALE_TEXT));
- }
-
- GuiElementTextField tf = textConfigMap.get(option);
- int tfX = x+(int)(65*mult);
- int tfY = y+tileHeight-(int)(20*mult);
- int tfWidth = tf.getWidth();
- int tfHeight = tf.getHeight();
- if(mouseYN > tfY && mouseYN < tfY+tfHeight) {
- if(mouseXN > tfX && mouseXN < tfX+tfWidth) {
- if(Mouse.getEventButtonState()) {
- tf.mouseClicked(mouseXN, mouseYN, Mouse.getEventButton());
- onTextfieldChange(tf, option);
- Utils.pushGuiScale(-1);
- return;
- } else if(Mouse.getEventButton() == -1 && mouseDown) {
- tf.mouseClickMove(mouseXN, mouseYN, 0, 0); //last 2 values are unused
- Utils.pushGuiScale(-1);
- return;
- }
- } else if(clickedSlider != option && Mouse.getEventButtonState() && mouseXN > x+1*mult && mouseXN < x+63*mult) {
- clickedSlider = option;
- clickedSliderX = x;
- clickedSliderMult = mult;
- }
- }
-
- if(clickedSlider == option) {
- float xMin = clickedSliderX+5*clickedSliderMult;
- float xMax = clickedSliderX+59*clickedSliderMult;
-
- float sliderAmount = (mouseXN - xMin)/(xMax - xMin);
- sliderAmount = Math.max(0, Math.min(1, sliderAmount));
-
- double range = option.maxValue - option.minValue;
- double value = option.minValue + sliderAmount*range;
-
- if(range >= 10 || (option.flags & Options.FLAG_INT) != 0) {
- value = Math.round(value);
- } else if(range >= 1) {
- value = Math.round(value*10)/10.0;
- } else {
- value = Math.round(value*100)/100.0;
- }
-
- value = Math.max(option.minValue, Math.min(option.maxValue, value));
-
- tf.setText(String.valueOf(value));
- onTextfieldChange(tf, option);
-
- if(Mouse.getEventButton() == 0 && !Mouse.getEventButtonState()) {
- clickedSlider = null;
- }
- }
-
- if(Mouse.getEventButtonState()) tf.otherComponentClick();
- } else {
- if((option.flags & Options.FLAG_COLOUR) != 0) {
- if(Mouse.getEventButtonState()) {
- if(mouseXN > x+tileWidth/2-(int)(32*mult) && mouseXN < x+tileWidth/2-(int)(32*mult)+(int)(48*mult)) {
- if(mouseYN > y+tileHeight-(int)(20*mult) && mouseYN < y+tileHeight-(int)(20*mult)+(int)(16*mult)) {
- int editorX = (int)Math.min(mouseXN, widthN*overlay.getInfoPaneOffsetFactor()-129);
- int editorY = Math.min(mouseYN, heightN-99);
- showColourEditor(editorX, editorY, (Options.Option<String>) option, (String)option.value);
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- } else {
- if(!textConfigMap.containsKey(option)) {
- textConfigMap.put(option, new GuiElementTextField(String.valueOf(option.value), 0));
- }
- GuiElementTextField tf = textConfigMap.get(option);
- int tfX = x+(int)(10*mult);
- int tfY = y+tileHeight-(int)(20*mult);
- int tfWidth = tf.getWidth();
- int tfHeight = tf.getHeight();
- if(mouseXN > tfX && mouseXN < tfX+tfWidth) {
- if(mouseYN > tfY && mouseYN < tfY+tfHeight) {
- if(Mouse.getEventButtonState()) {
- tf.mouseClicked(mouseXN, mouseYN, Mouse.getEventButton());
- onTextfieldChange(tf, option);
- Utils.pushGuiScale(-1);
- return;
- } else if(Mouse.getEventButton() == -1 && mouseDown) {
- tf.mouseClickMove(mouseXN, mouseYN, 0, 0); //last 2 values are unused
- Utils.pushGuiScale(-1);
- return;
- }
- }
- }
- if(Mouse.getEventButtonState()) tf.otherComponentClick();
- }
- }
- }
- });
-
- if(Mouse.getEventButtonState()) {
- rightSide -= overlay.getBoxPadding();
- leftSide += overlay.getBoxPadding();
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- float maxStrLen = fr.getStringWidth(EnumChatFormatting.BOLD+"Settings: " + maxPages + "/" + maxPages);
- float maxButtonXSize = (rightSide-leftSide+2 - maxStrLen*0.5f - 10)/2f;
- int buttonXSize = (int)Math.min(maxButtonXSize, overlay.getSearchBarYSize()*480/160f);
- int ySize2 = (int)(buttonXSize/480f*160);
- int yOffset = (int)((overlay.getSearchBarYSize()-ySize2)/2f);
- int top = overlay.getBoxPadding()+yOffset;
-
- if(mouseYN >= top && mouseYN <= top+ySize2) {
- int leftPrev = leftSide-1;
- if(mouseXN > leftPrev && mouseXN < leftPrev+buttonXSize) { //"Previous" button
- page--;
- }
- int leftNext = rightSide+1-buttonXSize;
- if(mouseXN > leftNext && mouseXN < leftNext+buttonXSize) { //"Next" button
- page++;
- }
- }
- }
-
- Utils.pushGuiScale(-1);
- }
-
- public boolean keyboardInput() {
- if(searchBar.getFocus()) {
- searchBar.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
- return true;
- }
-
- AtomicBoolean ret = new AtomicBoolean(false);
- iterateSettingTile(new SettingsTileConsumer() {
- @Override
- public void consume(int x, int y, int tileWidth, int tileHeight, Options.Option<?> option, Options.Button button) {
- if(option == null) return;
-
- if(!textConfigMap.containsKey(option)) {
- return;
- }
- GuiElementTextField tf = textConfigMap.get(option);
-
- if(!(option.value instanceof Boolean)) {
- if(tf.getFocus()) {
- tf.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
- onTextfieldChange(tf, option);
- ret.set(true);
- }
- }
- }
- });
- if(activeColourEditor != null && hexField.getFocus()) {
- String old = hexField.getText();
-
- hexField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
-
- if(hexField.getText().length() > 6) {
- hexField.setText(old);
- } else {
- try {
- String text = hexField.getText().toLowerCase();
-
- int rgb = Integer.parseInt(text, 16);
- int alpha = (SpecialColour.specialToSimpleRGB(activeColourEditor.special) >> 24) & 0xFF;
- activeColourEditor.special = SpecialColour.special(SpecialColour.getSpeed(activeColourEditor.special), alpha, rgb);
- activeColourEditor.option.value = activeColourEditor.special;
- } catch(Exception e) {};
- }
- }
- return ret.get();
- }
-
- private abstract static class SettingsTileConsumer {
- public abstract void consume(int x, int y, int tileWidth, int tileHeight, Options.Option<?> option, Options.Button button);
- }
-
- public void iterateSettingTile(SettingsTileConsumer settingsTileConsumer) {
- ScaledResolution scaledresolution = Utils.pushGuiScale(2);
- int width = scaledresolution.getScaledWidth();
- int height = scaledresolution.getScaledHeight();
-
- int numHorz = scaledresolution.getScaleFactor() >= 3 ? 2 : 3;
-
- int paneWidth = (int)(width/3*overlay.getWidthMult());
- int rightSide = (int)(width*overlay.getInfoPaneOffsetFactor());
- int leftSide = rightSide - paneWidth;
-
- int padding = overlay.getBoxPadding();
-
- int boxLeft = leftSide+padding-5;
- int boxRight = rightSide-padding+5;
-
- int boxBottom = height - padding + 5;
-
- int boxWidth = boxRight-boxLeft;
- int tilePadding = 7;
- int tileWidth = (boxWidth-tilePadding*4)/numHorz;
- int tileHeight = tileWidth*3/4;
-
- int top = tilePadding+padding+overlay.getSearchBarYSize()*3+3*2;
- int bottom = height - padding;
- int leftover = (bottom-top)%(tileHeight+tilePadding);
-
- top += leftover/2;
-
- maxPages=1;
- int currPage=0;
- int x=0;
- int y=top;
- int tileCount = 0;
- out:
- for(int i=0; i<manager.config.getOptions().size()+manager.config.getButtons().size(); i++) {
- if(i < manager.config.getButtons().size()) {
- if(currentCategory != Options.CAT_ALL || searchBar.getText().trim().length() != 0) {
- continue;
- }
- } else {
- Options.Option<?> option = manager.config.getOptions().get(i-manager.config.getButtons().size());
- if(searchBar.getText().trim().length() != 0) {
- for(String s : searchBar.getText().split(" ")) {
- s = s.replaceAll("[^A-Za-z]", "").toLowerCase();
- boolean contains = false;
- for(String tag : option.tags) {
- if(tag.contains(s)) {
- contains = true;
- break;
- }
- }
- if(!contains) {
- continue out;
- }
- }
- }
- if(currentCategory != Options.CAT_ALL && currentCategory != option.category) {
- continue;
- }
- }
-
- if(tileCount != 0 && tileCount % numHorz == 0) {
- x = 0;
- y += tileHeight+tilePadding;
- }
- if(y + tileHeight > boxBottom) {
- x=0;
- y=top;
- currPage++;
- maxPages = currPage+1;
- }
- x+=tilePadding;
-
- if(currPage == page) {
- if(i < manager.config.getButtons().size()) {
- settingsTileConsumer.consume(boxLeft+x, y, tileWidth, tileHeight,
- null, manager.config.getButtons().get(i));
- } else {
- settingsTileConsumer.consume(boxLeft+x, y, tileWidth, tileHeight,
- manager.config.getOptions().get(i-manager.config.getButtons().size()), null);
- }
- }
-
- tileCount++;
- x+=tileWidth;
- }
-
- Utils.pushGuiScale(-1);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
index 1d67b8c4..37ffc938 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
@@ -2,8 +2,8 @@ package io.github.moulberry.notenoughupdates.itemeditor;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.util.LerpingInteger;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
index 293fc241..8a972f78 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mbgui/MBGuiGroupFloating.java
@@ -1,6 +1,6 @@
package io.github.moulberry.notenoughupdates.mbgui;
-import io.github.moulberry.notenoughupdates.GuiItemRecipe;
+import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.util.Utils;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
index 02ff2164..2b682e4f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
@@ -1,6 +1,7 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.TexLoc;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -10,6 +11,7 @@ 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.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
@@ -122,6 +124,7 @@ public class BetterContainers {
public static boolean isBlankStack(ItemStack stack) {
return stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) &&
+ stack.getItemDamage() == 15 &&
stack.getDisplayName() != null && stack.getDisplayName().trim().isEmpty();
}
@@ -167,7 +170,7 @@ public class BetterContainers {
Container container = ((GuiChest)Minecraft.getMinecraft().currentScreen).inventorySlots;
if(hasNullPane() && container instanceof ContainerChest) {
- int backgroundStyle = NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuBackgroundStyle.value.intValue();
+ int backgroundStyle = NotEnoughUpdates.INSTANCE.config.improvedSBMenu.backgroundStyle+1;
backgroundStyle = Math.max(1, Math.min(10, backgroundStyle));
try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(
new ResourceLocation("notenoughupdates:dynamic_54/style"+ backgroundStyle+"/dynamic_config.json")).getInputStream(), StandardCharsets.UTF_8))) {
@@ -189,14 +192,14 @@ public class BetterContainers {
} catch(Exception e) {}
BufferedImage bufferedImageSlot = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(DYNAMIC_54_SLOT).getInputStream());
try {
- int buttonStyle = NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuButtonStyle.value.intValue();
+ int buttonStyle = NotEnoughUpdates.INSTANCE.config.improvedSBMenu.buttonStyle+1;
buttonStyle = Math.max(1, Math.min(10, buttonStyle));
bufferedImageSlot = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(
new ResourceLocation("notenoughupdates:dynamic_54/style"+buttonStyle+"/dynamic_54_slot_ctm.png")).getInputStream());
} catch(Exception e) {}
BufferedImage bufferedImageButton = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(DYNAMIC_54_BUTTON).getInputStream());
try {
- int buttonStyle = NotEnoughUpdates.INSTANCE.manager.config.dynamicMenuButtonStyle.value.intValue();
+ int buttonStyle = NotEnoughUpdates.INSTANCE.config.improvedSBMenu.buttonStyle+1;
buttonStyle = Math.max(1, Math.min(10, buttonStyle));
bufferedImageButton = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(
new ResourceLocation("notenoughupdates:dynamic_54/style"+buttonStyle+"/dynamic_54_button_ctm.png")).getInputStream());
@@ -213,13 +216,26 @@ public class BetterContainers {
int size = lower.getSizeInventory();
boolean[][] slots = new boolean[9][size/9];
boolean[][] buttons = new boolean[9][size/9];
+
+ boolean ultrasequencer = lower.getDisplayName().getUnformattedText().startsWith("Ultrasequencer") &&
+ !lower.getDisplayName().getUnformattedText().contains("Stakes");
+ boolean superpairs = lower.getDisplayName().getUnformattedText().startsWith("Superpairs") &&
+ !lower.getDisplayName().getUnformattedText().contains("Stakes");
for (int index = 0; index < size; index++) {
ItemStack stack = getStackCached(lower, index);
buttons[index%9][index/9] = isButtonStack(stack);
- if(buttons[index%9][index/9] && lastClickedSlot == index) {
+ if(ultrasequencer && stack.getItem() == Items.dye) {
+ buttons[index%9][index/9] = false;
+ }
+
+ if(superpairs && index > 9 && index < size-9) {
buttons[index%9][index/9] = false;
- slots[index%9][index/9] = true;
+ }
+
+ if(buttons[index%9][index/9] && lastClickedSlot == index) {
+ //buttons[index%9][index/9] = false;
+ //slots[index%9][index/9] = true;
} else {
slots[index%9][index/9] = !isBlankStack(stack) && !buttons[index%9][index/9];
}
@@ -301,8 +317,7 @@ public class BetterContainers {
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);
+ NotEnoughUpdates.INSTANCE.config.improvedSBMenu.enableSbMenus;
}
private static boolean hasItem() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
index 796d630c..763da0b5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -1,35 +1,29 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscfeatures;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
-import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.block.model.BakedQuad;
-import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.model.IBakedModel;
-import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagByteArray;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.*;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
-import net.minecraftforge.client.event.EntityViewRenderEvent;
-import net.minecraftforge.client.event.RenderBlockOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.Loader;
@@ -37,11 +31,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Vector3f;
-import scala.tools.cmd.Spec;
import java.awt.*;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.util.*;
import java.util.List;
@@ -52,6 +44,9 @@ public class CustomItemEffects {
private static final int MAX_BUILDERS_BLOCKS = 164;
public long aoteUseMillis = 0;
+
+ public long lastUsedHyperion = 0;
+
public int aoteTeleportationMillis = 0;
public Vector3f aoteTeleportationCurr = null;
@@ -72,8 +67,8 @@ public class CustomItemEffects {
if(delta <= 0) return;
- if(aoteTeleportationMillis > NotEnoughUpdates.INSTANCE.manager.config.smoothAoteMillis.value.intValue()*2) {
- aoteTeleportationMillis = NotEnoughUpdates.INSTANCE.manager.config.smoothAoteMillis.value.intValue()*2;
+ if(aoteTeleportationMillis > NotEnoughUpdates.INSTANCE.config.smoothAOTE.smoothTpMillis*2) {
+ aoteTeleportationMillis = NotEnoughUpdates.INSTANCE.config.smoothAOTE.smoothTpMillis*2;
}
if(aoteTeleportationMillis < 0) aoteTeleportationMillis = 0;
@@ -114,14 +109,20 @@ public class CustomItemEffects {
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
- if(NotEnoughUpdates.INSTANCE.manager.config.smoothAoteMillis.value <= 0
- || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return;
-
if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR || event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
- if(held != null) {
- String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
- if(internal != null && (internal.equals("ASPECT_OF_THE_END") || internal.equals("HYPERION"))) {
+ String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+ if(internal != null) {
+ if(internal.equals("HYPERION")) {
+ lastUsedHyperion = System.currentTimeMillis();
+ }
+
+ if(NotEnoughUpdates.INSTANCE.config.smoothAOTE.smoothTpMillis <= 0
+ || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return;
+
+ boolean aote = NotEnoughUpdates.INSTANCE.config.smoothAOTE.enableSmoothAOTE && internal.equals("ASPECT_OF_THE_END");
+ boolean hyp = NotEnoughUpdates.INSTANCE.config.smoothAOTE.enableSmoothHyperion && internal.equals("HYPERION");
+ if(aote || hyp) {
aoteUseMillis = System.currentTimeMillis();
if(aoteTeleportationCurr == null) {
aoteTeleportationCurr = new Vector3f();
@@ -136,7 +137,7 @@ public class CustomItemEffects {
@SubscribeEvent
public void onOverlayDrawn(RenderGameOverlayEvent event) {
- if(!NotEnoughUpdates.INSTANCE.manager.config.disableWandOverlay.value &&
+ if(NotEnoughUpdates.INSTANCE.config.builderWand.enableWandOverlay &&
Minecraft.getMinecraft().objectMouseOver != null &&
Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK &&
((event.type == null && Loader.isModLoaded("labymod")) ||
@@ -191,7 +192,7 @@ public class CustomItemEffects {
String itemCountS = EnumChatFormatting.DARK_GRAY+"x"+EnumChatFormatting.RESET+itemCount;
int itemCountLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(itemCountS);
- if(NotEnoughUpdates.INSTANCE.manager.config.wandBlockCount.value) {
+ if(NotEnoughUpdates.INSTANCE.config.builderWand.wandBlockCount) {
if(usingDirtWand) {
Utils.drawItemStack(new ItemStack(Items.gold_nugget), scaledResolution.getScaledWidth()/2 - (itemCountLen+16)/2,
scaledResolution.getScaledHeight()/2+10+4);
@@ -303,7 +304,7 @@ 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(!NotEnoughUpdates.INSTANCE.manager.config.disableTreecapOverlay.value &&
+ if(NotEnoughUpdates.INSTANCE.config.treecapOverlay.enableTreecapOverlay &&
(heldInternal.equals("JUNGLE_AXE") || heldInternal.equals("TREECAPITATOR_AXE"))) {
int maxWood = 10;
if(heldInternal.equals("TREECAPITATOR_AXE")) maxWood = 35;
@@ -363,7 +364,7 @@ public class CustomItemEffects {
drawFilledBoundingBox(block.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, candidate)
.expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2),
- random ? 0.5f : 1f, NotEnoughUpdates.INSTANCE.manager.config.treecapOverlayColour.value);
+ random ? 0.5f : 1f, NotEnoughUpdates.INSTANCE.config.treecapOverlay.treecapOverlayColour);
}
}
}
@@ -372,7 +373,7 @@ public class CustomItemEffects {
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
- } else if(!NotEnoughUpdates.INSTANCE.manager.config.disableWandOverlay.value) {
+ } else if(NotEnoughUpdates.INSTANCE.config.builderWand.enableWandOverlay) {
if(heldInternal.equals("BUILDERS_WAND")) {
int maxBlocks = 164;
if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
@@ -391,7 +392,8 @@ public class CustomItemEffects {
getBuildersWandCandidates(player, event.target, event.partialTicks, candidatesOld, candidatesOldSorted, 10);
- ItemStack matchStack = new ItemStack(matchItem, 1, match.getBlock().getMetaFromState(match));
+ ItemStack matchStack = new ItemStack(matchItem, 1,
+ match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos()));
int itemCount;
if(match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
itemCount = candidatesOld.size();
@@ -399,7 +401,7 @@ public class CustomItemEffects {
itemCount = countItemsInInventoryAndStorage(matchStack);
}
- String special = (candidatesOld.size() <= itemCount) ? NotEnoughUpdates.INSTANCE.manager.config.wandOverlayColour.value :
+ String special = (candidatesOld.size() <= itemCount) ? NotEnoughUpdates.INSTANCE.config.builderWand.wandOverlayColour :
"0:255:255:0:0";
if(candidatesOld.size() <= maxBlocks) {
@@ -440,7 +442,7 @@ public class CustomItemEffects {
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
- String special = NotEnoughUpdates.INSTANCE.manager.config.wandOverlayColour.value;
+ String special = NotEnoughUpdates.INSTANCE.config.builderWand.wandOverlayColour;
AxisAlignedBB bb = Blocks.dirt.getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, hover);
drawBlock((int)bb.minX, (int)bb.minY, (int)bb.minZ+1, Blocks.dirt.getDefaultState(),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
new file mode 100644
index 00000000..79dc2bba
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java
@@ -0,0 +1,542 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+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.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.client.event.GuiOpenEvent;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+
+import java.util.*;
+
+public class EnchantingSolvers {
+
+ private static SolverType currentSolver = SolverType.NONE;
+
+ private enum SolverType {
+ NONE,
+ CHRONOMATRON,
+ ULTRASEQUENCER,
+ SUPERPAIRS
+ }
+
+ private static final NBTTagCompound enchTag = new NBTTagCompound();
+ static {
+ enchTag.setTag("ench", new NBTTagList());
+ }
+
+ //Chronomatron
+ private static boolean addToChronomatron = false;
+ private static boolean chronomatronStartSeq = false;
+ private static List<String> chronomatronOrder = new ArrayList<>();
+ private static int chronomatronReplayIndex = 0;
+ private static int lastChronomatronSize = 0;
+ private static long millisLastClick = 0;
+
+ //Ultrasequencer
+ private static class UltrasequencerItem {
+ ItemStack stack;
+ int containerIndex;
+
+ public UltrasequencerItem(ItemStack stack, int containerIndex) {
+ this.stack = stack;
+ this.containerIndex = containerIndex;
+ }
+ }
+
+ private static Map<Integer, UltrasequencerItem> ultraSequencerOrder = new HashMap<>();
+ private static int ultrasequencerReplayIndex = 0;
+
+ //Superpairs
+ private static Map<Integer, ItemStack> superpairStacks = new HashMap<>();
+ private static int lastSlotClicked = -1;
+ private static HashSet<Integer> successfulMatches = new HashSet<>();
+ private static HashSet<Integer> possibleMatches = new HashSet<>();
+ private static HashSet<Integer> powerupMatches = new HashSet<>();
+
+ @SubscribeEvent
+ public void onGuiOpen(GuiOpenEvent event) {
+ chronomatronOrder.clear();
+ currentSolver = SolverType.NONE;
+
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return;
+ }
+
+ if(event.gui instanceof GuiChest) {
+ GuiChest chest = (GuiChest) event.gui;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
+ String lower = containerName.toLowerCase();
+
+ if(!lower.contains("stakes")) {
+ if(lower.startsWith("chronomatron")) {
+ currentSolver = SolverType.CHRONOMATRON;
+ } else if(lower.startsWith("ultrasequencer")) {
+ currentSolver = SolverType.ULTRASEQUENCER;
+ } else if(lower.startsWith("superpairs")) {
+ currentSolver = SolverType.SUPERPAIRS;
+ }
+ }
+ }
+ }
+
+ public static ItemStack overrideStack(IInventory inventory, int slotIndex, ItemStack stack) {
+ if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) {
+ return null;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return null;
+ }
+
+ if(stack != null && stack.getDisplayName() != null) {
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ IInventory lower = container.getLowerChestInventory();
+
+ if(lower != inventory) {
+ return null;
+ }
+
+ String displayName = stack.getDisplayName();
+
+ if(currentSolver == SolverType.CHRONOMATRON) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory()-5);
+ if(timerStack == null) {
+ return null;
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if(yepClock && (addToChronomatron && chronomatronOrder.size() >= lastChronomatronSize+1)) {
+ if(chronomatronReplayIndex < chronomatronOrder.size()) {
+ String chronomatronCurrent = chronomatronOrder.get(chronomatronReplayIndex);
+ if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) ||
+ stack.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay)) {
+ long currentTime = System.currentTimeMillis();
+
+ boolean lastSame = chronomatronReplayIndex > 0 &&
+ chronomatronCurrent.equals(chronomatronOrder.get(chronomatronReplayIndex-1));
+
+ if(chronomatronCurrent.equals(displayName)) {
+ if(!lastSame || currentTime - millisLastClick > 300) {
+ ItemStack retStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_hardened_clay), 1, stack.getItemDamage());
+ retStack.setTagCompound(enchTag);
+ retStack.setStackDisplayName(stack.getDisplayName());
+ return retStack;
+ } else {
+ ItemStack retStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass), 1, stack.getItemDamage());
+ retStack.setStackDisplayName(stack.getDisplayName());
+ return retStack;
+ }
+ } else {
+ if(chronomatronReplayIndex+1 < chronomatronOrder.size()) {
+ String chronomatronNext = chronomatronOrder.get(chronomatronReplayIndex+1);
+ if(chronomatronNext.equals(displayName)) {
+ ItemStack retStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass), 1, stack.getItemDamage());
+ retStack.setStackDisplayName(stack.getDisplayName());
+ return retStack;
+ }
+ }
+ ItemStack retStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass), 1, 8);
+ retStack.setStackDisplayName(stack.getDisplayName());
+ return retStack;
+ }
+ }
+
+ }
+ }
+ } else if(currentSolver == SolverType.ULTRASEQUENCER) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory()-5);
+ if(timerStack == null) {
+ return null;
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && stack.getItemDamage() != 15) {
+ if(yepClock) {
+ for(int solveIndex : ultraSequencerOrder.keySet()) {
+ UltrasequencerItem item = ultraSequencerOrder.get(solveIndex);
+ if(item.containerIndex == slotIndex) {
+ ItemStack newStack = item.stack;
+ if(solveIndex == ultrasequencerReplayIndex) {
+ newStack.setTagCompound(enchTag);
+ } else {
+ newStack.setTagCompound(null);
+ }
+ return newStack;
+ }
+ }
+ ItemStack retStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, 15);
+ retStack.setStackDisplayName(stack.getDisplayName());
+ return retStack;
+ }
+ }
+ } else if(currentSolver == SolverType.SUPERPAIRS) {
+ if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) &&
+ superpairStacks.containsKey(slotIndex)) {
+ return superpairStacks.get(slotIndex);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static boolean onStackRender(ItemStack stack, IInventory inventory, int slotIndex, int x, int y) {
+ if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) {
+ return false;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return false;
+ }
+
+ if(stack != null && stack.getDisplayName() != null) {
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ IInventory lower = container.getLowerChestInventory();
+
+ if(lower != inventory) {
+ return false;
+ }
+
+ if(currentSolver == SolverType.ULTRASEQUENCER) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory()-5);
+ if(timerStack == null) {
+ return false;
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && stack.getItemDamage() != 15) {
+ if(yepClock) {
+ for(int solveIndex : ultraSequencerOrder.keySet()) {
+ UltrasequencerItem item = ultraSequencerOrder.get(solveIndex);
+ if(item.containerIndex == slotIndex) {
+ int meta = 0;
+ if(solveIndex == ultrasequencerReplayIndex) {
+ meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNext;
+ } else if(solveIndex == ultrasequencerReplayIndex+1) {
+ 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.enchantingSolvers.seqNumbers &&
+ solveIndex >= ultrasequencerReplayIndex) {
+ int w = Minecraft.getMinecraft().fontRendererObj.getStringWidth((solveIndex+1)+"");
+ GlStateManager.disableDepth();
+ GlStateManager.enableBlend();
+ GlStateManager.disableLighting();
+ Utils.drawStringScaled((solveIndex+1)+"", Minecraft.getMinecraft().fontRendererObj,
+ x+8.5f-w/2f, y+8.5f-4, true, 0xffc0c0c0, 1f);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ } else if(currentSolver == SolverType.SUPERPAIRS) {
+ int meta = 0;
+ if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) &&
+ superpairStacks.containsKey(slotIndex)) {
+ if(possibleMatches.contains(slotIndex)) {
+ meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPossible;
+ } else {
+ meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supUnmatched;
+ }
+ } else {
+ if(powerupMatches.contains(slotIndex)) {
+ meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPower;
+ } else if(successfulMatches.contains(slotIndex)) {
+ meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supMatched;
+ }
+ }
+ if(meta > 0) {
+ Utils.drawItemStack(new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, meta-1), x, y);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) {
+ if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) {
+ return false;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return false;
+ }
+
+ if(stack != null && stack.getDisplayName() != null) {
+ String displayName = stack.getDisplayName();
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ IInventory lower = container.getLowerChestInventory();
+
+ if(currentSolver == SolverType.CHRONOMATRON) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory()-5);
+ if(timerStack == null) {
+ return false;
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if(timerStack.getItem() == Item.getItemFromBlock(Blocks.glowstone) ||
+ (yepClock && (!addToChronomatron || chronomatronOrder.size() < lastChronomatronSize+1))) {
+ return true;
+ } else if(yepClock) {
+ long currentTime = System.currentTimeMillis();
+ if(currentTime - millisLastClick < 150) {
+ return true;
+ }
+
+ if(chronomatronReplayIndex < chronomatronOrder.size()) {
+ String chronomatronCurrent = chronomatronOrder.get(chronomatronReplayIndex);
+ if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks ||
+ chronomatronCurrent.equals(displayName)) {
+ chronomatronReplayIndex++;
+ Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
+ 2, mode, Minecraft.getMinecraft().thePlayer);
+ millisLastClick = currentTime;
+ }
+ }
+ return true;
+ }
+ } else if(currentSolver == SolverType.ULTRASEQUENCER) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory()-5);
+ if(timerStack == null) {
+ return false;
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if(yepClock) {
+ UltrasequencerItem current = ultraSequencerOrder.get(ultrasequencerReplayIndex);
+ if(current == null) {
+ return true;
+ }
+ long currentTime = System.currentTimeMillis();
+ if(currentTime - millisLastClick > 150 &&
+ (!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.preventMisclicks ||
+ current.containerIndex == slotId)) {
+ ultrasequencerReplayIndex++;
+ Minecraft.getMinecraft().playerController.windowClick(windowId, slotId,
+ 2, mode, Minecraft.getMinecraft().thePlayer);
+ millisLastClick = currentTime;
+ }
+ return true;
+ } else {
+ return true;
+ }
+ } else if(currentSolver == SolverType.SUPERPAIRS) {
+ lastSlotClicked = slotId;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void processInventoryContents() {
+ if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) {
+ return;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ return;
+ }
+
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ ContainerChest container = (ContainerChest) chest.inventorySlots;
+ IInventory lower = container.getLowerChestInventory();
+
+ if(currentSolver == SolverType.CHRONOMATRON) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
+ if (timerStack == null) {
+ return;
+ }
+
+ String stainedHardenedClayName = null;
+ for (int index = 0; index < lower.getSizeInventory(); index++) {
+ ItemStack stack = lower.getStackInSlot(index);
+ if (stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay)) {
+ if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("ench")) {
+ if (stainedHardenedClayName != null && !stack.getDisplayName().equals(stainedHardenedClayName)) {
+ return;
+ }
+ stainedHardenedClayName = stack.getDisplayName();
+ }
+ }
+ }
+
+ boolean yepClock = timerStack.getItem() == Items.clock;
+ if (timerStack.getItem() == Item.getItemFromBlock(Blocks.glowstone) ||
+ (yepClock && (!addToChronomatron || chronomatronOrder.size() < lastChronomatronSize + 1))) {
+ if (chronomatronStartSeq) {
+ chronomatronStartSeq = false;
+ addToChronomatron = false;
+ lastChronomatronSize = chronomatronOrder.size();
+ chronomatronOrder.clear();
+ }
+
+ if (stainedHardenedClayName != null) {
+ if (addToChronomatron) {
+ chronomatronOrder.add(stainedHardenedClayName);
+ }
+ addToChronomatron = false;
+ } else {
+ addToChronomatron = true;
+ chronomatronReplayIndex = 0;
+ }
+ } else if (yepClock) {
+ chronomatronStartSeq = true;
+ }
+ } else {
+ chronomatronStartSeq = true;
+ addToChronomatron = true;
+ }
+ if(currentSolver == SolverType.ULTRASEQUENCER) {
+ ItemStack timerStack = lower.getStackInSlot(lower.getSizeInventory() - 5);
+ if (timerStack == null) {
+ return;
+ }
+ if(timerStack.getItem() == Item.getItemFromBlock(Blocks.glowstone)) {
+ ultrasequencerReplayIndex = 0;
+ }
+
+ for (int index = 0; index < lower.getSizeInventory(); index++) {
+ ItemStack stack = lower.getStackInSlot(index);
+ if (stack != null && stack.getItem() == Items.dye) {
+ if(ultraSequencerOrder.containsKey(stack.stackSize-1)) {
+ UltrasequencerItem ultrasequencerItem = ultraSequencerOrder.get(stack.stackSize-1);
+ ultrasequencerItem.containerIndex = index;
+ ultrasequencerItem.stack = stack;
+ } else {
+ ultraSequencerOrder.put(stack.stackSize-1, new UltrasequencerItem(stack, index));
+ }
+ }
+ }
+ } else {
+ ultraSequencerOrder.clear();
+ }
+ if(currentSolver == SolverType.SUPERPAIRS) {
+ successfulMatches.clear();
+ possibleMatches.clear();
+ powerupMatches.clear();
+ out:
+ for (int index = 0; index < lower.getSizeInventory(); index++) {
+ ItemStack stack = lower.getStackInSlot(index);
+ if(stack == null) continue;
+ if (stack.getItem() != Item.getItemFromBlock(Blocks.stained_glass) &&
+ stack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) {
+ superpairStacks.put(index, stack);
+
+ NBTTagCompound tag = stack.getTagCompound();
+ if(tag != null) {
+ NBTTagCompound display = tag.getCompoundTag("display");
+ if (display.hasKey("Lore", 9)) {
+ NBTTagList list = display.getTagList("Lore", 8);
+ for (int i = 0; i < list.tagCount(); i++) {
+ if(list.getStringTagAt(i).toLowerCase().contains("powerup")) {
+ powerupMatches.add(index);
+ continue out;
+ }
+ }
+ }
+ }
+
+ int numMatches = 0;
+ for (int index2 = 0; index2 < lower.getSizeInventory(); index2++) {
+ ItemStack stack2 = lower.getStackInSlot(index2);
+ if(stack2 != null && stack2.getDisplayName().equals(stack.getDisplayName()) &&
+ stack.getItem() == stack2.getItem()) {
+ numMatches++;
+ }
+ }
+ boolean oddMatches = (numMatches % 2) == 1;
+
+ if((!oddMatches || index != lastSlotClicked) && !successfulMatches.contains(index)) {
+ for (int index2 = 0; index2 < lower.getSizeInventory(); index2++) {
+ if(index == index2) continue;
+ if(oddMatches && index2 == lastSlotClicked) continue;
+
+ ItemStack stack2 = lower.getStackInSlot(index2);
+ if(stack2 != null && stack2.getDisplayName().equals(stack.getDisplayName()) &&
+ stack.getItem() == stack2.getItem()) {
+ successfulMatches.add(index);
+ successfulMatches.add(index2);
+ }
+ }
+ }
+ } else {
+ if(superpairStacks.containsKey(index) && superpairStacks.get(index) != null &&
+ !possibleMatches.contains(index)) {
+ ItemStack stack1 = superpairStacks.get(index);
+ for (int index2 = 0; index2 < lower.getSizeInventory(); index2++) {
+ if(index == index2) continue;
+
+ if(superpairStacks.containsKey(index2) && superpairStacks.get(index2) != null) {
+ ItemStack stack2 = superpairStacks.get(index2);
+ if(stack1.getDisplayName().equals(stack2.getDisplayName()) &&
+ stack1.getItem() == stack2.getItem()) {
+ possibleMatches.add(index);
+ possibleMatches.add(index2);
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ superpairStacks.clear();
+ successfulMatches.clear();
+ powerupMatches.clear();
+ lastSlotClicked = -1;
+ }
+ }
+ }
+
+
+ @SubscribeEvent
+ public void onItemTooltip(ItemTooltipEvent event) {
+ 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(" ")) {
+ event.toolTip.clear();
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) {
+ currentSolver = SolverType.NONE;
+ }
+
+ if(event.phase != TickEvent.Phase.END) {
+ return;
+ }
+
+ processInventoryContents();
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemRarityHalo.java
index 2c70ec1e..244d6906 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/ItemRarityHalo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemRarityHalo.java
@@ -1,5 +1,7 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscfeatures;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.NEUResourceManager;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
@@ -12,7 +14,6 @@ import net.minecraft.client.shader.Shader;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Matrix4f;
import org.lwjgl.BufferUtils;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL30;
@@ -42,7 +43,7 @@ public class ItemRarityHalo {
if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
NotEnoughUpdates neu = NotEnoughUpdates.INSTANCE;
if(!neu.isOnSkyblock()) return;
- if(neu.manager.config.itemHighlightOpacity.value <= 1) return;
+ //if(neu.manager.config.itemHighlightOpacity.value <= 1) return;
if(neu.manager.getInternalNameForItem(stack) == null) return;
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
@@ -155,8 +156,8 @@ public class ItemRarityHalo {
GlStateManager.bindTexture(itemHaloTexMap.get(stack));
Color color = Utils.getPrimaryColour(stack.getDisplayName());
- GlStateManager.color(color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f,
- NotEnoughUpdates.INSTANCE.manager.config.itemHighlightOpacity.value.floatValue()/255f);
+ //GlStateManager.color(color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f,
+ // NotEnoughUpdates.INSTANCE.manager.config.itemHighlightOpacity.value.floatValue()/255f);
Utils.drawTexturedRect(x, y, 16, 16,
0, 1, 1, 0, GL11.GL_NEAREST);
GlStateManager.bindTexture(0);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/StreamerMode.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StreamerMode.java
index 051313d1..40b75e50 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/StreamerMode.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StreamerMode.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.util.Utils;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/SunTzu.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
index 6de8245e..8b690765 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/SunTzu.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
@@ -1,10 +1,9 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Loader;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
index 5ca25082..612dd8d7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
@@ -1,8 +1,9 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -35,7 +36,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
public class AccessoryBagOverlay {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
index ccfe4a65..c54a0218 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
@@ -1,9 +1,10 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
@@ -27,16 +28,14 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.sound.SoundEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-import static io.github.moulberry.notenoughupdates.GuiTextures.*;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
import java.io.File;
import java.util.*;
@@ -159,7 +158,7 @@ public class CalendarOverlay {
if(event.phase != TickEvent.Phase.START) return;
if(jingleIndex == 0) {
- if (NotEnoughUpdates.INSTANCE.manager.config.eventNotificationSounds.value) {
+ if (NotEnoughUpdates.INSTANCE.config.calendar.eventNotificationSounds) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(
new ResourceLocation("notenoughupdates:calendar_notif_jingle")
));
@@ -169,7 +168,7 @@ public class CalendarOverlay {
}
jingleIndex = -15*20;
} else if(jingleIndex >= 1) {
- if (NotEnoughUpdates.INSTANCE.manager.config.eventNotificationSounds.value) {
+ if (NotEnoughUpdates.INSTANCE.config.calendar.eventNotificationSounds) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(
new ResourceLocation("notenoughupdates:calendar_notif_in")
));
@@ -179,7 +178,7 @@ public class CalendarOverlay {
jingleIndex++;
}
if(jingleIndex == -20*6-10) {
- if(NotEnoughUpdates.INSTANCE.manager.config.eventNotificationSounds.value) {
+ if(NotEnoughUpdates.INSTANCE.config.calendar.eventNotificationSounds) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(
new ResourceLocation("notenoughupdates:calendar_notif_out")
));
@@ -434,7 +433,7 @@ public class CalendarOverlay {
int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
if(!enabled) {
- if(Mouse.getEventButtonState() && NotEnoughUpdates.INSTANCE.manager.config.showEventTimerInInventory.value &&
+ if(Mouse.getEventButtonState() && NotEnoughUpdates.INSTANCE.config.calendar.showEventTimerInInventory &&
Minecraft.getMinecraft().currentScreen instanceof GuiContainer) {
xSize = 168;
ySize = 20;
@@ -491,7 +490,7 @@ public class CalendarOverlay {
mouseY > jfFavouriteSelectY && mouseY < jfFavouriteSelectY + 18 + jfFavouriteSelect.size() * 10) {
jfFavouriteSelectIndex = Math.max(0, (mouseY - jfFavouriteSelectY - 5)/10);
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
String id = null;
if(jfFavouriteSelectIndex == 0) {
id = "jacob_farming";
@@ -504,10 +503,6 @@ public class CalendarOverlay {
} else {
eventFavourites.add(id);
}
- try {
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
- } catch (Exception ignored) {
- }
}
} else {
jfFavouriteSelect = null;
@@ -573,7 +568,7 @@ public class CalendarOverlay {
jfFavouriteSelectIndex--;
if(jfFavouriteSelectIndex < 0) jfFavouriteSelectIndex = jfFavouriteSelect.size();
} else if(keyPressed == Keyboard.KEY_RIGHT || keyPressed == Keyboard.KEY_RETURN) {
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
String id = null;
if(jfFavouriteSelectIndex == 0) {
id = "jacob_farming";
@@ -586,10 +581,6 @@ public class CalendarOverlay {
} else {
eventFavourites.add(id);
}
- try {
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
- } catch (Exception ignored) {
- }
}
} else if(keyPressed == Keyboard.KEY_LEFT ||
keyPressed == NotEnoughUpdates.INSTANCE.manager.keybindFavourite.getKeyCode()) {
@@ -643,16 +634,12 @@ public class CalendarOverlay {
jfFavouriteSelectX = mouseX;
jfFavouriteSelectY = mouseY;
} else {
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
if (eventFavourites.contains(id)) {
eventFavourites.remove(id);
} else {
eventFavourites.add(id);
}
- try {
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
- } catch (Exception ignored) {
- }
}
}
}
@@ -662,7 +649,7 @@ public class CalendarOverlay {
@SubscribeEvent(priority = EventPriority.LOW)
public void onGuiDraw(RenderGameOverlayEvent.Post event) {
- if(NotEnoughUpdates.INSTANCE.manager.config.eventNotifications.value &&
+ if(NotEnoughUpdates.INSTANCE.config.calendar.eventNotifications &&
event.type == RenderGameOverlayEvent.ElementType.ALL) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, 0, 10);
@@ -674,7 +661,7 @@ public class CalendarOverlay {
long timeUntilFirst = 0;
SBEvent firstEvent = null;
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
//Daily Events
out:
@@ -722,15 +709,16 @@ public class CalendarOverlay {
}
public boolean renderToast(SBEvent event, long timeUntil) {
- if(!NotEnoughUpdates.INSTANCE.manager.config.eventNotifications.value) {
+ if(!NotEnoughUpdates.INSTANCE.config.calendar.eventNotifications) {
return false;
}
long currentTime = System.currentTimeMillis();
- if(currentTime - spookyStart < HOUR && NotEnoughUpdates.INSTANCE.manager.config.spookyMorningNotification.value) {
- long delta = (currentTime - SKYBLOCK_START) % (20*MINUTE) - 7*50*SECOND - 10*SECOND;
+ if(currentTime - spookyStart > 0 && currentTime - spookyStart < HOUR &&
+ NotEnoughUpdates.INSTANCE.config.calendar.spookyNightNotification) {
+ long delta = (currentTime - SKYBLOCK_START) % (20*MINUTE) - 19*50*SECOND - 10*SECOND;
if(delta < 500 && delta > -8500) {
- event = new SBEvent("spooky_festival_7am", "Spooky Festival 7am", new ItemStack(Items.bone), null);
+ event = new SBEvent("spooky_festival_7pm", "Spooky Festival 7pm", new ItemStack(Items.bone), null);
timeUntil = delta;
}
}
@@ -746,7 +734,7 @@ public class CalendarOverlay {
int guiTop = 5;
boolean preNotification = false;
- long preNotificationTime = SECOND*NotEnoughUpdates.INSTANCE.manager.config.eventNotificationBeforeSeconds.value.intValue();
+ long preNotificationTime = SECOND*NotEnoughUpdates.INSTANCE.config.calendar.startingSoonTime;
if(preNotificationTime > 500 && timeUntil > 500) {
timeUntil = timeUntil - preNotificationTime;
@@ -838,7 +826,7 @@ public class CalendarOverlay {
long timeUntilMajor = 0;
SBEvent nextMajorEvent = null;
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
guiLeft = (width - xSize)/2;
guiTop = 5;
@@ -854,7 +842,7 @@ public class CalendarOverlay {
}
if(sbEvent.id.equals("spooky_festival")) {
- if(currentTime - spookyStart > HOUR || (sbEvents.getKey() > currentTime && sbEvents.getKey() < spookyStart)) {
+ if(sbEvents.getKey() > currentTime-HOUR && (sbEvents.getKey() < spookyStart || spookyStart == 0)) {
spookyStart = sbEvents.getKey();
}
}
@@ -904,7 +892,7 @@ public class CalendarOverlay {
GlStateManager.translate(0, 0, 50);
boolean toastRendered = renderToast(nextEvent, timeUntilNext);
GlStateManager.translate(0, 0, -50);
- if(!toastRendered && !enabled && NotEnoughUpdates.INSTANCE.manager.config.showEventTimerInInventory.value) {
+ if(!toastRendered && !enabled && NotEnoughUpdates.INSTANCE.config.calendar.showEventTimerInInventory) {
List<String> tooltipToDisplay = null;
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
@@ -1083,7 +1071,7 @@ public class CalendarOverlay {
SBEvent nextEvent = null;
long timeUntilFirst = 0;
SBEvent firstEvent = null;
- List<String> eventFavourites = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value;
+ List<String> eventFavourites = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites;
//Daily Events
int index = 0;
@@ -1096,7 +1084,7 @@ public class CalendarOverlay {
int y = guiTop+44+17*(index/3);
if(sbEvent.id.equals("spooky_festival")) {
- if(currentTime - spookyStart > HOUR || (sbEvents.getKey() > currentTime && sbEvents.getKey() < spookyStart)) {
+ if(sbEvents.getKey() > currentTime-HOUR && (sbEvents.getKey() < spookyStart || spookyStart == 0)) {
spookyStart = sbEvents.getKey();
}
}
@@ -1300,7 +1288,7 @@ public class CalendarOverlay {
jfFavouriteSelectY+18+jfFavouriteSelect.size()*10, 0xff909090);
GlStateManager.depthFunc(GL11.GL_LEQUAL);
- String all = (NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value.contains("jacob_farming")?
+ String all = (NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites.contains("jacob_farming")?
EnumChatFormatting.DARK_GREEN:EnumChatFormatting.DARK_GRAY)+"All";
if(jfFavouriteSelectIndex == 0) {
fr.drawString(EnumChatFormatting.BLACK+"> "+all, jfFavouriteSelectX+5, jfFavouriteSelectY+5, 0xff000000);
@@ -1313,7 +1301,7 @@ public class CalendarOverlay {
selectStringIndex=0;
for(String s : jfFavouriteSelect) {
- EnumChatFormatting colour = NotEnoughUpdates.INSTANCE.manager.config.eventFavourites.value.contains("jacob_farming:"+s)
+ EnumChatFormatting colour = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites.contains("jacob_farming:"+s)
? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_GRAY;
s = (selectStringIndex+1 == jfFavouriteSelectIndex ? EnumChatFormatting.BLACK+"> " : "") + colour + s;
fr.drawString(s, jfFavouriteSelectX+5, jfFavouriteSelectY+10*selectStringIndex+15, 0xff000000);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
index c450c6f4..e6beb660 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/GuiEnchantColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
@@ -1,13 +1,13 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.base.Splitter;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.util.LerpingInteger;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -28,7 +28,7 @@ public class GuiEnchantColour extends GuiScreen {
private int ySize = 0;
private List<String> getEnchantColours() {
- return NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value;
+ return NotEnoughUpdates.INSTANCE.config.hidden.enchantColours;
}
public static final Splitter splitter = Splitter.on(":").limit(4);
@@ -61,9 +61,6 @@ public class GuiEnchantColour extends GuiScreen {
scroll.resetTimer();
}
-
- NotEnoughUpdates.INSTANCE.manager.loadConfig();
-
Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
Utils.drawTexturedRect(guiLeft, guiTop, xSize, 21, 0, 1, 0, 21/78f, GL11.GL_NEAREST);
Utils.drawTexturedRect(guiLeft, guiTop+ySize-32, xSize, 32, 0, 1, 46/78f, 1, GL11.GL_NEAREST);
@@ -136,16 +133,15 @@ public class GuiEnchantColour extends GuiScreen {
addOffset += 1;
}
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex);
if(yIndex+addOffset < 0) {
addOffset = -yIndex;
- } else if(yIndex+addOffset > NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.size()) {
- addOffset = NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.size()-yIndex;
+ } else if(yIndex+addOffset > NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.size()) {
+ addOffset = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.size()-yIndex;
}
System.out.println(addOffset);
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex+addOffset,
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex+addOffset,
getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
if(addOffset != 0) {
GuiElementTextField[] guiElementTextFieldArray = guiElementTextFields.remove(yIndex);
guiElementTextFields.add(yIndex+addOffset, guiElementTextFieldArray);
@@ -196,10 +192,9 @@ public class GuiEnchantColour extends GuiScreen {
if(mouseY > guiTop+23+25*yIndex && mouseY < guiTop+23+25*yIndex+20) {
guiElementTextFields.get(yIndex)[i].mouseClicked(mouseX, mouseY, mouseButton);
if(mouseButton == 1) {
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex,
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex,
getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
}
continue;
}
@@ -217,22 +212,19 @@ public class GuiEnchantColour extends GuiScreen {
default:
comparators.put(yIndex, ">"); break;
}
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add(yIndex,
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add(yIndex,
getEnchantOpString(guiElementTextFields.get(yIndex), comparators.get(yIndex)));
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
} else if(mouseX > guiLeft+146 && mouseX < guiLeft+146+20) {
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.remove(yIndex);
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.remove(yIndex);
guiElementTextFields.remove(yIndex);
comparators.remove(yIndex);
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
}
}
}
if(mouseX >= guiLeft+42 && mouseX <= guiLeft+42+88) {
if(mouseY >= guiTop+ySize-30 && mouseY <= guiTop+ySize-10) {
- NotEnoughUpdates.INSTANCE.manager.config.enchantColours.value.add("[a-zA-Z\\- ]+:>:5:9");
- NotEnoughUpdates.INSTANCE.manager.saveConfig();
+ NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add("[a-zA-Z\\- ]+:>:5:9");
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
index c4040f60..8992db2a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -1,6 +1,7 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.util.TexLoc;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/HelpGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java
index 1049dc55..cc41a76f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/HelpGUI.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import io.github.moulberry.notenoughupdates.util.TexLoc;
import io.github.moulberry.notenoughupdates.util.Utils;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlayPlacements.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java
index 633c1c4b..995ed5e3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlayPlacements.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/NEUOverlayPlacements.java
@@ -1,5 +1,6 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.mbgui.*;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -145,11 +146,10 @@ public class NEUOverlayPlacements extends GuiScreen {
mainGroup.recalculate();
if(index == 0) {
- NotEnoughUpdates.INSTANCE.manager.config.overlaySearchBar.value = anchorPoint.toString();
+ NotEnoughUpdates.INSTANCE.config.hidden.overlaySearchBar = anchorPoint.toString();
} else if(index == 1) {
- NotEnoughUpdates.INSTANCE.manager.config.overlayQuickCommand.value = anchorPoint.toString();
+ NotEnoughUpdates.INSTANCE.config.hidden.overlayQuickCommand = anchorPoint.toString();
}
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
}
}
return;
@@ -159,9 +159,8 @@ public class NEUOverlayPlacements extends GuiScreen {
}
if(guiButton.mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) {
- NotEnoughUpdates.INSTANCE.manager.config.overlayQuickCommand.value = "";
- NotEnoughUpdates.INSTANCE.manager.config.overlaySearchBar.value = "";
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
+ NotEnoughUpdates.INSTANCE.config.hidden.overlayQuickCommand = "";
+ NotEnoughUpdates.INSTANCE.config.hidden.overlaySearchBar = "";
NotEnoughUpdates.INSTANCE.overlay.resetAnchors(false);
mainGroup.recalculate();
@@ -200,11 +199,10 @@ public class NEUOverlayPlacements extends GuiScreen {
for(MBGuiElement element : mainGroup.getChildren()) {
if(element == clickedElement) {
if(index == 0) {
- NotEnoughUpdates.INSTANCE.manager.config.overlaySearchBar.value = anchorPoint.toString();
+ NotEnoughUpdates.INSTANCE.config.hidden.overlaySearchBar = anchorPoint.toString();
} else if(index == 1) {
- NotEnoughUpdates.INSTANCE.manager.config.overlayQuickCommand.value = anchorPoint.toString();
+ NotEnoughUpdates.INSTANCE.config.hidden.overlayQuickCommand = anchorPoint.toString();
}
- try { NotEnoughUpdates.INSTANCE.manager.saveConfig(); } catch(IOException ignored) {}
break;
}
index++;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
index 6bdf2c5d..371da939 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/TradeWindow.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/TradeWindow.java
@@ -1,15 +1,15 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.SBAIntegration;
import io.github.moulberry.notenoughupdates.util.TexLoc;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
@@ -18,8 +18,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-import net.minecraft.tileentity.TileEntitySign;
-import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
@@ -59,7 +57,7 @@ public class TradeWindow {
public static boolean tradeWindowActive() {
if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false;
- if(!NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.value) return false;
+ if(!NotEnoughUpdates.INSTANCE.config.tradeMenu.enableCustomTrade) return false;
GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen;
if(guiScreen instanceof GuiChest) {
@@ -731,7 +729,7 @@ public class TradeWindow {
}
}
- if(NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.value) {
+ if(NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePrices) {
TreeMap<Integer, Set<String>> ourTopItems = new TreeMap<>();
TreeMap<String, ItemStack> ourTopItemsStack = new TreeMap<>();
TreeMap<String, Integer> ourTopItemsCount = new TreeMap<>();
@@ -780,7 +778,7 @@ public class TradeWindow {
ItemStack stack = ourTopItemsStack.get(ourTopItemInternal);
if(stack == null) continue;
- if(NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value) {
+ if(NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePriceStyle) {
String countS = "";
if(ourTopItemsCount.containsKey(ourTopItemInternal)) {
int count = ourTopItemsCount.get(ourTopItemInternal);
@@ -828,7 +826,7 @@ public class TradeWindow {
ItemStack stack = theirTopItemsStack.get(theirTopItemInternal);
if(stack == null) continue;
- if(NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value) {
+ if(NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePriceStyle) {
String countS = "";
if(theirTopItemsCount.containsKey(theirTopItemInternal)) {
int count = theirTopItemsCount.get(theirTopItemInternal);
@@ -862,9 +860,9 @@ public class TradeWindow {
}
- boolean button1 = NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value;
- boolean button2 = NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.value;
- boolean button3 = NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.value;
+ boolean button1 = NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePriceStyle;
+ boolean button2 = NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePrices;
+ boolean button3 = NotEnoughUpdates.INSTANCE.config.tradeMenu.enableCustomTrade;
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
@@ -878,18 +876,18 @@ public class TradeWindow {
if(mouseX >= guiLeft+xSize+3 && mouseX <= guiLeft+xSize+3+17) {
if(mouseY >= guiTop+ySize-19 && mouseY <= guiTop+ySize-19+17) {
tooltipToDisplay = new ArrayList<>();
- tooltipToDisplay.add(EnumChatFormatting.GOLD+NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.displayName);
- tooltipToDisplay.add(EnumChatFormatting.GRAY+NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.desc);
+ tooltipToDisplay.add(EnumChatFormatting.GOLD+"Enable Custom Trade Menu");
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Use this menu instead of the default trade window");
tooltipLen = 200;
} else if(mouseY >= guiTop+ySize-38 && mouseY <= guiTop+ySize-38+17) {
tooltipToDisplay = new ArrayList<>();
- tooltipToDisplay.add(EnumChatFormatting.GOLD+NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.displayName);
- tooltipToDisplay.add(EnumChatFormatting.GRAY+NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.desc);
+ tooltipToDisplay.add(EnumChatFormatting.GOLD+"Price Information");
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Show the price of items on both sides");
tooltipLen = 200;
} else if(mouseY >= guiTop+ySize-57 && mouseY <= guiTop+ySize-57+17) {
tooltipToDisplay = new ArrayList<>();
- tooltipToDisplay.add(EnumChatFormatting.GOLD+NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.displayName);
- tooltipToDisplay.add(EnumChatFormatting.GRAY+NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.desc);
+ tooltipToDisplay.add(EnumChatFormatting.GOLD+"Trade Prices Style");
+ tooltipToDisplay.add(EnumChatFormatting.GRAY+"Changes the style of the top item prices");
tooltipLen = 200;
}
}
@@ -1019,16 +1017,16 @@ public class TradeWindow {
if(mouseX >= guiLeft+xSize+3 && mouseX <= guiLeft+xSize+3+17) {
if(mouseY >= guiTop+ySize-19 && mouseY <= guiTop+ySize-19+17) {
- NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.value =
- !NotEnoughUpdates.INSTANCE.manager.config.useCustomTrade.value;
+ NotEnoughUpdates.INSTANCE.config.tradeMenu.enableCustomTrade =
+ !NotEnoughUpdates.INSTANCE.config.tradeMenu.enableCustomTrade;
return;
} else if(mouseY >= guiTop+ySize-38 && mouseY <= guiTop+ySize-38+17) {
- NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.value =
- !NotEnoughUpdates.INSTANCE.manager.config.customTradePrices.value;
+ NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePrices =
+ !NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePrices;
return;
} else if(mouseY >= guiTop+ySize-57 && mouseY <= guiTop+ySize-57+17) {
- NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value =
- !NotEnoughUpdates.INSTANCE.manager.config.customTradePriceStyle.value;
+ NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePriceStyle =
+ !NotEnoughUpdates.INSTANCE.config.tradeMenu.customTradePriceStyle;
return;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinContainer.java
new file mode 100644
index 00000000..d3c96896
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinContainer.java
@@ -0,0 +1,19 @@
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(Container.class)
+public class MixinContainer {
+
+ @Inject(method = "putStacksInSlots", at=@At("RETURN"))
+ public void putStacksInSlots(ItemStack[] stacks, CallbackInfo ci) {
+ EnchantingSolvers.processInventoryContents();
+ }
+
+}
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 b9820033..6ca5a308 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java
@@ -1,20 +1,11 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.BetterContainers;
-import io.github.moulberry.notenoughupdates.CustomItemEffects;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import net.minecraft.client.gui.FontRenderer;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
import net.minecraft.client.renderer.EntityRenderer;
-import net.minecraft.client.renderer.RenderGlobal;
-import net.minecraft.entity.Entity;
-import net.minecraft.util.EnumWorldBlockLayer;
import org.lwjgl.util.vector.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-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;
@Mixin(EntityRenderer.class)
public class MixinEntityRenderer {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
index bd74b44c..da704ce3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiChest.java
@@ -1,24 +1,13 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.BetterContainers;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.StreamerMode;
+import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.inventory.Slot;
-import net.minecraft.item.ItemStack;
-import net.minecraft.scoreboard.ScorePlayerTeam;
-import net.minecraft.scoreboard.Team;
import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin({GuiChest.class})
public class MixinGuiChest {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index e6d0a986..12d1f929 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -1,20 +1,18 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.BetterContainers;
+import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -23,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GuiContainer.class)
-public abstract class MixinGuiContainer {
+public abstract class MixinGuiContainer extends GuiScreen {
@Inject(method="drawSlot", at=@At("HEAD"), cancellable = true)
public void drawSlot(Slot slot, CallbackInfo ci) {
@@ -32,6 +30,15 @@ public abstract class MixinGuiContainer {
GuiContainer $this = (GuiContainer)(Object)this;
ItemStack stack = slot.getStack();
+ if(stack != null) {
+ if(EnchantingSolvers.onStackRender(stack, slot.inventory, slot.getSlotIndex(), slot.xDisplayPosition, slot.yDisplayPosition)) {
+ ci.cancel();
+ return;
+ }
+ }
+
+ RenderHelper.enableGUIStandardItemLighting();
+
if(stack == null && System.currentTimeMillis() - BetterContainers.lastRenderMillis < 300 && $this instanceof GuiChest) {
Container container = ((GuiChest)$this).inventorySlots;
if(container instanceof ContainerChest) {
@@ -58,12 +65,33 @@ public abstract class MixinGuiContainer {
}
}
+ @Shadow
+ private Slot theSlot;
+
private static final String TARGET_GETSTACK = "Lnet/minecraft/inventory/Slot;getStack()Lnet/minecraft/item/ItemStack;";
+ @Redirect(method="drawScreen", at=@At(value="INVOKE", target=TARGET_GETSTACK))
+ public ItemStack drawScreen_getStack(Slot slot) {
+ if(theSlot != null && theSlot == slot && theSlot.getStack() != null) {
+ ItemStack newStack = EnchantingSolvers.overrideStack(theSlot.inventory, theSlot.getSlotIndex(), theSlot.getStack());
+ if(newStack != null) {
+ return newStack;
+ }
+ }
+ return slot.getStack();
+ }
+
@Redirect(method="drawSlot", at=@At(value="INVOKE", target=TARGET_GETSTACK))
public ItemStack drawSlot_getStack(Slot slot) {
GuiContainer $this = (GuiContainer)(Object)this;
ItemStack stack = slot.getStack();
+ if(stack != null) {
+ ItemStack newStack = EnchantingSolvers.overrideStack(slot.inventory, slot.getSlotIndex(), stack);
+ if(newStack != null) {
+ stack = newStack;
+ }
+ }
+
if($this instanceof GuiChest) {
Container container = ((GuiChest)$this).inventorySlots;
if(container instanceof ContainerChest) {
@@ -91,7 +119,7 @@ public abstract class MixinGuiContainer {
private static final String TARGET_CANBEHOVERED = "Lnet/minecraft/inventory/Slot;canBeHovered()Z";
@Redirect(method="drawScreen", at=@At(value="INVOKE", target=TARGET_CANBEHOVERED))
public boolean drawScreen_canBeHovered(Slot slot) {
- if(NotEnoughUpdates.INSTANCE.manager.config.hideEmptyPanes.value &&
+ if(NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes &&
BetterContainers.isOverriding() && BetterContainers.isBlankStack(slot.getStack())) {
return false;
}
@@ -100,12 +128,18 @@ public abstract class MixinGuiContainer {
@Inject(method="handleMouseClick", at=@At(value="HEAD"), cancellable = true)
public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) {
+ GuiContainer $this = (GuiContainer)(Object)this;
+ if(slotIn != null && slotIn.getStack() != null) {
+ if(EnchantingSolvers.onStackClick(slotIn.getStack(), $this.inventorySlots.windowId,
+ slotId, clickedButton, clickType)) {
+ ci.cancel();
+ }
+ }
if(slotIn != null && BetterContainers.isOverriding() && (BetterContainers.isBlankStack(slotIn.getStack()) ||
BetterContainers.isButtonStack(slotIn.getStack()))) {
BetterContainers.clickSlot(slotIn.getSlotIndex());
if(BetterContainers.isBlankStack(slotIn.getStack())) {
- GuiContainer $this = (GuiContainer)(Object)this;
$this.mc.playerController.windowClick($this.inventorySlots.windowId, slotId, 2, clickType, $this.mc.thePlayer);
ci.cancel();
} else {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
index 60361306..4ec15bea 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiIngame.java
@@ -1,7 +1,7 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.StreamerMode;
+import io.github.moulberry.notenoughupdates.miscfeatures.StreamerMode;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Team;
@@ -16,7 +16,7 @@ public class MixinGuiIngame {
"formatPlayerName(Lnet/minecraft/scoreboard/Team;Ljava/lang/String;)Ljava/lang/String;";
@Redirect(method="renderScoreboard", at=@At(value="INVOKE", target=TARGET))
public String renderScoreboard_formatPlayerName(Team team, String name) {
- if(NotEnoughUpdates.INSTANCE.isOnSkyblock() && NotEnoughUpdates.INSTANCE.manager.config.streamerMode.value) {
+ if(NotEnoughUpdates.INSTANCE.isOnSkyblock() && NotEnoughUpdates.INSTANCE.config.misc.streamerMode) {
return StreamerMode.filterScoreboard(ScorePlayerTeam.formatPlayerName(team, name));
}
return ScorePlayerTeam.formatPlayerName(team, name);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java
index 00fdc873..390896f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryEffectRenderer.java
@@ -13,7 +13,7 @@ public class MixinInventoryEffectRenderer {
@ModifyVariable(method="updateActivePotionEffects", at=@At(value="STORE"))
public boolean hasVisibleEffect_updateActivePotionEffects(boolean hasVisibleEffect) {
- if(NotEnoughUpdates.INSTANCE.manager.config.hidePotionEffect.value &&
+ if(NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect &&
NotEnoughUpdates.INSTANCE.isOnSkyblock()) {
return false;
} else {
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 0bb84f44..19bcdacf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
@@ -1,16 +1,16 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.StreamerMode;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.scoreboard.ScorePlayerTeam;
-import net.minecraft.scoreboard.Team;
-import org.lwjgl.util.vector.Vector3f;
+import net.minecraft.network.play.server.S2FPacketSetSlot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(NetHandlerPlayClient.class)
public class MixinNetHandlerPlayClient {
@@ -21,9 +21,16 @@ public class MixinNetHandlerPlayClient {
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.manager.config.smoothAoteMillis.value));
+ Math.max(0, Math.min(300, NotEnoughUpdates.INSTANCE.config.smoothAOTE.smoothTpMillis));
}
player.setPositionAndRotation(x, y, z, yaw, pitch);
}
+ @Inject(method="handleSetSlot", at=@At("HEAD"))
+ public void handleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci) {
+ EnchantingSolvers.processInventoryContents();
+ }
+
+
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java
index 2c92a0b1..106f9f94 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java
@@ -20,7 +20,7 @@ public class MixinRender {
public void bindEntityTexture(Entity entity, CallbackInfoReturnable<Boolean> cir) {
if(entity instanceof EntityBat && DungeonBlocks.isOverriding()) {
if(DungeonBlocks.bindModifiedTexture(new ResourceLocation("textures/entity/bat.png"),
- SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value))) {
+ SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungBatColour))) {
cir.setReturnValue(true);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
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 fc536267..12888dcb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java
@@ -34,7 +34,7 @@ public abstract class MixinRenderFish extends Render<EntityFishHook> {
@Inject(method = "doRender(Lnet/minecraft/entity/projectile/EntityFishHook;DDDFF)V", at=@At(value = "HEAD"), cancellable = true)
public void render(EntityFishHook entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
- if(!NotEnoughUpdates.INSTANCE.manager.config.rodColours.value || entity == null) return;
+ if(!NotEnoughUpdates.INSTANCE.config.rodColours.enableRodColours || entity == null) return;
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(entity.angler.getHeldItem());
if (NotEnoughUpdates.INSTANCE.isOnSkyblock() && internalname != null && entity.angler != null &&
@@ -103,9 +103,9 @@ public abstract class MixinRenderFish extends Render<EntityFishHook> {
String specialColour;
if (entity.angler.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) {
- specialColour = NotEnoughUpdates.INSTANCE.manager.config.selfRodLineColour.value;
+ specialColour = NotEnoughUpdates.INSTANCE.config.rodColours.ownRodColour;
} else {
- specialColour = NotEnoughUpdates.INSTANCE.manager.config.otherRodLineColour.value;
+ specialColour = NotEnoughUpdates.INSTANCE.config.rodColours.otherRodColour;
}
int colourI = SpecialColour.specialToChromaRGB(specialColour);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderGlobal.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderGlobal.java
index 2bb5503b..1b2b99ec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderGlobal.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderGlobal.java
@@ -1,11 +1,16 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.cosmetics.CapeManager;
import net.minecraft.client.renderer.RenderGlobal;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.EnumWorldBlockLayer;
import org.lwjgl.util.vector.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RenderGlobal.class)
public class MixinRenderGlobal {
@@ -66,4 +71,12 @@ public class MixinRenderGlobal {
return d5;
}
+ @Inject(method="renderBlockLayer", at=@At("RETURN"))
+ public void renderBlockLayer(EnumWorldBlockLayer blockLayerIn, double partialTicks, int pass,
+ Entity entityIn, CallbackInfoReturnable<Integer> cir) {
+ if(blockLayerIn == EnumWorldBlockLayer.CUTOUT) {
+ CapeManager.getInstance().postRenderBlocks();
+ }
+ }
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
index 67f0f7dc..6e552e3c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
@@ -1,42 +1,13 @@
package io.github.moulberry.notenoughupdates.mixins;
-import io.github.moulberry.notenoughupdates.ItemRarityHalo;
-import io.github.moulberry.notenoughupdates.NEUResourceManager;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
-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 io.github.moulberry.notenoughupdates.miscfeatures.ItemRarityHalo;
import net.minecraft.client.renderer.entity.RenderItem;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.resources.model.IBakedModel;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.client.shader.Shader;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.Matrix4f;
-import org.lwjgl.BufferUtils;
import org.lwjgl.input.Keyboard;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-import org.lwjgl.opengl.GL30;
-import org.lwjgl.util.vector.Vector4f;
import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import javax.vecmath.Vector3f;
-import java.awt.*;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.util.HashMap;
@Mixin({RenderItem.class})
public abstract class MixinRenderItem {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java
index d53f62c9..f7c2435a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java
@@ -21,8 +21,8 @@ public abstract class MixinTileEntitySpecialRenderer {
location.getResourcePath().equals("textures/entity/chest/normal_double.png") ||
location.getResourcePath().equals("textures/entity/chest/trapped.png") ||
location.getResourcePath().equals("textures/entity/chest/trapped_double.png")) {
- String colour = location.getResourcePath().contains("trapped") ? NotEnoughUpdates.INSTANCE.manager.config.dungTrappedChestColour.value :
- NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value;
+ String colour = location.getResourcePath().contains("trapped") ? NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungTrappedChestColour :
+ NotEnoughUpdates.INSTANCE.config.dungeonBlock.dungChestColour;
if(DungeonBlocks.bindModifiedTexture(location,
SpecialColour.specialToChromaRGB(colour))) {
info.cancel();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java
new file mode 100644
index 00000000..bedfafc9
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorld.java
@@ -0,0 +1,25 @@
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(World.class)
+public class MixinWorld {
+
+ @Inject(method="spawnParticle(IZDDDDDD[I)V", at=@At("HEAD"), cancellable = true)
+ public void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord,
+ double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
+ if(NotEnoughUpdates.INSTANCE.config.smoothAOTE.disableHyperionParticles &&
+ System.currentTimeMillis() - CustomItemEffects.INSTANCE.lastUsedHyperion < 500) {
+ if(particleID == 1) {
+ ci.cancel();
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
new file mode 100644
index 00000000..3aa7d122
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -0,0 +1,1234 @@
+package io.github.moulberry.notenoughupdates.options;
+
+import com.google.common.collect.Lists;
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Config;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+
+import java.util.ArrayList;
+
+public class NEUConfig extends Config {
+
+ @Expose
+ @Category(
+ name = "Misc",
+ desc = "Miscellaneous options which don't fit into any other category"
+ )
+ public Misc misc = new Misc();
+
+ @Expose
+ @Category(
+ name = "Notifications",
+ desc = "Notifications"
+ )
+ public Notifications notifications = new Notifications();
+
+ @Expose
+ @Category(
+ name = "Item List",
+ desc = "Modify the item list which shows when opening an inventory"
+ )
+ public Itemlist itemlist = new Itemlist();
+
+ @Expose
+ @Category(
+ name = "Toolbar",
+ desc = "Toolbar"
+ )
+ public Toolbar toolbar = new Toolbar();
+
+ @Expose
+ @Category(
+ name = "Tooltip Tweaks",
+ desc = "Tooltip Tweaks"
+ )
+ public TooltipTweaks tooltipTweaks = new TooltipTweaks();
+
+ @Expose
+ @Category(
+ name = "Price Info (Auction)",
+ desc = "Price Info (Auction)"
+ )
+ public PriceInfoAuc priceInfoAuc = new PriceInfoAuc();
+
+ @Expose
+ @Category(
+ name = "Price Info (Bazaar)",
+ desc = "Price Info (Bazaar)"
+ )
+ public PriceInfoBaz priceInfoBaz = new PriceInfoBaz();
+
+ @Expose
+ @Category(
+ name = "Dungeon Profit",
+ desc = "Dungeon Profit"
+ )
+ public DungeonProfit dungeonProfit = new DungeonProfit();
+
+
+ @Expose
+ @Category(
+ name = "Dungeon Solvers",
+ desc = "Dungeon Solvers"
+ )
+ public DungeonSolvers dungeonSolvers = new DungeonSolvers();
+
+
+ @Expose
+ @Category(
+ name = "Enchanting Solvers",
+ desc = "Enchanting Solvers"
+ )
+ public EnchSolvers enchantingSolvers = new EnchSolvers();
+
+ @Expose
+ @Category(
+ name = "NEU Auction House",
+ desc = "NEU Auction House"
+ )
+ public NeuAuctionHouse neuAuctionHouse = new NeuAuctionHouse();
+
+ @Expose
+ @Category(
+ name = "Improved SB Menus",
+ desc = "Improved SB Menus"
+ )
+ public ImprovedSBMenu improvedSBMenu = new ImprovedSBMenu();
+
+ @Expose
+ @Category(
+ name = "Calendar",
+ desc = "Calendar"
+ )
+ public Calendar calendar = new Calendar();
+
+ @Expose
+ @Category(
+ name = "Trade Menu",
+ desc = "Trade Menu"
+ )
+ public TradeMenu tradeMenu = new TradeMenu();
+
+ @Expose
+ @Category(
+ name = "Treecap Overlay",
+ desc = "Treecap Overlay"
+ )
+ public TreecapOverlay treecapOverlay = new TreecapOverlay();
+
+ @Expose
+ @Category(
+ name = "Builders Wand Overlay",
+ desc = "Builders Wand Overlay"
+ )
+ public BuilderWand builderWand = new BuilderWand();
+
+ @Expose
+ @Category(
+ name = "Dungeon Block Overlay",
+ desc = "Dungeon Block Overlay"
+ )
+ public DungeonBlock dungeonBlock = new DungeonBlock();
+
+ @Expose
+ @Category(
+ name = "Accessory Bag Overlay",
+ desc = "Accessory Bag Overlay"
+ )
+ public AccessoryBag accessoryBag = new AccessoryBag();
+
+ @Expose
+ @Category(
+ name = "Smooth AOTE",
+ desc = "Smooth AOTE"
+ )
+ public SmoothAOTE smoothAOTE = new SmoothAOTE();
+
+ @Expose
+ @Category(
+ name = "Custom Rod Colours",
+ desc = "Custom Rod Colours"
+ )
+ public RodColours rodColours = new RodColours();
+
+ @Expose
+ @Category(
+ name = "Dungeon Win Overlay",
+ desc = "Dungeon Win Overlay"
+ )
+ public DungeonWin dungeonWin = new DungeonWin();
+
+ @Expose
+ @Category(
+ name = "Api Key",
+ desc = "Api Key"
+ )
+ public ApiKey apiKey = new ApiKey();
+
+ @Expose
+ public Hidden hidden = new Hidden();
+
+ @Expose
+ public DungeonMap dungeonMap = new DungeonMap();
+
+ public static class Misc {
+ @Expose
+ @ConfigOption(
+ name = "Only Show on Skyblock",
+ desc = "The item list and some other GUI elements will only show on skyblock"
+ )
+ @ConfigEditorBoolean
+ public boolean onlyShowOnSkyblock = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Potion Effects",
+ desc = "Hides the potion effects inside your inventory while on skyblock"
+ )
+ @ConfigEditorBoolean
+ public boolean hidePotionEffect = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Streamer Mode",
+ desc = "Randomizes lobby names in the scoreboard and chat messages to help prevent stream sniping"
+ )
+ @ConfigEditorBoolean
+ public boolean streamerMode = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Gui Click Sounds",
+ desc = "Plays click sounds in various NEU-related GUIs when pressing buttons"
+ )
+ @ConfigEditorBoolean
+ public boolean guiButtonClicks = true;
+ }
+
+ public static class Notifications {
+ @Expose
+ @ConfigOption(
+ name = "Update Messages",
+ desc = "Give a notification in chat whenever a new version of NEU is released"
+ )
+ @ConfigEditorBoolean
+ public boolean showUpdateMsg = true;
+ }
+
+ public static class Itemlist {
+ @Expose
+ @ConfigOption(
+ name = "Show Vanilla Items",
+ desc = "Vanilla items are included in the item list"
+ )
+ @ConfigEditorBoolean
+ public boolean showVanillaItems = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Open Itemlist Arrow",
+ desc = "Creates an arrow on the right-side to open the item list when hovered"
+ )
+ @ConfigEditorBoolean
+ public boolean tabOpen = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Keep Open",
+ desc = "Keeps the Itemlist open after the inventory is closed"
+ )
+ @ConfigEditorBoolean
+ public boolean keepopen = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Item Style",
+ desc = "Sets the style of the background behind items"
+ )
+ @ConfigEditorDropdown(
+ values = {"Round", "Square"}
+ )
+ public int itemStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Gui Scale",
+ desc = "Change the gui scale of the Itemlist"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "Small", "Medium", "Large", "Auto"}
+ )
+ public int paneGuiScale = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Blur",
+ desc = "Change the blur amount behind the Itemlist. 0 = off"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 20,
+ minStep = 1
+ )
+ public int bgBlurFactor = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Width Multiplier",
+ desc = "Change the width of the Itemlist"
+ )
+ @ConfigEditorSlider(
+ minValue = 0.5f,
+ maxValue = 1.5f,
+ minStep = 0.1f
+ )
+ public float paneWidthMult = 1.0f;
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Padding",
+ desc = "Change the padding around the Itemlist"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 20f,
+ minStep = 1f
+ )
+ public int panePadding = 10;
+
+ @Expose
+ @ConfigOption(
+ name = "Foreground Colour",
+ desc = "Change the colour of foreground elements in the Itemlist"
+ )
+ @ConfigEditorColour
+ public String foregroundColour = "00:255:100:100:100";
+
+ @Expose
+ @ConfigOption(
+ name = "Favourite Colour",
+ desc = "Change the colour of favourited elements in the Itemlist"
+ )
+ @ConfigEditorColour
+ public String favouriteColour = "00:255:200:150:50";
+
+ @Expose
+ @ConfigOption(
+ name = "Pane Background Colour",
+ desc = "Change the colour of the Itemlist background"
+ )
+ @ConfigEditorColour
+ public String backgroundColour = "15:6:0:0:255";
+ }
+
+ public static class Toolbar {
+ @Expose
+ @ConfigOption(
+ name = "Show Quick Commands",
+ desc = "Show QuickCommands\u2122 in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ public boolean quickCommands = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Search Bar",
+ desc = "Show Itemlist search bar in the NEU toolbar"
+ )
+ @ConfigEditorBoolean
+ public boolean searchBar = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Search Bar Width",
+ desc = "Change the width of the search bar"
+ )
+ @ConfigEditorSlider(
+ minValue = 50f,
+ maxValue = 300f,
+ minStep = 10f
+ )
+ public int searchBarWidth = 200;
+
+ @Expose
+ @ConfigOption(
+ name = "Search Bar Height",
+ desc = "Change the height of the search bar"
+ )
+ @ConfigEditorSlider(
+ minValue = 15f,
+ maxValue = 50f,
+ minStep = 1f
+ )
+ public int searchBarHeight = 40;
+
+ @Expose
+ @ConfigOption(
+ name = "Quick Commands Click Type",
+ desc = "Change the click type needed to trigger quick commands"
+ )
+ @ConfigEditorDropdown(
+ values = {"Mouse Up", "Mouse Down"}
+ )
+ public int quickCommandsClickType = 0;
+ }
+
+ public static class TooltipTweaks {
+ @Expose
+ @ConfigOption(
+ name = "Price Info (Inv)",
+ desc = "Show price information for items in your inventory"
+ )
+ @ConfigEditorBoolean
+ public boolean showPriceInfoInvItem = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Price Info (AH)",
+ desc = "Show price information for auctioned items"
+ )
+ @ConfigEditorBoolean
+ public boolean showPriceInfoAucItem = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Missing Enchant List",
+ desc = "Show which enchants are missing on an item when pressing LSHIFT"
+ )
+ @ConfigEditorBoolean
+ public boolean missingEnchantList = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Tooltip Border Colours",
+ desc = "Make the borders of tooltips match the rarity of the item (NEU Tooltips Only)"
+ )
+ @ConfigEditorBoolean
+ public boolean tooltipBorderColours = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Tooltip Border Opacity",
+ desc = "Change the opacity of the rarity highlight (NEU Tooltips Only)"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 255f,
+ minStep = 1f
+ )
+ public int tooltipBorderOpacity = 200;
+ }
+
+ public static class PriceInfoAuc {
+ @Expose
+ @ConfigOption(
+ name = "Line 1",
+ desc = "Set the price information displayed on Line #1"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line1 = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 2",
+ desc = "Set the price information displayed on Line #2"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line2 = 2;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 3",
+ desc = "Set the price information displayed on Line #3"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line3 = 3;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 4",
+ desc = "Set the price information displayed on Line #4"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line4 = 4;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 5",
+ desc = "Set the price information displayed on Line #5"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line5 = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 6",
+ desc = "Set the price information displayed on Line #6"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Lowest BIN", "AH Price", "AH Sales", "Raw Craft Cost", "AVG Lowest BIN"}
+ )
+ public int line6 = 0;
+ }
+
+ public static class PriceInfoBaz {
+ @Expose
+ @ConfigOption(
+ name = "Line 1",
+ desc = "Set the price information displayed on Line #1"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line1 = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 2",
+ desc = "Set the price information displayed on Line #2"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line2 = 2;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 3",
+ desc = "Set the price information displayed on Line #3"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line3 = 3;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 4",
+ desc = "Set the price information displayed on Line #4"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line4 = 4;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 5",
+ desc = "Set the price information displayed on Line #5"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line5 = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Line 6",
+ desc = "Set the price information displayed on Line #6"
+ )
+ @ConfigEditorDropdown(
+ values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"}
+ )
+ public int line6 = 0;
+ }
+
+ public static class DungeonProfit {
+ @Expose
+ @ConfigOption(
+ name = "Profit Type",
+ desc = "Set the price dataset used for calculating profit"
+ )
+ @ConfigEditorDropdown(
+ values = {"Lowest BIN", "24 AVG Lowest Bin", "Auction AVG"}
+ )
+ public int profitType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Profit Display Location",
+ desc = "Set where the profit information is displayed\n" +
+ "Overlay = Overlay on right side of inventory\n" +
+ "GUI Title = Text displayed next to the inventory title\n" +
+ "Lore = Inside the \"Open Reward Chest\" item"
+ )
+ @ConfigEditorDropdown(
+ values = {"Overlay", "GUI Title", "Lore"}
+ )
+ public int profitDisplayLoc = 0;
+ }
+ public static class DungeonSolvers {
+
+ }
+
+ public static class EnchSolvers {
+ @Expose
+ @ConfigOption(
+ name = "Enable Solvers",
+ desc = "Turn on solvers for the experimentation table"
+ )
+ @ConfigEditorBoolean
+ public boolean enableEnchantingSolvers = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Prevent Misclicks",
+ desc = "Prevent accidentally failing the Chronomatron and Ultrasequencer experiments"
+ )
+ @ConfigEditorBoolean
+ public boolean preventMisclicks = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Tooltips",
+ desc = "Hide the tooltip of items in the Chronomatron and Ultrasequencer experiments"
+ )
+ @ConfigEditorBoolean
+ public boolean hideTooltips = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Ultrasequencer Numbers",
+ desc = "Replace the items in the supersequencer with only numbers"
+ )
+ @ConfigEditorBoolean
+ public boolean seqNumbers = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Ultrasequencer Next",
+ desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next"
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int seqNext = 6;
+
+ @Expose
+ @ConfigOption(
+ name = "Ultrasequencer Upcoming",
+ desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is coming after \"next\""
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int seqUpcoming = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Superpairs Matched",
+ desc = "Set the colour of the glass pane shown behind successfully matched pairs"
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int supMatched = 6;
+
+ @Expose
+ @ConfigOption(
+ name = "Superpairs Possible",
+ desc = "Set the colour of the glass pane shown behind pairs which can be matched, but have not yet"
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int supPossible = 2;
+
+ @Expose
+ @ConfigOption(
+ name = "Superpairs Unmatched",
+ desc = "Set the colour of the glass pane shown behind pairs which have been previously uncovered"
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int supUnmatched = 5;
+
+ @Expose
+ @ConfigOption(
+ name = "Superpairs Powerups",
+ desc = "Set the colour of the glass pane shown behind powerups"
+ )
+ @ConfigEditorDropdown(
+ values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink",
+ "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"}
+ )
+ public int supPower = 11;
+ }
+
+ public static class NeuAuctionHouse {
+ @Expose
+ @ConfigOption(
+ name = "Enable NeuAH",
+ desc = "Turn on the NEU Auction House. \u00A7cWARNING: May negatively impact performance on low-end machines"
+ )
+ @ConfigEditorBoolean
+ public boolean enableNeuAuctionHouse = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Disable AH Scroll",
+ desc = "Disable scrolling using the scroll wheel inside NeuAH.\n" +
+ "This should be used if you want to be able to scroll through tooltips"
+ )
+ @ConfigEditorBoolean
+ public boolean disableAhScroll = false;
+
+ @Expose
+ @ConfigOption(
+ name = "AH Notification (Mins)",
+ desc = "Change the amount of time (in minutes) before the \"Ending Soon\" notification for an auction you have bid on"
+ )
+ @ConfigEditorSlider(
+ minValue = 1f,
+ maxValue = 10f,
+ minStep = 1f
+ )
+ public int ahNotification = 5;
+ }
+
+ public static class ImprovedSBMenu {
+ @Expose
+ @ConfigOption(
+ name = "Enable Improved SB Menus",
+ desc = "Change the way that skyblock menus (eg. /sbmenu) look"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSbMenus = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Menu Background Style",
+ desc = "Change the style of the background of skyblock menus"
+ )
+ @ConfigEditorDropdown(
+ values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3",
+ "Unused 1", "Unused 2", "Unused 3", "Unused 4"}
+ )
+ public int backgroundStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Button Background Style",
+ desc = "Change the style of the foreground elements in skyblock menus"
+ )
+ @ConfigEditorDropdown(
+ values = {"Dark 1", "Dark 2", "Transparent", "Light 1", "Light 2", "Light 3",
+ "Unused 1", "Unused 2", "Unused 3", "Unused 4"}
+ )
+ public int buttonStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Empty Tooltips",
+ desc = "Hide the tooltips of glass panes with no text"
+ )
+ @ConfigEditorBoolean
+ public boolean hideEmptyPanes = true;
+ }
+
+ public static class Calendar {
+ @Expose
+ @ConfigOption(
+ name = "Event Notifications",
+ desc = "Display notifications for skyblock calendar events"
+ )
+ @ConfigEditorBoolean
+ public boolean eventNotifications = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Starting Soon Time",
+ desc = "Display a notification before events start, time in seconds.\n" +
+ "0 = No prior notification"
+ )
+ @ConfigEditorSlider(
+ minValue = 0f,
+ maxValue = 600f,
+ minStep = 30f
+ )
+ public int startingSoonTime = 300;
+
+ @Expose
+ @ConfigOption(
+ name = "Timer In Inventory",
+ desc = "Displays the time until the next event at the top of your screen when in inventories"
+ )
+ @ConfigEditorBoolean
+ public boolean showEventTimerInInventory = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Notification Sounds",
+ desc = "Play a sound whenever events start"
+ )
+ @ConfigEditorBoolean
+ public boolean eventNotificationSounds = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Spooky Night Notification",
+ desc = "Send a notification during spooky event when the time reaches 7pm"
+ )
+ @ConfigEditorBoolean
+ public boolean spookyNightNotification = true;
+ }
+
+ public static class TradeMenu {
+ @Expose
+ @ConfigOption(
+ name = "Enable Custom Trade Menu",
+ desc = "When trading with other players in skyblock, display a special GUI designed to prevent scamming"
+ )
+ @ConfigEditorBoolean
+ public boolean enableCustomTrade = true;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Price Information",
+ desc = "Show the price of items in the trade window on both sides"
+ )
+ @ConfigEditorBoolean
+ public boolean customTradePrices = true;
+
+ @Expose
+ public boolean customTradePriceStyle = true;
+ }
+
+ public static class TreecapOverlay {
+ @Expose
+ @ConfigOption(
+ name = "Enable Treecap Overlay",
+ desc = "Show which blocks will be broken when using a Jungle Axe or Treecapitator"
+ )
+ @ConfigEditorBoolean
+ public boolean enableTreecapOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Colour",
+ desc = "Change the colour of the overlay"
+ )
+ @ConfigEditorColour
+ public String treecapOverlayColour = "00:50:64:224:208";
+ }
+
+ public static class BuilderWand {
+ @Expose
+ @ConfigOption(
+ name = "Enable Wand Overlay",
+ desc = "Show which blocks will be placed when using the Builder's Wand"
+ )
+ @ConfigEditorBoolean
+ public boolean enableWandOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Wand Block Count",
+ desc = "Shows the total count of a block in your inventory"
+ )
+ @ConfigEditorBoolean
+ public boolean wandBlockCount = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Overlay Colour",
+ desc = "Change the colour of the ghost block outline"
+ )
+ @ConfigEditorColour
+ public String wandOverlayColour = "00:50:64:224:208";
+ }
+
+ public static class DungeonBlock {
+ @Expose
+ @ConfigOption(
+ name = "Enable Block Overlay",
+ desc = "Change the colour of certain blocks / entities while inside dungeons, but keeps the normal texture outside of dungeons"
+ )
+ @ConfigEditorBoolean
+ public boolean enableDungBlockOverlay = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Overlay Everywhere",
+ desc = "Show the dungeon block overlay even when not inside dungeons. Should only be used for testing."
+ )
+ @ConfigEditorBoolean
+ public boolean dungeonBlocksEverywhere = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Slow Update",
+ desc = "Updates the colour every second instead of every tick.\n" +
+ "\u00A7cWARNING: This will cause all texture animations (eg. flowing water) to update slowly.\n" +
+ "This should only be used on low-end machines"
+ )
+ @ConfigEditorBoolean
+ public boolean slowDungeonBlocks = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Cracked Bricks",
+ desc = "Change the colour of: Cracked Bricks"
+ )
+ @ConfigEditorColour
+ public String dungCrackedColour = "0:255:7:255:217";
+
+ @Expose
+ @ConfigOption(
+ name = "Dispensers",
+ desc = "Change the colour of: Dispensers"
+ )
+ @ConfigEditorColour
+ public String dungDispenserColour = "0:255:255:76:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Levers",
+ desc = "Change the colour of: Levers"
+ )
+ @ConfigEditorColour
+ public String dungLeverColour = "0:252:24:249:255";
+
+ @Expose
+ @ConfigOption(
+ name = "Tripwire String",
+ desc = "Change the colour of: Tripwire String"
+ )
+ @ConfigEditorColour
+ public String dungTripWireColour = "0:255:255:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Normal Chests",
+ desc = "Change the colour of: Normal Chests"
+ )
+ @ConfigEditorColour
+ public String dungChestColour = "0:255:0:163:36";
+
+ @Expose
+ @ConfigOption(
+ name = "Trapped Chests",
+ desc = "Change the colour of: Trapped Chests"
+ )
+ @ConfigEditorColour
+ public String dungTrappedChestColour = "0:255:0:163:36";
+
+ @Expose
+ @ConfigOption(
+ name = "Bats",
+ desc = "Change the colour of: Bats"
+ )
+ @ConfigEditorColour
+ public String dungBatColour = "0:255:12:255:0";
+ }
+
+ public static class AccessoryBag {
+ @Expose
+ @ConfigOption(
+ name = "Enable Accessory Bag Overlay",
+ desc = "Show an overlay on the accessory bag screen which gives useful information about your accessories"
+ )
+ @ConfigEditorBoolean
+ public boolean enableOverlay = true;
+ }
+
+ public static class SmoothAOTE {
+ @Expose
+ @ConfigOption(
+ name = "Enable Smooth AOTE",
+ desc = "Teleport smoothly to your destination when using AOTE"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSmoothAOTE = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Smooth Hyperion",
+ desc = "Teleport smoothly to your destination when using Hyperion"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSmoothHyperion = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Smooth TP Time",
+ desc = "Change the amount of time (milliseconds) taken to teleport"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 500,
+ minStep = 25
+ )
+ public int smoothTpMillis = 175;
+
+
+ @Expose
+ @ConfigOption(
+ name = "Disable Hyperion Particles",
+ desc = "Remove the explosion effect when using a hyperion"
+ )
+ @ConfigEditorBoolean
+ public boolean disableHyperionParticles = true;
+ }
+
+ public static class RodColours {
+ @Expose
+ @ConfigOption(
+ name = "Enable Rod Colours",
+ desc = "Change the colour of your and other players' rod lines\n" +
+ "Also fixes the position of the rod line"
+ )
+ @ConfigEditorBoolean
+ public boolean enableRodColours = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Own Rod Colour",
+ desc = "Change the colour of your own rod lines"
+ )
+ @ConfigEditorColour
+ public String ownRodColour = "0:255:0:0:0";
+
+
+ @Expose
+ @ConfigOption(
+ name = "Other Rod Colour",
+ desc = "Change the colour of other players' rod lines"
+ )
+ @ConfigEditorColour
+ public String otherRodColour = "0:255:0:0:0";
+ }
+
+ public static class DungeonWin {
+ @Expose
+ @ConfigOption(
+ name = "Enable Dungeon Win",
+ desc = "Show a fancy win screen and stats when completing a dungeon"
+ )
+ @ConfigEditorBoolean
+ public boolean enableDungeonWin = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Dungeon Win Time",
+ desc = "Change the amount of time (milliseconds) that the win screen shows for"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 20000,
+ minStep = 500
+ )
+ public int dungeonWinMillis = 8000;
+ }
+
+ public static class ApiKey {
+ @Expose
+ @ConfigOption(
+ name = "Api Key",
+ desc = "Hypixel api key"
+ )
+ @ConfigEditorText
+ public String apiKey = "";
+ }
+
+ private static ArrayList<String> createDefaultQuickCommands() {
+ ArrayList<String> arr = new ArrayList<>();
+ arr.add("/warp home:Warp Home:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzljODg4MWU0MjkxNWE5ZDI5YmI2MWExNmZiMjZkMDU5OTEzMjA0ZDI2NWRmNWI0MzliM2Q3OTJhY2Q1NiJ9fX0=");
+ arr.add("/warp hub:Warp Hub:eyJ0aW1lc3RhbXAiOjE1NTkyMTU0MTY5MDksInByb2ZpbGVJZCI6IjQxZDNhYmMyZDc0OTQwMGM5MDkwZDU0MzRkMDM4MzFiIiwicHJvZmlsZU5hbWUiOiJNZWdha2xvb24iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2Q3Y2M2Njg3NDIzZDA1NzBkNTU2YWM1M2UwNjc2Y2I1NjNiYmRkOTcxN2NkODI2OWJkZWJlZDZmNmQ0ZTdiZjgifX19");
+ arr.add("/warp dungeon_hub:Dungeon Hub:eyJ0aW1lc3RhbXAiOjE1Nzg0MDk0MTMxNjksInByb2ZpbGVJZCI6IjQxZDNhYmMyZDc0OTQwMGM5MDkwZDU0MzRkMDM4MzFiIiwicHJvZmlsZU5hbWUiOiJNZWdha2xvb24iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzliNTY4OTViOTY1OTg5NmFkNjQ3ZjU4NTk5MjM4YWY1MzJkNDZkYjljMWIwMzg5YjhiYmViNzA5OTlkYWIzM2QiLCJtZXRhZGF0YSI6eyJtb2RlbCI6InNsaW0ifX19fQ==");
+ arr.add("/craft:Crafting Table:CRAFTING_TABLE");
+ arr.add("/enderchest:Ender Chest:ENDER_CHEST");
+ arr.add("/wardrobe:Wardrobe:LEATHER_CHESTPLATE");
+ arr.add("/pets:Pets:BONE");
+ arr.add("/ah:Auction House:GOLD_BLOCK");
+ arr.add("/bz:Bazaar:GOLD_BARDING");
+ return arr;
+ }
+
+ public static class Hidden {
+ @Expose public boolean enableItemEditing = false;
+ @Expose public boolean cacheRenderedItempane = true;
+ @Expose public boolean autoupdate = true;
+ @Expose public String overlaySearchBar = "";
+ @Expose public String overlayQuickCommand = "";
+ @Expose public boolean dev = false;
+ @Expose public boolean loadedModBefore = false;
+ @Expose public boolean doRamNotif = true;
+ @Expose public String selectedCape = null;
+ @Expose public int compareMode = 0;
+ @Expose public int sortMode = 0;
+ @Expose public ArrayList<Boolean> compareAscending = Lists.newArrayList(true, true, true);
+ @Expose public ArrayList<String> favourites = new ArrayList<>();
+ @Expose public ArrayList<String> eventFavourites = new ArrayList<>();
+ @Expose public ArrayList<String> quickCommands = createDefaultQuickCommands();
+ @Expose public ArrayList<String> enchantColours = Lists.newArrayList(
+ "[a-zA-Z\\- ]+:\u003e:9:6",
+ "[a-zA-Z\\- ]+:\u003e:6:c",
+ "[a-zA-Z\\- ]+:\u003e:5:5",
+ "Experience:\u003e:3:5",
+ "Life Steal:\u003e:3:5",
+ "Scavenger:\u003e:3:5",
+ "Looting:\u003e:3:5");
+ }
+
+ public static class DungeonMap {
+ @Expose
+ @ConfigOption(
+ name = "Border Size",
+ desc = "Changes the size of the map border, without changing the size of the contents"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 5,
+ minStep = 1
+ )
+ public int dmBorderSize = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Room Size",
+ desc = "Changes the size of rooms. Useful for higher dungeons with larger maps"
+ )
+ @ConfigEditorSlider(
+ minValue = 0,
+ maxValue = 5,
+ minStep = 1
+ )
+ public int dmRoomSize = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Icon Size",
+ desc = "Changes the scale of room indicators and player icons"
+ )
+ @ConfigEditorSlider(
+ minValue = 0.5f,
+ maxValue = 3f,
+ minStep = 0.25f
+ )
+ public float dmIconScale = 1.0f;
+
+ @Expose
+ @ConfigOption(
+ name = "Border Style",
+ desc = "Various custom borders from various talented artists.\nUse 'custom' if your texture pack has a custom border"
+ )
+ public int dmBorderStyle = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Dungeon Map",
+ desc = "Show/hide the NEU dungeon map"
+ )
+ public boolean dmEnable = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Map Center",
+ desc = "Center on rooms, or center on your player"
+ )
+ public boolean dmCenterPlayer = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Rotate with Player",
+ desc = "Rotate the map to face the same direction as your player"
+ )
+ public boolean dmRotatePlayer = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Orient Checkmarks",
+ desc = "Checkmarks will always show vertically, regardless of rotation"
+ )
+ public boolean dmOrientCheck = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Center Checkmarks",
+ desc = "Checkmarks will show closer to the center of rooms"
+ )
+ public boolean dmCenterCheck = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Player Icon Style",
+ desc = "Various player icon styles"
+ )
+ public int dmPlayerHeads = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Interpolate Far Players",
+ desc = "Will make players far away move smoothly"
+ )
+ public boolean dmPlayerInterp = true;
+
+ @Expose
+ @ConfigOption(
+ name = "OpenGL Compatibility",
+ desc = "Compatiblity options for people with bad computers. ONLY use this if you know what you are doing, otherwise the map will look worse"
+ )
+ public int dmCompat = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Colour",
+ desc = "Colour of the map background. Supports opacity & chroma"
+ )
+ public String dmBackgroundColour = "00:170:75:75:75";
+
+ @Expose
+ @ConfigOption(
+ name = "Border Colour",
+ desc = "Colour of the map border. Supports opacity & chroma. Turn off custom borders to see"
+ )
+ public String dmBorderColour = "00:0:0:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Chroma Border Mode",
+ desc = "Applies a hue offset around the map border"
+ )
+ public boolean dmChromaBorder = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Background Blur Factor",
+ desc = "Changes the blur factor behind the map. Set to 0 to disable blur"
+ )
+ public int dmBackgroundBlur = 3;
+
+ @Expose
+ @ConfigOption(
+ name = "Center X (%)",
+ desc = "The horizontal position of the map"
+ )
+ public double dmCenterX = 8.5;
+
+ @Expose
+ @ConfigOption(
+ name = "Center Y (%)",
+ desc = "The vertical position of the map"
+ )
+ public double dmCenterY = 15.0;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
new file mode 100644
index 00000000..3d006383
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -0,0 +1,390 @@
+package io.github.moulberry.notenoughupdates.options;
+
+import com.google.common.collect.Lists;
+import io.github.moulberry.notenoughupdates.core.GlScissorStack;
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.core.config.Config;
+import io.github.moulberry.notenoughupdates.core.config.gui.GuiOptionEditor;
+import io.github.moulberry.notenoughupdates.core.config.struct.ConfigProcessor;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.GL11;
+import static io.github.moulberry.notenoughupdates.util.GuiTextures.*;
+
+import java.awt.*;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class NEUConfigEditor extends GuiElement {
+
+ private static final ResourceLocation[] socialsIco = new ResourceLocation[] {
+ DISCORD,
+ GITHUB,
+ TWITTER,
+ YOUTUBE,
+ PATREON
+ };
+ private static final String[] socialsLink = new String[] {
+ "https://discord.gg/moulberry",
+ "https://github.com/Moulberry/Hychat",
+ "https://twitter.com/moulberry/",
+ "https://www.youtube.com/channel/UCPh-OKmRSS3IQi9p6YppLcw",
+ "https://patreon.com/moulberry"
+ };
+
+ private final long openedMillis;
+
+ private String selectedCategory = null;
+
+ private LerpingInteger optionsScroll = new LerpingInteger(0, 150);
+
+ private LinkedHashMap<String, ConfigProcessor.ProcessedCategory> processedConfig;
+
+ public NEUConfigEditor(Config config) {
+ this.openedMillis = System.currentTimeMillis();
+ this.processedConfig = ConfigProcessor.create(config);
+ }
+
+ private LinkedHashMap<String, ConfigProcessor.ProcessedCategory> getCurrentConfigEditing() {
+ return processedConfig;
+ }
+
+ private String getSelectedCategory() {
+ return selectedCategory;
+ }
+
+ private void setSelectedCategory(String category) {
+ selectedCategory = category;
+ optionsScroll.setValue(0);
+ }
+
+ public void render() {
+ optionsScroll.tick();
+
+ List<String> tooltipToDisplay = null;
+
+ long currentTime = System.currentTimeMillis();
+ long delta = currentTime - openedMillis;
+
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+ int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ float opacityFactor = LerpUtils.sigmoidZeroOne(delta/500f);
+ RenderUtils.drawGradientRect(0, 0, 0, width, height,
+ (int)(0x80*opacityFactor) << 24 | 0x101010,
+ (int)(0x90*opacityFactor) << 24 | 0x101010);
+
+ int xSize = Math.min(scaledResolution.getScaledWidth()-100/scaledResolution.getScaleFactor(), 500);
+ int ySize = Math.min(scaledResolution.getScaledHeight()-100/scaledResolution.getScaleFactor(), 400);
+
+ int x = (scaledResolution.getScaledWidth() - xSize)/2;
+ int y = (scaledResolution.getScaledHeight() - ySize)/2;
+
+ int adjScaleFactor = Math.max(2, scaledResolution.getScaleFactor());
+
+ int openingXSize = xSize;
+ int openingYSize = ySize;
+ if(delta < 150) {
+ openingXSize = (int)(delta*xSize/150);
+ openingYSize = 5;
+ } else if(delta < 300) {
+ openingYSize = 5 + (int)(delta-150)*(ySize-5)/150;
+ }
+ RenderUtils.drawFloatingRectDark(
+ (scaledResolution.getScaledWidth() - openingXSize)/2,
+ (scaledResolution.getScaledHeight() - openingYSize)/2,
+ openingXSize, openingYSize);
+ GlScissorStack.clear();
+ GlScissorStack.push((scaledResolution.getScaledWidth() - openingXSize)/2,
+ (scaledResolution.getScaledHeight() - openingYSize)/2,
+ (scaledResolution.getScaledWidth() + openingXSize)/2,
+ (scaledResolution.getScaledHeight() + openingYSize)/2, scaledResolution);
+
+ RenderUtils.drawFloatingRectDark(x+5, y+5, xSize-10, 20, false);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("NotEnoughUpdates by "+EnumChatFormatting.DARK_PURPLE+"Moulberry",
+ fr, x+xSize/2, y+15, false, 200, 0xa0a0a0);
+
+ RenderUtils.drawFloatingRectDark(x+4, y+49-20,
+ 140, ySize-54+20, false);
+
+ int innerPadding = 20/adjScaleFactor;
+ int innerLeft = x+4+innerPadding;
+ int innerRight = x+144-innerPadding;
+ int innerTop = y+49+innerPadding;
+ int innerBottom = y+ySize-5-innerPadding;
+ Gui.drawRect(innerLeft, innerTop, innerLeft+1, innerBottom, 0xff08080E); //Left
+ Gui.drawRect(innerLeft+1, innerTop, innerRight, innerTop+1, 0xff08080E); //Top
+ Gui.drawRect(innerRight-1, innerTop+1, innerRight, innerBottom, 0xff28282E); //Right
+ Gui.drawRect(innerLeft+1, innerBottom-1, innerRight-1, innerBottom, 0xff28282E); //Bottom
+ Gui.drawRect(innerLeft+1, innerTop+1, innerRight-1, innerBottom-1, 0x6008080E); //Middle
+
+ GlScissorStack.push(0, innerTop+1, scaledResolution.getScaledWidth(),
+ innerBottom-1, scaledResolution);
+
+ int categoryIndex = 0;
+ for(Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) {
+ if(getSelectedCategory() == null) {
+ setSelectedCategory(entry.getKey());
+ }
+ String catName = entry.getValue().name;
+ if(entry.getKey().equals(getSelectedCategory())) {
+ catName = EnumChatFormatting.DARK_AQUA.toString() + EnumChatFormatting.UNDERLINE + catName;
+ } else {
+ catName = EnumChatFormatting.GRAY + catName;
+ }
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(catName,
+ fr, x+75, y+70+categoryIndex*15, false, 140, -1);
+ categoryIndex++;
+ }
+
+ GlScissorStack.pop(scaledResolution);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Categories",
+ fr, x+75, y+44, false, 120, 0xa368ef);
+
+ RenderUtils.drawFloatingRectDark(x+149, y+29,
+ xSize-154, ySize-34, false);
+
+ if(getSelectedCategory() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(cat.desc,
+ fr, x+xSize/2+72, y+44, true, xSize-154-innerPadding*2, 0xb0b0b0);
+ }
+
+ innerLeft = x+149+innerPadding;
+ innerRight =x+xSize-5-innerPadding;
+ //innerTop = y+29+innerPadding;
+ innerBottom = y+ySize-5-innerPadding;
+ Gui.drawRect(innerLeft, innerTop, innerLeft+1, innerBottom, 0xff08080E); //Left
+ Gui.drawRect(innerLeft+1, innerTop, innerRight, innerTop+1, 0xff08080E); //Top
+ Gui.drawRect(innerRight-1, innerTop+1, innerRight, innerBottom, 0xff303036); //Right
+ Gui.drawRect(innerLeft+1, innerBottom-1, innerRight-1, innerBottom, 0xff303036); //Bottom
+ Gui.drawRect(innerLeft+1, innerTop+1, innerRight-1, innerBottom-1, 0x6008080E); //Middle
+
+ GlScissorStack.push(innerLeft+1, innerTop+1, innerRight-1, innerBottom-1, scaledResolution);
+
+ float barSize = 1;
+ int optionY = -optionsScroll.getValue();
+ if(getSelectedCategory() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+ int optionWidth = innerRight-innerLeft-20;
+ GlStateManager.enableDepth();
+ for(ConfigProcessor.ProcessedOption option : cat.options.values()) {
+ GuiOptionEditor editor = option.editor;
+ if(editor == null) {
+ continue;
+ }
+ int optionHeight = editor.getHeight();
+ if(innerTop+5+optionY+optionHeight > innerTop+1 && innerTop+5+optionY < innerBottom-1) {
+ editor.render(innerLeft+5, innerTop+5+optionY, optionWidth);
+ }
+ optionY += optionHeight + 5;
+ }
+ GlStateManager.disableDepth();
+ if(optionY > 0) {
+ barSize = LerpUtils.clampZeroOne((float)(innerBottom-innerTop-2)/(optionY+5+optionsScroll.getValue()));
+ }
+ }
+
+ GlScissorStack.pop(scaledResolution);
+
+ float barStart = optionsScroll.getValue() / (float)(optionY + optionsScroll.getValue());
+ float barEnd = barStart+barSize;
+ if(barEnd > 1) {
+ barEnd = 1;
+ if(optionsScroll.getTarget()/(float)(optionY + optionsScroll.getValue())+barSize < 1) {
+ int target = optionsScroll.getTarget();
+ optionsScroll.setValue((int)Math.ceil((optionY+5+optionsScroll.getValue())-barSize*(optionY+5+optionsScroll.getValue())));
+ optionsScroll.setTarget(target);
+ } else {
+ optionsScroll.setValue((int)Math.ceil((optionY+5+optionsScroll.getValue())-barSize*(optionY+5+optionsScroll.getValue())));
+ }
+ }
+ int dist = innerBottom-innerTop-12;
+ Gui.drawRect(innerRight-10, innerTop+5, innerRight-5, innerBottom-5, 0xff101010);
+ Gui.drawRect(innerRight-9, innerTop+6+(int)(dist*barStart), innerRight-6, innerTop+6+(int)(dist*barEnd), 0xff303030);
+
+ for(int socialIndex=0; socialIndex<socialsIco.length; socialIndex++) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(socialsIco[socialIndex]);
+ GlStateManager.color(1, 1, 1, 1);
+ int socialLeft = x+xSize-23-18*socialIndex;
+ RenderUtils.drawTexturedRect(socialLeft, y+7, 16, 16, GL11.GL_LINEAR);
+
+ if(mouseX >= socialLeft && mouseX <= socialLeft+16 &&
+ mouseY >= y+6 && mouseY <= y+23) {
+ tooltipToDisplay = Lists.newArrayList(EnumChatFormatting.YELLOW+"Go to: "+EnumChatFormatting.RESET+socialsLink[socialIndex]);
+ }
+ }
+
+ GlScissorStack.clear();
+
+ if(tooltipToDisplay != null) {
+ TextRenderUtils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
+ }
+
+ GlStateManager.translate(0, 0, -2);
+ }
+
+ public boolean mouseInput(int mouseX, int mouseY) {
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+
+ int xSize = Math.min(width-100/scaledResolution.getScaleFactor(), 500);
+ int ySize = Math.min(height-100/scaledResolution.getScaleFactor(), 400);
+
+ int x = (scaledResolution.getScaledWidth() - xSize)/2;
+ int y = (scaledResolution.getScaledHeight() - ySize)/2;
+
+ int adjScaleFactor = Math.max(2, scaledResolution.getScaleFactor());
+
+ int innerPadding = 20/adjScaleFactor;
+ int innerTop = y+49+innerPadding;
+ int innerBottom = y+ySize-5-innerPadding;
+ int innerLeft = x+149+innerPadding;
+ int innerRight = x+xSize-5-innerPadding;
+
+ int dWheel = Mouse.getDWheel();
+ if(mouseY > innerTop && mouseY < innerBottom && dWheel != 0) {
+ if(dWheel < 0) {
+ dWheel = -1;
+ }
+ if(dWheel > 0) {
+ dWheel = 1;
+ }
+ boolean resetTimer = true;
+ int newTarget = optionsScroll.getTarget() - dWheel*30;
+ if(newTarget < 0) {
+ newTarget = 0;
+ resetTimer = false;
+ }
+
+ float barSize = 1;
+ int optionY = -newTarget;
+ if(getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+ for(ConfigProcessor.ProcessedOption option : cat.options.values()) {
+ GuiOptionEditor editor = option.editor;
+ if(editor == null) {
+ continue;
+ }
+ optionY += editor.getHeight() + 5;
+
+ if(optionY > 0) {
+ barSize = LerpUtils.clampZeroOne((float)(innerBottom-innerTop-2)/(optionY+5 + newTarget));
+ }
+ }
+ }
+
+ int barMax = (int)Math.floor((optionY+5+newTarget)-barSize*(optionY+5+newTarget));
+ if(newTarget > barMax) {
+ newTarget = barMax;
+ resetTimer = false;
+ }
+ if(resetTimer && optionsScroll.getTarget() != newTarget) {
+ optionsScroll.resetTimer();
+ }
+ optionsScroll.setTarget(newTarget);
+ } else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
+ if(getCurrentConfigEditing() != null) {
+ int categoryIndex = 0;
+ for(Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) {
+ if(getSelectedCategory() == null) {
+ setSelectedCategory(entry.getKey());
+ }
+ if(mouseX >= x+5 && mouseX <= x+145 &&
+ mouseY >= y+70+categoryIndex*15-7 && mouseY <= y+70+categoryIndex*15+7) {
+ setSelectedCategory(entry.getKey());
+ return true;
+ }
+ categoryIndex++;
+ }
+ }
+
+ for(int socialIndex=0; socialIndex<socialsLink.length; socialIndex++) {
+ int socialLeft = x+xSize-23-18*socialIndex;
+
+ if(mouseX >= socialLeft && mouseX <= socialLeft+16 &&
+ mouseY >= y+6 && mouseY <= y+23) {
+ try {
+ Desktop.getDesktop().browse(new URI(socialsLink[socialIndex]));
+ } catch(Exception ignored) {}
+ return true;
+ }
+ }
+ }
+
+ int optionY = -optionsScroll.getValue();
+ if(getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ int optionWidth = innerRight-innerLeft-20;
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+ for(ConfigProcessor.ProcessedOption option : cat.options.values()) {
+ GuiOptionEditor editor = option.editor;
+ if(editor == null) {
+ continue;
+ }
+ if(editor.mouseInputGlobal(innerLeft+5, innerTop+5+optionY, optionWidth, mouseX, mouseY)) {
+ return true;
+ }
+ optionY += editor.getHeight() + 5;
+ }
+ }
+
+ if(mouseX > innerLeft && mouseX < innerRight &&
+ mouseY > innerTop && mouseY < innerBottom) {
+ optionY = -optionsScroll.getValue();
+ if(getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ int optionWidth = innerRight-innerLeft-20;
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+ for(ConfigProcessor.ProcessedOption option : cat.options.values()) {
+ GuiOptionEditor editor = option.editor;
+ if(editor == null) {
+ continue;
+ }
+ if(editor.mouseInput(innerLeft+5, innerTop+5+optionY, optionWidth, mouseX, mouseY)) {
+ return true;
+ }
+ optionY += editor.getHeight() + 5;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public boolean keyboardInput() {
+ if(getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) {
+ ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory());
+ for(ConfigProcessor.ProcessedOption option : cat.options.values()) {
+ GuiOptionEditor editor = option.editor;
+ if(editor == null) {
+ continue;
+ }
+ if(editor.keyboardInput()) {
+ return true;
+ }
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java
deleted file mode 100644
index a5566ce6..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java
+++ /dev/null
@@ -1,819 +0,0 @@
-package io.github.moulberry.notenoughupdates.options;
-
-import com.google.gson.*;
-import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor;
-import io.github.moulberry.notenoughupdates.GuiEnchantColour;
-import io.github.moulberry.notenoughupdates.NEUOverlayPlacements;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-
-import java.awt.*;
-import java.io.*;
-import java.lang.reflect.Field;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Options {
-
- /**
- * Ok, I'll be honest. I wrote this class without looking too much in to how to make proper serializable
- * variables with defaults values/etc. It works. I'm happy.
- */
-
- public static final transient int FLAG_COLOUR = 0b1;
- public static final transient int FLAG_INT = 0b10;
-
- public static final int CAT_ALL = 0;
- public static final int CAT_MISC = 1;
- public static final int CAT_FEATURES = 2;
- public static final int CAT_SLIDERS = 3;
- public static final int CAT_COLOURS = 4;
-
- public Option<Boolean> enableItemEditing = new Option(
- false,
- "Enable Item Editing",
- true,
- "Dev Feature.", CAT_ALL);
- public Option<Boolean> onlyShowOnSkyblock = new Option(
- true,
- "Only Show On Skyblock",
- false,
- "NEU Overlay only appears when you are playing Skyblock.", CAT_MISC);
- public Option<Boolean> showVanillaItems = new Option(
- true,
- "Show Vanilla Items",
- false,
- "Shows vanilla items in the itemlist.", CAT_MISC);
- public Option<Boolean> hidePotionEffect = new Option(
- true,
- "Hide Potion Effects",
- false,
- "Potion effects are hidden in the inventory GUI. Contrib: All the gamers that play on GUI AUTO", CAT_MISC);
- public Option<Boolean> showQuickCommands = new Option(
- true,
- "Quick Commands",
- false,
- "Shows QuickCommands\u2122 above search bar.", CAT_FEATURES);
- public Option<Boolean> showUpdateMsg = new Option(
- true,
- "Show Update Notifs",
- false,
- "Shows update messages if NEU is out-of-date.", CAT_MISC);
- public Option<Boolean> tooltipBorderColours = new Option(
- true,
- "Coloured Tooltip Borders",
- false,
- "Makes the border of tooltips coloured. (Only NEU Tooltips)", CAT_MISC);
- public Option<Boolean> disableAhScroll = new Option(
- false,
- "No NeuAH Scroll",
- false,
- "Disables Scrolling in NeuAH", CAT_MISC);
- public Option<Boolean> advancedPriceInfo = new Option(
- false,
- "Adv. Item Price Info",
- false,
- "Shows some extra information about item prices.", CAT_MISC);
- public Option<Boolean> cacheRenderedItempane = new Option(
- true,
- "Cache Itempane",
- false,
- "Caches the drawn itempane, drastically improving performance. Animated textures will not work.", CAT_MISC);
- public Option<Boolean> streamerMode = new Option(
- false,
- "Streamer Mode",
- false,
- "Hides or randomises some stuff on your screen to prevent sniping", CAT_MISC);
- public Option<Boolean> disableTreecapOverlay = new Option(
- false,
- "Disable Treecap Overlay",
- false,
- "Disables the treecapitator overlay effect", CAT_FEATURES);
- public Option<Boolean> disableWandOverlay = new Option(
- false,
- "Disable Builder's Wand Overlay",
- false,
- "Disables the builder's wand overlay effect", CAT_FEATURES);
- public Option<Boolean> wandBlockCount = new Option(
- true,
- "Builder's Wand Block Count",
- false,
- "If true, will show how many blocks you have remaining when holding a builder's wand.", CAT_MISC);
- public Option<Boolean> hideApiKey = new Option(
- false,
- "Hide Apikey Setting",
- false,
- "Hides the Apikey setting (please try not to leak Apikey if you're recording)", CAT_MISC);
- public Option<Double> bgBlurFactor = new Option(
- 5.0,
- "Background Blur",
- false,
- "Changes the strength of pane background blur. 0-50.", 0, 50, CAT_SLIDERS);
- public Option<String> apiKey = new Option(
- "",
- "Api Key",
- false,
- "Type /api new to receive key and put it here.", CAT_MISC);
- public Option<Boolean> autoupdate = new Option(
- true,
- "Automatically Update Items",
- false,
- "If true, updated items will automatically download from the remote repository when you start the game. \nHIGHLY RECOMMENDED.", CAT_MISC);
- public Option<Boolean> quickcommandMousePress = new Option(
- false,
- "QuickCommand on Mouse Press",
- false,
- "If true, quickcommands will trigger on mouse down instead of mouse up.", CAT_MISC);
- public Option<Boolean> disableItemTabOpen = new Option(
- false,
- "No Tab Open",
- false,
- "If True, moving your mouse to the item tab on the right side won't open the itempane.", CAT_MISC);
- public Option<Boolean> keepopen = new Option(
- false,
- "Keep Itempane Open",
- false,
- "If true, the itempane will stay open after the gui is closed.", CAT_MISC);
- public Option<Boolean> itemStyle = new Option(
- true,
- "Circular Item Style",
- false,
- "Uses the circular item background style instead of the square style. Contrib: Calyps0", CAT_MISC);
- public Option<Boolean> hideEmptyPanes = new Option(
- true,
- "Hide GUI Filler Tooltips",
- false,
- "Hides the tooltip of glass panes in skyblock GUIs. Contrib: ThatGravyBoat", CAT_MISC);
- public Option<Boolean> guiButtonClicks = new Option(
- true,
- "Button Click Sounds",
- false,
- "Plays a click sound whenever various NEU GUIs are interacted with", CAT_MISC);
- public Option<Boolean> dungeonProfitLore = new Option(
- false,
- "Dungeon Profit in Lore",
- false,
- "If true, will show the dungeon profit on the tooltip of the 'reward chest' instead of as a GUI.", CAT_MISC);
- public Option<Boolean> auctionPriceInfo = new Option(
- true,
- "Price Info in Auction Lore",
- false,
- "If true, will show price information about an item inside the auction house item tooltip.", CAT_MISC);
- public Option<Boolean> useCustomTrade = new Option(
- true,
- "Custom Trade",
- false,
- "If true, uses the custom trade window for skyblock trades.", CAT_FEATURES);
- public Option<Boolean> invBazaarPrice = new Option(
- false,
- "Show Bazaar Price In Inventory",
- false,
- "If true, shows the bazaar price for the item you hover in your inventory.", CAT_MISC);
- public Option<Boolean> invAuctionPrice = new Option(
- false,
- "Show Auction Price In Inventory",
- false,
- "If true, shows the auction price for the item you hover in your inventory.", CAT_MISC);
- public Option<Boolean> dungeonBlocksEverywhere = new Option(
- false,
- "Show Dungeon Block Overlay Everywhere",
- false,
- "If true, will show the overlay for cracked bricks, etc. even when not in dungeons.", CAT_MISC);
- public Option<Boolean> disableDungeonBlocks = new Option(
- true,
- "Disable the dungeon blocks feature",
- false,
- "If true, the dungeon block overlay will be disabled. WARNING: May cause memory/fps issues on some machines", CAT_FEATURES);
- public Option<Boolean> slowDungeonBlocks = new Option(
- false,
- "Slowly Update Dungeon Block Textures",
- false,
- "If true, dungeon blocks will only update once every second.\n" +
- "Use this option if you are having performance\n" +
- "issues relating to the dungeon blocks.", CAT_MISC);
- public Option<Boolean> missingEnchantList = new Option(
- true,
- "Missing Enchant List",
- false,
- "If true, will show enchants that are missing on an enchanted item when LSHIFT is pressed.", CAT_FEATURES);
- public Option<Boolean> neuAuctionHouse = new Option(
- false,
- "NEU Auction House",
- false,
- "Enables the auction house which can be found using /neuah.\n" +
- "Don't enable this option unless you use /neuah\n" +
- "You *may* need to restart after enabling this for the auctions to download properly", CAT_FEATURES);
- public Option<Boolean> eventNotifications = new Option(
- true,
- "Skyblock Event Notifications",
- false,
- "Notifies you 5m (default) before and when favourited events (/neucalendar) start.", CAT_FEATURES);
- public Option<Boolean> showEventTimerInInventory = new Option(
- true,
- "Event Timer In Inventory",
- false,
- "Will show how long until the next event starts at the top of your inventory", CAT_FEATURES);
- public Option<Boolean> eventNotificationSounds = new Option(
- true,
- "Skyblock Event Notification Sounds",
- false,
- "Will play a sounds whenever a favourited event starts.", CAT_MISC);
- public Option<Boolean> spookyMorningNotification = new Option(
- true,
- "Spooky Festival Morning Notification",
- false,
- "During a spooky festival, will notify the player whenever it hits 7am", CAT_MISC);
-
- public Option<Boolean> accessoryBagOverlay = new Option(
- true,
- "Accessory Bag Overlay",
- false,
- "If true, will an overlay with useful information in your accessory bag.", CAT_FEATURES);
- public Option<Boolean> rodColours = new Option(
- true,
- "Custom Rod Line Colours",
- false,
- "If true, will use custom colours for fishing line rods in skyblock.", CAT_FEATURES);
- public Option<Double> paneGuiScale = new Option(
- 0.0,
- "Pane GUI Scale",
- false,
- "Changes the GUI scale of the item pane. 0 = use game default. 1-4 = scale", FLAG_INT, 0, 4, CAT_SLIDERS);
- public Option<Double> paneWidthMult = new Option(
- 1.0,
- "Pane Width",
- false,
- "Changes how wide the item and info panes are. Value between 0.5-1.5.", 0.5, 1.5, CAT_SLIDERS);
- public Option<Double> smoothAoteMillis = new Option(
- 175.0,
- "Smooth AOTE Milliseconds",
- false,
- "How long teleporting with the AOTE takes. 0 = disable.", 0, 300, CAT_SLIDERS);
- public Option<Double> itemHighlightOpacity = new Option(
- 178.0,
- "Item Highlight Opacity",
- false,
- "Changes the opacity of item highlights. Value between 0-255.", 0, 255, CAT_SLIDERS);
- public Option<Double> panePadding = new Option(
- 10.0,
- "Pane Padding",
- false,
- "Changes the padding of the panes. Value between 0-20.", 0, 20, CAT_SLIDERS);
- public Option<Double> ahNotification = new Option(
- 2.0,
- "AH Notification (Mins, 0 = off)",
- false,
- "Minutes before AH ends to notify. 0-10.", 0, 10, CAT_SLIDERS);
- public Option<Double> tooltipBorderOpacity = new Option(
- 200.0,
- "Coloured Tooltip Border Opacity",
- false,
- "Coloured tooltips only apply to tooltips in my GUIs. Value between 0-255.", 0, 255, CAT_SLIDERS);
- public Option<Double> dynamicMenuBackgroundStyle = new Option(
- 1.0,
- "SBMenu Background Style",
- false,
- "Style of the background used for the skyblock menu.", 0, 10, CAT_FEATURES);
- public Option<Double> dynamicMenuButtonStyle = new Option(
- 1.0,
- "SBMenu Button Style",
- false,
- "Style of the buttons used for the skyblock menu.", 0, 10, CAT_FEATURES);
- public Option<Double> dungeonWinMillis = new Option(
- 5000.0,
- "Dungeon Victory Screen Millis",
- false,
- "Changes how long the victory screen at the end of dungeons appears for. 0 = off", FLAG_INT, 0, 15000, CAT_SLIDERS);
- public Option<Double> eventNotificationBeforeSeconds = new Option(
- 300.0,
- "Event Notification Before Seconds",
- false,
- "Changes how long before skyblock events will the 'starting in' notification show. 0 = off", FLAG_INT, 0, 1800, CAT_SLIDERS);
-
- public Option<String> itemBackgroundColour = new Option(
- "00:255:100:100:100",
- "Item BG Colour",
- false,
- "Item BG Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> itemFavouriteColour = new Option(
- "00:255:200:150:50",
- "Item BG Favourite Colour",
- false,
- "Item BG Favourite Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> paneBackgroundColour = new Option(
- "15:6:0:0:255",
- "Pane Background Colour",
- false,
- "Pane Background Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> treecapOverlayColour = new Option(
- "00:50:64:224:208",
- "Treecapitator Overlay Colour",
- false,
- "Treecapitator Overlay Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> wandOverlayColour = new Option(
- "00:50:64:224:208",
- "Builder's Wand Overlay Colour",
- false,
- "Builder's Wand Overlay Colour",
- FLAG_COLOUR, CAT_COLOURS);
-
- public Option<String> dungCrackedColour = new Option(
- "0:252:7:255:217",
- "Dungeon Cracked Brick Colour",
- false,
- "Dungeon Cracked Brick Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungDispenserColour = new Option(
- "0:255:255:76:0",
- "Dungeon Dispenser Colour",
- false,
- "Dungeon Dispenser Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungLeverColour = new Option(
- "0:252:24:249:255",
- "Dungeon Lever Colour",
- false,
- "Dungeon Lever Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungTripWireColour = new Option(
- "0:255:255:0:0",
- "Dungeon Trip Wire Colour",
- false,
- "Dungeon Trip Wire Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungChestColour = new Option(
- "0:255:0:163:36",
- "Dungeon Chest Colour",
- false,
- "Dungeon Chest Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungTrappedChestColour = new Option(
- "0:255:0:163:36",
- "Dungeon Trapped Chest Colour",
- false,
- "Dungeon Trapped Chest Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> dungBatColour = new Option(
- "0:255:12:255:0",
- "Dungeon Bat Colour",
- false,
- "Dungeon Bat Colour",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> selfRodLineColour = new Option(
- "0:255:0:0:0",
- "Your Rod Line Colour",
- false,
- "Changes the colour of your rod's fishing line.\nContrib: ThatGravyBoat",
- FLAG_COLOUR, CAT_COLOURS);
- public Option<String> otherRodLineColour = new Option(
- "0:255:0:0:0",
- "Other Rod Line Colour",
- false,
- "Changes the colour of other players' rod's fishing line.\nContrib: ThatGravyBoat",
- FLAG_COLOUR, CAT_COLOURS);
-
- /**
- * OPTIONS THAT DON'T SHOW IN GUI
- */
- public Option<Boolean> dev = new Option(
- false,
- "Show Dev Options",
- true,
- "Dev Feature. Please don't use.", CAT_ALL);
- public Option<Boolean> loadedModBefore = new Option(
- false,
- "loadedModBefore",
- true,
- "loadedModBefore", CAT_ALL);
- public Option<Boolean> doRamNotif = new Option(
- true,
- "doRamNotif",
- false,
- "doRamNotif", CAT_ALL);
- public Option<Boolean> customTradePrices = new Option(
- true,
- "Trade Item Values",
- true,
- "If true, shows a window with the total item value of either side", CAT_ALL);
- public Option<Boolean> customTradePriceStyle = new Option(
- true,
- "Trade Prices Style",
- true,
- "Changes the style of the top item prices", CAT_ALL);
- public Option<String> selectedCape = new Option(
- "",
- "Selected Cape",
- true,
- "Selected Cape", CAT_ALL);
- public Option<Double> compareMode = new Option(
- 0.0,
- "Compare Mode",
- false,
- "Compare Mode", CAT_ALL);
- public Option<Double> sortMode = new Option(
- 0.0,
- "Sort Mode",
- false,
- "Sort Mode", CAT_ALL);
- public Option<ArrayList<Boolean>> compareAscending = new Option(
- Utils.createList(true, true, true),
- "Compare Ascending",
- false,
- "Compare Ascending", CAT_ALL);
- public Option<ArrayList<String>> favourites = new Option(
- new ArrayList<String>(),
- "Favourites",
- false,
- "Favourites", CAT_ALL);
- public Option<ArrayList<String>> eventFavourites = new Option(
- new ArrayList<String>(),
- "Event Favourites",
- false,
- "Event Favourites", CAT_ALL);
- public Option<Map<String, ArrayList<String>>> collectionLog = new Option(
- new HashMap<String, ArrayList<String>>(),
- "CollectionLog",
- false,
- "CollectionLog", CAT_ALL);
- public Option<ArrayList<String>> quickCommands = new Option(
- createDefaultQuickCommands(),
- "Quick Commands",
- false,
- "Quick Commands", CAT_ALL);
- public Option<String> overlaySearchBar = new Option(
- "",
- "OverlaySearchBar",
- false,
- "OverlaySearchBar", CAT_ALL);
- public Option<String> overlayQuickCommand = new Option(
- "",
- "OverlaySearchBar",
- false,
- "OverlaySearchBar", CAT_ALL);
- public Option<List<String>> enchantColours = new Option(
- Utils.createList("[a-zA-Z\\- ]+:\u003e:9:6",
- "[a-zA-Z\\- ]+:\u003e:6:c",
- "[a-zA-Z\\- ]+:\u003e:5:5",
- "Experience:\u003e:3:5",
- "Life Steal:\u003e:3:5",
- "Scavenger:\u003e:3:5",
- "Looting:\u003e:3:5"),
- "enchantColours",
- false,
- "enchantColours", CAT_ALL);
-
- //Dungeon Map Options
- public Option<Double> dmBorderSize = new Option(
- 1.0,
- "Border Size",
- false,
- "Changes the size of the map border, without changing the size of the contents", 0, 5, CAT_ALL);
- public Option<Double> dmRoomSize = new Option(
- 1.0,
- "Room Size",
- false,
- "Changes the size of rooms. Useful for higher dungeons with larger maps", 0, 5, CAT_ALL);
- public Option<Double> dmIconScale = new Option(
- 1.0,
- "Icon Size",
- false,
- "Changes the scale of room indicators and player icons", 0.5, 3, CAT_ALL);
- public Option<Double> dmBorderStyle = new Option(
- 0.0,
- "Border Style",
- false,
- "Various custom borders from various talented artists.\nUse 'custom' if your texture pack has a custom border", CAT_ALL);
- public Option<Boolean> dmEnable = new Option(
- true,
- "Show Dungeon Map",
- false,
- "Show/hide the NEU dungeon map", CAT_ALL);
- public Option<Boolean> dmCenterPlayer = new Option(
- false,
- "Map Center",
- false,
- "Center on rooms, or center on your player", CAT_ALL);
- public Option<Boolean> dmRotatePlayer = new Option(
- true,
- "Rotate with Player",
- false,
- "Rotate the map to face the same direction as your player", CAT_ALL);
- public Option<Boolean> dmOrientCheck = new Option(
- true,
- "Orient Checkmarks",
- false,
- "Checkmarks will always show vertically, regardless of rotation", CAT_ALL);
- public Option<Boolean> dmCenterCheck = new Option(
- false,
- "Center Checkmarks",
- false,
- "Checkmarks will show closer to the center of rooms", CAT_ALL);
- public Option<Double> dmPlayerHeads = new Option(
- 0.0,
- "Player Icon Style",
- false,
- "Various player icon styles", CAT_ALL);
- public Option<Boolean> dmPlayerInterp = new Option(
- true,
- "Interpolate Far Players",
- false,
- "Will make players far away move smoothly", CAT_ALL);
- public Option<Double> dmCompat = new Option(
- 0.0,
- "OpenGL Compatibility",
- false,
- "Compatiblity options for people with bad computers. ONLY use this if you know what you are doing, otherwise the map will look worse", CAT_ALL);
- public Option<String> dmBackgroundColour = new Option(
- "00:170:75:75:75",
- "Background Colour",
- false,
- "Colour of the map background. Supports opacity & chroma", FLAG_COLOUR, CAT_ALL);
- public Option<String> dmBorderColour = new Option(
- "00:0:0:0:0",
- "Border Colour",
- false,
- "Colour of the map border. Supports opacity & chroma. Turn off custom borders to see", FLAG_COLOUR, CAT_ALL);
- public Option<Boolean> dmChromaBorder = new Option(
- false,
- "Chroma Border Mode",
- false,
- "Applies a hue offset around the map border", CAT_ALL);
- public Option<Double> dmBackgroundBlur = new Option(
- 3.0,
- "Background Blur Factor",
- false,
- "Changes the blur factor behind the map. Set to 0 to disable blur", CAT_ALL);
- public Option<Double> dmCenterX = new Option(
- 8.5,
- "Center X (%)",
- false,
- "The horizontal position of the map", CAT_ALL);
- public Option<Double> dmCenterY = new Option(
- 15.0,
- "Center Y (%)",
- false,
- "The vertical position of the map", CAT_ALL);
-
- private ArrayList<String> createDefaultQuickCommands() {
- ArrayList<String> arr = new ArrayList<>();
- arr.add("/warp home:Warp Home:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzljODg4MWU0MjkxNWE5ZDI5YmI2MWExNmZiMjZkMDU5OTEzMjA0ZDI2NWRmNWI0MzliM2Q3OTJhY2Q1NiJ9fX0=");
- arr.add("/warp hub:Warp Hub:eyJ0aW1lc3RhbXAiOjE1NTkyMTU0MTY5MDksInByb2ZpbGVJZCI6IjQxZDNhYmMyZDc0OTQwMGM5MDkwZDU0MzRkMDM4MzFiIiwicHJvZmlsZU5hbWUiOiJNZWdha2xvb24iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2Q3Y2M2Njg3NDIzZDA1NzBkNTU2YWM1M2UwNjc2Y2I1NjNiYmRkOTcxN2NkODI2OWJkZWJlZDZmNmQ0ZTdiZjgifX19");
- arr.add("/craft:Crafting Table:CRAFTING_TABLE");
- arr.add("/enderchest:Ender Chest:ENDER_CHEST");
- arr.add("/wardrobe:Wardrobe:LEATHER_CHESTPLATE");
- arr.add("/pets:Pets:BONE");
- arr.add("neucl:Collection Log:MAP");
- arr.add("neuah:NEU Auction House:GOLD_BLOCK");
- return arr;
- }
-
- public class Button {
- public String displayName;
- public String desc;
- public Runnable click;
-
- public Button(String displayName, String desc, Runnable click) {
- this.displayName = displayName;
- this.desc = desc;
- this.click = click;
- }
- }
-
- private transient List<Button> buttons = new ArrayList<>();
-
- {
- buttons.add(new Button("Open Config Folder", "Opens the config folder. Be careful.", () -> {
- if (Desktop.isDesktopSupported()) {
- Desktop desktop = Desktop.getDesktop();
- if (NotEnoughUpdates.INSTANCE.manager.configFile.getParentFile().exists()) {
- try {
- desktop.open(NotEnoughUpdates.INSTANCE.manager.configFile.getParentFile());
- } catch (IOException ignored) {
- }
- }
- }
- }));
-
- buttons.add(new Button("Edit Gui Positions", "Allows you to change the position of the search bar, etc.", () -> {
- Minecraft.getMinecraft().displayGuiScreen(new NEUOverlayPlacements());
- }));
-
- buttons.add(new Button("Edit Enchant Colours", "Allows you to change the colour of any enchant at any level.", () -> {
- Minecraft.getMinecraft().displayGuiScreen(new GuiEnchantColour());
- }));
-
-
- buttons.add(new Button("Edit Dungeon Map", "Allows you to configure the NEU dungeon map.", () -> {
- Minecraft.getMinecraft().displayGuiScreen(new GuiDungeonMapEditor());
- }));
- }
-
- public List<Button> getButtons() {
- return buttons;
- }
-
- public List<Option> getOptions() {
- List<Option> options = new ArrayList<>();
-
- //Pane width near top so less scuffed
- tryAddOption(paneWidthMult, options);
- //Buttons
- tryAddOption(enableItemEditing, options);
- tryAddOption(onlyShowOnSkyblock, options);
- tryAddOption(showVanillaItems, options);
- tryAddOption(showQuickCommands, options);
- tryAddOption(hidePotionEffect, options);
- tryAddOption(hideEmptyPanes, options);
- tryAddOption(guiButtonClicks, options);
- tryAddOption(advancedPriceInfo, options);
- tryAddOption(showUpdateMsg, options);
- tryAddOption(tooltipBorderColours, options);
- tryAddOption(disableAhScroll, options);
- tryAddOption(hideApiKey, options);
- tryAddOption(streamerMode, options);
- tryAddOption(disableTreecapOverlay, options);
- tryAddOption(disableWandOverlay, options);
- tryAddOption(wandBlockCount, options);
- tryAddOption(autoupdate, options);
- tryAddOption(cacheRenderedItempane, options);
- tryAddOption(itemStyle, options);
- tryAddOption(keepopen, options);
- tryAddOption(disableItemTabOpen, options);
- tryAddOption(dungeonProfitLore, options);
- tryAddOption(auctionPriceInfo, options);
- tryAddOption(useCustomTrade, options);
- tryAddOption(customTradePrices, options);
- tryAddOption(customTradePriceStyle, options);
- tryAddOption(invBazaarPrice, options);
- tryAddOption(invAuctionPrice, options);
- tryAddOption(dungeonBlocksEverywhere, options);
- tryAddOption(disableDungeonBlocks, options);
- tryAddOption(slowDungeonBlocks, options);
- tryAddOption(missingEnchantList, options);
- tryAddOption(accessoryBagOverlay, options);
- tryAddOption(rodColours, options);
- tryAddOption(neuAuctionHouse, options);
- tryAddOption(eventNotifications, options);
- tryAddOption(showEventTimerInInventory, options);
- tryAddOption(spookyMorningNotification, options);
- //Sliders
- tryAddOption(paneGuiScale, options);
- tryAddOption(smoothAoteMillis, options);
- tryAddOption(bgBlurFactor, options);
- tryAddOption(ahNotification, options);
- tryAddOption(panePadding, options);
- tryAddOption(tooltipBorderOpacity, options);
- tryAddOption(dynamicMenuBackgroundStyle, options);
- tryAddOption(dynamicMenuButtonStyle, options);
- tryAddOption(dungeonWinMillis, options);
- tryAddOption(eventNotificationBeforeSeconds, options);
- //Text
- tryAddOption(apiKey, options);
- //Colour
- tryAddOption(paneBackgroundColour, options);
- tryAddOption(itemBackgroundColour, options);
- tryAddOption(itemFavouriteColour, options);
- tryAddOption(treecapOverlayColour, options);
- tryAddOption(wandOverlayColour, options);
- tryAddOption(selfRodLineColour, options);
- tryAddOption(otherRodLineColour, options);
-
- tryAddOption(dungCrackedColour, options);
- tryAddOption(dungDispenserColour, options);
- tryAddOption(dungLeverColour, options);
- tryAddOption(dungTripWireColour, options);
- tryAddOption(dungChestColour, options);
- tryAddOption(dungTrappedChestColour, options);
- tryAddOption(dungBatColour, options);
-
- return options;
- }
-
- private void tryAddOption(Option<?> option, List<Option> list) {
- if (!option.secret) {// || dev.value) {
- list.add(option);
- }
- }
-
- public static class Option<T> implements Serializable {
- public T value;
- public final transient T defaultValue;
- public final transient String displayName;
- public final transient boolean secret;
- public final transient String desc;
- public final transient int flags;
- public final transient double minValue;
- public final transient double maxValue;
- public final transient int category;
- public final transient ArrayList<String> tags;
-
- public Option(T defaultValue, String displayName, boolean secret, String desc, int category) {
- this(defaultValue, displayName, secret, desc, 0, 0, 100, category);
- }
-
- public Option(T defaultValue, String displayName, boolean secret, String desc, int flags, int category) {
- this(defaultValue, displayName, secret, desc, flags, 0, 100, category);
- }
-
- public Option(T defaultValue, String displayName, boolean secret, String desc, double minValue, double maxValue, int category) {
- this(defaultValue, displayName, secret, desc, 0, minValue, maxValue, category);
- }
-
- public Option(T defaultValue, String displayName, boolean secret, String desc, int flags, double minValue, double maxValue, int category) {
- this.value = defaultValue;
- this.defaultValue = defaultValue;
- this.displayName = displayName;
- this.secret = secret;
- this.desc = desc;
- this.flags = flags;
- this.minValue = minValue;
- this.maxValue = maxValue;
- this.category = category;
-
- this.tags = new ArrayList<>();
- for(String s : displayName.split(" ")) {
- s = s.replaceAll("[^A-Za-z]", "").toLowerCase();
- if(s.length() > 0) {
- tags.add(s);
- }
- }
- for(String s : desc.split(" ")) {
- s = s.replaceAll("[^A-Za-z]", "").toLowerCase();
- if(s.length() >= 4) {
- tags.add(s);
- }
- }
- }
-
- public void setValue(String value) {
- if (this.value instanceof Boolean) {
- ((Option<Boolean>) this).value = Boolean.valueOf(value);
- } else if (this.value instanceof Double) {
- ((Option<Double>) this).value = Double.valueOf(value);
- } else if (this.value instanceof String) {
- ((Option<String>) this).value = value;
- }
- }
- }
-
- public static JsonSerializer<Option<?>> createSerializer() {
- return (src, typeOfSrc, context) -> {
- if (src.secret && src.defaultValue.equals(src.value)) {
- return null;
- }
- return context.serialize(src.value);
- };
- }
-
- public static JsonDeserializer<Option<?>> createDeserializer() {
- return (json, typeOfT, context) -> {
- try {
- return new Option(context.deserialize(json, Object.class), "unknown", false, "unknown", CAT_ALL);
- } catch (Exception e) {
- return null;
- }
- };
- }
-
- public static Options loadFromFile(Gson gson, File file) throws IOException {
- try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
- Options oLoad = gson.fromJson(reader, Options.class);
- Options oDefault = new Options();
- if (oLoad == null) return oDefault;
-
- for (Field f : Options.class.getDeclaredFields()) {
- try {
- if (((Option<?>) f.get(oDefault)).value instanceof List) {
- //If the default size of the list is greater than the loaded size, use the default value.
- //if(((List<?>)((Option)f.get(oDefault)).value).size() > ((List<?>)((Option)f.get(oLoad)).value).size()) {
- // continue;
- //}
- }
- if(((Option<?>) f.get(oDefault)).value.getClass().isAssignableFrom(((Option<?>) f.get(oLoad)).value.getClass())) {
- ((Option) f.get(oDefault)).value = ((Option) f.get(oLoad)).value;
- }
- } catch (Exception e) {
- }
- }
- return oDefault;
- }
- }
-
-
- public void saveToFile(Gson gson, File file) throws IOException {
- file.createNewFile();
-
- try(BufferedWriter writer = new BufferedWriter(
- new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
- writer.write(gson.toJson(this));
- }
- }
-} \ No newline at end of file
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 9480db06..bc2361f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -8,10 +8,10 @@ import com.google.gson.JsonPrimitive;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.SBAIntegration;
+import io.github.moulberry.notenoughupdates.util.SBAIntegration;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -230,10 +230,6 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- private boolean isLoadedProfile() {
- return profile.getProfileInformation(profileId) != null;
- }
-
private void renderTabs(boolean renderPressed) {
int ignoredTabs = 0;
for(int i=0; i<ProfileViewerPage.values().length; i++) {
@@ -530,10 +526,8 @@ public class GuiProfileViewer extends GuiScreen {
JsonObject inventoryInfo = profile.getInventoryInfo(profileId);
if(inventoryInfo == null) return;
- JsonObject collectionInfo = profile.getCollectionInfo(profileId);
- if(collectionInfo == null) return;
- ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, collectionInfo, selectedInventory);
+ ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory);
if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1;
if(currentInventoryIndex < 0) currentInventoryIndex = 0;
@@ -575,13 +569,13 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- private class Level {
+ public static class Level {
float level;
float currentLevelRequirement;
float maxXP;
}
- public Level getLevel(JsonArray levels, int offset, float exp) {
+ public static Level getLevel(JsonArray levels, int offset, float exp) {
float xpTotal = 0;
float level = 1;
float currentLevelRequirement = 0;
@@ -618,7 +612,7 @@ public class GuiProfileViewer extends GuiScreen {
return levelObj;
}
- private static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS = new HashMap<>();
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS = new HashMap<>();
static {
HashMap<String, Float> bigTeeth = new HashMap<>();
bigTeeth.put("CRIT_CHANCE", 5f);
@@ -636,7 +630,7 @@ public class GuiProfileViewer extends GuiScreen {
sharpenedClaws.put("CRIT_DAMAGE", 15f);
PET_STAT_BOOSTS.put("PET_ITEM_SHARPENED_CLAWS_UNCOMMON", sharpenedClaws);
}
- private static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS_MULT = new HashMap<>();
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS_MULT = new HashMap<>();
static {
HashMap<String, Float> ironClaws = new HashMap<>();
ironClaws.put("CRIT_DAMAGE", 1.4f);
@@ -652,13 +646,13 @@ public class GuiProfileViewer extends GuiScreen {
private int petsPage = 0;
private List<JsonObject> sortedPets = null;
private List<ItemStack> sortedPetsStack = null;
- private static HashMap<String, String> minionRarityToNumMap = new HashMap<>();
+ public static HashMap<String, String> MINION_RARITY_TO_NUM = new HashMap<>();
static {
- minionRarityToNumMap.put("COMMON", "0");
- minionRarityToNumMap.put("UNCOMMON", "1");
- minionRarityToNumMap.put("RARE", "2");
- minionRarityToNumMap.put("EPIC", "3");
- minionRarityToNumMap.put("LEGENDARY", "4");
+ MINION_RARITY_TO_NUM.put("COMMON", "0");
+ MINION_RARITY_TO_NUM.put("UNCOMMON", "1");
+ MINION_RARITY_TO_NUM.put("RARE", "2");
+ MINION_RARITY_TO_NUM.put("EPIC", "3");
+ MINION_RARITY_TO_NUM.put("LEGENDARY", "4");
}
private void drawPetsPage(int mouseX, int mouseY, float partialTicks) {
JsonObject petsInfo = profile.getPetsInfo(profileId);
@@ -692,12 +686,12 @@ public class GuiProfileViewer extends GuiScreen {
}
sortedPets.sort((pet1, pet2) -> {
String tier1 = pet1.get("tier").getAsString();
- String tierNum1 = minionRarityToNumMap.get(tier1);
+ String tierNum1 = MINION_RARITY_TO_NUM.get(tier1);
int tierNum1I = Integer.parseInt(tierNum1);
float exp1 = pet1.get("exp").getAsFloat();
String tier2 = pet2.get("tier").getAsString();
- String tierNum2 = minionRarityToNumMap.get(tier2);
+ String tierNum2 = MINION_RARITY_TO_NUM.get(tier2);
int tierNum2I = Integer.parseInt(tierNum2);
float exp2 = pet2.get("exp").getAsFloat();
@@ -712,7 +706,7 @@ public class GuiProfileViewer extends GuiScreen {
String tier = pet.get("tier").getAsString();
String heldItem = Utils.getElementAsString(pet.get("heldItem"), null);
JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem);
- String tierNum = minionRarityToNumMap.get(tier);
+ String tierNum = MINION_RARITY_TO_NUM.get(tier);
float exp = pet.get("exp").getAsFloat();
if(tierNum == null) continue;
@@ -934,22 +928,22 @@ public class GuiProfileViewer extends GuiScreen {
String[] split = display.split("] ");
String colouredName = split[split.length-1];
- renderAlignedString(colouredName, EnumChatFormatting.WHITE+"Level "+(int)Math.floor(level), guiLeft+319, guiTop+28, 98);
+ Utils.renderAlignedString(colouredName, EnumChatFormatting.WHITE+"Level "+(int)Math.floor(level), guiLeft+319, guiTop+28, 98);
//Utils.drawStringCenteredScaledMaxWidth(, Minecraft.getMinecraft().fontRendererObj, guiLeft+368, guiTop+28+4, true, 98, 0);
//renderAlignedString(display, EnumChatFormatting.YELLOW+"[LVL "+Math.floor(level)+"]", guiLeft+319, guiTop+28, 98);
renderBar(guiLeft+319, guiTop+38, 98, (float)Math.floor(level)/100f);
- renderAlignedString(EnumChatFormatting.YELLOW+"To Next LVL", EnumChatFormatting.WHITE.toString()+(int)(level%1*100)+"%", guiLeft+319, guiTop+46, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Next LVL", EnumChatFormatting.WHITE.toString()+(int)(level%1*100)+"%", guiLeft+319, guiTop+46, 98);
renderBar(guiLeft+319, guiTop+56, 98, level%1);
- renderAlignedString(EnumChatFormatting.YELLOW+"To Max LVL", EnumChatFormatting.WHITE.toString()+Math.min(100, (int)(exp/maxXP*100))+"%", guiLeft+319, guiTop+64, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"To Max LVL", EnumChatFormatting.WHITE.toString()+Math.min(100, (int)(exp/maxXP*100))+"%", guiLeft+319, guiTop+64, 98);
renderBar(guiLeft+319, guiTop+74, 98, exp/maxXP);
- renderAlignedString(EnumChatFormatting.YELLOW+"Total XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(exp, 0), guiLeft+319, guiTop+125, 98);
- renderAlignedString(EnumChatFormatting.YELLOW+"Current LVL XP",
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(exp, 0), guiLeft+319, guiTop+125, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Current LVL XP",
EnumChatFormatting.WHITE.toString()+shortNumberFormat((level%1)*currentLevelRequirement, 0), guiLeft+319, guiTop+143, 98);
- renderAlignedString(EnumChatFormatting.YELLOW+"Required LVL XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(currentLevelRequirement, 0), guiLeft+319, guiTop+161, 98);
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Required LVL XP", EnumChatFormatting.WHITE.toString()+shortNumberFormat(currentLevelRequirement, 0), guiLeft+319, guiTop+161, 98);
}
}
@@ -1216,6 +1210,16 @@ public class GuiProfileViewer extends GuiScreen {
return 6;
}
+ private boolean useActualMax(String invName) {
+ switch(invName) {
+ case "talisman_bag":
+ case "fishing_bag":
+ case "potion_bag":
+ return true;
+ }
+ return false;
+ }
+
private int getIgnoredRowsForInventory(String invName) {
switch(invName) {
case "talisman_bag":
@@ -1257,30 +1261,44 @@ public class GuiProfileViewer extends GuiScreen {
}
private ItemStack fillerStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, 15);
- public ItemStack[][][] getItemsForInventory(JsonObject inventoryInfo, JsonObject collectionInfo, String invName) {
+ public ItemStack[][][] getItemsForInventory(JsonObject inventoryInfo, String invName) {
if(inventoryItems.containsKey(invName)) return inventoryItems.get(invName);
JsonArray jsonInv = Utils.getElement(inventoryInfo, invName).getAsJsonArray();
+ if(jsonInv.size() == 0) return new ItemStack[1][][];
+
+ int jsonInvSize;
+ if(useActualMax(invName)) {
+ jsonInvSize = (int)Math.ceil(jsonInv.size()/9f)*9;
+ } else {
+ jsonInvSize = 9*4;
+ for(int i=9*4; i<jsonInv.size(); i++) {
+ JsonElement item = jsonInv.get(i);
+ if(item != null && item.isJsonObject()) {
+ jsonInvSize = (i/9)*9;
+ }
+ }
+ }
+
int rowSize = 9;
- int rows = jsonInv.size()/rowSize;
+ int rows = jsonInvSize/rowSize;
int maxRowsPerPage = getRowsForInventory(invName);
- int ignoredRows = getIgnoredRowsForInventory(invName);
int maxInvSize = rowSize*maxRowsPerPage;
- int numInventories = (jsonInv.size()-1)/maxInvSize+1;
+ int numInventories = (jsonInvSize-1)/maxInvSize+1;
ItemStack[][][] inventories = new ItemStack[numInventories][][];
- int availableSlots = getAvailableSlotsForInventory(inventoryInfo, collectionInfo, invName);
+ //int availableSlots = getAvailableSlotsForInventory(inventoryInfo, collectionInfo, invName);
for(int i=0; i<numInventories; i++) {
- int thisRows = Math.min(maxRowsPerPage, rows-maxRowsPerPage*i)-ignoredRows;
+ int thisRows = Math.min(maxRowsPerPage, rows-maxRowsPerPage*i);
if(thisRows <= 0) break;
ItemStack[][] items = new ItemStack[thisRows][rowSize];
- int invSize = Math.min(jsonInv.size(), maxInvSize+maxInvSize*i);
+ int invSize = Math.min(jsonInvSize, maxInvSize+maxInvSize*i);
for(int j=maxInvSize*i; j<invSize; j++) {
int xIndex = (j%maxInvSize)%rowSize;
int yIndex = (j%maxInvSize)/rowSize;
@@ -1292,12 +1310,11 @@ public class GuiProfileViewer extends GuiScreen {
break;
}
+ if(j >= jsonInv.size()) {
+ items[yIndex][xIndex] = fillerStack;
+ continue;
+ }
if(jsonInv.get(j) == null || !jsonInv.get(j).isJsonObject()) {
- if(availableSlots >= 0) {
- if(j >= availableSlots) {
- items[yIndex][xIndex] = fillerStack;
- }
- }
continue;
}
@@ -1353,7 +1370,6 @@ public class GuiProfileViewer extends GuiScreen {
JsonObject inventoryInfo = profile.getInventoryInfo(profileId);
if(inventoryInfo == null) return;
- JsonObject collectionInfo = profile.getCollectionInfo(profileId);
int invNameIndex=0;
for(Map.Entry<String, ItemStack> entry : invNameToDisplayMap.entrySet()) {
@@ -1411,7 +1427,7 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, collectionInfo, selectedInventory);
+ ItemStack[][][] inventories = getItemsForInventory(inventoryInfo, selectedInventory);
if(currentInventoryIndex >= inventories.length) currentInventoryIndex = inventories.length-1;
if(currentInventoryIndex < 0) currentInventoryIndex = 0;
@@ -1659,14 +1675,14 @@ public class GuiProfileViewer extends GuiScreen {
float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), 0);
float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0);
- renderAlignedString(EnumChatFormatting.GOLD+"Bank Balance", EnumChatFormatting.WHITE.toString()+shortNumberFormat(bankBalance, 0),
+ Utils.renderAlignedString(EnumChatFormatting.GOLD+"Bank Balance", EnumChatFormatting.WHITE.toString()+shortNumberFormat(bankBalance, 0),
guiLeft+xStart, guiTop+yStartTop, 76);
- renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0),
+ Utils.renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0),
guiLeft+xStart, guiTop+yStartTop+yOffset, 76);
float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0);
- renderAlignedString(EnumChatFormatting.LIGHT_PURPLE+"Fairy Souls", EnumChatFormatting.WHITE.toString()+(int)fairySouls+"/209",
+ Utils.renderAlignedString(EnumChatFormatting.LIGHT_PURPLE+"Fairy Souls", EnumChatFormatting.WHITE.toString()+(int)fairySouls+"/209",
guiLeft+xStart, guiTop+yStartBottom, 76);
if(skillInfo != null) {
float totalSkillLVL = 0;
@@ -1694,11 +1710,11 @@ public class GuiProfileViewer extends GuiScreen {
float avgTrueSkillLVL = totalTrueSkillLVL/totalSkillCount;
float avgSlayerLVL = totalSlayerLVL/totalSlayerCount;
- renderAlignedString(EnumChatFormatting.RED+"AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSkillLVL*10)/10,
+ Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSkillLVL*10)/10,
guiLeft+xStart, guiTop+yStartBottom+yOffset, 76);
- renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10,
+ Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10,
guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76);
- renderAlignedString(EnumChatFormatting.RED+"True AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgTrueSkillLVL*10)/10,
+ Utils.renderAlignedString(EnumChatFormatting.RED+"True AVG Skill Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgTrueSkillLVL*10)/10,
guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76);
}
@@ -1710,17 +1726,17 @@ public class GuiProfileViewer extends GuiScreen {
float auctions_gold_spent = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_spent"), 0);
float auctions_gold_earned = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.auctions_gold_earned"), 0);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auction Bids", EnumChatFormatting.WHITE.toString()+(int)auctions_bids,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auction Bids", EnumChatFormatting.WHITE.toString()+(int)auctions_bids,
guiLeft+xStart+xOffset, guiTop+yStartTop, 76);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Highest Bid", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_highest_bid, 0),
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Highest Bid", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_highest_bid, 0),
guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset, 76);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Won", EnumChatFormatting.WHITE.toString()+(int)auctions_won,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Won", EnumChatFormatting.WHITE.toString()+(int)auctions_won,
guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*2, 76);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Created", EnumChatFormatting.WHITE.toString()+(int)auctions_created,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Auctions Created", EnumChatFormatting.WHITE.toString()+(int)auctions_created,
guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*3, 76);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Spent", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_spent, 0),
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Spent", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_spent, 0),
guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*4, 76);
- renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Earned", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_earned, 0),
+ Utils.renderAlignedString(EnumChatFormatting.DARK_PURPLE+"Gold Earned", EnumChatFormatting.WHITE.toString()+shortNumberFormat(auctions_gold_earned, 0),
guiLeft+xStart+xOffset, guiTop+yStartTop+yOffset*5, 76);
@@ -1731,17 +1747,17 @@ public class GuiProfileViewer extends GuiScreen {
float wolf_boss_kills_tier_2 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_2"), 0);
float wolf_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.boss_kills_tier_3"), 0);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T3", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_2,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T3", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_2,
guiLeft+xStart+xOffset, guiTop+yStartBottom, 76);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_3,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Revenant T4", EnumChatFormatting.WHITE.toString()+(int)zombie_boss_kills_tier_3,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset, 76);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T3", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_2,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T3", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_2,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*2, 76);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T4", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_3,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Sven T4", EnumChatFormatting.WHITE.toString()+(int)wolf_boss_kills_tier_3,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*3, 76);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T3", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_2,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T3", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_2,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*4, 76);
- renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T4", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_3,
+ Utils.renderAlignedString(EnumChatFormatting.DARK_AQUA+"Tarantula T4", EnumChatFormatting.WHITE.toString()+(int)spider_boss_kills_tier_3,
guiLeft+xStart+xOffset, guiTop+yStartBottom+yOffset*5, 76);
float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_ores_mined"), 0);
@@ -1751,16 +1767,16 @@ public class GuiProfileViewer extends GuiScreen {
float items_fished_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_treasure"), 0);
float items_fished_large_treasure = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.items_fished_large_treasure"), 0);
- renderAlignedString(EnumChatFormatting.GREEN+"Ores Mined", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_ores_mined,
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Ores Mined", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_ores_mined,
guiLeft+xStart+xOffset*2, guiTop+yStartTop, 76);
- renderAlignedString(EnumChatFormatting.GREEN+"Sea Creatures Killed", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_sea_creatures_killed,
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Sea Creatures Killed", EnumChatFormatting.WHITE.toString()+(int)pet_milestone_sea_creatures_killed,
guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset, 76);
- renderAlignedString(EnumChatFormatting.GREEN+"Items Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished,
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Items Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished,
guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*3, 76);
- renderAlignedString(EnumChatFormatting.GREEN+"Treasures Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished_treasure,
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Treasures Fished", EnumChatFormatting.WHITE.toString()+(int)items_fished_treasure,
guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*4, 76);
- renderAlignedString(EnumChatFormatting.GREEN+"Large Treasures", EnumChatFormatting.WHITE.toString()+(int)items_fished_large_treasure,
+ Utils.renderAlignedString(EnumChatFormatting.GREEN+"Large Treasures", EnumChatFormatting.WHITE.toString()+(int)items_fished_large_treasure,
guiLeft+xStart+xOffset*2, guiTop+yStartTop+yOffset*5, 76);
if(topKills == null) {
@@ -1802,7 +1818,7 @@ public class GuiProfileViewer extends GuiScreen {
Set<String> kills = topKills.get(killCount);
for(String killType : kills) {
if(index >= 6) break;
- renderAlignedString(EnumChatFormatting.YELLOW+killType+" Kills", EnumChatFormatting.WHITE.toString()+killCount,
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+killType+" Kills", EnumChatFormatting.WHITE.toString()+killCount,
guiLeft+xStart+xOffset*3, guiTop+yStartTop+yOffset*index, 76);
index++;
}
@@ -1813,7 +1829,7 @@ public class GuiProfileViewer extends GuiScreen {
Set<String> deaths = topDeaths.get(deathCount);
for(String deathType : deaths) {
if(index >= 6) break;
- renderAlignedString(EnumChatFormatting.YELLOW+"Deaths: "+ deathType, EnumChatFormatting.WHITE.toString()+deathCount,
+ Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Deaths: "+ deathType, EnumChatFormatting.WHITE.toString()+deathCount,
guiLeft+xStart+xOffset*3, guiTop+yStartBottom+yOffset*index, 76);
index++;
}
@@ -1834,50 +1850,6 @@ public class GuiProfileViewer extends GuiScreen {
: shortNumberFormat(d, iteration+1));
}
- private void renderAlignedString(String first, String second, float x, float y, int length) {
- if(fontRendererObj.getStringWidth(first + " " + second) >= length) {
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(first + " " + second), Minecraft.getMinecraft().fontRendererObj,
- x+length/2f+xOff/2f, y+4+yOff/2f, false, length,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB());
- }
- }
- }
-
- GlStateManager.color(1, 1, 1, 1);
- Utils.drawStringCenteredScaledMaxWidth(first + " " + second, Minecraft.getMinecraft().fontRendererObj,
- x+length/2f, y+4, false, length, 4210752);
- } else {
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(first),
- x+xOff/2f, y+yOff/2f,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
- }
- }
- }
-
- int secondLen = fontRendererObj.getStringWidth(second);
- GlStateManager.color(1, 1, 1, 1);
- fontRendererObj.drawString(first, x, y, 4210752, false);
- for(int xOff=-2; xOff<=2; xOff++) {
- for(int yOff=-2; yOff<=2; yOff++) {
- if(Math.abs(xOff) != Math.abs(yOff)) {
- fontRendererObj.drawString(Utils.cleanColourNotModifiers(second),
- x+length-secondLen+xOff/2f, y+yOff/2f,
- new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
- }
- }
- }
-
- GlStateManager.color(1, 1, 1, 1);
- fontRendererObj.drawString(second, x+length-secondLen, y, 4210752, false);
- }
- }
-
private void drawBasicPage(int mouseX, int mouseY, float partialTicks) {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
@@ -1934,8 +1906,9 @@ public class GuiProfileViewer extends GuiScreen {
if(!rank.equals("YOUTUBER") && !monthlyPackageRank.equals("NONE")) {
rank = monthlyPackageRank;
}
- EnumChatFormatting rankPlusColorECF = EnumChatFormatting.getValueByName(Utils.getElementAsString(profile.getHypixelProfile().get("rankPlusColor"), "YELLOW"));
- String rankPlusColor = EnumChatFormatting.YELLOW.toString();
+ EnumChatFormatting rankPlusColorECF = EnumChatFormatting.getValueByName(Utils.getElementAsString(profile.getHypixelProfile().get("rankPlusColor"),
+ "GOLD"));
+ String rankPlusColor = EnumChatFormatting.GOLD.toString();
if(rankPlusColorECF != null) {
rankPlusColor = rankPlusColorECF.toString();
}
@@ -2160,10 +2133,10 @@ public class GuiProfileViewer extends GuiScreen {
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, guiLeft+132, guiTop+32+12.5f*i, 80);
+ Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, guiLeft+132, guiTop+27+11f*i, 80);
if(mouseX > guiLeft+132 && mouseX < guiLeft+212) {
- if(mouseY > guiTop+32+12.5f*i && mouseY < guiTop+40+12.5f*i) {
+ if(mouseY > guiTop+27+11f*i && mouseY < guiTop+37+11f*i) {
List<String> split = splitter.splitToList(statNamePretty);
PlayerStats.Stats baseStats = PlayerStats.getBaseStats();
tooltipToDisplay = new ArrayList<>();
@@ -2207,7 +2180,7 @@ public class GuiProfileViewer extends GuiScreen {
int x = guiLeft+237+86*xPosition;
int y = guiTop+31+21*yPosition;
- renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, 60);
+ Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString()+levelFloored, x+14, y-4, 60);
if(skillInfo.get("maxed_"+entry.getKey()).getAsBoolean()) {
renderGoldBar(x, y+6, 80);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
index 5223e127..0ae6fed2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
@@ -1,15 +1,16 @@
package io.github.moulberry.notenoughupdates.profileviewer;
import com.google.gson.*;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.util.Base64;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -30,11 +31,12 @@ public class PlayerStats {
public static final String PET_LUCK = "pet_luck";
public static final String[] defaultStatNames = new String[]{"health","defence","strength","speed","crit_chance",
- "crit_damage","bonus_attack_speed","intelligence","sea_creature_chance","magic_find","pet_luck"};
+ "crit_damage","bonus_attack_speed","intelligence","sea_creature_chance","magic_find","pet_luck","ferocity","ability_damage"};
public static final String[] defaultStatNamesPretty = new String[]{EnumChatFormatting.RED+"\u2764 Health",EnumChatFormatting.GREEN+"\u2748 Defence",
EnumChatFormatting.RED+"\u2741 Strength",EnumChatFormatting.WHITE+"\u2726 Speed",EnumChatFormatting.BLUE+"\u2623 Crit Chance",
EnumChatFormatting.BLUE+"\u2620 Crit Damage",EnumChatFormatting.YELLOW+"\u2694 Attack Speed",EnumChatFormatting.AQUA+"\u270e Intelligence",
- EnumChatFormatting.DARK_AQUA+"\u03b1 SC Chance",EnumChatFormatting.AQUA+"\u272f Magic Find",EnumChatFormatting.LIGHT_PURPLE+"\u2663 Pet Luck"};
+ EnumChatFormatting.DARK_AQUA+"\u03b1 SC Chance",EnumChatFormatting.AQUA+"\u272f Magic Find",EnumChatFormatting.LIGHT_PURPLE+"\u2663 Pet Luck",
+ EnumChatFormatting.RED+"\u2AFD Ferocity",EnumChatFormatting.RED+"\u2739 Ability Damage"};
public static class Stats {
JsonObject statsJson = new JsonObject();
@@ -88,6 +90,12 @@ public class PlayerStats {
return this;
}
+ public void scale(String statName, float scale) {
+ if(statsJson.has(statName)) {
+ statsJson.add(statName, new JsonPrimitive(statsJson.get(statName).getAsFloat()*scale));
+ }
+ }
+
public void scaleAll(float scale) {
for(Map.Entry<String, JsonElement> statEntry : statsJson.entrySet()) {
statsJson.add(statEntry.getKey(), new JsonPrimitive(statEntry.getValue().getAsFloat()*scale));
@@ -159,7 +167,7 @@ public class PlayerStats {
return skillBonus;
}
- private static Stats getPetBonus(JsonObject profile) {
+ private static Stats getTamingBonus(JsonObject profile) {
JsonObject bonuses = Constants.BONUSES;
if(bonuses == null) return null;
@@ -211,10 +219,9 @@ public class PlayerStats {
Stats fairyBonus = getFairyBonus((int)Utils.getElementAsFloat(Utils.getElement(profile, "fairy_exchanges"), 0));
Stats skillBonus = getSkillBonus(skillInfo);
- Stats petBonus = getPetBonus(profile);
+ Stats petBonus = getTamingBonus(profile);
- if(fairyBonus == null || skillBonus == null || petBonus == null) {
- System.out.println(petBonus);
+ if(skillBonus == null || petBonus == null) {
return null;
}
@@ -332,6 +339,8 @@ public class PlayerStats {
private static final Pattern ATKSPEED_PATTERN = Pattern.compile("^Bonus Attack Speed: ((?:\\+|-)[0-9]+)");
private static final Pattern INTELLIGENCE_PATTERN = Pattern.compile("^Intelligence: ((?:\\+|-)[0-9]+)");
private static final Pattern SCC_PATTERN = Pattern.compile("^Sea Creature Chance: ((?:\\+|-)[0-9]+)");
+ private static final Pattern FEROCITY_PATTERN = Pattern.compile("^Ferocity: ((?:\\+|-)[0-9]+)");
+ private static final Pattern AD_PATTERN = Pattern.compile("^Ability Damage: ((?:\\+|-)[0-9]+)");
private static final HashMap<String, Pattern> STAT_PATTERN_MAP = new HashMap<>();
static {
STAT_PATTERN_MAP.put("health", HEALTH_PATTERN);
@@ -343,6 +352,8 @@ public class PlayerStats {
STAT_PATTERN_MAP.put("bonus_attack_speed", ATKSPEED_PATTERN);
STAT_PATTERN_MAP.put("intelligence", INTELLIGENCE_PATTERN);
STAT_PATTERN_MAP.put("sea_creature_chance", SCC_PATTERN);
+ STAT_PATTERN_MAP.put("ferocity", FEROCITY_PATTERN);
+ STAT_PATTERN_MAP.put("ability_damage", AD_PATTERN);
}
private static Stats getStatForItem(String internalname, JsonObject item, JsonArray lore) {
Stats stats = new Stats();
@@ -429,9 +440,104 @@ public class PlayerStats {
for(Stats stats : itemBonuses.values()) {
itemBonusesStats.add(stats);
}
+
return itemBonusesStats;
}
+ public static Stats getPetStatBonuses(JsonObject petsInfo) {
+ JsonObject petsJson = Constants.PETS;
+ JsonObject petnums = Constants.PETNUMS;
+ if(petsJson == null || petnums == null) return new Stats();
+
+ if(petsInfo != null && petsInfo.has("active_pet") && petsInfo.get("active_pet") != null &&
+ petsInfo.get("active_pet").isJsonObject()) {
+ JsonObject pet = petsInfo.get("active_pet").getAsJsonObject();
+ if(pet.has("type") && pet.get("type") != null &&
+ pet.has("tier") && pet.get("tier") != null &&
+ pet.has("exp") && pet.get("exp") != null) {
+
+ String petname = pet.get("type").getAsString();
+ String tier = pet.get("tier").getAsString();
+ String heldItem = Utils.getElementAsString(pet.get("heldItem"), null);
+
+ if(!petnums.has(petname)) {
+ return new Stats();
+ }
+
+ String tierNum = GuiProfileViewer.MINION_RARITY_TO_NUM.get(tier);
+ float exp = pet.get("exp").getAsFloat();
+ if(tierNum == null) return new Stats();
+
+ if(pet.has("heldItem") && !pet.get("heldItem").isJsonNull() && pet.get("heldItem").getAsString().equals("PET_ITEM_TIER_BOOST")) {
+ tierNum = ""+(Integer.parseInt(tierNum)+1);
+ }
+
+ int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt();
+ JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray();
+
+ GuiProfileViewer.Level levelObj = GuiProfileViewer.getLevel(levelsArr, petRarityOffset, exp);
+ float level = levelObj.level;
+ float currentLevelRequirement = levelObj.currentLevelRequirement;
+ float maxXP = levelObj.maxXP;
+ pet.addProperty("level", level);
+ pet.addProperty("currentLevelRequirement", currentLevelRequirement);
+ pet.addProperty("maxXP", maxXP);
+
+ JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(petname+";"+tierNum);
+ if(petItem == null) return new Stats();
+
+ Stats stats = new Stats();
+
+ JsonObject petInfo = petnums.get(petname).getAsJsonObject();
+ if(petInfo.has(tier)) {
+ JsonObject petInfoTier = petInfo.get(tier).getAsJsonObject();
+ if(petInfoTier == null || !petInfoTier.has("1") || !petInfoTier.has("100")) {
+ return new Stats();
+ }
+
+ JsonObject min = petInfoTier.get("1").getAsJsonObject();
+ JsonObject max = petInfoTier.get("100").getAsJsonObject();
+
+ float minMix = (100-level)/99f;
+ float maxMix = (level-1)/99f;
+
+ for(Map.Entry<String, JsonElement> entry : max.get("statNums").getAsJsonObject().entrySet()) {
+ float statMax = entry.getValue().getAsFloat();
+ float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat();
+ float val = statMin*minMix + statMax*maxMix;
+
+ stats.addStat(entry.getKey().toLowerCase(), (int)Math.floor(val));
+ }
+ }
+
+ if(heldItem != null) {
+ HashMap<String, Float> petStatBoots = GuiProfileViewer.PET_STAT_BOOSTS.get(heldItem);
+ HashMap<String, Float> petStatBootsMult = GuiProfileViewer.PET_STAT_BOOSTS_MULT.get(heldItem);
+ if(petStatBoots != null) {
+ for(Map.Entry<String, Float> entryBoost : petStatBoots.entrySet()) {
+ String key = entryBoost.getKey().toLowerCase();
+ try {
+ stats.addStat(key, entryBoost.getValue());
+ } catch(Exception ignored) {}
+ }
+
+ }
+ if(petStatBootsMult != null) {
+ for(Map.Entry<String, Float> entryBoost : petStatBootsMult.entrySet()) {
+ String key = entryBoost.getKey().toLowerCase();
+ try {
+ stats.scale(key, entryBoost.getValue());
+ } catch(Exception ignored) {}
+ }
+ }
+ }
+
+ return stats;
+ }
+ }
+ return new Stats();
+ }
+
private static float getStatMult(JsonObject inventoryInfo) {
float mult = 1f;
@@ -485,7 +591,8 @@ public class PlayerStats {
}
}
- public static Stats getStats(JsonObject skillInfo, JsonObject inventoryInfo, JsonObject collectionInfo, JsonObject profile) {
+ public static Stats getStats(JsonObject skillInfo, JsonObject inventoryInfo, JsonObject collectionInfo,
+ JsonObject petsInfo, JsonObject profile) {
if(skillInfo == null || inventoryInfo == null || collectionInfo == null || profile == null) return null;
JsonArray armor = Utils.getElement(inventoryInfo, "inv_armor").getAsJsonArray();
@@ -500,7 +607,14 @@ public class PlayerStats {
return null;
}
- Stats stats = getBaseStats().add(passiveBonuses).add(armorBonuses).add(talismanBonuses);
+ Stats stats = getBaseStats();
+ if(stats == null) {
+ return null;
+ }
+
+ Stats petBonus = getPetStatBonuses(petsInfo);
+
+ stats = stats.add(passiveBonuses).add(armorBonuses).add(talismanBonuses).add(petBonus);
stats.add(getSetBonuses(stats, inventoryInfo, collectionInfo, skillInfo, profile));
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index e4ab29d2..63c61ee4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -293,7 +293,7 @@ public class ProfileViewer {
HashMap<String, String> args = new HashMap<>();
args.put("uuid", ""+uuid);
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "status",
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "status",
args, jsonObject -> {
if(jsonObject == null) return;
@@ -415,7 +415,7 @@ public class ProfileViewer {
HashMap<String, String> args = new HashMap<>();
args.put("uuid", "" + uuid);
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "skyblock/profiles",
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "skyblock/profiles",
args, jsonObject -> {
if (jsonObject == null) return;
@@ -553,7 +553,7 @@ public class ProfileViewer {
private boolean maxed = false;
}
- public Level getLevel(JsonArray levelingArray, float xp, boolean cumulative) {
+ public Level getLevel(JsonArray levelingArray, float xp, int levelCap, boolean cumulative) {
Level levelObj = new Level();
for(int level=0; level<levelingArray.size(); level++) {
float levelXp = levelingArray.get(level).getAsFloat();
@@ -567,16 +567,35 @@ public class ProfileViewer {
levelObj.maxXpForLevel = levelXp;
levelObj.level = level + xp/levelXp;
}
+ if(levelObj.level > levelCap) {
+ levelObj.level = levelCap;
+ levelObj.maxed = true;
+ }
return levelObj;
} else {
if(!cumulative) xp -= levelXp;
}
}
levelObj.level = levelingArray.size();
+ if(levelObj.level > levelCap) {
+ levelObj.level = levelCap;
+ }
levelObj.maxed = true;
return levelObj;
}
+ public int getCap(JsonObject leveling, String skillName) {
+ JsonElement capsElement = Utils.getElement(leveling, "leveling_caps");
+ if(capsElement == null || !capsElement.isJsonObject()) {
+ return 50;
+ }
+ JsonObject caps = capsElement.getAsJsonObject();
+ if(caps.has(skillName)) {
+ return caps.get(skillName).getAsInt();
+ }
+ return 50;
+ }
+
public JsonObject getSkillInfo(String profileId) {
JsonObject profileInfo = getProfileInformation(profileId);
if(profileInfo == null) return null;
@@ -597,7 +616,6 @@ public class ProfileViewer {
float experience_skill_runecrafting = Utils.getElementAsFloat(Utils.getElement(profileInfo, "experience_skill_runecrafting"), 0);
float experience_skill_catacombs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.experience"), 0);
- if(uuid.equals("d14403fd77664905929ee1a6e365e623")) experience_skill_catacombs = 569809640; //lvl 50
float experience_slayer_zombie = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.zombie.xp"), 0);
float experience_slayer_spider = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.spider.xp"), 0);
@@ -632,22 +650,30 @@ public class ProfileViewer {
skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider);
skillInfo.addProperty("experience_slayer_wolf", experience_slayer_wolf);
- Level level_skill_taming = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_taming, false);
- Level level_skill_mining = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_mining, false);
- Level level_skill_foraging = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_foraging, false);
- Level level_skill_enchanting = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_enchanting, false);
- Level level_skill_carpentry = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_carpentry, false);
- Level level_skill_farming = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_farming, false);
- Level level_skill_combat = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_combat, false);
- Level level_skill_fishing = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_fishing, false);
- Level level_skill_alchemy = getLevel(Utils.getElement(leveling, "leveling_xp").getAsJsonArray(), experience_skill_alchemy, false);
- Level level_skill_runecrafting = getLevel(Utils.getElement(leveling, "runecrafting_xp").getAsJsonArray(), experience_skill_runecrafting, false);
-
- Level level_skill_catacombs = getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(), experience_skill_catacombs, false);
-
- Level level_slayer_zombie = getLevel(Utils.getElement(leveling, "slayer_xp.zombie").getAsJsonArray(), experience_slayer_zombie, true);
- Level level_slayer_spider = getLevel(Utils.getElement(leveling, "slayer_xp.spider").getAsJsonArray(), experience_slayer_spider, true);
- Level level_slayer_wolf = getLevel(Utils.getElement(leveling, "slayer_xp.wolf").getAsJsonArray(), experience_slayer_wolf, true);
+ JsonArray levelingArray = Utils.getElement(leveling, "leveling_xp").getAsJsonArray();
+ int farmingCap = getCap(leveling, "farming") + (int)Utils.getElementAsFloat(
+ Utils.getElement(profileInfo, "jacob2.perks.farming_level_cap"), 0);
+ Level level_skill_taming = getLevel(levelingArray, experience_skill_taming, getCap(leveling, "taming"), false);
+ Level level_skill_mining = getLevel(levelingArray, experience_skill_mining, getCap(leveling, "mining"), false);
+ Level level_skill_foraging = getLevel(levelingArray, experience_skill_foraging, getCap(leveling, "foraging"), false);
+ Level level_skill_enchanting = getLevel(levelingArray, experience_skill_enchanting, getCap(leveling, "enchanting"), false);
+ Level level_skill_carpentry = getLevel(levelingArray, experience_skill_carpentry,getCap(leveling, "carpetry"), false);
+ Level level_skill_farming = getLevel(levelingArray, experience_skill_farming, farmingCap, false);
+ Level level_skill_combat = getLevel(levelingArray, experience_skill_combat, getCap(leveling, "combat"), false);
+ Level level_skill_fishing = getLevel(levelingArray, experience_skill_fishing, getCap(leveling, "fishing"), false);
+ Level level_skill_alchemy = getLevel(levelingArray, experience_skill_alchemy, getCap(leveling, "alchemy"), false);
+ Level level_skill_runecrafting = getLevel(Utils.getElement(leveling, "runecrafting_xp").getAsJsonArray(),
+ experience_skill_runecrafting, getCap(leveling, "runecrafting"), false);
+
+ Level level_skill_catacombs = getLevel(Utils.getElement(leveling, "catacombs").getAsJsonArray(),
+ experience_skill_catacombs, getCap(leveling, "catacombs"), false);
+
+ Level level_slayer_zombie = getLevel(Utils.getElement(leveling, "slayer_xp.zombie").getAsJsonArray(),
+ experience_slayer_zombie, 9,true);
+ Level level_slayer_spider = getLevel(Utils.getElement(leveling, "slayer_xp.spider").getAsJsonArray(),
+ experience_slayer_spider, 9,true);
+ Level level_slayer_wolf = getLevel(Utils.getElement(leveling, "slayer_xp.wolf").getAsJsonArray(),
+ experience_slayer_wolf, 9,true);
skillInfo.addProperty("level_skill_taming", level_skill_taming.level);
skillInfo.addProperty("level_skill_mining", level_skill_mining.level);
@@ -785,7 +811,7 @@ public class ProfileViewer {
JsonElement crafted_generators_element = Utils.getElement(profileInfo, "crafted_generators");
JsonElement collectionInfoElement = Utils.getElement(profileInfo, "collection");
- if(unlocked_coll_tiers_element == null || crafted_generators_element == null || collectionInfoElement == null) {
+ if(unlocked_coll_tiers_element == null || collectionInfoElement == null) {
return null;
}
@@ -816,7 +842,7 @@ public class ProfileViewer {
}
}
- if(unlocked_coll_tiers_element != null && unlocked_coll_tiers_element.isJsonArray()) {
+ if(unlocked_coll_tiers_element.isJsonArray()) {
JsonArray unlocked_coll_tiers = unlocked_coll_tiers_element.getAsJsonArray();
for(int i=0; i<unlocked_coll_tiers.size(); i++) {
String unlocked = unlocked_coll_tiers.get(i).getAsString();
@@ -920,7 +946,8 @@ public class ProfileViewer {
return null;
}
- PlayerStats.Stats stats = PlayerStats.getStats(getSkillInfo(profileId), getInventoryInfo(profileId), getCollectionInfo(profileId), profileInfo);
+ PlayerStats.Stats stats = PlayerStats.getStats(getSkillInfo(profileId), getInventoryInfo(profileId), getCollectionInfo(profileId),
+ getPetsInfo(profileId), profileInfo);
this.stats.put(profileId, stats);
return stats;
}
@@ -942,7 +969,7 @@ public class ProfileViewer {
public void getHypixelProfile(String name, Consumer<JsonObject> callback) {
HashMap<String, String> args = new HashMap<>();
args.put("name", ""+name);
- manager.hypixelApi.getHypixelApiAsync(manager.config.apiKey.value, "player",
+ manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "player",
args, jsonObject -> {
if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean()
&& jsonObject.get("player").isJsonObject()) {
@@ -1000,7 +1027,7 @@ public class ProfileViewer {
updatingResourceCollection.set(true);
HashMap<String, String> args = new HashMap<>();
- NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.manager.config.apiKey.value, "resources/skyblock/collections",
+ NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "resources/skyblock/collections",
args, jsonObject -> {
updatingResourceCollection.set(false);
if(jsonObject != null && jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/GuiQuestLine.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/GuiQuestLine.java
deleted file mode 100644
index 6840a5aa..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/GuiQuestLine.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing;
-
-import net.minecraft.client.gui.GuiScreen;
-
-import java.awt.*;
-
-public class GuiQuestLine extends GuiScreen {
-
- public static QuestLine questLine = new QuestLine();
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
-
- drawDefaultBackground();
-
- drawRect(0, 0, 20, height, new Color(100, 100, 100, 100).getRGB());
- drawRect(20, 0, 21, height, new Color(50, 50, 50, 200).getRGB());
-
- questLine.render(width, height, mouseX, mouseY);
- }
-
- @Override
- public boolean doesGuiPauseGame() {
- return false;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/QuestLine.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/QuestLine.java
deleted file mode 100644
index 4e541583..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/QuestLine.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing;
-
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NEUResourceManager;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.cosmetics.CapeNode;
-import io.github.moulberry.notenoughupdates.questing.requirements.*;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.WorldRenderer;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.client.shader.Shader;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.Matrix4f;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-import org.lwjgl.util.vector.Vector3f;
-
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static io.github.moulberry.notenoughupdates.GuiTextures.item_mask;
-
-public class QuestLine {
-
- private List<Quest> quests = new ArrayList<>();
- private Framebuffer framebuffer = null;
- private Framebuffer framebufferGrayscale = null;
- private Shader grayscaleShader = null;
-
- public class Quest {
- //requirements
- //rewards
- //display icon
- //x,y offset
- //prerequisite quests id:0,6
-
- private Requirement requirement;
-
- private int x;
- private int y;
- private ItemStack display;
- private String[] tooltip = new String[0];
- private int[] prerequisites;
- private boolean completed = false;
-
- public Quest(ItemStack display, Requirement requirement, int x, int y, int... prerequisites) {
- this.requirement = requirement;
- this.display = display;
- this.x = x;
- this.y = y;
- this.prerequisites = prerequisites;
- }
-
- public String[] render(int mouseX, int mouseY, boolean hasCompleted) {
- if(hasCompleted != completed) return null;
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(item_mask);
- if(completed) {
- GlStateManager.color(200/255f, 150/255f, 50/255f, 255/255f);
- } else {
- GlStateManager.color(100/255f, 100/255f, 100/255f, 255/255f);
- }
- Utils.drawTexturedRect(x-9, y-9, 18, 18, GL11.GL_NEAREST);
-
- Utils.drawItemStack(display, x-8, y-8);
-
- GlStateManager.color(100/255f, 100/255f, 100/255f, 255/255f);
- GlStateManager.disableTexture2D();
- for(int prereq : prerequisites) {
- Quest other = quests.get(prereq);
-
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
- worldrenderer.pos(x, y, 0).endVertex();
- worldrenderer.pos(other.x, other.y, 0).endVertex();
- tessellator.draw();
- }
-
- if(mouseX > x-9 && mouseX < x+9) {
- if(mouseY > y-9 && mouseY < y+9) {
- return tooltip;
- }
- }
- return null;
- }
-
- public void tick() {
- if(completed) return;
- for(int prereq : prerequisites) {
- Quest other = quests.get(prereq);
- if(!other.completed) return;
- }
- requirement.updateRequirement();
- if(requirement.getCompleted()) {
- completed = true;
- }
- }
- }
-
- private Framebuffer checkFramebufferSizes(Framebuffer framebuffer, int width, int height, int scaleFactor) {
- int sw = width*scaleFactor;
- int sh = height*scaleFactor;
-
- if(framebuffer == null || framebuffer.framebufferWidth != sw || framebuffer.framebufferHeight != sh) {
- if(framebuffer == null) {
- framebuffer = new Framebuffer(sw, sh, true);
- } else {
- framebuffer.createBindFramebuffer(sw, sh);
- }
- framebuffer.setFramebufferFilter(GL11.GL_NEAREST);
- }
- return framebuffer;
- }
-
- private Matrix4f createProjectionMatrix(int width, int height) {
- Matrix4f projMatrix = new Matrix4f();
- projMatrix.setIdentity();
- projMatrix.m00 = 2.0F / (float)width;
- projMatrix.m11 = 2.0F / (float)(-height);
- projMatrix.m22 = -0.0020001999F;
- projMatrix.m33 = 1.0F;
- projMatrix.m03 = -1.0F;
- projMatrix.m13 = 1.0F;
- projMatrix.m23 = -1.0001999F;
- return projMatrix;
- }
-
- public void render(int width, int height, int mouseX, int mouseY) {
- ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
-
- GL11.glTranslatef(width/2f, height/2f, 0);
- String[] tooltipDisplay = null;
- for(Quest quest : quests) {
- String[] tooltip = quest.render(mouseX-width/2, mouseY-height/2, true);
- if(tooltip != null && tooltip.length > 0) tooltipDisplay = tooltip;
- }
- GL11.glTranslatef(-width/2f, -height/2f, 0);
-
- //FBO/Shader setup
- if(framebuffer != null && grayscaleShader != null && (framebuffer.framebufferWidth != width || framebuffer.framebufferHeight != height)) {
- grayscaleShader.setProjectionMatrix(createProjectionMatrix(
- width*scaledresolution.getScaleFactor(), height*scaledresolution.getScaleFactor()));
- }
- framebuffer = checkFramebufferSizes(framebuffer, width, height,
- scaledresolution.getScaleFactor());
- framebufferGrayscale = checkFramebufferSizes(framebufferGrayscale, width, height,
- scaledresolution.getScaleFactor());
- if(grayscaleShader == null) {
- try {
- grayscaleShader = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()),
- "grayscale",
- framebuffer, framebufferGrayscale);
- grayscaleShader.setProjectionMatrix(createProjectionMatrix(
- width*scaledresolution.getScaleFactor(), height*scaledresolution.getScaleFactor()));
- } catch(Exception e) {
- return;
- }
- }
-
- //Render contents of framebuffer to screen
- framebufferGrayscale.bindFramebufferTexture();
- GlStateManager.color(1f, 1f, 1f, 1f);
- Utils.drawTexturedRect(0, 0, width, height, 0, 1, 1, 0);
- framebufferGrayscale.unbindFramebufferTexture();
-
- //Render uncompleted quests to framebuffer
- GL11.glPushMatrix();
- framebuffer.framebufferClear();
- framebuffer.bindFramebuffer(false);
- GlStateManager.color(1f, 1f, 1f, 1f);
- GL11.glTranslatef(width/2f, height/2f, 0);
- for(Quest quest : quests) {
- String[] tooltip = quest.render(mouseX-width/2, mouseY-height/2, false);
- if(tooltip != null && tooltip.length > 0) tooltipDisplay = tooltip;
- }
- GL11.glTranslatef(-width/2f, -height/2f, 0);
- framebuffer.unbindFramebuffer();
- GL11.glPopMatrix();
-
- //Execute shader
- GL11.glPushMatrix();
- grayscaleShader.loadShader(0);
- Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true);
- GL11.glPopMatrix();
-
- if(tooltipDisplay != null) {
- List<String> tooltip = new ArrayList<>();
- tooltip.addAll(Arrays.asList(tooltipDisplay));
-
- Utils.drawHoveringText(tooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj, false);
- }
- }
-
- public void tick() {
- for(Quest quest : quests) {
- quest.tick();
- }
- }
-
- {
- //Requirement hubRequirement = new RequirementIslandType("Village");
- //Requirement locationRequirement = new RequirementLocation(-29, 79, -108, 2);
- //Requirement locationRequirement2 = new RequirementLocation(-29, 79, -108, 2, hubRequirement);
- Requirement req1 = new RequirementApi("coin_purse>20000");
- Requirement req2 = new RequirementIslandType("The End");
- Requirement req3 = new RequirementGuiOpen("Auctions Browser");
-
- Quest quest1 = new Quest(new ItemStack(Items.rotten_flesh), req1, 0, 0);
- Quest quest2 = new Quest(new ItemStack(Items.cooked_porkchop), req2, 0, 30);
- Quest quest3 = new Quest(new ItemStack(Items.diamond_axe), req3, 30, 30, 0, 1);
- quest1.tooltip = new String[]{"Line1", "Line2", "Line3"};
- quests.add(quest1);
- quests.add(quest2);
- quests.add(quest3);
- }
-
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/Requirement.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/Requirement.java
deleted file mode 100644
index a7f40e73..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/Requirement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-public abstract class Requirement {
-
- private Requirement[] preconditions;
-
- protected boolean completed = false;
-
- public Requirement(Requirement... preconditions) {
- this.preconditions = preconditions;
- }
-
- public boolean getPreconditionCompleted() {
- boolean completed = true;
- for(Requirement precondition : preconditions) {
- completed &= precondition.completed;
- }
- return completed;
- }
-
- //Collection, Item obtained, GUI Open, Fake npc interact
-
- public boolean getCompleted() {
- return completed && getPreconditionCompleted();
- }
-
- public abstract void updateRequirement();
-
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementApi.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementApi.java
deleted file mode 100644
index 16da64fe..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementApi.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import com.google.common.base.Splitter;
-import com.google.gson.*;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-
-import java.util.List;
-
-public class RequirementApi extends Requirement {
-
- private boolean valid = false;
- private String requirementLeft; //a.b.c
- private String op; //!=,<=,>=,=,<,>
- private String requirementRight; //true,float,etc.
-
- private String[] ops = new String[]{"!=","<=",">=","=","<",">"};
-
- public RequirementApi(String apiCheck, Requirement... preconditions) {
- super(preconditions);
-
- processApiCheck(apiCheck);
- }
-
- public void processApiCheck(String apiCheck) {
- for(String operator : ops) {
- if(apiCheck.contains(operator)) {
- String[] split = apiCheck.split(operator);
- requirementLeft = split[0];
- requirementRight = split[1];
- op = operator;
- valid = true;
- return;
- }
- }
- }
-
- private static Splitter PATH_SPLITTER = Splitter.on(".").omitEmptyStrings().limit(2);
- private static JsonElement getElement(JsonElement element, String path) {
- List<String> path_split = PATH_SPLITTER.splitToList(path);
- if(element instanceof JsonObject) {
- JsonElement e = element.getAsJsonObject().get(path_split.get(0));
- if(path_split.size() > 1) {
- return getElement(e, path_split.get(1));
- } else {
- return e;
- }
- } else {
- return element;
- }
- }
-
- private static boolean checkElementSatisfiesComparison(JsonElement element, String op, String value) {
- try {
- if(element instanceof JsonNull) {
- return value.equals("null");
- } else if(element instanceof JsonObject) {
- if(value.contains(".")) {
- StringBuilder sb = new StringBuilder();
- String[] split = value.split("\\.");
- for(int i=0; i<split.length-1; i++) {
- sb.append(split[i]).append(".");
- }
- return checkElementSatisfiesComparison(getElement(element, sb.toString()), op, split[split.length-1]);
- } else {
- boolean containsValue = element.getAsJsonObject().has(value);
- switch(op) {
- case "=": return containsValue;
- case "!=": return !containsValue;
- default: return false;
- }
- }
- } else if(element instanceof JsonArray) {
- for(int i=0; i<element.getAsJsonArray().size(); i++) {
- JsonElement e = element.getAsJsonArray().get(i);
- if(checkElementSatisfiesComparison(e, op, value)) return true;
- }
- } else if(element instanceof JsonPrimitive) {
- JsonPrimitive prim = element.getAsJsonPrimitive();
- if(!prim.isNumber()) {
- return prim.getAsString().equals(value);
- } else {
- switch(op) {
- case "=": return prim.getAsString().equals(value);
- case "!=": return !prim.getAsString().equals(value);
- case ">": return prim.getAsDouble() > Double.parseDouble(value);
- case "<": return prim.getAsDouble() < Double.parseDouble(value);
- case "<=": return prim.getAsDouble() <= Double.parseDouble(value);
- case ">=": return prim.getAsDouble() >= Double.parseDouble(value);
- default: return false;
- }
- }
- }
- } catch(Exception e) {}
- return false;
- }
-
- @Override
- public void updateRequirement() {
- if(valid) {
- /*JsonObject profile = NotEnoughUpdates.INSTANCE.manager.auctionManager.getPlayerInformation();
- if(profile != null) {
- System.out.println("-----------");
- JsonElement element = getElement(profile, requirementLeft);
- completed = checkElementSatisfiesComparison(element, op, requirementRight);
- }*/
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementGuiOpen.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementGuiOpen.java
deleted file mode 100644
index e53a1aca..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementGuiOpen.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.inventory.GuiChest;
-import net.minecraft.inventory.ContainerChest;
-
-public class RequirementGuiOpen extends Requirement {
-
- private String guiName;
-
- public RequirementGuiOpen(String guiName, Requirement... preconditions) {
- super(preconditions);
- this.guiName = guiName;
- }
-
- @Override
- public void updateRequirement() {
- if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
- GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
- ContainerChest container = (ContainerChest) chest.inventorySlots;
- String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();
-
- if(containerName.equals(guiName)) {
- completed = true;
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementIslandType.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementIslandType.java
deleted file mode 100644
index c0aef344..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementIslandType.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import io.github.moulberry.notenoughupdates.questing.SBInfo;
-
-public class RequirementIslandType extends Requirement {
-
- private String islandType;
-
- public RequirementIslandType(String islandType, Requirement... preconditions) {
- super(preconditions);
- this.islandType = islandType;
- }
-
-
- @Override
- public void updateRequirement() {
- completed = islandType.equalsIgnoreCase(SBInfo.getInstance().location);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementItemObtained.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementItemObtained.java
deleted file mode 100644
index 0627a1cf..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementItemObtained.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-public class RequirementItemObtained extends Requirement {
-
- private String internalname;
-
- public RequirementItemObtained(String internalname, Requirement... preconditions) {
- super(preconditions);
- this.internalname = internalname;
- }
-
- private Map<String, ArrayList<String>> getAcquiredItems() {
- return NotEnoughUpdates.INSTANCE.manager.config.collectionLog.value;
- }
-
- @Override
- public void updateRequirement() {
- if(getAcquiredItems() != null &&
- getAcquiredItems().containsKey(NotEnoughUpdates.INSTANCE.manager.getCurrentProfile()) &&
- getAcquiredItems().get(NotEnoughUpdates.INSTANCE.manager.getCurrentProfile()).contains(internalname)) {
- completed = true;
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocation.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocation.java
deleted file mode 100644
index 0e995f34..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocation.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-
-public class RequirementLocation extends Requirement {
-
- private int x;
- private int y;
- private int z;
- private float radius;
-
- public RequirementLocation(int x, int y, int z, float radius, Requirement... preconditions) {
- super(preconditions);
- this.x = x;
- this.y = y;
- this.z = z;
- this.radius = radius;
- }
-
- @Override
- public void updateRequirement() {
- EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- completed = player.getDistance(x, y, z) < radius;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocationRect.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocationRect.java
deleted file mode 100644
index fff71af7..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/requirements/RequirementLocationRect.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package io.github.moulberry.notenoughupdates.questing.requirements;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.player.EntityPlayer;
-
-public class RequirementLocationRect extends Requirement {
-
- private int x1;
- private int y1;
- private int z1;
- private int x2;
- private int y2;
- private int z2;
-
- public RequirementLocationRect(int x1, int y1, int z1, int x2, int y2, int z2, Requirement... preconditions) {
- super(preconditions);
- this.x1 = Math.min(x1, x2);
- this.y1 = Math.min(y1, y2);
- this.z1 = Math.min(z1, z2);
-
- this.x2 = Math.max(x1, x2);
- this.y2 = Math.max(y1, y2);
- this.z2 = Math.max(z1, z2);
- }
-
- @Override
- public void updateRequirement() {
- EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- completed = true;
- completed &= player.posX > x1 && player.posX < x2;
- completed &= player.posY > y1 && player.posY < y2;
- completed &= player.posZ > z1 && player.posZ < z2;
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/AllowEmptyHTMLTag.java b/src/main/java/io/github/moulberry/notenoughupdates/util/AllowEmptyHTMLTag.java
index 3cf5ef31..e6baff16 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/AllowEmptyHTMLTag.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/AllowEmptyHTMLTag.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.util;
import info.bliki.htmlcleaner.TagNode;
import info.bliki.wiki.filter.ITextConverter;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java
index 141ffefb..5bb15ef3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/GuiTextures.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.util;
import net.minecraft.util.ResourceLocation;
@@ -23,6 +23,12 @@ public class GuiTextures {
public static final ResourceLocation slider_on_large = new ResourceLocation("notenoughupdates:slider_on_large.png");
public static final ResourceLocation slider_button = new ResourceLocation("notenoughupdates:slider_button.png");
+ public static final ResourceLocation DISCORD = new ResourceLocation("notenoughupdates:social/discord.png");
+ public static final ResourceLocation GITHUB = new ResourceLocation("notenoughupdates:social/github.png");
+ public static final ResourceLocation PATREON = new ResourceLocation("notenoughupdates:social/patreon.png");
+ public static final ResourceLocation TWITTER = new ResourceLocation("notenoughupdates:social/twitter.png");
+ public static final ResourceLocation YOUTUBE = new ResourceLocation("notenoughupdates:social/youtube.png");
+
public static final ResourceLocation item_mask = new ResourceLocation("notenoughupdates:item_mask.png");
public static final ResourceLocation item_haschild = new ResourceLocation("notenoughupdates:item_haschild.png");
public static final ResourceLocation button_tex = new ResourceLocation("notenoughupdates:button.png");
@@ -78,4 +84,20 @@ public class GuiTextures {
public static final ResourceLocation ascending_overlay = new ResourceLocation("notenoughupdates:ascending_overlay.png");
public static final ResourceLocation descending_overlay = new ResourceLocation("notenoughupdates:descending_overlay.png");
+ public static final ResourceLocation BAR = new ResourceLocation("notenoughupdates:core/bar.png");
+ public static final ResourceLocation OFF = new ResourceLocation("notenoughupdates:core/toggle_off.png");
+ public static final ResourceLocation ONE = new ResourceLocation("notenoughupdates:core/toggle_1.png");
+ public static final ResourceLocation TWO = new ResourceLocation("notenoughupdates:core/toggle_2.png");
+ public static final ResourceLocation THREE = new ResourceLocation("notenoughupdates:core/toggle_3.png");
+ public static final ResourceLocation ON = new ResourceLocation("notenoughupdates:core/toggle_on.png");
+
+ public static final ResourceLocation slider_off_cap = new ResourceLocation("notenoughupdates:core/slider/slider_off_cap.png");
+ public static final ResourceLocation slider_off_notch = new ResourceLocation("notenoughupdates:core/slider/slider_off_notch.png");
+ public static final ResourceLocation slider_off_segment = new ResourceLocation("notenoughupdates:core/slider/slider_off_segment.png");
+ public static final ResourceLocation slider_on_cap = new ResourceLocation("notenoughupdates:core/slider/slider_on_cap.png");
+ public static final ResourceLocation slider_on_notch = new ResourceLocation("notenoughupdates:core/slider/slider_on_notch.png");
+ public static final ResourceLocation slider_on_segment = new ResourceLocation("notenoughupdates:core/slider/slider_on_segment.png");
+
+
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUResourceManager.java b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUResourceManager.java
index 41737eda..388fd4f6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUResourceManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUResourceManager.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResource;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/RequestFocusListener.java b/src/main/java/io/github/moulberry/notenoughupdates/util/RequestFocusListener.java
index ecc27c9a..2365b60b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/RequestFocusListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/RequestFocusListener.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.util;
import javax.swing.*;
import javax.swing.event.*;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBAIntegration.java
index 4df9c847..04f53bf3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/SBAIntegration.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBAIntegration.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates;
+package io.github.moulberry.notenoughupdates.util;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 67cd79a9..f5df9305 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -1,8 +1,7 @@
-package io.github.moulberry.notenoughupdates.questing;
+package io.github.moulberry.notenoughupdates.util;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 64bf3015..37f4db0c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -366,7 +366,7 @@ public class Utils {
}
public static void playPressSound() {
- if(NotEnoughUpdates.INSTANCE.manager.config.guiButtonClicks.value) {
+ if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(
new ResourceLocation("gui.button.press"), 1.0F));
}
@@ -517,6 +517,51 @@ public class Utils {
}
}
+ public static void renderAlignedString(String first, String second, float x, float y, int length) {
+ FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
+ if(fontRendererObj.getStringWidth(first + " " + second) >= length) {
+ for(int xOff=-2; xOff<=2; xOff++) {
+ for(int yOff=-2; yOff<=2; yOff++) {
+ if(Math.abs(xOff) != Math.abs(yOff)) {
+ Utils.drawStringCenteredScaledMaxWidth(Utils.cleanColourNotModifiers(first + " " + second), Minecraft.getMinecraft().fontRendererObj,
+ x+length/2f+xOff/2f, y+4+yOff/2f, false, length,
+ new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB());
+ }
+ }
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ Utils.drawStringCenteredScaledMaxWidth(first + " " + second, Minecraft.getMinecraft().fontRendererObj,
+ x+length/2f, y+4, false, length, 4210752);
+ } else {
+ for(int xOff=-2; xOff<=2; xOff++) {
+ for(int yOff=-2; yOff<=2; yOff++) {
+ if(Math.abs(xOff) != Math.abs(yOff)) {
+ fontRendererObj.drawString(Utils.cleanColourNotModifiers(first),
+ x+xOff/2f, y+yOff/2f,
+ new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
+ }
+ }
+ }
+
+ int secondLen = fontRendererObj.getStringWidth(second);
+ GlStateManager.color(1, 1, 1, 1);
+ fontRendererObj.drawString(first, x, y, 4210752, false);
+ for(int xOff=-2; xOff<=2; xOff++) {
+ for(int yOff=-2; yOff<=2; yOff++) {
+ if(Math.abs(xOff) != Math.abs(yOff)) {
+ fontRendererObj.drawString(Utils.cleanColourNotModifiers(second),
+ x+length-secondLen+xOff/2f, y+yOff/2f,
+ new Color(0, 0, 0, 200/Math.max(Math.abs(xOff), Math.abs(yOff))).getRGB(), false);
+ }
+ }
+ }
+
+ GlStateManager.color(1, 1, 1, 1);
+ fontRendererObj.drawString(second, x+length-secondLen, y, 4210752, false);
+ }
+ }
+
public static void drawStringScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) {
int strLen = fr.getStringWidth(str);
float factor = len/(float)strLen;
@@ -939,11 +984,11 @@ public class Utils {
drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor);
//TODO: Coloured Borders
int borderColorStart = 0x505000FF;
- if(NotEnoughUpdates.INSTANCE.manager.config.tooltipBorderColours.value && coloured) {
+ if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.tooltipBorderColours && coloured) {
if(textLines.size() > 0) {
String first = textLines.get(0);
borderColorStart = getPrimaryColour(first).getRGB() & 0x00FFFFFF |
- ((NotEnoughUpdates.INSTANCE.manager.config.tooltipBorderOpacity.value.intValue()) << 24);
+ ((NotEnoughUpdates.INSTANCE.config.tooltipTweaks.tooltipBorderOpacity) << 24);
}
}
final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000;
diff --git a/src/main/resources/assets/notenoughupdates/capes/furf.png b/src/main/resources/assets/notenoughupdates/capes/furf.png
new file mode 100644
index 00000000..70f8f98a
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/capes/furf.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/capes/lightning.png b/src/main/resources/assets/notenoughupdates/capes/lightning.png
deleted file mode 100644
index dc0afce1..00000000
--- a/src/main/resources/assets/notenoughupdates/capes/lightning.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/capes/void.png b/src/main/resources/assets/notenoughupdates/capes/void.png
new file mode 100644
index 00000000..d9f27e95
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/capes/void.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/bar.png b/src/main/resources/assets/notenoughupdates/core/bar.png
new file mode 100644
index 00000000..664c0f32
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/bar.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/colour_selector_bar.png b/src/main/resources/assets/notenoughupdates/core/colour_selector_bar.png
new file mode 100644
index 00000000..f176af90
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/colour_selector_bar.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/colour_selector_bar_alpha.png b/src/main/resources/assets/notenoughupdates/core/colour_selector_bar_alpha.png
new file mode 100644
index 00000000..7a89510c
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/colour_selector_bar_alpha.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/colour_selector_chroma.png b/src/main/resources/assets/notenoughupdates/core/colour_selector_chroma.png
new file mode 100644
index 00000000..ea273959
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/colour_selector_chroma.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/colour_selector_dot.png b/src/main/resources/assets/notenoughupdates/core/colour_selector_dot.png
new file mode 100644
index 00000000..1150c8bb
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/colour_selector_dot.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_off_cap.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_cap.png
new file mode 100644
index 00000000..60ddcbf5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_cap.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_off_notch.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_notch.png
new file mode 100644
index 00000000..3cdfbec9
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_notch.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_off_segment.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_segment.png
new file mode 100644
index 00000000..13f161d1
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_off_segment.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_on_cap.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_cap.png
new file mode 100644
index 00000000..e1d1aab5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_cap.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_on_notch.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_notch.png
new file mode 100644
index 00000000..8e39633b
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_notch.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/slider/slider_on_segment.png b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_segment.png
new file mode 100644
index 00000000..931a8904
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/slider/slider_on_segment.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/toggle_1.png b/src/main/resources/assets/notenoughupdates/core/toggle_1.png
new file mode 100644
index 00000000..618e2c62
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/toggle_1.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/toggle_2.png b/src/main/resources/assets/notenoughupdates/core/toggle_2.png
new file mode 100644
index 00000000..4bb5ee39
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/toggle_2.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/toggle_3.png b/src/main/resources/assets/notenoughupdates/core/toggle_3.png
new file mode 100644
index 00000000..50164cc3
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/toggle_3.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/toggle_off.png b/src/main/resources/assets/notenoughupdates/core/toggle_off.png
new file mode 100644
index 00000000..ed7d5e68
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/toggle_off.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/core/toggle_on.png b/src/main/resources/assets/notenoughupdates/core/toggle_on.png
new file mode 100644
index 00000000..68ce1c0c
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/core/toggle_on.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/shaders/void.frag b/src/main/resources/assets/notenoughupdates/shaders/void.frag
new file mode 100644
index 00000000..3809c133
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/void.frag
@@ -0,0 +1,41 @@
+#version 130
+
+varying vec4 passColour;
+varying vec3 passNormal;
+uniform sampler2D textureIn;
+varying vec4 passPosition;
+uniform vec2 screensize;
+uniform int millis;
+
+//Algorithm by hughsk
+vec3 hsv2rgb(vec3 c) {
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+void main() {
+ vec2 viewportCoord1 = (gl_FragCoord.xy+vec2(-millis/100.0f, 70)/5.0f)/screensize.yy;
+ vec4 texture1 = texture2D(textureIn, viewportCoord1);
+
+ vec2 viewportCoord2 = (gl_FragCoord.xy/2.0f+vec2(50, millis/100.0f)/3.0f)/screensize.yy;
+ vec4 texture2 = texture2D(textureIn, viewportCoord2);
+
+ vec2 viewportCoord3 = (gl_FragCoord.xy/3.0f+vec2(-millis/100.0f+30, millis/100.0f+90)/2.0f)/screensize.yy;
+ vec4 texture3 = texture2D(textureIn, viewportCoord3);
+
+ vec2 viewportCoord4 = (gl_FragCoord.xy/3.0f+vec2(-millis/100.0f+50, -millis/100.0f+10)/2.0f)/screensize.yy;
+ vec4 texture4 = texture2D(textureIn, viewportCoord4);
+
+ float r = texture1.r + texture2.r + texture3.r + texture4.r;
+ float g = texture1.g + texture2.g + texture3.g + texture4.g;
+ float b = texture1.b + texture2.b + texture3.b + texture4.b;
+
+ if(r > 1) r = 1;
+ if(g > 1) g = 1;
+ if(b > 1) b = 1;
+
+ vec4 colour = vec4(hsv2rgb(vec3(mod(millis/50000.0f+gl_FragCoord.x/screensize.x/3.0f, 1.0f), 0.35f, 1.0f)), 1.0f);
+
+ gl_FragColor = vec4(r, g, b, 1) * passColour * colour;
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/shaders/void.vert b/src/main/resources/assets/notenoughupdates/shaders/void.vert
new file mode 100644
index 00000000..0cc39c90
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/void.vert
@@ -0,0 +1,16 @@
+#version 120
+
+varying vec4 passColour;
+varying vec3 passNormal;
+varying vec4 passPosition;
+uniform vec2 screensize;
+uniform int millis;
+
+void main() {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ passColour = gl_Color;
+ passNormal = normalize(gl_Normal);
+ passPosition = gl_Position;
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/social/discord.png b/src/main/resources/assets/notenoughupdates/social/discord.png
new file mode 100644
index 00000000..27962167
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/social/discord.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/social/github.png b/src/main/resources/assets/notenoughupdates/social/github.png
new file mode 100644
index 00000000..9c8650a5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/social/github.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/social/patreon.png b/src/main/resources/assets/notenoughupdates/social/patreon.png
new file mode 100644
index 00000000..00a169de
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/social/patreon.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/social/twitter.png b/src/main/resources/assets/notenoughupdates/social/twitter.png
new file mode 100644
index 00000000..5f249b80
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/social/twitter.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/social/youtube.png b/src/main/resources/assets/notenoughupdates/social/youtube.png
new file mode 100644
index 00000000..b0c05d07
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/social/youtube.png
Binary files differ
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index a90fbb8d..e1572aa5 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -17,6 +17,8 @@
"MixinEntityPlayer",
"MixinTileEntitySpecialRenderer",
"MixinRender",
- "MixinRenderFish"
+ "MixinRenderFish",
+ "MixinContainer",
+ "MixinWorld"
]
} \ No newline at end of file