aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java60
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java63
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java68
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/KeybindHelper.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FancyPortals.java303
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java549
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NPCRetexturing.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java295
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java92
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java47
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java27
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java21
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorldClient.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java277
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java22
-rw-r--r--src/main/resources/assets/notenoughupdates/fishing_warning_exclam.pngbin0 -> 5807 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/groundplane.pngbin0 -> 40868 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-1.pngbin0 -> 82574 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-2.pngbin0 -> 1228306 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-3.pngbin0 -> 646267 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-4.pngbin0 -> 668239 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-5.pngbin0 -> 531635 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-6.pngbin0 -> 275559 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/slotlocking/bound.pngbin0 -> 5619 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.pngbin3374 -> 7861 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/storage_gui/storage_preview_3.pngbin7160 -> 4373 bytes
-rw-r--r--src/main/resources/mixins.notenoughupdates.json4
-rw-r--r--src/main/resources/notenoughupdates_at.cfg5
46 files changed, 1785 insertions, 282 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java b/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java
deleted file mode 100644
index 8ec4263a..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/MorusIntegration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.github.moulberry.notenoughupdates;
-
-import io.github.moulberry.morus.MorusSubstitutor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.item.ItemStack;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MorusIntegration {
-
- private static MorusIntegration INSTANCE = new MorusIntegration();
-
- public static MorusIntegration getInstance() {
- return INSTANCE;
- }
-
- private HashMap<String, Integer> itemDrops = null;
- private HashMap<String, Integer> inventoryItems = null;
-
- public void tick() {
- if(itemDrops == null) {
- itemDrops = new HashMap<>();
- for(String item : NotEnoughUpdates.INSTANCE.manager.getItemInformation().keySet()) {
- itemDrops.put(item, 0);
- }
- }
-
- HashMap<String, Integer> newInventoryItems = getInventoryItems();
- if(inventoryItems != null) {
- for(String internal : newInventoryItems.keySet()) {
- int newAmount = newInventoryItems.get(internal);
- int oldAmount = inventoryItems.getOrDefault(internal, 0);
- if(newAmount > oldAmount) {
- itemDrops.put(internal, itemDrops.getOrDefault(internal, 0)+newAmount-oldAmount);
- }
- }
- }
- inventoryItems = newInventoryItems;
-
- for(Map.Entry<String, Integer> entry : itemDrops.entrySet()) {
- MorusSubstitutor.putSubstiution("notenoughupdates", "itemdrops."+entry.getKey().toLowerCase(), ""+entry.getValue());
- }
-
- }
-
- public HashMap<String, Integer> getInventoryItems() {
- HashMap<String, Integer> inventoryItems = new HashMap<>();
- if(Minecraft.getMinecraft().thePlayer != null) {
- for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if(internalname != null) {
- inventoryItems.put(internalname, inventoryItems.getOrDefault(internalname, 0)+stack.stackSize);
- }
- }
- }
- return inventoryItems;
- }
-
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 081a0c1d..98300e73 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -32,6 +32,8 @@ import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Blocks;
@@ -240,7 +242,6 @@ public class NEUEventListener {
DungeonWin.tick();
if(longUpdate) {
-
CrystalOverlay.tick();
DwarvenMinesTextures.tick();
FairySouls.tick();
@@ -260,9 +261,6 @@ public class NEUEventListener {
NotEnoughUpdates.INSTANCE.overlay.redrawItems();
CapeManager.onTickSlow();
- for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
- NotEnoughUpdates.profileViewer.putNameUuid(player.getName(), player.getUniqueID().toString().replace("-", ""));
- }
NotEnoughUpdates.profileViewer.putNameUuid(Minecraft.getMinecraft().thePlayer.getName(),
Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", ""));
@@ -286,9 +284,6 @@ public class NEUEventListener {
if(neu.hasSkyblockScoreboard()) {
SBInfo.getInstance().tick();
- if(Loader.isModLoaded("morus")) {
- MorusIntegration.getInstance().tick();
- }
lastSkyblockScoreboard = currentTime;
if(!joinedSB) {
joinedSB = true;
@@ -702,7 +697,7 @@ public class NEUEventListener {
* 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI)
* 3) Replaces lobby join notifications when streamer mode is active
*/
- @SubscribeEvent(priority = EventPriority.LOW)
+ @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
public void onGuiChat(ClientChatReceivedEvent e) {
if(e.type == 2) {
e.message = processChatComponent(e.message);
@@ -1380,9 +1375,10 @@ public class NEUEventListener {
boolean customAhActive = event.gui instanceof CustomAHGui || neu.manager.auctionManager.customAH.isRenderOverAuctionView();
if(storageOverlayActive) {
- event.setCanceled(true);
- StorageOverlay.getInstance().keyboardInput();
- return;
+ if(StorageOverlay.getInstance().keyboardInput()) {
+ event.setCanceled(true);
+ return;
+ }
}
if(tradeWindowActive || customAhActive) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 8e0c1444..f9965300 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -73,9 +73,11 @@ import java.lang.management.ManagementFactory;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.List;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
@Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true)
public class NotEnoughUpdates {
@@ -706,6 +708,7 @@ public class NotEnoughUpdates {
}
});
+ private ScheduledExecutorService devES = Executors.newSingleThreadScheduledExecutor();
private static final String[] devFailStrings = {"No.", "I said no.", "You aren't allowed to use this.",
"Are you sure you want to use this? Type 'Yes' in chat.", "Lmao you thought", "Ok please stop",
"What do you want from me?", "This command almost certainly does nothing useful for you",
@@ -716,7 +719,8 @@ public class NotEnoughUpdates {
SimpleCommand devTestCommand = new SimpleCommand("neudevtest", new SimpleCommand.ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if(!Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("Moulberry")) {
+ if(!Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("Moulberry") &&
+ !Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("LucyCoconut")) {
if(devFailIndex >= devFailStrings.length) {
throw new Error("L") {
@Override
@@ -741,6 +745,14 @@ public class NotEnoughUpdates {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+devFailStrings[devFailIndex++]));
return;
}
+ /*if(args.length == 1) {
+ DupePOC.doDupe(args[0]);
+ return;
+ }*/
+ if(args.length == 2 && args[0].equalsIgnoreCase("pt")) {
+ EnumParticleTypes t = EnumParticleTypes.valueOf(args[1]);
+ FishingHelper.type = t;
+ }
if(args.length == 1 && args[0].equalsIgnoreCase("dev")) {
NotEnoughUpdates.INSTANCE.config.hidden.dev = true;
return;
@@ -749,6 +761,51 @@ public class NotEnoughUpdates {
saveConfig();
return;
}
+ if(args.length == 1 && args[0].equalsIgnoreCase("center")) {
+ double x = Math.floor(Minecraft.getMinecraft().thePlayer.posX) + 0.5f;
+ double z = Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + 0.5f;
+ Minecraft.getMinecraft().thePlayer.setPosition(x, Minecraft.getMinecraft().thePlayer.posY, z);
+ return;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("pansc")) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Taking panorama screenshot"));
+
+ AtomicInteger perspective = new AtomicInteger(0);
+ FancyPortals.perspectiveId = 0;
+
+ EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
+ p.prevRotationYaw = p.rotationYaw = 0;
+ p.prevRotationPitch = p.rotationPitch = 90;
+ devES.schedule(new Runnable() {
+ @Override
+ public void run() {
+ Minecraft.getMinecraft().addScheduledTask(() -> {
+ ScreenShotHelper.saveScreenshot(new File("C:/Users/James/Desktop/"), "pansc-"+perspective.get()+".png",
+ Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight,
+ Minecraft.getMinecraft().getFramebuffer());
+ });
+ if(perspective.incrementAndGet() >= 6) {
+ FancyPortals.perspectiveId = -1;
+ return;
+ }
+ devES.schedule(() -> {
+ FancyPortals.perspectiveId = perspective.get();
+ if(FancyPortals.perspectiveId == 5) {
+ p.prevRotationYaw = p.rotationYaw = 0;
+ p.prevRotationPitch = p.rotationPitch = -90;
+ } else if(FancyPortals.perspectiveId >= 1 && FancyPortals.perspectiveId <= 4) {
+ float yaw = 90*FancyPortals.perspectiveId-180;
+ if(yaw > 180) yaw -= 360;
+ p.prevRotationYaw = p.rotationYaw = yaw;
+ p.prevRotationPitch = p.rotationPitch = 0;
+ }
+ devES.schedule(this, 3000L, TimeUnit.MILLISECONDS);
+ }, 100L, TimeUnit.MILLISECONDS);
+ }
+ }, 3000L, TimeUnit.MILLISECONDS);
+
+ return;
+ }
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Executing dubious code"));
/*Minecraft.getMinecraft().thePlayer.rotationYaw = 0;
Minecraft.getMinecraft().thePlayer.rotationPitch = 0;
@@ -1070,6 +1127,7 @@ public class NotEnoughUpdates {
StorageManager.getInstance().loadConfig(new File(neuDir, "storageItems.json"));
FairySouls.load(new File(neuDir, "collected_fairy_souls.json"), gson);
PetInfoOverlay.loadConfig(new File(neuDir, "petCache.json"));
+ SlotLocking.getInstance().loadConfig(new File(neuDir, "slotLocking.json"));
if(config == null) {
config = new NEUConfig();
@@ -1093,12 +1151,14 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new DwarvenMinesTextures());
MinecraftForge.EVENT_BUS.register(new DwarvenMinesWaypoints());
MinecraftForge.EVENT_BUS.register(new FuelBar());
+ //MinecraftForge.EVENT_BUS.register(new FancyPortals());
MinecraftForge.EVENT_BUS.register(XPInformation.getInstance());
MinecraftForge.EVENT_BUS.register(OverlayManager.petInfoOverlay);
MinecraftForge.EVENT_BUS.register(OverlayManager.timersOverlay);
MinecraftForge.EVENT_BUS.register(new NullzeeSphere());
MinecraftForge.EVENT_BUS.register(InventoryStorageSelector.getInstance());
MinecraftForge.EVENT_BUS.register(SlotLocking.getInstance());
+ MinecraftForge.EVENT_BUS.register(FishingHelper.getInstance());
if(Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(CustomSkulls.getInstance());
@@ -1174,6 +1234,7 @@ public class NotEnoughUpdates {
try { StorageManager.getInstance().saveConfig(new File(neuDir, "storageItems.json")); } catch(Exception ignored) {}
try { FairySouls.save(new File(neuDir, "collected_fairy_souls.json"), gson); } catch(Exception ignored) {}
try { PetInfoOverlay.saveConfig(new File(neuDir, "petCache.json")); } catch(Exception ignored) {}
+ try { SlotLocking.getInstance().saveConfig(new File(neuDir, "slotLocking.json")); } catch(Exception ignored) {}
}
/**
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
index bc8ea93a..d27e6bd7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
@@ -157,7 +157,7 @@ public class BackgroundBlur {
try {
blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur",
- Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz);
+ output, blurOutputHorz);
blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
} catch(Exception e) { }
@@ -177,11 +177,11 @@ public class BackgroundBlur {
blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blurFactor);
GL11.glPushMatrix();
- /*GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
+ GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, output.framebufferObject);
GL30.glBlitFramebuffer(0, 0, width, height,
0, 0, output.framebufferWidth, output.framebufferHeight,
- GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);*/
+ GL11.GL_COLOR_BUFFER_BIT, GL11.GL_NEAREST);
blurShaderHorz.loadShader(0);
blurShaderVert.loadShader(0);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
index fb75ea23..3ab47531 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
@@ -217,13 +217,13 @@ public class GuiElementColour extends GuiElement {
if(opacitySlider) {
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);
+ x+5+64+5+valueOffset+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+valueOffset+15+6, y+5+64+5+5, true, 13, -1);
+ x+5+64+5+valueOffset+opacityOffset+6, y+5+64+5+5, true, 13, -1);
}
hexField.setSize(48, 10);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
index 965c705d..aded91e6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
@@ -16,6 +16,7 @@ import java.util.regex.Pattern;
public class GuiElementTextField {
+ public static final int SCISSOR_TEXT = 0b10000000;
public static final int DISABLE_BG = 0b1000000;
public static final int SCALE_TEXT = 0b100000;
public static final int NUM_ONLY = 0b10000;
@@ -73,6 +74,18 @@ public class GuiElementTextField {
return textField.getText();
}
+ public String getTextDisplay() {
+ String textNoColour = getText();
+ while(true) {
+ Matcher matcher = PATTERN_CONTROL_CODE.matcher(textNoColour);
+ if(!matcher.find()) break;
+ String code = matcher.group(1);
+ textNoColour = matcher.replaceFirst("\u00B6"+code);
+ }
+
+ return textNoColour;
+ }
+
public void setPrependText(String text) {
this.prependText = text;
}
@@ -130,13 +143,7 @@ public class GuiElementTextField {
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);
- }
- }
+ private static final Pattern PATTERN_CONTROL_CODE = Pattern.compile("(?i)\\u00A7([^\\u00B6]|$)(?!\\u00B6)");
public int getCursorPos(int mouseX, int mouseY) {
int xComp = mouseX - x;
@@ -148,12 +155,11 @@ public class GuiElementTextField {
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);
+ Matcher matcher = PATTERN_CONTROL_CODE.matcher(text);
if(!matcher.find() || matcher.groupCount() < 1) break;
String code = matcher.group(1);
if(code.isEmpty()) {
@@ -164,7 +170,7 @@ public class GuiElementTextField {
}
}
while(true) {
- Matcher matcher = patternControlCode.matcher(textNoColour);
+ Matcher matcher = PATTERN_CONTROL_CODE.matcher(textNoColour);
if(!matcher.find() || matcher.groupCount() < 1) break;
String code = matcher.group(1);
textNoColour = matcher.replaceFirst("\u00B6"+code);
@@ -351,6 +357,10 @@ public class GuiElementTextField {
if((options & FORCE_CAPS) != 0) typedChar = Character.toUpperCase(typedChar);
if((options & NO_SPACE) != 0 && typedChar == ' ') return;
+ if(typedChar == '\u00B6') {
+ typedChar = '\u00A7';
+ }
+
textField.setFocused(true);
textField.textboxKeyTyped(typedChar, keyCode);
@@ -368,6 +378,19 @@ public class GuiElementTextField {
textField.setCursorPosition(pos+1);
}
}
+ } else 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 + "\u272A" + after);
+ textField.setCursorPosition(pos+1);
+ }
+ }
}
}
@@ -415,13 +438,11 @@ public class GuiElementTextField {
}
//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);
+ Matcher matcher = PATTERN_CONTROL_CODE.matcher(text);
if(!matcher.find() || matcher.groupCount() < 1) break;
String code = matcher.group(1);
if(code.isEmpty()) {
@@ -432,7 +453,7 @@ public class GuiElementTextField {
}
}
while(true) {
- Matcher matcher = patternControlCode.matcher(textNoColor);
+ Matcher matcher = PATTERN_CONTROL_CODE.matcher(textNoColor);
if(!matcher.find() || matcher.groupCount() < 1) break;
String code = matcher.group(1);
textNoColor = matcher.replaceFirst("\u00B6"+code);
@@ -450,12 +471,21 @@ public class GuiElementTextField {
float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI])*scale;
xStartOffset = (int)((searchBarXSize-newLen)/2f);
- TextRenderUtils.drawStringCenteredScaledMaxWidth(texts[yOffI], Minecraft.getMinecraft().fontRendererObj, x+searchBarXSize/2f,
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(Utils.chromaStringByColourCode(texts[yOffI]), Minecraft.getMinecraft().fontRendererObj, x+searchBarXSize/2f,
y+searchBarYSize/2f+yOff, false,
searchBarXSize-2, customTextColour);
} else {
- Minecraft.getMinecraft().fontRendererObj.drawString(StringUtils.trimToWidth(texts[yOffI], searchBarXSize-10), x + 5,
- y+(searchBarYSize-8)/2+yOff, customTextColour);
+ if((options & SCISSOR_TEXT) != 0) {
+ GlScissorStack.push(x+5, 0, x+searchBarXSize, scaledresolution.getScaledHeight(), scaledresolution);
+ Minecraft.getMinecraft().fontRendererObj.drawString(Utils.chromaStringByColourCode(texts[yOffI]), x + 5,
+ y+(searchBarYSize-8)/2+yOff, customTextColour);
+ GlScissorStack.pop(scaledresolution);
+ } else {
+ String toRender = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(Utils.chromaStringByColourCode(texts[yOffI]), searchBarXSize-10);
+ Minecraft.getMinecraft().fontRendererObj.drawString(toRender, x + 5,
+ y+(searchBarYSize-8)/2+yOff, customTextColour);
+ }
+
}
}
@@ -482,7 +512,6 @@ public class GuiElementTextField {
String selectedText = textField.getSelectedText();
if(!selectedText.isEmpty()) {
- System.out.println("Start");
int leftIndex = Math.min(textField.getCursorPosition()+prependText.length(), textField.getSelectionEnd()+prependText.length());
int rightIndex = Math.max(textField.getCursorPosition()+prependText.length(), textField.getSelectionEnd()+prependText.length());
@@ -526,9 +555,6 @@ public class GuiElementTextField {
continue;
}
- //String c2 = bold ? EnumChatFormatting.BOLD.toString() : "" + c;
-
- System.out.println("Adding len for char:"+c+":"+Integer.toHexString(c));
int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c));
if(bold) len++;
if(i >= leftIndex && i < rightIndex) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/KeybindHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/KeybindHelper.java
index 306bc95e..7ebacac1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/KeybindHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/KeybindHelper.java
@@ -13,7 +13,9 @@ public class KeybindHelper {
return "Button "+(keyCode+101);
} else {
String keyName = Keyboard.getKeyName(keyCode);
- if(keyName.equalsIgnoreCase("LMENU")) {
+ if(keyName == null) {
+ keyName = "???";
+ } else if(keyName.equalsIgnoreCase("LMENU")) {
keyName = "LALT";
} else if(keyName.equalsIgnoreCase("RMENU")) {
keyName = "RALT";
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 651f75b7..ab4d1b7b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java
@@ -175,6 +175,8 @@ public class DungeonWin {
}
if(currentTime - lastDungeonFinish > 100 && currentTime - lastDungeonFinish < 10000) {
if(hideChat) {
+ if(text.size() > 50) text.clear();
+
e.setCanceled(true);
if(unformatted.contains("\u25AC")) {
hideChat = false;
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 5e1634e9..18324154 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java
@@ -81,7 +81,7 @@ public class SBGamemodes {
}
public enum IronmanMode {
- NORMAL("Normal", "Normal"),
+ NORMAL("Normal"),
IRONMAN(EnumChatFormatting.WHITE+"Ironman\n" +
"You are NOT allowed to trade or use the auction house.",
"You ", "Auction House", "Auctions Browser", "Auction View"),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
index c2f778a5..553a5d40 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
@@ -13,6 +13,7 @@ public class DamageCommas {
private static final HashMap<Integer, ChatComponentText> replacementMap = new HashMap<>();
+ //From [MVP++] HY7:
private static final EnumChatFormatting[] colours = {EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.WHITE};
public static void tick() {
@@ -31,8 +32,8 @@ public class DamageCommas {
return component;
}
- if(formatted.length() >= 7 && formatted.startsWith("\u00A7f\u2727") &&
- formatted.endsWith("\u2727\u00a7r")) {
+ if(formatted.length() >= 7 && (formatted.startsWith("\u00A7f\u2727") || formatted.startsWith("\u00A7f\u2694")) &&
+ (formatted.endsWith("\u2727\u00a7r") || formatted.endsWith("\u2694\u00a7r"))) {
if(NotEnoughUpdates.INSTANCE.config.misc.damageIndicatorStyle == 2) {
String numbers = Utils.cleanColour(formatted.substring(3, formatted.length()-3)).trim().replaceAll("[^0-9]", "");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FancyPortals.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FancyPortals.java
new file mode 100644
index 00000000..a9be6fd5
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FancyPortals.java
@@ -0,0 +1,303 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.cosmetics.CapeNode;
+import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer;
+import io.github.moulberry.notenoughupdates.util.TexLoc;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderGlobal;
+import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.chunk.CompiledChunk;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.client.renderer.vertex.VertexFormat;
+import net.minecraft.client.renderer.vertex.VertexFormatElement;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.network.play.server.S07PacketRespawn;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.client.event.RenderLivingEvent;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.util.glu.Project;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class FancyPortals {
+
+ private static ResourceLocation[] RENDERS = new ResourceLocation[6];
+
+ static {
+ for(int i=0; i<6; i++) {
+ RENDERS[i] = new ResourceLocation("notenoughupdates:portal_panoramas/nether/pansc-"+(i+1)+".png");
+ }
+ }
+
+ public static int perspectiveId = -1;
+ public static boolean overridePerspective() {
+ if(perspectiveId >= 0 && !Keyboard.isKeyDown(Keyboard.KEY_K)) {
+ if(perspectiveId == 0) {
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ GlStateManager.ortho(0.0D, 7, 7, 0.0D, -100D, 100D);
+ GlStateManager.scale(1, 1, -1);
+ GlStateManager.matrixMode(5888);
+ GlStateManager.loadIdentity();
+ GlStateManager.translate(3.5F, 3.5F, -1.0F);
+ GlStateManager.rotate(-90, 1, 0, 0);
+ } else if(perspectiveId <= 4) {
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ Project.gluPerspective(90, 1, 0.05F, 160 * MathHelper.SQRT_2);
+ GlStateManager.matrixMode(5888);
+ GlStateManager.loadIdentity();
+ GlStateManager.rotate(perspectiveId*90, 0, 1, 0);
+ GlStateManager.translate(0, -3.5f, 0);
+ } else {
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ Project.gluPerspective(90, 1, 0.05F, 160 * MathHelper.SQRT_2);
+ GlStateManager.matrixMode(5888);
+ GlStateManager.loadIdentity();
+ GlStateManager.rotate(-90, 1, 0, 0);
+ GlStateManager.translate(0, -3.5f, 0);
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ private static WorldRenderer surfaceWorldRenderer = null;
+
+ private static WorldRenderer getSurfaceWorldRenderer() {
+ if(surfaceWorldRenderer != null && !Keyboard.isKeyDown(Keyboard.KEY_O)) {
+ return surfaceWorldRenderer;
+ }
+
+ surfaceWorldRenderer = createSurfaceWorldRenderer();
+
+ return surfaceWorldRenderer;
+ }
+
+ private static void drawPoint(WorldRenderer worldRenderer, int x, int y) {
+ float xDist = 1-Math.abs(x-50)/50f;
+ float yDist = 1-Math.abs(y-50)/50f;
+ float distToEdge = Math.min(xDist, yDist);
+
+ float z = 0.4142f;
+ if(distToEdge < 1/3.5f) {
+ if(y > 50 && yDist < xDist) {
+ float circleH = 1.414f - distToEdge*3.5f*1.414f;
+ z = (float)Math.sqrt(2f-circleH*circleH);
+ z *= 0.4142f / 1.4142f;
+ } else {
+ float circleH = 1 - distToEdge*3.5f;
+ z = (float)Math.sqrt(2f-circleH*circleH)-1;
+ }
+ }
+
+ worldRenderer.pos(x*7/100f, y*7/100f, z).tex(x/100f, y/100f).endVertex();
+ }
+
+ private static WorldRenderer createSurfaceWorldRenderer() {
+ WorldRenderer worldRenderer = new WorldRenderer(20*100*100);
+ worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
+
+ for(int x=0; x<100; x++) {
+ for(int y=0; y<100; y++) {
+ drawPoint(worldRenderer, x, y);
+ drawPoint(worldRenderer, x, y+1);
+ drawPoint(worldRenderer, x+1, y+1);
+ drawPoint(worldRenderer, x+1, y);
+ }
+ }
+
+ return worldRenderer;
+ }
+
+ private static long overridingRenderMillis = -1;
+
+ public static void onRespawnPacket(S07PacketRespawn packet) {
+ if(true) return;
+ if (packet.getDimensionID() != Minecraft.getMinecraft().thePlayer.dimension) {
+ overridingRenderMillis = System.currentTimeMillis();
+ }
+ }
+
+ public static boolean shouldRenderLoadingScreen() {
+ return false;
+ }
+
+ public static boolean shouldRenderWorldOverlay() {
+ if(overridingRenderMillis > 0) {
+ if(Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null) {
+ RenderGlobal renderGlobal = Minecraft.getMinecraft().renderGlobal;
+ int loaded = 0;
+ for(RenderGlobal.ContainerLocalRenderInformation info : renderGlobal.renderInfos) {
+ CompiledChunk compiledchunk = info.renderChunk.compiledChunk;
+
+ if (compiledchunk != CompiledChunk.DUMMY && !compiledchunk.isEmpty()) {
+ if(++loaded >= 5) {
+ overridingRenderMillis = -1;
+ return false;
+ }
+ }
+ }
+ }
+ if(System.currentTimeMillis() - overridingRenderMillis > 1000) {
+ overridingRenderMillis = -1;
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static void onUpdateCameraAndRender(float partialTicks, long nanoTime) {
+ if(overridingRenderMillis > 0) {
+ if(Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null) {
+ Minecraft.getMinecraft().thePlayer.timeInPortal = 0.3f;
+ Minecraft.getMinecraft().thePlayer.prevTimeInPortal = 0.3f;
+ }
+
+ GlStateManager.rotate(90, 0, 1, 0);
+ renderWorld();
+
+ Minecraft.getMinecraft().ingameGUI.renderGameOverlay(partialTicks);
+ }
+ }
+
+ @SubscribeEvent
+ public void onRenderEntityYeeter(RenderLivingEvent.Pre<EntityLivingBase> event) {
+ /*if(!Keyboard.isKeyDown(Keyboard.KEY_G)) return;
+ event.setCanceled(true);
+ if(event.entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.entity;
+ if(player.getUniqueID().version() == 4) {
+ event.setCanceled(true);
+ }
+ }*/
+ }
+
+ private static void renderWorld() {
+ for(int i=5; i>=0; i--) {
+ GlStateManager.pushMatrix();
+
+ GlStateManager.disableDepth();
+ GlStateManager.disableLighting();
+
+
+ GlStateManager.rotate(180, 0, 0, 1);
+ GlStateManager.rotate(-90, 0, 1, 0);
+
+ if(i != 0) GlStateManager.translate(0, -3.49, 0);
+
+ switch (i) {
+ case 1:
+ GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); break;
+ case 2:
+ GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); break;
+ case 3:
+ GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); break;
+ case 5:
+ GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); break;
+ case 0:
+ GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); break;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(RENDERS[i]);
+ GlStateManager.color(1, 1, 1, 1);
+ if(i != 0) GlStateManager.translate(0, 0, 3.49);
+
+ if(i != 0) {
+ GlStateManager.translate(-3.5f, -3.5f, 0);
+ WorldRenderer worldRenderer = getSurfaceWorldRenderer();
+ VertexFormat vertexformat = worldRenderer.getVertexFormat();
+ int stride = vertexformat.getNextOffset();
+ ByteBuffer bytebuffer = worldRenderer.getByteBuffer();
+ List<VertexFormatElement> list = vertexformat.getElements();
+
+ for (int index = 0; index < list.size(); index++) {
+ VertexFormatElement vertexformatelement = list.get(index);
+ vertexformatelement.getUsage().preDraw(vertexformat, index, stride, bytebuffer);
+ }
+
+ GL11.glDrawArrays(worldRenderer.getDrawMode(), 0, worldRenderer.getVertexCount());
+
+ for (int index = 0; index < list.size(); index++) {
+ VertexFormatElement vertexformatelement = list.get(index);
+ vertexformatelement.getUsage().postDraw(vertexformat, index, stride, bytebuffer);
+ }
+ } else {
+ Utils.drawTexturedRect(-3.5f, -3.5f, 7, 7, i == 0 ? GL11.GL_NEAREST : GL11.GL_LINEAR);
+ }
+
+ GlStateManager.enableDepth();
+
+ GlStateManager.popMatrix();
+ }
+ }
+
+ @SubscribeEvent
+ public void onRenderLast(RenderWorldLastEvent event) {
+ if(true) return;
+ if(!Minecraft.getMinecraft().getFramebuffer().isStencilEnabled())
+ Minecraft.getMinecraft().getFramebuffer().enableStencil();
+
+ GL11.glEnable(GL11.GL_STENCIL_TEST);
+ GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF);
+ GL11.glStencilOp(GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_REPLACE);
+ GL11.glStencilMask(0xFF);
+ GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);
+ GlStateManager.enableDepth();
+ GlStateManager.enableCull();
+ GlStateManager.cullFace(GL11.GL_BACK);
+
+ GL11.glColorMask(false, false, false, false);
+
+ Entity viewer = Minecraft.getMinecraft().getRenderViewEntity();
+ double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * event.partialTicks;
+ double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * event.partialTicks;
+ double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * event.partialTicks;
+ GlStateManager.pushMatrix();
+
+ GlStateManager.translate(-viewerX+12+5/16f, -viewerY+100, -viewerZ+39);
+ GlStateManager.rotate(90, 0, 1, 0);
+ Gui.drawRect(0, 5, 3, 0, 0xffffffff);
+ GlStateManager.rotate(180, 0, 1, 0);
+ GlStateManager.translate(-3, 0, -6/16f);
+ Gui.drawRect(0, 5, 3, 0, 0xffffffff);
+
+ GlStateManager.popMatrix();
+
+
+ GL11.glColorMask(true, true, true, true);
+
+ // Only pass stencil test if equal to 1
+ GL11.glStencilMask(0x00);
+ GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
+
+ GlStateManager.translate(-viewerX+12, -viewerY+100, -viewerZ+37.5f);
+
+ renderWorld();
+
+ GL11.glDisable(GL11.GL_STENCIL_TEST);
+ GlStateManager.enableCull();
+ }
+
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
new file mode 100644
index 00000000..2c59fcd8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -0,0 +1,549 @@
+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.client.Minecraft;
+import net.minecraft.client.audio.ISound;
+import net.minecraft.client.audio.PositionedSound;
+import net.minecraft.client.audio.PositionedSoundRecord;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.projectile.EntityFishHook;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.util.*;
+
+public class FishingHelper {
+
+ private static final FishingHelper INSTANCE = new FishingHelper();
+
+ public static FishingHelper getInstance() {
+ return INSTANCE;
+ }
+
+ public static class WakeChain {
+ public int particleNum = 0;
+ public long lastUpdate;
+ public double currentAngle;
+ public double currentX;
+ public double currentZ;
+
+ public final HashMap<Integer, Double> distances = new HashMap<>();
+
+ public WakeChain(long lastUpdate, double currentAngle, double currentX, double currentZ) {
+ this.lastUpdate = lastUpdate;
+ this.currentAngle = currentAngle;
+ this.currentX = currentX;
+ this.currentZ = currentZ;
+ }
+ }
+
+ private enum PlayerWarningState {
+ NOTHING,
+ FISH_INCOMING,
+ FISH_HOOKED
+ }
+ private PlayerWarningState warningState = PlayerWarningState.NOTHING;
+ private int hookedWarningStateTicks = 0;
+
+ public final HashMap<Integer, EntityFishHook> hookEntities = new HashMap<>();
+ public final HashMap<WakeChain, List<Integer>> chains = new HashMap<>();
+
+ private long lastCastRodMillis = 0;
+ private int pingDelayTicks = 0;
+ private final List<Integer> pingDelayList = new ArrayList<>();
+ private int buildupSoundDelay = 0;
+
+ private static final ResourceLocation FISHING_WARNING_EXCLAM = new ResourceLocation("notenoughupdates:fishing_warning_exclam.png");
+ public void onRenderBobber(EntityFishHook hook) {
+ if(Minecraft.getMinecraft().thePlayer.fishEntity == hook && warningState != PlayerWarningState.NOTHING) {
+ GlStateManager.disableCull();
+ GlStateManager.disableLighting();
+ GL11.glDepthFunc(GL11.GL_ALWAYS);
+ GlStateManager.scale(1, -1, 1);
+
+ float offset = warningState == PlayerWarningState.FISH_HOOKED ? 0.5f : 0f;
+
+ float centerOffset = 0.5f/8f;
+ Minecraft.getMinecraft().getTextureManager().bindTexture(FISHING_WARNING_EXCLAM);
+ Utils.drawTexturedRect(centerOffset - 4f/8f, -20/8f, 1f, 2f, 0+offset, 0.5f+offset, 0, 1, GL11.GL_NEAREST);
+
+ GlStateManager.scale(1, -1, 1);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GlStateManager.enableLighting();
+ GlStateManager.enableCull();
+ }
+ }
+
+ public void addEntity(int entityId, Entity entity) {
+ if(entity instanceof EntityFishHook) {
+ hookEntities.put(entityId, (EntityFishHook) entity);
+
+ if(((EntityFishHook) entity).angler == Minecraft.getMinecraft().thePlayer) {
+ long currentTime = System.currentTimeMillis();
+ long delay = currentTime - lastCastRodMillis;
+ if(delay > 0 && delay < 500) {
+ if(delay > 300) delay = 300;
+ pingDelayList.add(0, (int)delay);
+ }
+ }
+ }
+ }
+
+ public void removeEntity(int entityId) {
+ hookEntities.remove(entityId);
+ }
+
+ @SubscribeEvent
+ public void onWorldUnload(WorldEvent.Unload event) {
+ hookEntities.clear();
+ chains.clear();
+ }
+
+ @SubscribeEvent
+ public void onPlayerInteract(PlayerInteractEvent event) {
+ if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR &&
+ event.entityPlayer == Minecraft.getMinecraft().thePlayer) {
+
+ ItemStack heldItem = event.entityPlayer.getHeldItem();
+
+ if(heldItem != null && heldItem.getItem() == Items.fishing_rod) {
+ long currentTime = System.currentTimeMillis();
+ if(currentTime - lastCastRodMillis > 500) {
+ lastCastRodMillis = currentTime;
+ }
+ }
+
+ }
+ }
+
+ private int tickCounter = 0;
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if(Minecraft.getMinecraft().thePlayer != null && event.phase == TickEvent.Phase.END) {
+ if(buildupSoundDelay > 0) buildupSoundDelay--;
+
+ if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning) {
+ if(Minecraft.getMinecraft().thePlayer.fishEntity != null) {
+ if(!pingDelayList.isEmpty()) {
+ while(pingDelayList.size() > 5) pingDelayList.remove(pingDelayList.size()-1);
+
+ int totalMS = 0;
+ for(int delay : pingDelayList) {
+ totalMS += delay;
+ }
+
+ int averageMS = totalMS / pingDelayList.size();
+ pingDelayTicks = (int)Math.ceil(averageMS/50f);
+ }
+ }
+
+ if(hookedWarningStateTicks > 0) {
+ hookedWarningStateTicks--;
+ warningState = PlayerWarningState.FISH_HOOKED;
+ } else {
+ warningState = PlayerWarningState.NOTHING;
+ if(Minecraft.getMinecraft().thePlayer.fishEntity != null) {
+ int fishEntityId = Minecraft.getMinecraft().thePlayer.fishEntity.getEntityId();
+ for(Map.Entry<WakeChain, List<Integer>> entry : chains.entrySet()) {
+ if(entry.getKey().particleNum >= 3 && entry.getValue().contains(fishEntityId)) {
+ warningState = PlayerWarningState.FISH_INCOMING;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(tickCounter++ >= 20) {
+ long currentTime = System.currentTimeMillis();
+ tickCounter = 0;
+
+ Set<Integer> toRemoveEnt = new HashSet<>();
+ for(Map.Entry<Integer, EntityFishHook> entry : hookEntities.entrySet()) {
+ if(entry.getValue().isDead) {
+ toRemoveEnt.add(entry.getKey());
+ }
+ }
+ hookEntities.keySet().removeAll(toRemoveEnt);
+
+ Set<WakeChain> toRemoveChain = new HashSet<>();
+ for(Map.Entry<WakeChain, List<Integer>> entry : chains.entrySet()) {
+ if(currentTime - entry.getKey().lastUpdate > 200 ||
+ entry.getValue().isEmpty() ||
+ Collections.disjoint(entry.getValue(), hookEntities.keySet())) {
+ toRemoveChain.add(entry.getKey());
+ }
+ }
+ chains.keySet().removeAll(toRemoveChain);
+ }
+ }
+ }
+
+ private double calculateAngleFromOffsets(double xOffset, double zOffset) {
+ double angleX = Math.toDegrees(Math.acos(xOffset / 0.04f));
+ double angleZ = Math.toDegrees(Math.asin(zOffset / 0.04f));
+
+ if(xOffset < 0) {
+ angleZ = 180 - angleZ;
+ }
+ if(zOffset < 0) {
+ angleX = 360 - angleX;
+ }
+
+ angleX %= 360;
+ angleZ %= 360;
+ if(angleX < 0) angleX += 360;
+ if(angleZ < 0) angleZ += 360;
+
+ double dist = angleX - angleZ;
+ if(dist < -180) dist += 360;
+ if(dist > 180) dist -= 360;
+
+ return angleZ + dist/2;
+ }
+
+ private boolean checkAngleWithinRange(double angle1, double angle2, double range) {
+ double dist = Math.abs(angle1 - angle2);
+ if(dist > 180) dist = 360 - dist;
+
+ return dist <= range;
+ }
+
+ private enum HookPossibleRet {
+ NOT_POSSIBLE,
+ EITHER,
+ ANGLE1,
+ ANGLE2
+ }
+
+ private HookPossibleRet isHookPossible(EntityFishHook hook, double particleX, double particleY, double particleZ, double angle1, double angle2) {
+ double dY = particleY - hook.posY;
+ if(Math.abs(dY) > 0.5f) {
+ return HookPossibleRet.NOT_POSSIBLE;
+ }
+
+ double dX = particleX - hook.posX;
+ double dZ = particleZ - hook.posZ;
+ double dist = Math.sqrt(dX*dX + dZ*dZ);
+
+ if(dist < 0.2) {
+ return HookPossibleRet.EITHER;
+ } else {
+ float angleAllowance = (float)Math.toDegrees(Math.atan2(0.03125f, dist))*1.5f;
+ float angleHook = (float) Math.toDegrees(Math.atan2(dX, dZ));
+ angleHook %= 360;
+ if(angleHook < 0) angleHook += 360;
+
+ if(checkAngleWithinRange(angle1, angleHook, angleAllowance)) {
+ return HookPossibleRet.ANGLE1;
+ } else if(checkAngleWithinRange(angle2, angleHook, angleAllowance)) {
+ return HookPossibleRet.ANGLE2;
+ }
+ }
+ return HookPossibleRet.NOT_POSSIBLE;
+ }
+
+ public static EnumParticleTypes type = EnumParticleTypes.BARRIER;
+
+ private static final float ZERO_PITCH = 1.0f;
+ private static final float MAX_PITCH = 0.1f;
+ private static final float MAX_DISTANCE = 5f;
+ private float calculatePitchFromDistance(float d) {
+ if(d < 0.1f) d = 0.1f;
+ if(d > MAX_DISTANCE) d = MAX_DISTANCE;
+
+ return 1/(d + (1/(ZERO_PITCH-MAX_PITCH))) * (1 - d/MAX_DISTANCE) + MAX_PITCH;
+ }
+
+ public boolean onSpawnParticle(EnumParticleTypes particleType, double x, double y, double z, double xOffset, double yOffset, double zOffset) {
+ if(!NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll &&
+ !NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles &&
+ !NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning) {
+ return false;
+ }
+ if(hookEntities.isEmpty()) {
+ return false;
+ }
+
+ if(particleType == EnumParticleTypes.WATER_WAKE && Math.abs(yOffset - 0.01f) < 0.001f) {
+ double angle1 = calculateAngleFromOffsets(xOffset, -zOffset);
+ double angle2 = calculateAngleFromOffsets(-xOffset, zOffset);
+
+ final List<Integer> possibleHooks1 = new ArrayList<>();
+ final List<Integer> possibleHooks2 = new ArrayList<>();
+
+ for(EntityFishHook hook : hookEntities.values()) {
+ if(hook.isDead) continue;
+ if(possibleHooks1.contains(hook.getEntityId())) continue;
+ if(possibleHooks2.contains(hook.getEntityId())) continue;
+
+ HookPossibleRet ret = isHookPossible(hook, x, y, z, angle1, angle2);
+ if(ret == HookPossibleRet.ANGLE1) {
+ possibleHooks1.add(hook.getEntityId());
+ } else if(ret == HookPossibleRet.ANGLE2) {
+ possibleHooks2.add(hook.getEntityId());
+ } else if(ret == HookPossibleRet.EITHER) {
+ possibleHooks1.add(hook.getEntityId());
+ possibleHooks2.add(hook.getEntityId());
+ }
+ }
+
+ if(!possibleHooks1.isEmpty() || !possibleHooks2.isEmpty()) {
+ long currentTime = System.currentTimeMillis();
+
+ boolean isMainPlayer = false;
+
+ boolean foundChain = false;
+ for(Map.Entry<WakeChain, List<Integer>> entry : chains.entrySet()) {
+ WakeChain chain = entry.getKey();
+
+ if(currentTime - chain.lastUpdate > 200) continue;
+
+ double updateAngle;
+ List<Integer> possibleHooks;
+ if(checkAngleWithinRange(chain.currentAngle, angle1, 16)) {
+ possibleHooks = possibleHooks1;
+ updateAngle = angle1;
+ } else if(checkAngleWithinRange(chain.currentAngle, angle2, 16)) {
+ possibleHooks = possibleHooks2;
+ updateAngle = angle2;
+ } else {
+ continue;
+ }
+
+ if(!Collections.disjoint(entry.getValue(), possibleHooks)) {
+ HashSet<Integer> newHooks = new HashSet<>();
+
+ for(int hookEntityId : possibleHooks) {
+ if(entry.getValue().contains(hookEntityId) && chain.distances.containsKey(hookEntityId)) {
+ EntityFishHook entity = hookEntities.get(hookEntityId);
+
+ if(entity != null && !entity.isDead) {
+ double oldDistance = chain.distances.get(hookEntityId);
+
+ double dX = entity.posX - x;
+ double dZ = entity.posZ - z;
+ double newDistance = Math.sqrt(dX*dX + dZ*dZ);
+
+ double delta = oldDistance - newDistance;
+
+ if(newDistance < 0.2 || (delta > -0.1 && delta < 0.3)) {
+ if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishWarning &&
+ Minecraft.getMinecraft().thePlayer.fishEntity != null &&
+ Minecraft.getMinecraft().thePlayer.fishEntity.getEntityId() == hookEntityId &&
+ chain.particleNum > 3) {
+
+ if(newDistance <= 0.2f + 0.1f*pingDelayTicks) {
+ if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishHookedSounds &&
+ hookedWarningStateTicks <= 0) {
+ Minecraft.getMinecraft().getSoundHandler().playSound(
+ PositionedSoundRecord.create(new ResourceLocation("note.pling"), 2f));
+ }
+
+ hookedWarningStateTicks = 12;
+ } else if(newDistance >= 0.4f + 0.1f*pingDelayTicks) {
+ if(NotEnoughUpdates.INSTANCE.config.fishing.incomingFishIncSounds &&
+ buildupSoundDelay <= 0) {
+ ISound sound = new PositionedSound(new ResourceLocation("note.pling")) {{
+ volume = 0.1f;
+ pitch = calculatePitchFromDistance((float)newDistance - (0.3f+0.1f*pingDelayTicks));
+ repeat = false;
+ repeatDelay = 0;
+ attenuationType = ISound.AttenuationType.NONE;
+ }};
+ Minecraft.getMinecraft().getSoundHandler().playSound(sound);
+ buildupSoundDelay = 4;
+ }
+ }
+ }
+
+ chain.distances.put(hookEntityId, newDistance);
+ newHooks.add(hookEntityId);
+ }
+ }
+
+ }
+ }
+ if(newHooks.isEmpty()) {
+ continue;
+ }
+
+ entry.getValue().retainAll(newHooks);
+ chain.distances.keySet().retainAll(newHooks);
+
+ for(int i : entry.getValue()) {
+ EntityFishHook hook = hookEntities.get(i);
+ if(hook != null && hook.angler == Minecraft.getMinecraft().thePlayer) {
+ isMainPlayer = true;
+ break;
+ }
+ }
+
+ chain.lastUpdate = currentTime;
+ chain.particleNum++;
+ chain.currentAngle = updateAngle;
+
+ foundChain = true;
+ }
+ }
+
+
+ if(!foundChain) {
+ possibleHooks1.removeAll(possibleHooks2);
+ if(!possibleHooks1.isEmpty()) {
+ for(int i : possibleHooks1) {
+ EntityFishHook hook = hookEntities.get(i);
+ if(hook != null && hook.angler == Minecraft.getMinecraft().thePlayer) {
+ isMainPlayer = true;
+ break;
+ }
+ }
+
+ WakeChain chain = new WakeChain(currentTime, angle1, x, z);
+ for(int hookEntityId : possibleHooks1) {
+ EntityFishHook entity = hookEntities.get(hookEntityId);
+
+ if(entity != null && !entity.isDead) {
+ double dX = entity.posX - x;
+ double dZ = entity.posZ - z;
+ double newDistance = Math.sqrt(dX*dX + dZ*dZ);
+ chain.distances.put(hookEntityId, newDistance);
+ }
+ }
+ chains.put(chain, possibleHooks1);
+ } else if(!possibleHooks2.isEmpty()) {
+ for(int i : possibleHooks2) {
+ EntityFishHook hook = hookEntities.get(i);
+ if(hook != null && hook.angler == Minecraft.getMinecraft().thePlayer) {
+ isMainPlayer = true;
+ break;
+ }
+ }
+
+ WakeChain chain = new WakeChain(currentTime, angle2, x, z);
+ for(int hookEntityId : possibleHooks2) {
+ EntityFishHook entity = hookEntities.get(hookEntityId);
+
+ if(entity != null && !entity.isDead) {
+ double dX = entity.posX - x;
+ double dZ = entity.posZ - z;
+ double newDistance = Math.sqrt(dX*dX + dZ*dZ);
+ chain.distances.put(hookEntityId, newDistance);
+ }
+ }
+ chains.put(chain, possibleHooks2);
+ }
+ }
+
+ int particleTypeI;
+ String particleCustomColour;
+ if(isMainPlayer) {
+ particleTypeI = NotEnoughUpdates.INSTANCE.config.fishing.yourParticleType;
+ particleCustomColour = NotEnoughUpdates.INSTANCE.config.fishing.yourParticleColour;
+ } else if(NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll) {
+ return true;
+ } else {
+ particleTypeI = NotEnoughUpdates.INSTANCE.config.fishing.otherParticleType;
+ particleCustomColour = NotEnoughUpdates.INSTANCE.config.fishing.otherParticleColour;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.config.fishing.enableCustomParticles) {
+ return false;
+ }
+
+ int argb = SpecialColour.specialToChromaRGB(particleCustomColour);
+
+ if(particleTypeI == 0) {
+ return false;
+ } else if(particleTypeI == 1) {
+ return true;
+ }
+
+ if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().getRenderViewEntity() != null && Minecraft.getMinecraft().effectRenderer != null) {
+ int i = Minecraft.getMinecraft().gameSettings.particleSetting;
+
+ if (i == 1 && Minecraft.getMinecraft().theWorld.rand.nextInt(3) == 0) {
+ return true;
+ }
+
+ if(i >= 2) {
+ return true;
+ }
+
+ double xDist = Minecraft.getMinecraft().getRenderViewEntity().posX - x;
+ double yDist = Minecraft.getMinecraft().getRenderViewEntity().posY - y;
+ double zDist = Minecraft.getMinecraft().getRenderViewEntity().posZ - z;
+ double distSq = xDist*xDist + yDist*yDist + zDist*zDist;
+
+ if(distSq < 32*32) {
+ boolean customColour = false;
+ double yVel = 0;
+
+ switch(particleTypeI) {
+ case 2:
+ particleType = EnumParticleTypes.FIREWORKS_SPARK;
+ customColour = true;
+ yVel = 0.05;
+ break;
+ case 3:
+ particleType = EnumParticleTypes.SPELL_MOB;
+ customColour = true;
+ break;
+ case 4:
+ particleType = EnumParticleTypes.REDSTONE;
+ customColour = true;
+ break;
+ case 5:
+ particleType = EnumParticleTypes.FLAME;
+ yVel = 0.015;
+ break;
+ case 6:
+ particleType = EnumParticleTypes.CRIT;
+ yVel = 0.05;
+ break;
+ case 7:
+ particleType = EnumParticleTypes.CRIT_MAGIC;
+ yVel = 0.05;
+ break;
+ }
+
+ if(customColour && (((argb >> 24) & 0xFF) < 10)) {
+ return true;
+ }
+
+ EntityFX fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(particleType.getParticleID(), x, y, z, 0, 0, 0);
+
+ fx.motionX = Math.random() * 0.02 - 0.01;
+ fx.motionY = yVel;
+ fx.motionZ = Math.random() * 0.02 - 0.01;
+
+ if(customColour) {
+ float red = ((argb >> 16) & 0xFF) / 255f;
+ float green = ((argb >> 8) & 0xFF) / 255f;
+ float blue = (argb & 0xFF) / 255f;
+ float alpha = ((argb >> 24) & 0xFF) / 255f;
+ fx.setRBGColorF(red, green, blue);
+ fx.setAlphaF(alpha);
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
index c36f619e..546f9d89 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
@@ -60,8 +60,8 @@ public class ItemCooldowns {
@SubscribeEvent
public void onWorldUnload(WorldEvent.Load event) {
blocksClicked.clear();
+ if(pickaxeCooldown > 0) pickaxeUseCooldownMillisRemaining = 60*1000;
pickaxeCooldown = -1;
- pickaxeUseCooldownMillisRemaining = 60*1000;
}
public static long getTreecapCooldownWithPet(){
@@ -127,14 +127,14 @@ public class ItemCooldowns {
}
}
}
- pickaxeCooldown = 120;
+ pickaxeCooldown = 0;
}
}
@SubscribeEvent
public void onChatMessage(ClientChatReceivedEvent event) {
- if(PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches()) {
+ if(pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches()) {
updatePickaxeCooldown();
pickaxeUseCooldownMillisRemaining = pickaxeCooldown*1000;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
index b07408a8..7006df74 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java
@@ -49,6 +49,7 @@ public class ItemCustomizeManager {
public static class ItemData {
public String customName = null;
+ public String customNamePrefix = "";
public boolean overrideEnchantGlint = false;
public boolean enchantGlintValue;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NPCRetexturing.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NPCRetexturing.java
index 465d3ea9..a0b0cd64 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NPCRetexturing.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NPCRetexturing.java
@@ -87,7 +87,6 @@ public class NPCRetexturing implements IResourceManagerReloadListener {
}
}
} catch(Exception e) {
- e.printStackTrace();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
index 99ab6a84..e7c5b460 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
@@ -1,5 +1,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.KeybindHelper;
@@ -15,6 +17,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
@@ -26,15 +29,23 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.function.Consumer;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
public class SlotLocking {
private static final SlotLocking INSTANCE = new SlotLocking();
+
+ private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
+
private static final LockedSlot DEFAULT_LOCKED_SLOT = new LockedSlot();
private final ResourceLocation LOCK = new ResourceLocation("notenoughupdates:slotlocking/lock.png");
+ private final ResourceLocation BOUND = new ResourceLocation("notenoughupdates:slotlocking/bound.png");
public static SlotLocking getInstance() {
return INSTANCE;
@@ -63,8 +74,28 @@ public class SlotLocking {
private boolean lockKeyHeld = false;
private Slot pairingSlot = null;
+ public void loadConfig(File file) {
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
+ config = GSON.fromJson(reader, SlotLockingConfig.class);
+ } catch(Exception ignored) { }
+ if(config == null) {
+ config = new SlotLockingConfig();
+ }
+ }
+
+ public void saveConfig(File file) {
+ try {
+ file.createNewFile();
+ try(BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
+ writer.write(GSON.toJson(config));
+ }
+ } catch(Exception ignored) {
+ ignored.printStackTrace();
+ }
+ }
+
private LockedSlot[] getDataForProfile() {
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return null;
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) return null;
if(SBInfo.getInstance().currentProfile == null) return null;
SlotLockProfile profile = config.profileData.computeIfAbsent(SBInfo.getInstance().currentProfile,
@@ -94,9 +125,9 @@ public class SlotLocking {
return slot;
}
- @SubscribeEvent
- public void keyboardInput(GuiScreenEvent.KeyboardInputEvent.Post event) {
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ @SubscribeEvent(priority = EventPriority.LOW)
+ public void keyboardInput(GuiScreenEvent.KeyboardInputEvent.Pre event) {
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) {
return;
}
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
@@ -104,8 +135,8 @@ public class SlotLocking {
}
GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
- int key = Keyboard.KEY_L;
- if(!lockKeyHeld && KeybindHelper.isKeyPressed(key)) {
+ int key = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey;
+ if(!lockKeyHeld && KeybindHelper.isKeyPressed(key) && !Keyboard.isRepeatEvent()) {
final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
final int scaledWidth = scaledresolution.getScaledWidth();
final int scaledHeight = scaledresolution.getScaledHeight();
@@ -113,7 +144,7 @@ public class SlotLocking {
int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1;
Slot slot = container.getSlotAtPosition(mouseX, mouseY);
- if(slot != null && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) {
+ if(slot != null && slot.getSlotIndex() != 8 && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) {
int slotNum = slot.getSlotIndex();
if(slotNum >= 0 && slotNum <= 39) {
boolean isHotbar = slotNum < 9;
@@ -131,11 +162,16 @@ public class SlotLocking {
if(lockedSlots != null) {
if(lockedSlots[slotNum] == null) {
lockedSlots[slotNum] = new LockedSlot();
- lockedSlots[slotNum].locked = true;
- lockedSlots[slotNum].boundTo = -1;
- } else {
- lockedSlots[slotNum].locked = !lockedSlots[slotNum].locked;
- lockedSlots[slotNum].boundTo = -1;
+ }
+ lockedSlots[slotNum].locked = !lockedSlots[slotNum].locked;
+ lockedSlots[slotNum].boundTo = -1;
+
+ if(isHotbar && lockedSlots[slotNum].locked) {
+ for(int i = 9; i <= 39; i++) {
+ if(lockedSlots[i] != null && lockedSlots[i].boundTo == slotNum) {
+ lockedSlots[i].boundTo = -1;
+ }
+ }
}
}
}
@@ -147,9 +183,9 @@ public class SlotLocking {
}
}
- @SubscribeEvent
- public void mouseEvent(GuiScreenEvent.MouseInputEvent event) {
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ @SubscribeEvent(priority = EventPriority.LOW)
+ public void mouseEvent(GuiScreenEvent.MouseInputEvent.Pre event) {
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) {
return;
}
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
@@ -157,7 +193,7 @@ public class SlotLocking {
}
GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
- if(lockKeyHeld && pairingSlot != null) {
+ if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && lockKeyHeld && pairingSlot != null) {
final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
final int scaledWidth = scaledresolution.getScaledWidth();
final int scaledHeight = scaledresolution.getScaledHeight();
@@ -165,9 +201,10 @@ public class SlotLocking {
int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1;
Slot slot = container.getSlotAtPosition(mouseX, mouseY);
- if(slot != null && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) {
+ if(slot != null && slot.getSlotIndex() != 8 && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) {
int slotNum = slot.getSlotIndex();
if(slotNum >= 0 && slotNum <= 39) {
+
boolean isHotbar = slotNum < 9;
boolean isInventory = !isHotbar && slotNum < 36;
boolean isArmor = !isHotbar && !isInventory;
@@ -176,14 +213,30 @@ public class SlotLocking {
if(isHotbar && slotNum != pairingNum) {
LockedSlot[] lockedSlots = getDataForProfile();
if(lockedSlots != null) {
- if(lockedSlots[pairingNum] == null) {
- lockedSlots[pairingNum] = new LockedSlot();
+ if(lockedSlots[slotNum] == null) {
+ lockedSlots[slotNum] = new LockedSlot();
+ }
+ if(!lockedSlots[slotNum].locked) {
+ if(lockedSlots[pairingNum] == null) {
+ lockedSlots[pairingNum] = new LockedSlot();
+ }
+ lockedSlots[pairingNum].boundTo = slotNum;
+ lockedSlots[pairingNum].locked = false;
+
+ lockedSlots[slotNum].boundTo = pairingNum;
}
- lockedSlots[pairingNum].boundTo = slotNum;
- lockedSlots[pairingNum].locked = false;
}
}
}
+ } else {
+ int pairingNum = pairingSlot.getSlotIndex();
+ LockedSlot[] lockedSlots = getDataForProfile();
+ if(lockedSlots != null && lockedSlots[pairingNum] != null) {
+ if(lockedSlots[pairingNum].boundTo >= 0) {
+ lockedSlots[lockedSlots[pairingNum].boundTo] = null;
+ }
+ lockedSlots[pairingNum] = null;
+ }
}
}
}
@@ -191,31 +244,34 @@ public class SlotLocking {
@SubscribeEvent(priority = EventPriority.LOW)
public void drawScreenEvent(GuiScreenEvent.DrawScreenEvent.Post event) {
- if(!event.isCanceled() && pairingSlot != null && lockKeyHeld) {
+ if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && !event.isCanceled() && pairingSlot != null && lockKeyHeld) {
+ LockedSlot[] lockedSlots = getDataForProfile();
+ LockedSlot lockedSlot = getLockedSlot(lockedSlots, pairingSlot.getSlotIndex());
+ if(lockedSlot.boundTo >= 0 && lockedSlot.boundTo < 8) {
+ return;
+ }
+
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
return;
}
GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
+ int x1 = container.guiLeft+pairingSlot.xDisplayPosition+8;
+ int y1 = container.guiTop+pairingSlot.yDisplayPosition+8;
int x2 = event.mouseX;
int y2 = event.mouseY;
- LockedSlot[] lockedSlots = getDataForProfile();
- LockedSlot lockedSlot = getLockedSlot(lockedSlots, pairingSlot.getSlotIndex());
- if(lockedSlot.boundTo >= 0 && lockedSlot.boundTo < 9) {
- Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, lockedSlot.boundTo);
- x2 = container.guiLeft+boundSlot.xDisplayPosition+8;
- y2 = container.guiTop+boundSlot.yDisplayPosition+8;
+ if(x2 > x1-8 && x2 < x1+8 &&
+ y2 > y1-8 && y2 < y1+8) {
+ return;
}
- drawLinkArrow(container.guiLeft+pairingSlot.xDisplayPosition+8,
- container.guiTop+pairingSlot.yDisplayPosition+8,
- x2, y2);
+ drawLinkArrow(x1, y1, x2, y2);
}
}
private void drawLinkArrow(int x1, int y1, int x2, int y2) {
- GlStateManager.color(0x33/255f, 0xff/255f, 0xcc/255f, 1f);
+ GlStateManager.color(0x33/255f, 0xee/255f, 0xdd/255f, 1f);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableTexture2D();
@@ -237,50 +293,56 @@ public class SlotLocking {
GL11.glLineWidth(1f);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
- /*worldrenderer.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION);
- worldrenderer.pos(x1, y1, 0.0D).endVertex();
- worldrenderer.pos(x1+vec.x-side.x, y1+vec.y-side.y, 0.0D).endVertex();
- worldrenderer.pos(x1+vec.x+side.x, y1+vec.y+side.y, 0.0D).endVertex();
- worldrenderer.pos(x2-vec.x-side.x, y2-vec.y-side.y, 0.0D).endVertex();
- worldrenderer.pos(x2-vec.x+side.x, y2-vec.y+side.y, 0.0D).endVertex();
- worldrenderer.pos(x2, y2, 0.0D).endVertex();*/
-
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
- worldrenderer.pos(x1, y1, 0.0D).endVertex();
- worldrenderer.pos(x2, y2, 0.0D).endVertex();
- tessellator.draw();
-
- worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
- worldrenderer.pos(x1-side.x/2f, y1-side.y/2f, 0.0D).endVertex();
- worldrenderer.pos(x2-side.x/2f, y2-side.y/2f, 0.0D).endVertex();
- tessellator.draw();
-
- worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
- worldrenderer.pos(x1+side.x/2f, y1+side.y/2f, 0.0D).endVertex();
- worldrenderer.pos(x2+side.x/2f, y2+side.y/2f, 0.0D).endVertex();
- tessellator.draw();
+
+ int lines = 6;
+ for(int i=0; i<lines; i++) {
+ worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
+ worldrenderer.pos(x1-side.x+side.x*i/lines, y1-side.y+side.y*i/lines, 0.0D).endVertex();
+ worldrenderer.pos(x2-side.x+side.x*i/lines, y2-side.y+side.y*i/lines, 0.0D).endVertex();
+ tessellator.draw();
+ }
}
public void onWindowClick(Slot slotIn, int slotId, int clickedButton, int clickType, Consumer<Triple<Integer, Integer, Integer>> consumer) {
LockedSlot locked = getLockedSlot(slotIn);
if(locked == null) {
return;
- } else if(isSlotLocked(slotIn) || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) {
+ } else if(locked.locked || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) {
consumer.accept(null);
- } else if(clickType == 1 && locked.boundTo >= 0 && locked.boundTo < 9) {
- if(slotId > 9) {
- consumer.accept(Triple.of(slotId, locked.boundTo, 2));
-
- GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
- Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo);
+ } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1) {
+ GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
+ Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo);
- LockedSlot boundLocked = getLockedSlot(boundSlot);
+ if(boundSlot == null) {
+ return;
+ }
+ LockedSlot boundLocked = getLockedSlot(boundSlot);
+ int id = slotIn.getSlotIndex();
+ if(id >= 9 && locked.boundTo >= 0 && locked.boundTo < 8) {
+ if(!boundLocked.locked) {
+ consumer.accept(Triple.of(slotId, locked.boundTo, 2));
+ if(boundLocked == DEFAULT_LOCKED_SLOT) {
+ LockedSlot[] lockedSlots = getDataForProfile();
+ lockedSlots[locked.boundTo] = new LockedSlot();
+ lockedSlots[locked.boundTo].boundTo = id;
+ } else {
+ boundLocked.boundTo = id;
+ }
+ }
+ } else if(id >= 0 && id < 8 && locked.boundTo >= 9 && locked.boundTo <= 39) {
+ if(boundLocked.locked || boundLocked.boundTo != id) {
+ locked.boundTo = -1;
+ } else {
+ int boundTo = boundSlot.slotNumber;
+ consumer.accept(Triple.of(boundTo, id, 2));
+ }
}
-
+ } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && locked.boundTo != -1 && NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks) {
+ consumer.accept(null);
}
}
@@ -296,7 +358,93 @@ public class SlotLocking {
GlStateManager.depthMask(true);
GlStateManager.enableBlend();
GlStateManager.translate(0, 0, -400);
- } else if(slot.canBeHovered() && locked.boundTo >= 0 && locked.boundTo < 9) {
+ } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && slot.canBeHovered() && locked.boundTo >= 0 && locked.boundTo <= 39) {
+ if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
+ return;
+ }
+ GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen;
+
+ final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int scaledWidth = scaledresolution.getScaledWidth();
+ final int scaledHeight = scaledresolution.getScaledHeight();
+ int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth;
+ int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1;
+
+ Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo);
+ if(boundSlot == null) {
+ return;
+ }
+
+ boolean hoverOverSlot = container.isMouseOverSlot(slot, mouseX, mouseY);
+
+ if(hoverOverSlot || slot.getSlotIndex() >= 9) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(BOUND);
+ GlStateManager.color(1, 1, 1, 0.7f);
+ GlStateManager.depthMask(false);
+ RenderUtils.drawTexturedRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0, 1, 0, 1, GL11.GL_NEAREST);
+ GlStateManager.depthMask(true);
+ GlStateManager.enableBlend();
+
+ //Rerender Text over Top
+ if(slot.getStack() != null) {
+ Minecraft.getMinecraft().getRenderItem().renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, slot.getStack(),
+ slot.xDisplayPosition, slot.yDisplayPosition, null);
+ }
+ } else if(pairingSlot != null && lockKeyHeld && slot.getSlotIndex() < 8) {
+ int x1 = container.guiLeft+pairingSlot.xDisplayPosition;
+ int y1 = container.guiTop+pairingSlot.yDisplayPosition;
+
+ if(mouseX <= x1 || mouseX >= x1+16 ||
+ mouseY <= y1 || mouseY >= y1+16) {
+ Gui.drawRect(slot.xDisplayPosition, slot.yDisplayPosition, slot.xDisplayPosition+16, slot.yDisplayPosition+16, 0x80ffffff);
+ }
+ }
+
+ if(hoverOverSlot) {
+ LockedSlot boundLocked = getLockedSlot(boundSlot);
+ if(boundLocked == null || boundLocked.locked ||
+ (boundSlot.getSlotIndex() >= 9 && boundLocked.boundTo != slot.getSlotIndex())) {
+ locked.boundTo = -1;
+ return;
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(BOUND);
+ GlStateManager.color(1, 1, 1, 0.7f);
+ GlStateManager.depthMask(false);
+ RenderUtils.drawTexturedRect(boundSlot.xDisplayPosition, boundSlot.yDisplayPosition, 16, 16, 0, 1, 0, 1, GL11.GL_NEAREST);
+ GlStateManager.depthMask(true);
+ GlStateManager.enableBlend();
+
+ //Rerender Text over Top
+ if(boundSlot.getStack() != null) {
+ Minecraft.getMinecraft().getRenderItem().renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, boundSlot.getStack(),
+ boundSlot.xDisplayPosition, boundSlot.yDisplayPosition, null);
+ }
+
+ int maxIter = 100;
+ float x1 = slot.xDisplayPosition+8;
+ float y1 = slot.yDisplayPosition+8;
+ float x2 = boundSlot.xDisplayPosition+8;
+ float y2 = boundSlot.yDisplayPosition+8;
+ Vector2f vec = new Vector2f(x2 - x1, y2 - y1);
+ vec.normalise(vec);
+
+ while(x1 > slot.xDisplayPosition && x1 < slot.xDisplayPosition+16 &&
+ y1 > slot.yDisplayPosition && y1 < slot.yDisplayPosition+16) {
+ if(maxIter-- < 50) break;
+ x1 += vec.x;
+ y1 += vec.y;
+ }
+ while(x2 > boundSlot.xDisplayPosition && x2 < boundSlot.xDisplayPosition+16 &&
+ y2 > boundSlot.yDisplayPosition && y2 < boundSlot.yDisplayPosition+16) {
+ if(maxIter-- < 0) break;
+ x2 -= vec.x;
+ y2 -= vec.y;
+ }
+
+ drawLinkArrow((int)x1, (int)y1, (int)x2, (int)y2);
+ }
+ } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && slot.getSlotIndex() < 8 && pairingSlot != null && lockKeyHeld) {
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
return;
}
@@ -308,20 +456,19 @@ public class SlotLocking {
int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth;
int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1;
- if(container.isMouseOverSlot(slot, mouseX, mouseY)) {
- Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo);
- int x2 = boundSlot.xDisplayPosition+8;
- int y2 = boundSlot.yDisplayPosition+8;
+ int x1 = container.guiLeft+pairingSlot.xDisplayPosition;
+ int y1 = container.guiTop+pairingSlot.yDisplayPosition;
- drawLinkArrow(slot.xDisplayPosition+8,
- slot.yDisplayPosition+8, x2, y2);
+ if(mouseX <= x1 || mouseX >= x1+16 ||
+ mouseY <= y1 || mouseY >= y1+16) {
+ Gui.drawRect(slot.xDisplayPosition, slot.yDisplayPosition, slot.xDisplayPosition+16, slot.yDisplayPosition+16, 0x80ffffff);
}
}
}
}
public LockedSlot getLockedSlot(Slot slot) {
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return null;
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) return null;
if(slot == null) {
return null;
}
@@ -336,7 +483,7 @@ public class SlotLocking {
}
public LockedSlot getLockedSlotIndex(int index) {
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return null;
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) return null;
LockedSlot[] lockedSlots = getDataForProfile();
if(lockedSlots == null) return null;
@@ -345,13 +492,13 @@ public class SlotLocking {
public boolean isSlotLocked(Slot slot) {
LockedSlot locked = getLockedSlot(slot);
- return locked != null && locked.locked;
+ return locked != null && (locked.locked || (NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks && locked.boundTo != -1));
}
public boolean isSlotIndexLocked(int index) {
LockedSlot locked = getLockedSlotIndex(index);
- return locked != null && locked.locked;
+ return locked != null && (locked.locked || (NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks && locked.boundTo != -1));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
index 54478fa4..66fede9c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
@@ -173,7 +173,7 @@ public class StorageManager {
private String lastSearch = "";
- private boolean[] storagePresent = new boolean[27];
+ private boolean[] storagePresent = null;
//TODO: Replace with /storage {id} when hypixel becomes not lazy
public int desiredStoragePage = -1;
@@ -414,6 +414,10 @@ public class StorageManager {
setItemSlot(packet.func_149173_d()-9, packet.func_149174_e());
}
} else if(onStorageMenu) {
+ if(storagePresent == null) {
+ storagePresent = new boolean[27];
+ }
+
int slot = packet.func_149173_d();
ItemStack stack = packet.func_149174_e();
@@ -532,6 +536,8 @@ public class StorageManager {
}
public void searchDisplay(String searchStr) {
+ if(storagePresent == null) return;
+
synchronized(storageConfig.displayToStorageIdMap) {
storageConfig.displayToStorageIdMap.clear();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
index 73ab69c9..df13b42a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
@@ -1,9 +1,13 @@
package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
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.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -29,16 +33,14 @@ public class GuiEnchantColour extends GuiScreen {
private final int xSize = 217;
private int ySize = 0;
- private List<String> getEnchantColours() {
- return NotEnoughUpdates.INSTANCE.config.hidden.enchantColours;
- }
-
public static final Splitter splitter = Splitter.on(":").limit(5);
private HashMap<Integer, String> comparators = new HashMap<>();
private HashMap<Integer, String> modifiers = new HashMap<>();
private List<GuiElementTextField[]> guiElementTextFields = new ArrayList<>();
+ private List<String> enchantNamesPretty = null;
+
private LerpingInteger scroll = new LerpingInteger(0, 100);
public static int BOLD_MODIFIER = 0b1;
@@ -47,6 +49,27 @@ public class GuiEnchantColour extends GuiScreen {
public static int UNDERLINE_MODIFIER = 0b1000;
public static int STRIKETHROUGH_MODIFIER = 0b10000;
+ private List<String> getEnchantNamesPretty() {
+ if(enchantNamesPretty == null) {
+ JsonObject enchantsJson = Constants.ENCHANTS;
+ if(!enchantsJson.has("enchants_pretty")) {
+ return Lists.newArrayList("ERROR");
+ } else {
+ JsonArray pretty = enchantsJson.getAsJsonArray("enchants_pretty");
+
+ enchantNamesPretty = new ArrayList<>();
+ for(int i=0; i<pretty.size(); i++) {
+ enchantNamesPretty.add(pretty.get(i).getAsString());
+ }
+ }
+ }
+ return enchantNamesPretty;
+ }
+
+ private List<String> getEnchantColours() {
+ return NotEnoughUpdates.INSTANCE.config.hidden.enchantColours;
+ }
+
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
index 166e6ba2..21d1018d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
@@ -1,18 +1,23 @@
package io.github.moulberry.notenoughupdates.miscgui;
+import com.google.common.collect.Lists;
import io.github.moulberry.notenoughupdates.core.*;
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingFloat;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
+import io.github.moulberry.notenoughupdates.util.GuiTextures;
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.GuiTextField;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -21,6 +26,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.*;
import java.net.URL;
+import java.util.List;
public class GuiItemCustomize extends GuiScreen {
@@ -28,7 +34,7 @@ public class GuiItemCustomize extends GuiScreen {
private final ItemStack stack;
private final String itemUUID;
- private final GuiElementTextField textFieldRename = new GuiElementTextField("", 178, 20, GuiElementTextField.COLOUR);
+ private final GuiElementTextField textFieldRename = new GuiElementTextField("", 158, 20, GuiElementTextField.COLOUR);
private final GuiElementBoolean enchantGlintButton;
private int renderHeight = 0;
@@ -108,6 +114,25 @@ public class GuiItemCustomize extends GuiScreen {
if(!this.textFieldRename.getText().isEmpty()) {
data.customName = this.textFieldRename.getText();
+
+ NBTTagCompound stackTagCompound = stack.getTagCompound();
+ if (stackTagCompound != null && stackTagCompound.hasKey("display", 10)) {
+ NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display");
+
+ if (nbttagcompound.hasKey("Name", 8)) {
+ String name = nbttagcompound.getString("Name");
+ char[] chars = name.toCharArray();
+
+ int i;
+ for(i=0; i<chars.length; i+=2) {
+ if(chars[i] != '\u00a7'){
+ break;
+ }
+ }
+
+ data.customNamePrefix = name.substring(0, i);
+ }
+ }
}
ItemCustomizeManager.putItemData(itemUUID, data);
@@ -129,13 +154,15 @@ public class GuiItemCustomize extends GuiScreen {
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
+ List<String> tooltipToDisplay = null;
+
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
int xCenter = scaledResolution.getScaledWidth()/2;
int yTopStart = (scaledResolution.getScaledHeight()-renderHeight)/2;
int yTop = yTopStart;
- RenderUtils.drawFloatingRectDark(xCenter-100, yTop-9, 200, renderHeight);
+ RenderUtils.drawFloatingRectDark(xCenter-100, yTop-9, 200, renderHeight+11);
RenderUtils.drawFloatingRectDark(xCenter-90, yTop-5, 180, 14);
Utils.renderShadowedString("\u00a75\u00a7lNEU Item Customizer", xCenter, yTop-1, 180);
@@ -143,14 +170,61 @@ public class GuiItemCustomize extends GuiScreen {
yTop += 14;
if(!textFieldRename.getFocus() && textFieldRename.getText().isEmpty()) {
- textFieldRename.setOptions(0);
+ textFieldRename.setOptions(GuiElementTextField.SCISSOR_TEXT);
textFieldRename.setPrependText("\u00a77Enter Custom Name...");
} else {
- textFieldRename.setOptions(GuiElementTextField.COLOUR);
+ textFieldRename.setOptions(GuiElementTextField.COLOUR | GuiElementTextField.SCISSOR_TEXT);
textFieldRename.setPrependText("");
}
- textFieldRename.render(xCenter-textFieldRename.getWidth()/2, yTop);
+ if(!textFieldRename.getFocus()) {
+ textFieldRename.setSize(158, 20);
+ } else {
+ int textSize = fontRendererObj.getStringWidth(textFieldRename.getTextDisplay())+10;
+ textFieldRename.setSize(Math.max(textSize, 158), 20);
+ }
+
+ textFieldRename.render(xCenter-textFieldRename.getWidth()/2-10, yTop);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help);
+ GlStateManager.color(1, 1, 1, 1);
+ int helpX = xCenter+textFieldRename.getWidth()/2-10;
+ Utils.drawTexturedRect(helpX, yTop, 20, 20, GL11.GL_LINEAR);
+
+ if(mouseX >= helpX && mouseX <= helpX+20 && mouseY >= yTop && mouseY <= yTop+20) {
+ tooltipToDisplay = Lists.newArrayList(
+ EnumChatFormatting.AQUA+"Set a custom name for the item",
+ EnumChatFormatting.GREEN+"",
+ EnumChatFormatting.GREEN+"Type \"&&\" to use colour codes",
+ EnumChatFormatting.GREEN+"Type \"**\" for \u272A",
+ EnumChatFormatting.GREEN+"",
+ EnumChatFormatting.GREEN+"Available colour codes:",
+ Utils.chromaString("\u00B6z = Chroma"),
+ EnumChatFormatting.DARK_BLUE+"\u00B61 = Dark Blue",
+ EnumChatFormatting.DARK_GREEN+"\u00B62 = Dark Green",
+ EnumChatFormatting.DARK_AQUA+"\u00B63 = Dark Aqua",
+ EnumChatFormatting.DARK_RED+"\u00B64 = Dark Red",
+ EnumChatFormatting.DARK_PURPLE+"\u00B65 = Dark Purple",
+ EnumChatFormatting.GOLD+"\u00B66 = Gold",
+ EnumChatFormatting.GRAY+"\u00B67 = Gray",
+ EnumChatFormatting.DARK_GRAY+"\u00B68 = Dark Gray",
+ EnumChatFormatting.BLUE+"\u00B69 = Blue",
+ EnumChatFormatting.GREEN+"\u00B6a = Green",
+ EnumChatFormatting.AQUA+"\u00B6b = Aqua",
+ EnumChatFormatting.RED+"\u00B6c = Red",
+ EnumChatFormatting.LIGHT_PURPLE+"\u00B6d = Purple",
+ EnumChatFormatting.YELLOW+"\u00B6e = Yellow",
+ EnumChatFormatting.WHITE+"\u00B6f = White",
+ "",
+ EnumChatFormatting.GREEN+"Available formatting codes:",
+ EnumChatFormatting.GRAY+"\u00B6k = "+EnumChatFormatting.OBFUSCATED+"Obfuscated",
+ EnumChatFormatting.GRAY+"\u00B6l = "+EnumChatFormatting.BOLD+"Bold",
+ EnumChatFormatting.GRAY+"\u00B6m = "+EnumChatFormatting.STRIKETHROUGH+"Strikethrough",
+ EnumChatFormatting.GRAY+"\u00B6n = "+EnumChatFormatting.UNDERLINE+"Underline",
+ EnumChatFormatting.GRAY+"\u00B6o = "+EnumChatFormatting.ITALIC+"Italic"
+ );
+ }
+
yTop += 25;
RenderUtils.drawFloatingRectDark(xCenter-90, yTop, 180, 110);
@@ -246,6 +320,10 @@ public class GuiItemCustomize extends GuiScreen {
editor.render();
}
+ if(tooltipToDisplay != null) {
+ Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fontRendererObj);
+ }
+
super.drawScreen(mouseX, mouseY, partialTicks);
}
@@ -268,6 +346,8 @@ public class GuiItemCustomize extends GuiScreen {
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ Keyboard.enableRepeatEvents(true);
+
if(textFieldRename.getFocus()) {
if(keyCode == Keyboard.KEY_ESCAPE) {
textFieldRename.setFocus(false);
@@ -313,7 +393,7 @@ public class GuiItemCustomize extends GuiScreen {
int xCenter = scaledResolution.getScaledWidth()/2;
int yTop = (scaledResolution.getScaledHeight()-renderHeight)/2;
- if(mouseX >= xCenter-textFieldRename.getWidth()/2 && mouseX <= xCenter+textFieldRename.getWidth()/2 &&
+ if(mouseX >= xCenter-textFieldRename.getWidth()/2-10 && mouseX <= xCenter+textFieldRename.getWidth()/2-10 &&
mouseY >= yTop+14 && mouseY <= yTop+14+textFieldRename.getHeight()) {
textFieldRename.mouseClicked(mouseX, mouseY, mouseButton);
} else {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
index 010dc3e2..32a7c76a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java
@@ -39,7 +39,6 @@ public class InventoryStorageSelector {
return false;
}
if(Minecraft.getMinecraft().currentScreen != null) {
- isOverridingSlot = false;
return false;
}
if(Minecraft.getMinecraft().thePlayer == null) {
@@ -58,6 +57,9 @@ public class InventoryStorageSelector {
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.storageGUI.showInvBackpack) {
return;
}
+ if(Minecraft.getMinecraft().currentScreen != null) {
+ return;
+ }
if(KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) {
selectedIndex--;
@@ -107,12 +109,18 @@ public class InventoryStorageSelector {
if(Minecraft.getMinecraft().gameSettings.keyBindsHotbar[0].isKeyDown()) {
isOverridingSlot = false;
}
+ if(Minecraft.getMinecraft().currentScreen != null) {
+ return;
+ }
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.storageGUI.showInvBackpack) {
return;
}
- if(KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) {
+ if(KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.backpackHotkey)) {
+ Minecraft.getMinecraft().thePlayer.inventory.currentItem = 0;
+ isOverridingSlot = true;
+ } else if(KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) {
selectedIndex--;
int max = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1;
@@ -156,6 +164,9 @@ public class InventoryStorageSelector {
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.storageGUI.showInvBackpack) {
return resultantSlot;
}
+ if(Minecraft.getMinecraft().currentScreen != null) {
+ return resultantSlot;
+ }
int keyCode = NotEnoughUpdates.INSTANCE.config.storageGUI.backpackScrollKey;
if(isOverridingSlot && KeybindHelper.isKeyDown(keyCode)) {
@@ -219,6 +230,9 @@ public class InventoryStorageSelector {
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.storageGUI.showInvBackpack) {
return;
}
+ if(Minecraft.getMinecraft().currentScreen != null) {
+ return;
+ }
int max = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1;
if(selectedIndex > max) selectedIndex = max;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
index f22ed9ae..a59131ea 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java
@@ -1008,7 +1008,13 @@ public class StorageOverlay extends GuiElement {
@Override
public boolean keyboardInput() {
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
- Minecraft.getMinecraft().thePlayer.closeScreen();
+ clearSearch();
+ return false;
+ }
+ if(Keyboard.getEventKey() == Minecraft.getMinecraft().gameSettings.keyBindScreenshot.getKeyCode()) {
+ return false;
+ }
+ if(Keyboard.getEventKey() == Minecraft.getMinecraft().gameSettings.keyBindFullscreen.getKeyCode()) {
return false;
}
@@ -1021,6 +1027,6 @@ public class StorageOverlay extends GuiElement {
}
}
- return false;
+ return true;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java
index 2cad4011..f82cc88f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.item.EntityItem;
@@ -16,6 +17,10 @@ public class MixinEntityPlayerSP {
@Inject(method="dropOneItem", at=@At("HEAD"), cancellable = true)
public void dropOneItem(CallbackInfoReturnable<EntityItem> ci) {
+ if(SBInfo.getInstance().isInDungeon) {
+ return;
+ }
+
int slot = Minecraft.getMinecraft().thePlayer.inventory.currentItem;
if(SlotLocking.getInstance().isSlotIndexLocked(slot)) {
ci.cancel();
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 8520bd01..b4ffa7ff 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityRenderer.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
+import io.github.moulberry.notenoughupdates.miscfeatures.FancyPortals;
import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
@@ -9,16 +10,60 @@ import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
import net.minecraftforge.client.ForgeHooksClient;
+import org.lwjgl.util.Display;
+import org.lwjgl.util.glu.Project;
import org.lwjgl.util.vector.Vector3f;
import org.spongepowered.asm.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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(EntityRenderer.class)
-public class MixinEntityRenderer {
+public abstract class MixinEntityRenderer {
+ @Shadow protected abstract float getFOVModifier(float partialTicks, boolean useFOVSetting);
+
+ @Shadow private Minecraft mc;
+
+ @Shadow private float farPlaneDistance;
+
+ @Shadow protected abstract void orientCamera(float partialTicks);
+
+ @Redirect(method="renderWorldPass", at=@At(
+ value="INVOKE",
+ target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V",
+ remap = false)
+ )
+ public void perspective(float f1, float f2, float f3, float f4) {
+ if(!FancyPortals.overridePerspective()) {
+ Project.gluPerspective(f1, f2, f3, f4);
+ }
+ }
+
+ @Inject(method="updateCameraAndRender", at=@At("RETURN"))
+ public void onUpdateCameraAndRender(float partialTicks, long nanoTime, CallbackInfo ci) {
+ if(Minecraft.getMinecraft().getRenderViewEntity() == null) return;
+
+ if(FancyPortals.shouldRenderWorldOverlay()) {
+ GlStateManager.matrixMode(5889);
+ GlStateManager.loadIdentity();
+ Project.gluPerspective(getFOVModifier(partialTicks, true),
+ (float)mc.displayWidth / (float)this.mc.displayHeight, 0.05F,
+ farPlaneDistance * MathHelper.SQRT_2);
+ GlStateManager.matrixMode(5888);
+ GlStateManager.loadIdentity();
+ orientCamera(partialTicks);
+
+ FancyPortals.onUpdateCameraAndRender(partialTicks, nanoTime);
+
+ Minecraft.getMinecraft().entityRenderer.setupOverlayRendering();
+ }
+ }
@Redirect(method="renderWorldPass", at=@At(
value="INVOKE",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
index 39586458..ab2dff1d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemRenderer.java
@@ -4,6 +4,7 @@ import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
@@ -17,18 +18,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ItemRenderer.class)
public abstract class MixinItemRenderer {
- @Shadow private ItemStack itemToRender;
-
- @Redirect(method="renderItemInFirstPerson", at=@At(
- value = "FIELD",
- target = "Lnet/minecraft/client/renderer/ItemRenderer;itemToRender:Lnet/minecraft/item/ItemStack;",
- opcode = Opcodes.GETFIELD
+ @Redirect(method="updateEquippedItem", at=@At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/entity/player/InventoryPlayer;getCurrentItem()Lnet/minecraft/item/ItemStack;"
))
- public ItemStack modifyStackToRender(ItemRenderer renderer) {
+ public ItemStack modifyStackToRender(InventoryPlayer player) {
if(InventoryStorageSelector.getInstance().isSlotSelected()) {
return InventoryStorageSelector.getInstance().getHeldItemOverride();
}
- return itemToRender;
+ return player.getCurrentItem();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
index 4a7f0f5b..52c96c16 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinItemStack.java
@@ -11,6 +11,9 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
@Mixin({ItemStack.class})
public class MixinItemStack {
@@ -37,25 +40,13 @@ public class MixinItemStack {
if(data != null && data.customName != null) {
String customName = data.customName;
if(customName != null && !customName.equals("")) {
- String prefix = EnumChatFormatting.RESET.toString();
- if (stackTagCompound != null && stackTagCompound.hasKey("display", 10)) {
- NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display");
-
- if (nbttagcompound.hasKey("Name", 8)) {
- String name = nbttagcompound.getString("Name");
- char[] chars = name.toCharArray();
+ customName = Utils.chromaStringByColourCode(customName);
- int i;
- for(i=0; i<chars.length; i+=2) {
- if(chars[i] != '\u00a7'){
- break;
- }
- }
-
- prefix = name.substring(0, i);
- }
+ if(data.customNamePrefix != null) {
+ customName = data.customNamePrefix + customName;
}
- returnable.setReturnValue(prefix+customName);
+
+ returnable.setReturnValue(customName);
}
}
} catch(Exception e) { }
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java
new file mode 100644
index 00000000..3366f569
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinLoadingScreenRenderer.java
@@ -0,0 +1,22 @@
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.FancyPortals;
+import net.minecraft.client.LoadingScreenRenderer;
+import net.minecraft.client.Minecraft;
+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(LoadingScreenRenderer.class)
+public class MixinLoadingScreenRenderer {
+
+ @Inject(method="setLoadingProgress", at=@At(value = "HEAD"), cancellable = true)
+ public void setLoadingProgress(int progress, CallbackInfo ci) {
+ if(progress < 0 && !FancyPortals.shouldRenderLoadingScreen()) {
+ ci.cancel();
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java
index 96e6600e..a72f247f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java
@@ -2,7 +2,10 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.renderer.EntityRenderer;
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;
@@ -10,9 +13,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft {
+ @Shadow public WorldClient theWorld;
+
+ @Shadow public EntityRenderer entityRenderer;
+
@Inject(method="shutdownMinecraftApplet", at=@At("HEAD"))
public void shutdownMinecraftApplet(CallbackInfo ci) {
NotEnoughUpdates.INSTANCE.saveConfig();
}
+ @Inject(method="loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at=@At("HEAD"))
+ public void onLoadWorld(WorldClient worldClientIn, String loadingMessage, CallbackInfo ci) {
+ if(worldClientIn != theWorld) {
+ entityRenderer.getMapItemRenderer().clearLoadedMaps();
+ }
+ }
+
}
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 a32fa216..85811606 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
@@ -3,19 +3,19 @@ package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.miscfeatures.*;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.SBInfo;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C0EPacketClickWindow;
-import net.minecraft.network.play.client.C13PacketPlayerAbilities;
import net.minecraft.network.play.server.*;
-import org.lwjgl.opengl.Display;
+import net.minecraft.util.EnumParticleTypes;
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(NetHandlerPlayClient.class)
public class MixinNetHandlerPlayClient {
@@ -30,6 +30,19 @@ public class MixinNetHandlerPlayClient {
player.setPositionAndRotation(x, y, z, yaw, pitch);
}
+ @Redirect(method="handleParticles", at=@At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/client/multiplayer/WorldClient;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;ZDDDDDD[I)V"
+ ))
+ public void handleParticles(WorldClient world, EnumParticleTypes particleTypes, boolean isLongDistance,
+ double xCoord, double yCoord, double zCoord,
+ double xOffset, double yOffset, double zOffset, int[] params) {
+ boolean override = FishingHelper.getInstance().onSpawnParticle(particleTypes, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset);
+ if(!override) {
+ world.spawnParticle(particleTypes, isLongDistance, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, params);
+ }
+ }
+
@Inject(method="handleSetSlot", at=@At("RETURN"))
public void handleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci) {
EnchantingSolvers.processInventoryContents(false);
@@ -51,6 +64,14 @@ public class MixinNetHandlerPlayClient {
StorageManager.getInstance().setItemsPacket(packetIn);
}
+ @Inject(method="handleRespawn", at=@At(
+ value = "INVOKE",
+ target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V",
+ shift = At.Shift.AFTER))
+ public void handleOpenWindow(S07PacketRespawn packetIn, CallbackInfo ci) {
+ FancyPortals.onRespawnPacket(packetIn);
+ }
+
@Inject(method="handleBlockChange", at=@At("HEAD"))
public void handleBlockChange(S23PacketBlockChange packetIn, CallbackInfo ci) {
MiningStuff.processBlockChangePacket(packetIn);
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 b94561ce..be8ca702 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderFish.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -34,7 +35,13 @@ 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.config.itemOverlays.enableRodColours || entity == null) return;
+ if(NotEnoughUpdates.INSTANCE.config.fishing.hideOtherPlayerAll &&
+ entity != null && entity.angler != Minecraft.getMinecraft().thePlayer) {
+ ci.cancel();
+ return;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.config.fishing.enableRodColours || entity == null) return;
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(entity.angler.getHeldItem());
if (NotEnoughUpdates.INSTANCE.isOnSkyblock() && internalname != null && entity.angler != null &&
@@ -46,17 +53,21 @@ public abstract class MixinRenderFish extends Render<EntityFishHook> {
GlStateManager.translate((float)x, (float)y, (float)z);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(0.5F, 0.5F, 0.5F);
+ GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
+ GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
this.bindEntityTexture(entity);
+
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
worldrenderer.pos(-0.5D, -0.5D, 0.0D).tex(0.0625D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, -0.5D, 0.0D).tex(0.125D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, 0.5D, 0.0D).tex(0.125D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(-0.5D, 0.5D, 0.0D).tex(0.0625D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
tessellator.draw();
+
+ FishingHelper.getInstance().onRenderBobber(entity);
+
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
@@ -103,9 +114,9 @@ public abstract class MixinRenderFish extends Render<EntityFishHook> {
String specialColour;
if (entity.angler.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) {
- specialColour = NotEnoughUpdates.INSTANCE.config.itemOverlays.ownRodColour;
+ specialColour = NotEnoughUpdates.INSTANCE.config.fishing.ownRodColour;
} else {
- specialColour = NotEnoughUpdates.INSTANCE.config.itemOverlays.otherRodColour;
+ specialColour = NotEnoughUpdates.INSTANCE.config.fishing.otherRodColour;
}
int colourI = SpecialColour.specialToChromaRGB(specialColour);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorldClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorldClient.java
new file mode 100644
index 00000000..f8b01883
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinWorldClient.java
@@ -0,0 +1,25 @@
+package io.github.moulberry.notenoughupdates.mixins;
+
+import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper;
+import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.entity.Entity;
+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;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(WorldClient.class)
+public class MixinWorldClient {
+
+ @Inject(method="addEntityToWorld", at=@At("HEAD"))
+ public void addEntityToWorld(int entityID, Entity entityToSpawn, CallbackInfo ci) {
+ FishingHelper.getInstance().addEntity(entityID, entityToSpawn);
+ }
+
+ @Inject(method="removeEntityFromWorld", at=@At("RETURN"))
+ public void removeEntityFromWorld(int entityID, CallbackInfoReturnable<Entity> cir) {
+ FishingHelper.getInstance().removeEntity(entityID);
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 1c1c746f..0982184a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -8,11 +8,13 @@ import io.github.moulberry.notenoughupdates.core.config.Config;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.*;
import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor;
+import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
import io.github.moulberry.notenoughupdates.overlays.*;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.ClientCommandHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Vector2f;
@@ -79,6 +81,9 @@ public class NEUConfig extends Config {
case 7:
NotEnoughUpdates.INSTANCE.openGui = new GuiInvButtonEditor();
return;
+ case 8:
+ NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour();
+ return;
}
}
@@ -155,10 +160,10 @@ public class NEUConfig extends Config {
public MiscOverlays miscOverlays = new MiscOverlays();
@Expose
- @Category(
+ /*@Category(
name = "Storage GUI",
desc = "Storage GUI"
- )
+ )*/
public StorageGUI storageGUI = new StorageGUI();
@Expose
@@ -183,6 +188,14 @@ public class NEUConfig extends Config {
)
public Mining mining = new Mining();
+
+ @Expose
+ @Category(
+ name = "Fishing",
+ desc = "Fishing"
+ )
+ public Fishing fishing = new Fishing();
+
@Expose
@Category(
name = "NEU Auction House",
@@ -272,7 +285,7 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
- name = "Gui Click Sounds",
+ name = "GUI Click Sounds",
desc = "Play click sounds in various NEU-related GUIs when pressing buttons"
)
@ConfigEditorBoolean
@@ -287,6 +300,14 @@ public class NEUConfig extends Config {
values = {"Off", "Commas", "Shortened"}
)
public int damageIndicatorStyle = 1;
+
+ @Expose
+ @ConfigOption(
+ name = "Edit Enchant Colours",
+ desc = "Change the colours of certain skyblock enchants"
+ )
+ @ConfigEditorButton(runnableId = 8, buttonText = "Open")
+ public boolean editEnchantColoursButton = true;
}
public static class Notifications {
@@ -511,19 +532,38 @@ public class NEUConfig extends Config {
}
public static class SlotLocking {
+ @Expose
@ConfigOption(
name = "Enable Slot Locking",
- desc = "Allows you to lock slots and create slot pairings"
+ desc = "Allows you to lock slots and create slot bindings"
)
+ @ConfigEditorBoolean
public boolean enableSlotLocking = false;
@Expose
@ConfigOption(
+ name = "Enable Slot Binding",
+ desc = "Allows you to create slot bindings\nNote: \"Enable Slot Locking\" must be on"
+ )
+ @ConfigEditorBoolean
+ public boolean enableSlotBinding = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Don't Drop Bound Slots",
+ desc = "Slot bindings also act as locked slots (prevents dropping / moving in inventory)"
+ )
+ @ConfigEditorBoolean
+ public boolean bindingAlsoLocks = false;
+
+ @Expose
+ @ConfigOption(
name = "Slot Lock Key",
- desc = ""
+ desc = "Click this key to LOCK a slot\n" +
+ "Hold this key and drag to BIND a slot"
)
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_L)
- public int backpackScrollKey = Keyboard.KEY_L;
+ public int slotLockKey = Keyboard.KEY_L;
}
public static class TooltipTweaks {
@@ -681,7 +721,7 @@ public class NEUConfig extends Config {
name = "Block Zapper Overlay",
desc = ""
)
- @ConfigEditorAccordion(id = 5)
+ @ConfigEditorAccordion(id = 6)
public boolean zapperAccordion = false;
@Expose
@@ -690,7 +730,7 @@ public class NEUConfig extends Config {
desc = "Show which blocks will be destroyed when using the Block Zapper"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 5)
+ @ConfigAccordionId(id = 6)
public boolean enableZapperOverlay = true;
@Expose
@@ -699,7 +739,7 @@ public class NEUConfig extends Config {
desc = "Change the colour of the ghost block outline"
)
@ConfigEditorColour
- @ConfigAccordionId(id = 5)
+ @ConfigAccordionId(id = 6)
public String zapperOverlayColour = "0:102:171:5:0";
@ConfigOption(
@@ -775,41 +815,6 @@ public class NEUConfig extends Config {
public boolean showBreak = true;
@ConfigOption(
- name = "Custom Rod Colours",
- desc = ""
- )
- @ConfigEditorAccordion(id = 4)
- public boolean rodAccordion = false;
-
- @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
- @ConfigAccordionId(id = 4)
- public boolean enableRodColours = true;
-
- @Expose
- @ConfigOption(
- name = "Own Rod Colour",
- desc = "Change the colour of your own rod lines"
- )
- @ConfigEditorColour
- @ConfigAccordionId(id = 4)
- public String ownRodColour = "0:255:0:0:0";
-
- @Expose
- @ConfigOption(
- name = "Other Rod Colour",
- desc = "Change the colour of other players' rod lines"
- )
- @ConfigEditorColour
- @ConfigAccordionId(id = 4)
- public String otherRodColour = "0:255:0:0:0";
-
- @ConfigOption(
name = "Minion Crystal Radius Overlay",
desc = ""
)
@@ -1164,8 +1169,8 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
name = "Enable Storage GUI",
- desc = "Show a custom storage overlay when accessing /storage." +
- "Makes switching between pages much easier and also allows for searching through all storages"
+ desc = "THIS FEATURE IS CURRENTLY DISABLED BECAUSE HYPIXEL IS TOO LAZY TO ADD A SINGLE COMMAND LMFAO"/*"Show a custom storage overlay when accessing /storage." +
+ "Makes switching between pages much easier and also allows for searching through all storages"*/
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
@@ -1204,14 +1209,14 @@ public class NEUConfig extends Config {
@ConfigAccordionId(id = 1)
public boolean enderchestPreview = true;
- @Expose
+ //@Expose
@ConfigOption(
name = "Backpack Preview",
- desc = "Preview Backpacks when hovering over the selector on the left side"
+ desc = "THIS FEATURE IS CURRENTLY DISABLED BECAUSE HYPIXEL IS TOO LAZY TO ADD A SINGLE COMMAND LMFAO"//"Preview Backpacks when hovering over the selector on the left side"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
- public boolean backpackPreview = true;
+ public boolean backpackPreview = false;
@ConfigOption(
name = "Inventory Backpacks",
@@ -1227,7 +1232,9 @@ public class NEUConfig extends Config {
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean showInvBackpack = true;
+ public boolean showInvBackpack = false;
+
+ //public boolean showInvBackpack = false;
@Expose
@ConfigOption(
@@ -1273,6 +1280,15 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
+ name = "Backpack Hotkey",
+ desc = "Hotkey to quickly switch to the backpack slot"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_GRAVE)
+ @ConfigAccordionId(id = 0)
+ public int backpackHotkey = Keyboard.KEY_GRAVE;
+
+ @Expose
+ @ConfigOption(
name = "Arrow Key Backpacks",
desc = "Use arrow keys [LEFT],[RIGHT] to move between backpacks and [DOWN] to navigate backpack even when the slot is not selected. Keys are customizable below"
)
@@ -1588,6 +1604,167 @@ public class NEUConfig extends Config {
public boolean revealMistCreepers = true;*/
}
+ public static class Fishing {
+ @Expose
+ @ConfigOption(
+ name = "Hide Other Players Fishing",
+ desc = "Convenience option to easily hide \u00a7lother players'\u00a7r bobbers, rod lines and fishing particles\n" +
+ "The advanced options below allow you to set the precise colour, particles, etc."
+ )
+ @ConfigEditorBoolean
+ public boolean hideOtherPlayerAll = false;
+
+ @ConfigOption(
+ name = "Incoming Fish Warning",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean incomingFishAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Incoming Fish Warning",
+ desc = "Display a yellow '!' when a fish is incoming and a red '!' when you need to pull the fish up. " +
+ "The red '!' also takes your ping into account"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishWarning = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hooked Sound",
+ desc = "Play a high-pitched ding sound when the '!' turns red"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishHookedSounds = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Approaching Sound",
+ desc = "Play low-pitched ding sounds while the yellow '!' is visible"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean incomingFishIncSounds = false;
+
+ @ConfigOption(
+ name = "Fishing Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 0)
+ public boolean particleAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Custom Particles",
+ desc = "Allow you to modify the particles that appear when a fish is incoming for you and other players"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ public boolean enableCustomParticles = false;
+
+ @ConfigOption(
+ name = "Your Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 1)
+ @ConfigAccordionId(id = 0)
+ public boolean yourParticlesAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Particle Type",
+ desc = "Change the type of the particle that is spawned\n" +
+ "Particle types with (RGB) support custom colours" +
+ "Set to 'NONE' to disable particles"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"}
+ )
+ @ConfigAccordionId(id = 1)
+ public int yourParticleType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Custom Colour",
+ desc = "Set a custom colour for the particle\n" +
+ "Only works for particle types with (RGB)"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 1)
+ public String yourParticleColour = "0:255:255:255:255";
+
+ @ConfigOption(
+ name = "Other Players' Particles",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ @ConfigAccordionId(id = 0)
+ public boolean otherParticlesAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Particle Type",
+ desc = "Change the type of the particle that is spawned\n" +
+ "Particle types with (RGB) support custom colours" +
+ "Set to 'NONE' to disable particles"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "None", "Spark (RGB)", "Swirl (RGB)", "Dust (RGB)", "Flame", "Crit", "Magic Crit"}
+ )
+ @ConfigAccordionId(id = 2)
+ public int otherParticleType = 0;
+
+ @Expose
+ @ConfigOption(
+ name = "Custom Colour",
+ desc = "Set a custom colour for the particle\n" +
+ "Only works for particle types with (RGB)"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 2)
+ public String otherParticleColour = "0:255:255:255:255";
+
+ @ConfigOption(
+ name = "Rod Line Colours",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 4)
+ public boolean rodAccordion = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Rod Line Colours",
+ desc = "Change the colour of your and other players' rod lines\n" +
+ "Also fixes the position of the rod line"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 4)
+ public boolean enableRodColours = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Own Rod Colour",
+ desc = "Change the colour of your own rod lines\n" +
+ "You can set the opacity to '0' to HIDE"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 4)
+ public String ownRodColour = "0:255:0:0:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Other Rod Colour",
+ desc = "Change the colour of other players' rod lines\n" +
+ "You can set the opacity to '0' to HIDE"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 4)
+ public String otherRodColour = "0:255:0:0:0";
+ }
+
public static class NeuAuctionHouse {
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 13317776..73d61a1e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -55,6 +55,7 @@ public class SBInfo {
private long lastLocRaw = -1;
private long joinedWorld = -1;
private JsonObject locraw = null;
+ public boolean isInDungeon = false;
public String currentProfile = null;
@@ -134,10 +135,14 @@ public class SBInfo {
currentProfile = Utils.cleanColour(name.substring(profilePrefix.length()));
}
}
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ try {
Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard();
- ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1); //§707/14/20
+ ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
List<Score> scores = new ArrayList<>(scoreboard.getSortedScores(sidebarObjective));
@@ -147,8 +152,14 @@ public class SBInfo {
ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score.getPlayerName());
String line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.getPlayerName());
line = Utils.cleanDuplicateColourCodes(line);
+
+ if(Utils.cleanColour(line).contains("Dungeon Cleared: ")) {
+ isInDungeon = true;
+ }
+
lines.add(line);
}
+
if(lines.size() >= 5) {
date = Utils.cleanColour(lines.get(1)).trim();
//§74:40am
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 4a72a85e..d77f3c9e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -194,6 +194,28 @@ public class Utils {
return chromaString(str, 0, false);
}
+ private static final Pattern CHROMA_REPLACE_PATTERN = Pattern.compile("\u00a7z(.+?)(?=\u00a7|$)");
+
+ public static String chromaStringByColourCode(String str) {
+ if(str.contains("\u00a7z")) {
+ Matcher matcher = CHROMA_REPLACE_PATTERN.matcher(str);
+
+ StringBuffer sb = new StringBuffer();
+
+ while(matcher.find()) {
+ matcher.appendReplacement(sb,
+ Utils.chromaString(matcher.group(1))
+ .replace("\\", "\\\\")
+ .replace("$", "\\$")
+ );
+ }
+ matcher.appendTail(sb);
+
+ str = sb.toString();
+ }
+ return str;
+ }
+
private static long startTime = 0;
public static String chromaString(String str, float offset, boolean bold) {
str = cleanColour(str);
diff --git a/src/main/resources/assets/notenoughupdates/fishing_warning_exclam.png b/src/main/resources/assets/notenoughupdates/fishing_warning_exclam.png
new file mode 100644
index 00000000..914e86bf
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/fishing_warning_exclam.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/groundplane.png b/src/main/resources/assets/notenoughupdates/groundplane.png
new file mode 100644
index 00000000..99630d67
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/groundplane.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-1.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-1.png
new file mode 100644
index 00000000..e6d34776
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-1.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-2.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-2.png
new file mode 100644
index 00000000..c94d88c1
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-2.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-3.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-3.png
new file mode 100644
index 00000000..8ca52a12
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-3.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-4.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-4.png
new file mode 100644
index 00000000..d889fef5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-4.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-5.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-5.png
new file mode 100644
index 00000000..2e40a05b
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-5.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-6.png b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-6.png
new file mode 100644
index 00000000..95e684f7
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/portal_panoramas/nether/pansc-6.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/slotlocking/bound.png b/src/main/resources/assets/notenoughupdates/slotlocking/bound.png
new file mode 100644
index 00000000..1631d386
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/slotlocking/bound.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png
index e33a395c..5fceb152 100644
--- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png
+++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_preview_3.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_preview_3.png
index d94bb97d..7ead5a79 100644
--- a/src/main/resources/assets/notenoughupdates/storage_gui/storage_preview_3.png
+++ b/src/main/resources/assets/notenoughupdates/storage_gui/storage_preview_3.png
Binary files differ
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index fe9d56ad..4c0261bb 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -34,6 +34,8 @@
"MixinAbstractClientPlayer",
"MixinInventoryPlayer",
"MixinItemRenderer",
- "MixinEntityPlayerSP"
+ "MixinEntityPlayerSP",
+ "MixinLoadingScreenRenderer",
+ "MixinWorldClient"
]
} \ No newline at end of file
diff --git a/src/main/resources/notenoughupdates_at.cfg b/src/main/resources/notenoughupdates_at.cfg
index 5e567296..c3fb5dbc 100644
--- a/src/main/resources/notenoughupdates_at.cfg
+++ b/src/main/resources/notenoughupdates_at.cfg
@@ -5,4 +5,7 @@ public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop
public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; #guiTop
public net.minecraft.client.gui.inventory.GuiEditSign field_146848_f #tileSign
public net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V #drawSlot
-public net.minecraft.client.gui.inventory.GuiContainer func_146981_a(Lnet/minecraft/inventory/Slot;II)Z #isMouseOverSlot \ No newline at end of file
+public net.minecraft.client.gui.inventory.GuiContainer func_146981_a(Lnet/minecraft/inventory/Slot;II)Z #isMouseOverSlot
+public net.minecraft.client.renderer.RenderGlobal field_72755_R #renderInfos
+public net.minecraft.client.renderer.RenderGlobal$ContainerLocalRenderInformation
+public net.minecraft.client.renderer.RenderGlobal$ContainerLocalRenderInformation field_178036_a #renderChunk \ No newline at end of file