aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@protonmail.com>2021-09-02 17:10:13 +0800
committerMoulberry <james.jenour@protonmail.com>2021-09-02 17:10:13 +0800
commit7cab76126da90f1884c111a1ee589b90a6ef828e (patch)
tree22fc3496e5fbfea4f01bcda045c91472bb6e5240 /src/main/java
parent81eea6bf1f653fa194735d892b40614389975dd3 (diff)
downloadNotEnoughUpdates-7cab76126da90f1884c111a1ee589b90a6ef828e.tar.gz
NotEnoughUpdates-7cab76126da90f1884c111a1ee589b90a6ef828e.tar.bz2
NotEnoughUpdates-7cab76126da90f1884c111a1ee589b90a6ef828e.zip
misc & bin warning & sort warning
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java243
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java72
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java74
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java124
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AuctionHouseBINWarning.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java3
19 files changed, 472 insertions, 238 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 48cd0e57..766c5a2f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -1199,6 +1199,10 @@ public class NEUEventListener {
}
}
if(!hoveringButton) buttonHovered = null;
+
+ if(AuctionBINWarning.getInstance().shouldShow()) {
+ AuctionBINWarning.getInstance().render();
+ }
}
private void renderDungeonChestOverlay(GuiScreen gui) {
@@ -1408,6 +1412,18 @@ public class NEUEventListener {
return;
}
+ 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;
+
+ if(AuctionBINWarning.getInstance().shouldShow()) {
+ AuctionBINWarning.getInstance().mouseInput(mouseX, mouseY);
+ event.setCanceled(true);
+ return;
+ }
+
if(!event.isCanceled()) {
Utils.scrollTooltip(Mouse.getEventDWheel());
}
@@ -1422,12 +1438,6 @@ public class NEUEventListener {
return;
}
- 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;
-
String containerName = null;
GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen;
if(guiScreen instanceof GuiChest) {
@@ -1547,6 +1557,12 @@ public class NEUEventListener {
*/
@SubscribeEvent
public void onGuiScreenKeyboard(GuiScreenEvent.KeyboardInputEvent.Pre event) {
+ if(AuctionBINWarning.getInstance().shouldShow()) {
+ AuctionBINWarning.getInstance().keyboardInput();
+ event.setCanceled(true);
+ return;
+ }
+
if(AuctionSearchOverlay.shouldReplace()) {
AuctionSearchOverlay.keyEvent();
event.setCanceled(true);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
index 6011f0ac..3b0e0928 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
@@ -95,8 +95,6 @@ public class NEUCape {
if(defaultBehaviour){
this.capeName = capeName;
-
-
if (capeName.equalsIgnoreCase("fade")) {
shaderName = "fade_cape";
} else if (capeName.equalsIgnoreCase("space")) {
@@ -125,26 +123,6 @@ public class NEUCape {
ResourceLocation staticCapeTex = new ResourceLocation("notenoughupdates:capes/" + capeName + ".png");
capeTextures = new ResourceLocation[1];
capeTextures[0] = staticCapeTex;
-
- /*if(rlExists(staticCapeTex)) {
- capeTextures = new ResourceLocation[1];
- capeTextures[0] = staticCapeTex;
- } else {
- List<ResourceLocation> texs = new ArrayList<>();
- for(int i=0; i<99; i++) {
- ResourceLocation frame = new ResourceLocation(
- "notenoughupdates:capes/"+capeName+"/"+capeName+"_"+String.format("%02d", i)+".png");
- if(rlExists(frame)) {
- texs.add(frame);
- } else {
- break;
- }
- }
- capeTextures = new ResourceLocation[texs.size()];
- for(int i=0; i<texs.size(); i++) {
- capeTextures[i] = texs.get(i);
- }
- }*/
}
private void bindTexture() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
new file mode 100644
index 00000000..4ba3bb73
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionBINWarning.java
@@ -0,0 +1,243 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.GuiElement;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AuctionBINWarning extends GuiElement {
+
+ private static final AuctionBINWarning INSTANCE = new AuctionBINWarning();
+ public static AuctionBINWarning getInstance() {
+ return INSTANCE;
+ }
+
+ private static final Pattern ITEM_PRICE_REGEX = Pattern.compile("\u00a7fItem price: \u00a76([0-9,]+) coins");
+
+ private boolean showWarning = false;
+ private List<String> sellingTooltip;
+ private String sellingName;
+ private int sellingPrice;
+ private int lowestPrice;
+
+ private boolean shouldPerformCheck() {
+ if(!NotEnoughUpdates.INSTANCE.config.auctionHouseBINWarning.enableBINWarning ||
+ !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ sellingTooltip = null;
+ showWarning = false;
+ return false;
+ }
+
+ if(Minecraft.getMinecraft().currentScreen instanceof GuiChest &&
+ SBInfo.getInstance().lastOpenContainerName.startsWith("Create BIN Auction")) {
+ return true;
+ } else {
+ sellingTooltip = null;
+ showWarning = false;
+ return false;
+ }
+ }
+
+ public boolean shouldShow() {
+ return shouldPerformCheck() && showWarning;
+ }
+
+ public boolean onMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
+ if(!shouldPerformCheck()) return false;
+
+ if(slotId == 29) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+
+ sellingPrice = -1;
+
+ ItemStack priceStack = chest.inventorySlots.getSlot(31).getStack();
+ if(priceStack != null) {
+ String displayName = priceStack.getDisplayName();
+ Matcher priceMatcher = ITEM_PRICE_REGEX.matcher(displayName);
+
+ if(priceMatcher.matches()) {
+ try {
+ sellingPrice = Integer.parseInt(priceMatcher.group(1).replace(",", ""));
+ } catch(NumberFormatException ignored) {
+ }
+ }
+ }
+
+ ItemStack sellStack = chest.inventorySlots.getSlot(13).getStack();
+ String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(sellStack);
+
+ if(internalname == null) {
+ return false;
+ }
+
+ JsonObject itemInfo = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internalname);
+ if(itemInfo == null || !itemInfo.has("displayname")) {
+ sellingName = internalname;
+ } else {
+ sellingName = itemInfo.get("displayname").getAsString();
+ }
+
+ sellingTooltip = sellStack.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+
+ lowestPrice = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBin(internalname);
+ if(lowestPrice <= 0) {
+ lowestPrice = (int)NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname);
+ }
+
+ //TODO: Add option for warning if lowest price does not exist
+
+ float factor = 1 - NotEnoughUpdates.INSTANCE.config.auctionHouseBINWarning.warningThreshold/100;
+ if(factor < 0) factor = 0;
+ if(factor > 1) factor = 1;
+
+ if(sellingPrice > 0 && lowestPrice > 0 && sellingPrice < lowestPrice*factor) {
+ showWarning = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
+ if(shouldShow()) {
+ cir.setReturnValue(false);
+ }
+ }
+
+ @Override
+ public void render() {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ GlStateManager.disableLighting();
+
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0, 0, 500);
+
+ Gui.drawRect(0, 0, width, height, 0x80000000);
+
+ RenderUtils.drawFloatingRectDark(width/2-90, height/2-45, 180, 90);
+
+ int neuLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth("\u00a7lNEU");
+ Minecraft.getMinecraft().fontRendererObj.drawString("\u00a7lNEU", width/2+90-neuLength-3, height/2-45+4, 0xff000000);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Are you SURE?", Minecraft.getMinecraft().fontRendererObj,
+ width/2, height/2-45+10, false, 170, 0xffff4040);
+
+ String lowestPriceStr;
+ if(lowestPrice > 999) {
+ lowestPriceStr = Utils.shortNumberFormat(lowestPrice, 0);
+ } else {
+ lowestPriceStr = ""+lowestPrice;
+ }
+
+ String sellingPriceStr;
+ if(sellingPrice > 999) {
+ sellingPriceStr = Utils.shortNumberFormat(sellingPrice, 0);
+ } else {
+ sellingPriceStr = ""+sellingPrice;
+ }
+
+ String sellLine = "\u00a77[ \u00a7r"+sellingName+"\u00a77 ]";
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(sellLine, Minecraft.getMinecraft().fontRendererObj,
+ width/2, height/2-45+25, false, 170, 0xffffffff);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("has a lowest BIN of \u00a76"+lowestPriceStr+"\u00a7r coins", Minecraft.getMinecraft().fontRendererObj,
+ width/2, height/2-45+34, false, 170, 0xffa0a0a0);
+
+ int buyPercentage = 100 - sellingPrice*100/lowestPrice;
+ if(buyPercentage <= 0) buyPercentage = 1;
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("Continue selling it for", Minecraft.getMinecraft().fontRendererObj,
+ width/2, height/2-45+50, false, 170, 0xffa0a0a0);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth("\u00a76"+sellingPriceStr+"\u00a7r coins? (\u00a7c-"+buyPercentage+"%\u00a7r)",
+ Minecraft.getMinecraft().fontRendererObj,
+ width/2, height/2-45+59, false, 170, 0xffa0a0a0);
+
+ RenderUtils.drawFloatingRectDark(width/2-43, height/2+23, 40, 16, false);
+ RenderUtils.drawFloatingRectDark(width/2+3, height/2+23, 40, 16, false);
+
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GREEN+"[Y]es", Minecraft.getMinecraft().fontRendererObj,
+ width/2-23, height/2+31, true, 36, 0xff00ff00);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.RED+"[n]o", Minecraft.getMinecraft().fontRendererObj,
+ width/2+23, height/2+31, true, 36, 0xffff0000);
+
+ if(sellingTooltip != null) {
+ int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
+
+ int sellLineLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(sellLine);
+
+ if(mouseX >= width/2-sellLineLength/2 && mouseX <= width/2+sellLineLength/2 &&
+ mouseY >= height/2-45+20 && mouseY <= height/2-45+30) {
+ Utils.drawHoveringText(sellingTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
+ }
+ }
+
+ GlStateManager.popMatrix();
+ }
+
+ @Override
+ public boolean mouseInput(int mouseX, int mouseY) {
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ final int width = scaledResolution.getScaledWidth();
+ final int height = scaledResolution.getScaledHeight();
+
+ if(Mouse.getEventButtonState()) {
+ if(mouseY >= height/2+23 && mouseY <= height/2+23+16) {
+ if(mouseX >= width/2-43 && mouseX <= width/2-3) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId,
+ 29, 0, 0, Minecraft.getMinecraft().thePlayer);
+ showWarning = false;
+ } else {
+ showWarning = false;
+ }
+ }
+
+ if(mouseX < width/2-90 || mouseX > width/2+90 ||
+ mouseY < height/2-45 || mouseY > height/2+45) {
+ showWarning = false;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean keyboardInput() {
+ if(!Keyboard.getEventKeyState()) {
+ if(Keyboard.getEventKey() == Keyboard.KEY_Y || Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+ Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId,
+ 29, 0, 0, Minecraft.getMinecraft().thePlayer);
+ }
+ showWarning = false;
+ }
+
+ return false;
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java
new file mode 100644
index 00000000..c9e8c33c
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionSortModeWarning.java
@@ -0,0 +1,72 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.core.util.render.TextRenderUtils;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+public class AuctionSortModeWarning {
+
+ private static final AuctionSortModeWarning INSTANCE = new AuctionSortModeWarning();
+ public static AuctionSortModeWarning getInstance() {
+ return INSTANCE;
+ }
+
+ private boolean isAuctionBrowser() {
+ return Minecraft.getMinecraft().currentScreen instanceof GuiChest &&
+ SBInfo.getInstance().lastOpenContainerName.startsWith("Auctions Browser");
+ }
+
+ public void onPostGuiRender() {
+ if(isAuctionBrowser()) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+
+ ItemStack stack = chest.inventorySlots.getSlot(50).getStack();
+
+ if(stack != null) {
+ List<String> tooltip = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+
+ String selectedSort = null;
+ for(String line : tooltip) {
+ if(line.startsWith("\u00a75\u00a7o\u00a7b\u25B6 ")) {
+ selectedSort = Utils.cleanColour(line.substring("\u00a75\u00a7o\u00a7b\u25B6 ".length()));
+ }
+ }
+
+ if(selectedSort != null) {
+ if(!selectedSort.trim().equals("Lowest Price")) {
+ GlStateManager.disableLighting();
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(0, 0, 500);
+
+ String selectedColour = "\u00a7e";
+
+ if(selectedSort.trim().equals("Highest Price")) {
+ selectedColour = "\u00a7c";
+ }
+
+ String warningText = "\u00a7aSort: " + selectedColour + selectedSort;
+ int warningLength = Minecraft.getMinecraft().fontRendererObj.getStringWidth(warningText);
+
+ int centerX = chest.guiLeft+chest.xSize/2+9;
+ int centerY = chest.guiTop+26;
+
+ RenderUtils.drawFloatingRectDark(centerX - warningLength/2 - 4, centerY - 6,
+ warningLength+8, 12, false);
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(warningText, Minecraft.getMinecraft().fontRendererObj,
+ centerX, centerY, true, chest.width/2, 0xffffffff);
+ GlStateManager.popMatrix();
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java
deleted file mode 100644
index 0fd2100c..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package 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.network.play.client.C13PacketPlayerAbilities;
-import net.minecraft.network.play.server.S39PacketPlayerAbilities;
-
-public class FlyFix {
-
- private static boolean serverWantFly = false;
- private static boolean clientWantFly = false;
- private static long lastAbilitySend = 0;
-
- public static void onSendAbilities(C13PacketPlayerAbilities packet) {
- if(true) return;
- //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
- if(Minecraft.getMinecraft().thePlayer == null) return;
- if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
- if(SBInfo.getInstance().getLocation() == null) return;
- if(!SBInfo.getInstance().getLocation().equals("dynamic")) return;
-
- long currentTime = System.currentTimeMillis();
-
- clientWantFly = packet.isFlying();
- if(clientWantFly != serverWantFly) lastAbilitySend = currentTime;
- }
-
- public static void onReceiveAbilities(S39PacketPlayerAbilities packet) {
- if(true) return;
- //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
- if(Minecraft.getMinecraft().thePlayer == null) return;
- if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
- if(SBInfo.getInstance().getLocation() == null) return;
- if(!SBInfo.getInstance().getLocation().equals("dynamic")) return;
-
- long currentTime = System.currentTimeMillis();
-
- serverWantFly = packet.isFlying();
-
- if(serverWantFly != clientWantFly) {
- if(currentTime - lastAbilitySend > 0 && currentTime - lastAbilitySend < 500) {
- packet.setFlying(clientWantFly);
- } else {
- clientWantFly = serverWantFly;
- }
- }
- }
-
- public static void tick() {
- if(true) return;
- //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return;
- if(Minecraft.getMinecraft().thePlayer == null) return;
- if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return;
- if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
- if(SBInfo.getInstance().getLocation() == null) return;
- if(!SBInfo.getInstance().getLocation().equals("dynamic")) return;
-
- long currentTime = System.currentTimeMillis();
-
- if(currentTime - lastAbilitySend > 1000 && currentTime - lastAbilitySend < 5000) {
- if(clientWantFly != serverWantFly) {
- Minecraft.getMinecraft().thePlayer.capabilities.isFlying = serverWantFly;
- Minecraft.getMinecraft().thePlayer.sendPlayerAbilities();
- clientWantFly = serverWantFly;
- }
- } else {
- clientWantFly = Minecraft.getMinecraft().thePlayer.capabilities.isFlying;
- }
- }
-
-}
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 c518afaa..f9344a3a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java
@@ -12,6 +12,7 @@ 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;
+import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.EnumChatFormatting;
@@ -39,6 +40,7 @@ public class GuiEnchantColour extends GuiScreen {
public static final ResourceLocation custom_ench_colour = new ResourceLocation("notenoughupdates:custom_ench_colour.png");
+ private static final String sharePrefix = "NEUEC/";
private int guiLeft;
private int guiTop;
@@ -126,12 +128,6 @@ public class GuiEnchantColour extends GuiScreen {
Utils.drawStringCentered("Add Ench Colour", fontRendererObj, guiLeft+xSize/2+1, guiTop+ySize-20, false, 4210752);
- //Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
-
-// Utils.drawTexturedRect(guiLeft+2, guiTop+ySize+2, 48, 16);
-// Utils.drawTexturedRect(guiLeft+xSize-50, guiTop+ySize+2, 48, 16);
-
-
int yIndex = 0;
for(String str : enchantColours) {
Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
@@ -196,13 +192,8 @@ public class GuiEnchantColour extends GuiScreen {
}
private void renderSideBar(int mouseX, int mouseY, float partialTicks){
- //ySizeSidebar = 25*(enchantPresets.size()+2);
-// enchantPresets = getEnchantPresetKeys();
-
-
ySizeSidebar = 24*(2);
-
if(ySizeSidebar > height) {
if (scrollSideBar.getTarget() > 0) {
@@ -225,52 +216,15 @@ public class GuiEnchantColour extends GuiScreen {
Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST);
Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST);
Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST);
- Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12, false, 86, 4210752);
- Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24, false, 86, 4210752);
+ Utils.drawStringCenteredScaledMaxWidth("Load preset", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+8, false, 86, 4210752);
+ Utils.drawStringCenteredScaledMaxWidth("from Clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+16, false, 86, 4210752);
+ Utils.drawStringCenteredScaledMaxWidth("Save preset", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+8+24, false, 86, 4210752);
+ Utils.drawStringCenteredScaledMaxWidth("to Clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+16+24, false, 86, 4210752);
Utils.drawStringCenteredScaledMaxWidth("Reset Config", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*2, false, 86, 4210752);
-// for (int i = 0; i < enchantPresets.size(); i++) {
-//
-// Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour);
-// GlStateManager.color(1, 1, 1, 1);
-// Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*(i+2), 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST);
-// String text;
-//
-// text = "Test";
-//
-//// {
-//// JsonElement element = enchantPresets.get(i - 2);
-//// if(element.isJsonObject()){
-//// JsonObject object = enchantPresets.get(i - 2).getAsJsonObject();
-//// if(object.has("NAME")){
-//// JsonElement nameobject = object.get("NAME");
-//// if(nameobject.isJsonPrimitive()){
-//// text = nameobject.getAsJsonPrimitive().getAsString();
-//// break;
-//// }
-//// }
-//// }
-//// text = "ERROR";
-//// }
-//// break;
-//
-// Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*i, false, 86, 4210752);
-// }
-
-
- }
-
- private JsonArray getEnchantPresetKeys(){
- return new JsonArray();
-// if(enchantPresets == null) {
-// JsonObject enchantsJson = Constants.ENCHANTS;
-// if(!enchantsJson.has("enchants_pretty")) {
-// return new JsonArray();
-// } else {
-// JsonArray pretty = enchantsJson.getAsJsonArray("enchants_pretty");
-// }
-// }
-// return enchantPresets;
+ if(!validShareContents()) {
+ Gui.drawRect(guiLeft+xSize+3, guiTopSidebar+2, guiLeft+xSize+3+88, guiTopSidebar+2+20, 0x80000000);
+ }
}
@Override
@@ -353,6 +307,22 @@ public class GuiEnchantColour extends GuiScreen {
}
}
+ private boolean validShareContents() {
+ try {
+ String base64 = (String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
+
+ if(base64.length() <= sharePrefix.length()) return false;
+
+ try {