aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-02-16 03:08:30 +0800
committerBuildTools <james.jenour@protonmail.com>2021-02-16 03:08:30 +0800
commita0e7d174472d034142003e58a42d6beefe36a92b (patch)
tree37fbdf5c5c3af3e85ed05e6e17d64207b2a6d8c9
parent6024bdf69193ad216e95fca53d7d28746f4269e0 (diff)
downloadNotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.tar.gz
NotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.tar.bz2
NotEnoughUpdates-a0e7d174472d034142003e58a42d6beefe36a92b.zip
PRE21
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java33
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java27
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/cosmetics/ShaderManager.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java283
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfo.java372
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java646
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySkullRenderer.java24
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java59
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java187
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java35
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java26
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java78
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java6
-rw-r--r--src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay.png (renamed from src/main/resources/assets/notenoughupdates/ah_search_overlay.png)bin3513 -> 3513 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/auc_search/star.pngbin0 -> 6416 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/auc_search/star_board.pngbin0 -> 4352 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/elephant.pngbin0 -> 1345 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/moul_hat.json204
-rw-r--r--src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/spartan.pngbin0 -> 2682 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/custom_skull_textures/customskull.json7
-rw-r--r--src/main/resources/assets/notenoughupdates/hhh.json22
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/fade_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/fade_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/lava_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/negative.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/negative.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/shiny_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/shiny_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/space_cape.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/space_cape.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag (renamed from src/main/resources/assets/notenoughupdates/shaders/void.frag)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert (renamed from src/main/resources/assets/notenoughupdates/shaders/void.vert)0
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/lightning_cape.frag13
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/lightning_cape.vert12
-rw-r--r--src/main/resources/mixins.notenoughupdates.json3
58 files changed, 1655 insertions, 584 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 710561f8..adf204d1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -169,6 +169,10 @@ public class NEUEventListener {
} else {
itemPreloader.shutdown();
}
+
+ for(TextOverlay overlay : OverlayManager.textOverlays) {
+ overlay.shouldUpdateFrequent = true;
+ }
}
boolean longUpdate = false;
@@ -183,9 +187,6 @@ public class NEUEventListener {
DungeonWin.tick();
FlyFix.tick();
- for(TextOverlay overlay : OverlayManager.textOverlays) {
- overlay.shouldUpdateFrequent = true;
- }
if(longUpdate) {
/*for(Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList) {
@@ -204,11 +205,11 @@ public class NEUEventListener {
ProfileApiSyncer.getInstance().tick();
DamageCommas.tick();
BackgroundBlur.markDirty();
- if(neu.config.overlay.enablePetInfo || neu.config.treecap.enableMonkeyCheck || neu.config.notifications.showWrongPetMsg){
- PetInfo.longTick();
- }
- for(TextOverlay overlay : OverlayManager.textOverlays) {
- overlay.tick();
+
+ if(neu.hasSkyblockScoreboard()) {
+ for(TextOverlay overlay : OverlayManager.textOverlays) {
+ overlay.tick();
+ }
}
if(TradeWindow.hypixelTradeWindowActive()) {
for(int i=0; i<16; i++) {
@@ -416,7 +417,7 @@ public class NEUEventListener {
@SubscribeEvent
public void onRenderGameOverlayPost(RenderGameOverlayEvent.Post event) {
long timeRemaining = 15000 - (System.currentTimeMillis() - notificationDisplayMillis);
- if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
+ if(neu.hasSkyblockScoreboard() && event.type == RenderGameOverlayEvent.ElementType.ALL) {
DungeonWin.render(event.partialTicks);
for(TextOverlay overlay : OverlayManager.textOverlays) {
if(OverlayManager.dontRenderOverlay != null && OverlayManager.dontRenderOverlay.isAssignableFrom(overlay.getClass())) {
@@ -470,7 +471,8 @@ public class NEUEventListener {
AtomicBoolean missingRecipe = new AtomicBoolean(false);
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
- if(Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper &&
+ if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper ||
+ Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) &&
event.gui == null && !(Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) &&
System.currentTimeMillis() - NotEnoughUpdates.INSTANCE.lastOpenedGui < 500) {
NotEnoughUpdates.INSTANCE.lastOpenedGui = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 7a43235a..a87d266a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -99,7 +99,7 @@ public class NEUOverlay extends Gui {
private InfoPane activeInfoPane = null;
private TreeSet<JsonObject> searchedItems = null;
- private JsonObject[] searchedItemsArr = null;
+ private final List<JsonObject> searchedItemsArr = new ArrayList<>();
private HashMap<String, List<String>> searchedItemsSubgroup = new HashMap<>();
@@ -1227,7 +1227,9 @@ public class NEUOverlay extends Gui {
this.searchedItems = searchedItems;
this.searchedItemsSubgroup = searchedItemsSubgroup;
- this.searchedItemsArr = null;
+ synchronized(this.searchedItemsArr) {
+ this.searchedItemsArr.clear();
+ }
redrawItems = true;
});
@@ -1237,18 +1239,15 @@ public class NEUOverlay extends Gui {
* Returns an index-able array containing the elements in searchedItems.
* Whenever searchedItems is updated in updateSearch(), the array is recreated here.
*/
- public JsonObject[] getSearchedItems() {
+ public List<JsonObject> getSearchedItems() {
if(searchedItems == null) {
updateSearch();
- return new JsonObject[0];
+ return new ArrayList<>();
}
- if(searchedItemsArr==null) {
- searchedItemsArr = new JsonObject[searchedItems.size()];
- int i=0;
- for(JsonObject item : searchedItems) {
- searchedItemsArr[i] = item;
- i++;
+ if(searchedItems.size() > 0 && searchedItemsArr.size() == 0) {
+ synchronized(searchedItemsArr) {
+ searchedItemsArr.addAll(searchedItems);
}
}
return searchedItemsArr;
@@ -1261,8 +1260,9 @@ public class NEUOverlay extends Gui {
public JsonObject getSearchedItemPage(int index) {
if(index < getSlotsXSize()*getSlotsYSize()) {
int actualIndex = index + getSlotsXSize()*getSlotsYSize()*page;
- if(actualIndex < getSearchedItems().length) {
- return getSearchedItems()[actualIndex];
+ List<JsonObject> searchedItems = getSearchedItems();
+ if(actualIndex < searchedItems.size()) {
+ return searchedItems.get(actualIndex);
} else {
return null;
}
@@ -1352,8 +1352,8 @@ public class NEUOverlay extends Gui {
}
public int getMaxPages() {
- if(getSearchedItems().length == 0) return 1;
- return (int)Math.ceil(getSearchedItems().length/(float)getSlotsYSize()/getSlotsXSize());
+ if(getSearchedItems().size() == 0) return 1;
+ return (int)Math.ceil(getSearchedItems().size()/(float)getSlotsYSize()/getSlotsXSize());
}
public int getSearchBarYSize() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index dea4d520..55ba7756 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -25,6 +25,7 @@ import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
import io.github.moulberry.notenoughupdates.overlays.FuelBar;
+import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
@@ -38,6 +39,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
@@ -45,7 +47,6 @@ import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
-import net.minecraft.network.play.client.C13PacketPlayerAbilities;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.*;
@@ -77,8 +78,6 @@ import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
@Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true)
public class NotEnoughUpdates {
@@ -669,6 +668,14 @@ public class NotEnoughUpdates {
}
});
+ SimpleCommand dnCommand = new SimpleCommand("dn", new SimpleCommand.ProcessCommandRunnable() {
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub");
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA+"Warping to:"+EnumChatFormatting.YELLOW+" Deez Nuts lmao"));
+ }
+ });
+
SimpleCommand viewCataCommand = new SimpleCommand("cata", new SimpleCommand.ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
@@ -879,7 +886,10 @@ public class NotEnoughUpdates {
public void preinit(FMLPreInitializationEvent event) {
INSTANCE = this;
- if(Minecraft.getMinecraft().getSession().getPlayerID().equalsIgnoreCase("ea9b1c5a-bf68-4fa2-9492-2d4e69693228")) throw new RuntimeException("Ding-dong, racism is wrong.");
+ String uuid = Minecraft.getMinecraft().getSession().getPlayerID();
+ if(uuid.equalsIgnoreCase("ea9b1c5a-bf68-4fa2-9492-2d4e69693228")) throw new RuntimeException("Ding-dong, racism is wrong.");
+ if(uuid.equalsIgnoreCase("1f4bc571-783a-490a-8ef6-54d18bb72c7c")) throw new RuntimeException("Oops misclicked");
+ if(uuid.equalsIgnoreCase("784747a0-3ac9-4ad6-bc75-8cf1bc9d7080")) throw new RuntimeException("Oops did it again");
neuDir = new File(event.getModConfigurationDirectory(), "notenoughupdates");
neuDir.mkdirs();
@@ -917,7 +927,11 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new DwarvenMinesWaypoints());
MinecraftForge.EVENT_BUS.register(new FuelBar());
MinecraftForge.EVENT_BUS.register(XPInformation.getInstance());
- MinecraftForge.EVENT_BUS.register(new PetInfo());
+ MinecraftForge.EVENT_BUS.register(OverlayManager.petInfoOverlay);
+
+ if(Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
+ ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(CustomSkulls.getInstance());
+ }
ClientCommandHandler.instance.registerCommand(collectionLogCommand);
ClientCommandHandler.instance.registerCommand(cosmeticsCommand);
@@ -930,6 +944,7 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(viewProfileCommand);
ClientCommandHandler.instance.registerCommand(viewProfileShortCommand);
ClientCommandHandler.instance.registerCommand(dhCommand);
+ ClientCommandHandler.instance.registerCommand(dnCommand);
if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand);
ClientCommandHandler.instance.registerCommand(peekCommand);
ClientCommandHandler.instance.registerCommand(tutorialCommand);
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 d23df8c3..b0f0bff3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/BackgroundBlur.java
@@ -80,6 +80,7 @@ public class BackgroundBlur {
}
remove.remove((float)NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor);
+ lastBlurUse.keySet().removeAll(remove);
blurOutput.keySet().removeAll(remove);
requestedBlurs.clear();
@@ -165,11 +166,10 @@ public class BackgroundBlur {
//Corrupted shader?
return;
}
- if(blurFactor != lastBgBlurFactor) {
- blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blurFactor);
- blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blurFactor);
- lastBgBlurFactor = blurFactor;
- }
+
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blurFactor);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blurFactor);
+
GL11.glPushMatrix();
/*GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, blurOutputVert.framebufferObject);
@@ -192,6 +192,7 @@ public class BackgroundBlur {
*/
public static void renderBlurredBackground(float blurStrength, int screenWidth, int screenHeight,
int x, int y, int blurWidth, int blurHeight) {
+ if(blurStrength < 0.5) return;
requestedBlurs.add(blurStrength);
if(!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
@@ -200,6 +201,7 @@ public class BackgroundBlur {
Framebuffer fb = blurOutput.get(blurStrength);
if(fb == null) {
+ System.out.println("Blur not found:"+blurStrength);
fb = blurOutput.values().iterator().next();
}
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 56dbe77d..b2f947d6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java
@@ -90,6 +90,9 @@ public class GuiElementTextField {
return textField.getText();
}
+ public void setFocus(boolean focus) {
+ this.focus = focus;
+ }
public boolean getFocus() {
return focus;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
index e7198631..66df27c6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/Position.java
@@ -27,8 +27,15 @@ public class Position {
this.centerY = centerY;
}
+ public void set(Position other) {
+ this.x = other.x;
+ this.y = other.y;
+ this.centerX = other.centerX;
+ this.centerY = other.centerY;
+ }
+
public Position clone() {
- return new Position(x, y);
+ return new Position(x, y, centerX, centerY);
}
public boolean isCenterX() {
@@ -90,14 +97,14 @@ public class Position {
if(centerX) {
if(wasPositiveX) {
- if(this.x > screenWidth/2-objWidth) {
- deltaX += screenWidth/2-objWidth-this.x;
- this.x = screenWidth/2-objWidth;
+ if(this.x > screenWidth/2-objWidth/2) {
+ deltaX += screenWidth/2-objWidth/2-this.x;
+ this.x = screenWidth/2-objWidth/2;
}
} else {
- if(this.x < -screenWidth/2) {
- deltaX += -screenWidth/2-this.x;
- this.x = -screenWidth/2;
+ if(this.x < -screenWidth/2+objWidth/2) {
+ deltaX += -screenWidth/2+objWidth/2-this.x;
+ this.x = -screenWidth/2+objWidth/2;
}
}
return deltaX;
@@ -139,14 +146,14 @@ public class Position {
if(centerY) {
if(wasPositiveY) {
- if(this.y > screenHeight/2-objHeight) {
- deltaY += screenHeight/2-objHeight-this.y;
- this.y = screenHeight/2-objHeight;
+ if(this.y > screenHeight/2-objHeight/2) {
+ deltaY += screenHeight/2-objHeight/2-this.y;
+ this.y = screenHeight/2-objHeight/2;
}
} else {
- if(this.y < -screenHeight/2) {
- deltaY += -screenHeight/2-this.y;
- this.y = -screenHeight/2;
+ if(this.y < -screenHeight/2+objHeight/2) {
+ deltaY += -screenHeight/2+objHeight/2-this.y;
+ this.y = -screenHeight/2+objHeight/2;
}
}
return deltaY;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
index 9ca6b85b..0451b459 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDropdown.java
@@ -19,6 +19,7 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
public GuiOptionEditorDropdown(ConfigProcessor.ProcessedOption option, String[] values, int selected, boolean useOrdinal) {
super(option);
+ if(selected >= values.length) selected = values.length;
this.values = values;
this.selected = selected;
this.useOrdinal = useOrdinal;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
index 3b0df42d..e979e832 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
@@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
+import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.IOException;
@@ -83,6 +84,12 @@ public class GuiPositionEditor extends GuiScreen {
if(guiScaleOverride >= 0) {
Utils.pushGuiScale(-1);
}
+
+ scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth()/2, 8, true, 0xffffff);
+ Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth()/2, 18, true, 0xffffff);
}
@Override
@@ -118,6 +125,28 @@ public class GuiPositionEditor extends GuiScreen {
}
@Override
+ protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ Keyboard.enableRepeatEvents(true);
+
+ if(keyCode == Keyboard.KEY_R) {
+ position.set(originalPosition);
+ } else if(!clicked) {
+ boolean shiftHeld = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
+ int dist = shiftHeld ? 10 : 1;
+ if(keyCode == Keyboard.KEY_DOWN) {
+ position.moveY(dist, elementHeight, new ScaledResolution(Minecraft.getMinecraft()));
+ } else if(keyCode == Keyboard.KEY_UP) {
+ position.moveY(-dist, elementHeight, new ScaledResolution(Minecraft.getMinecraft()));
+ } else if(keyCode == Keyboard.KEY_LEFT) {
+ position.moveX(-dist, elementWidth, new ScaledResolution(Minecraft.getMinecraft()));
+ } else if(keyCode == Keyboard.KEY_RIGHT) {
+ position.moveX(dist, elementWidth, new ScaledResolution(Minecraft.getMinecraft()));
+ }
+ }
+ super.keyTyped(typedChar, keyCode);
+ }
+
+ @Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
clicked = false;
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 3af37cdd..927ef8cf 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java
@@ -310,29 +310,30 @@ public class NEUCape {
}
private void loadShaderUniforms(ShaderManager shaderManager) {
+ String shaderId = "capes/"+shaderName+"/"+shaderName;
if(shaderName.equalsIgnoreCase("fade_cape")) {
- shaderManager.loadData(shaderName, "millis", (int)(System.currentTimeMillis()-startTime));
+ shaderManager.loadData(shaderId, "millis", (int)(System.currentTimeMillis()-startTime));
} else if(shaderName.equalsIgnoreCase("space_cape")) {
- shaderManager.loadData(shaderName, "millis", (int)(System.currentTimeMillis()-startTime));
- shaderManager.loadData(shaderName, "eventMillis", (int)(System.currentTimeMillis()-eventMillis));
- shaderManager.loadData(shaderName, "eventRand", eventRandom);
+ shaderManager.loadData(shaderId, "millis", (int)(System.currentTimeMillis()-startTime));
+ shaderManager.loadData(shaderId, "eventMillis", (int)(System.currentTimeMillis()-eventMillis));
+ shaderManager.loadData(shaderId, "eventRand", eventRandom);
} else if(shaderName.equalsIgnoreCase("mcworld_cape")) {
- shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderId, "millis", (int) (System.currentTimeMillis() - startTime));
} else if(shaderName.equalsIgnoreCase("lava_cape")) {
- shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderId, "millis", (int) (System.currentTimeMillis() - startTime));
} else if(shaderName.equalsIgnoreCase("lightning_cape")) {
- shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderId, "millis", (int) (System.currentTimeMillis() - startTime));
} else if(shaderName.equalsIgnoreCase("biscuit_cape") || shaderName.equalsIgnoreCase("shiny_cape")) {
- shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
- shaderManager.loadData(shaderName, "eventMillis", (int)(System.currentTimeMillis()-eventMillis));
+ shaderManager.loadData(shaderId, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderId, "eventMillis", (int)(System.currentTimeMillis()-eventMillis));
} else if(shaderName.equalsIgnoreCase("negative")) {
- shaderManager.loadData(shaderName, "screensize", new Vector2f(
+ shaderManager.loadData(shaderId, "screensize", new Vector2f(
Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight
));
} else if(shaderName.equalsIgnoreCase("void")) {
- shaderManager.loadData(shaderName, "millis", (int) (System.currentTimeMillis() - startTime));
- shaderManager.loadData(shaderName, "screensize", new Vector2f(
+ shaderManager.loadData(shaderId, "millis", (int) (System.currentTimeMillis() - startTime));
+ shaderManager.loadData(shaderId, "screensize", new Vector2f(
Minecraft.getMinecraft().displayWidth,
Minecraft.getMinecraft().displayHeight
));
@@ -375,7 +376,7 @@ public class NEUCape {
GL11.glTranslatef(-(float)viewerX, -(float)viewerY, -(float)viewerZ);
ShaderManager shaderManager = ShaderManager.getInstance();
- shaderManager.loadShader(shaderName);
+ shaderManager.loadShader("capes/"+shaderName+"/"+shaderName);
loadShaderUniforms(shaderManager);
renderCape(player, e.partialRenderTick);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/ShaderManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/ShaderManager.java
index a750f597..70fe6745 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/ShaderManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/ShaderManager.java
@@ -151,6 +151,7 @@ public class ShaderManager {
}
return source.toString();
} catch(IOException e) {
+ e.printStackTrace();
}
return "";
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
index d4b161de..f6b5b722 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -1382,6 +1382,7 @@ public class DungeonMap {
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event) {
+ if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
if(!NotEnoughUpdates.INSTANCE.config.dungeonMap.dmEnable) return;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
index 8e334d3b..e198e8e5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -41,7 +41,7 @@ public class CustomItemEffects {
public static final CustomItemEffects INSTANCE = new CustomItemEffects();
- private static final int MAX_BUILDERS_BLOCKS = 164;
+ private static final int MAX_BUILDERS_BLOCKS = 241;
public long aoteUseMillis = 0;
@@ -389,7 +389,7 @@ public class CustomItemEffects {
}
} else if(NotEnoughUpdates.INSTANCE.config.builderWand.enableWandOverlay) {
if(heldInternal.equals("BUILDERS_WAND")) {
- int maxBlocks = 164;
+ int maxBlocks = MAX_BUILDERS_BLOCKS;
if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos().offset(event.target.sideHit, 1));
if(hover.getBlock() == Blocks.air) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java
new file mode 100644
index 00000000..30b99e1c
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java
@@ -0,0 +1,283 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.TexLoc;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelHumanoidHead;
+import net.minecraft.client.model.ModelSkeletonHead;
+import net.minecraft.client.renderer.EntityRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.block.model.*;
+import net.minecraft.client.renderer.texture.*;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+import net.minecraft.client.resources.DefaultPlayerSkin;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.client.resources.IResourceManagerReloadListener;
+import net.minecraft.client.resources.model.IBakedModel;
+import net.minecraft.client.resources.model.ModelBakery;
+import net.minecraft.client.resources.model.ModelRotation;
+import net.minecraft.client.resources.model.SimpleBakedModel;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+public class CustomSkulls implements IResourceManagerReloadListener {
+
+ private static final CustomSkulls INSTANCE = new CustomSkulls();
+
+ public static CustomSkulls getInstance() {
+ return INSTANCE;
+ }
+
+ private ResourceLocation atlas = new ResourceLocation("notenoughupdates:custom_skull_textures_atlas");
+ private ResourceLocation configuration = new ResourceLocation("notenoughupdates:custom_skull_textures/customskull.json");
+ protected final TextureMap textureMap = new TextureMap("custom_skull_textures");
+
+ protected final Map<ResourceLocation, TextureAtlasSprite> sprites = Maps.<ResourceLocation, TextureAtlasSprite>newHashMap();
+
+ private final FaceBakery faceBakery = new FaceBakery();
+ private final ModelSkeletonHead humanoidHead = new ModelHumanoidHead();
+
+ private final HashMap<String, CustomSkull> customSkulls = new HashMap<>();
+
+ private final Gson gson = new GsonBuilder().create();
+
+ private class CustomSkull {
+ private ModelBlock model;
+ private IBakedModel modelBaked;
+
+ private ResourceLocation texture;
+ }
+
+ @Override
+ public void onResourceManagerReload(IResourceManager resourceManager) {
+ customSkulls.clear();
+
+ try(BufferedReader reader = new BufferedReader(new InputStreamReader(
+ Minecraft.getMinecraft().getResourceManager().getResource(configuration).getInputStream(), StandardCharsets.UTF_8))) {
+ JsonObject json = gson.fromJson(reader, JsonObject.class);
+
+ if(json == null) return;
+
+ for(Map.Entry<String, JsonElement> entry : json.entrySet()) {
+ if(entry.getValue().isJsonObject()) {
+ JsonObject obj = entry.getValue().getAsJsonObject();
+ if(obj.has("model")) {
+ String location = obj.get("model").getAsString();
+ ResourceLocation loc = new ResourceLocation("notenoughupdates:custom_skull_textures/" + location + ".json");
+
+ CustomSkull skull = new CustomSkull();
+ skull.model = ModelBlock.deserialize(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()));
+
+ customSkulls.put(entry.getKey(), skull);
+ } else if(obj.has("texture")) {
+ String location = obj.get("texture").getAsString();
+ ResourceLocation loc = new ResourceLocation("notenoughupdates:custom_skull_textures/" + location + ".png");
+
+ CustomSkull skull = new CustomSkull();
+ skull.texture = loc;
+
+ customSkulls.put(entry.getKey(), skull);
+ }
+ }
+ }
+
+ loadSprites();
+
+ for(CustomSkull skull : customSkulls.values()) {
+ if(skull.model != null) {
+ skull.modelBaked = bakeModel(skull.model, ModelRotation.X0_Y0, false);
+ }
+ }
+
+ Minecraft.getMinecraft().getTextureManager().loadTickableTexture(atlas, textureMap);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void loadSprites() {
+ final Set<ResourceLocation> set = this.getAllTextureLocations();
+ set.remove(TextureMap.LOCATION_MISSING_TEXTURE);
+ IIconCreator iiconcreator = new IIconCreator() {
+ public void registerSprites(TextureMap iconRegistry) {
+ for(ResourceLocation resourcelocation : set) {
+ TextureAtlasSprite textureatlassprite = iconRegistry.registerSprite(resourcelocation);
+ CustomSkulls.this.sprites.put(resourcelocation, textureatlassprite);
+ }
+ }
+ };
+ this.textureMap.loadSprites(Minecraft.getMinecraft().getResourceManager(), iiconcreator);
+ this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite());
+ }
+
+ protected Set<ResourceLocation> getAllTextureLocations() {
+ Set<ResourceLocation> set = new HashSet<>();
+
+ for(CustomSkull skull : customSkulls.values()) {
+ if(skull.model != null) {
+ set.addAll(getTextureLocations(skull.model));
+ }
+ }
+
+ return set;
+ }
+
+ protected Set<ResourceLocation> getTextureLocations(ModelBlock modelBlock) {
+ Set<ResourceLocation> set = Sets.<ResourceLocation>newHashSet();
+
+ for(BlockPart blockpart : modelBlock.getElements()) {
+ for(BlockPartFace blockpartface : blockpart.mapFaces.values()) {
+ ResourceLocation resourcelocation = new ResourceLocation("notenoughupdates", modelBlock.resolveTextureName(blockpartface.texture));
+ set.add(resourcelocation);
+ }
+ }
+
+ set.add(new ResourceLocation("notenoughupdates", modelBlock.resolveTextureName("particle")));
+ return set;
+ }
+
+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) {
+ TextureAtlasSprite textureatlassprite = this.sprites.get(new ResourceLocation("notenoughupdates", modelBlockIn.resolveTextureName("particle")));
+ SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite);
+
+ for(BlockPart blockpart : modelBlockIn.getElements()) {
+ for(EnumFacing enumfacing : blockpart.mapFaces.keySet()) {
+ BlockPartFace blockpartface = blockpart.mapFaces.get(enumfacing);
+ TextureAtlasSprite textureatlassprite1 = this.sprites.get(new ResourceLocation("notenoughupdates", modelBlockIn.resolveTextureName(blockpartface.texture)));
+
+ if(blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) {
+ simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
+ } else {
+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked));
+ }
+ }
+ }
+
+ return simplebakedmodel$builder.makeBakedModel();
+ }
+
+ private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) {
+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation) p_177589_5_, p_177589_6_);
+ }
+
+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) {
+ return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade);
+ }
+
+ private void renderModel(IBakedModel model, int color) {
+ Tessellator tessellator = Tessellator.getInstance();
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ worldrenderer.begin(7, DefaultVertexFormats.ITEM);
+
+ for(EnumFacing enumfacing : EnumFacing.values()) {
+ this.renderQuads(worldrenderer, model.getFaceQuads(enumfacing), color);
+ }
+
+ this.renderQuads(worldrenderer, model.getGeneralQuads(), color);
+ tessellator.draw();
+ }
+
+ private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color) {
+ int i = 0;
+
+ for(int j = quads.size(); i < j; ++i) {
+ BakedQuad bakedquad = quads.get(i);
+ int k = color;
+
+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k);
+ }
+ }
+
+ public boolean renderSkull(float xOffset, float yOffset, float zOffset, EnumFacing placedDirection,
+ float rotationDeg, int skullType, GameProfile skullOwner, int damage) {
+ if(skullOwner == null || placedDirection != EnumFacing.UP || skullType != 3) {
+ return false;
+ }
+
+ CustomSkull skull = customSkulls.get(skullOwner.getId().toString());
+ if(skull == null) {
+ return false;
+ }
+
+ if(skull.modelBaked != null) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(atlas);
+ GlStateManager.pushMatrix();
+ GlStateManager.disableCull();
+
+ GlStateManager.translate(xOffset + 0.5F, yOffset, zOffset + 0.5F);
+
+ GlStateManager.enableRescaleNormal();
+ GlStateManager.enableAlpha();
+ GlStateManager.scale(1, 1, -1);
+ GlStateManager.translate(-0.5f, 0.25f, -0.5f);
+ renderModel(skull.modelBaked, 0xffffffff);
+ GlStateManager.popMatrix();
+ } else if(skull.texture != null) {
+ if( Minecraft.getMinecraft().getTextureManager().getTexture(skull.texture) == null) {
+ try {
+ BufferedImage image = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(skull.texture).getInputStream());
+ int size = Math.max(image.getHeight(), image.getWidth());
+
+ Minecraft.getMinecraft().getTextureManager().loadTexture(skull.texture, new AbstractTexture() {
+ @Override
+ public void loadTexture(IResourceManager resourceManager) {
+ TextureUtil.allocateTexture(this.getGlTextureId(), size, size);
+
+ int[] rgb = new int[size*size];
+
+ image.getRGB(0, 0, image.getWidth(), image.getHeight(), rgb, 0, image.getWidth());
+
+ TextureUtil.uploadTexture(this.getGlTextureId(), rgb, size, size);
+ }
+ });
+ } catch(IOException ignored) {}
+ }
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(skull.texture);
+
+ GlStateManager.pushMatrix();
+ GlStateManager.disableCull();
+
+ GlStateManager.translate(xOffset + 0.5F, yOffset, zOffset + 0.5F);
+
+ float f = 0.0625F;
+ GlStateManager.enableRescaleNormal();
+ GlStateManager.scale(-1.0F, -1.0F, 1.0F);
+ GlStateManager.enableAlpha();
+ humanoidHead.render(null, 0.0F, 0.0F, 0.0F, rotationDeg, 0.0F, f);
+ GlStateManager.popMatrix();
+ } else {
+ return false;
+ }
+
+ return true;
+ }
+
+}
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 36f4b908..a3f6dbf4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
@@ -13,12 +14,14 @@ public class DamageCommas {
private static final HashMap<Integer, ChatComponentText> replacementMap = new HashMap<>();
+ private static final EnumChatFormatting[] colours = {EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.WHITE};
+
public static void tick() {
replacementMap.clear();
}
public static IChatComponent replaceName(IChatComponent name) {
- if(!NotEnoughUpdates.INSTANCE.config.misc.damageCommas) return name;
+ if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 0) return name;
String formatted = name.getFormattedText();
int hashCode = formatted.hashCode();
@@ -32,6 +35,37 @@ public class DamageCommas {
if(formatted.length() >= 7 && formatted.startsWith("\u00A7f\u2727") &&
formatted.endsWith("\u2727\u00a7r")) {
+ if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 2) {
+ String numbers = Utils.cleanColour(formatted.substring(3, formatted.length()-3)).trim().replaceAll("[^0-9]", "");
+ try {
+ int damage = Integer.parseInt(numbers);
+
+ String damageString;
+ if(damage > 999) {
+ damageString = Utils.shortNumberFormat(damage, 0);
+ } else {
+ damageString = NumberFormat.getIntegerInstance().format(damage);
+ }
+
+ StringBuilder colouredString = new StringBuilder();
+ int colourIndex = 0;
+ for(int i=0; i<damageString.length(); i++) {
+ int index = damageString.length() - 1 - i;
+ char c = damageString.charAt(index);
+ if(c >= '0' && c <= '9') {
+ colouredString.insert(0, c);
+ colouredString.insert(0, colours[colourIndex++ % colours.length]);
+ } else {
+ colouredString.insert(0, c);
+ }
+ }
+
+ ChatComponentText ret = new ChatComponentText("\u00A7f\u2727"+colouredString+"\u00a7r\u2727\u00a7r");
+ replacementMap.put(hashCode, ret);
+ return ret;
+ } catch(NumberFormatException ignored) {}
+ }
+
StringBuilder builder = new StringBuilder();
boolean numLast = false;
boolean colLast = false;
@@ -81,7 +115,12 @@ public class DamageCommas {
try {
int damage = Integer.parseInt(damageS);
- String damageFormatted = NumberFormat.getIntegerInstance().format(damage);
+ String damageFormatted;
+ if(NotEnoughUpdates.INSTANCE.config.misc.damageCommas == 2 && damage > 999) {
+ damageFormatted = Utils.shortNumberFormat(damage, 0);
+ } else {
+ damageFormatted = NumberFormat.getIntegerInstance().format(damage);
+ }
ChatComponentText ret = new ChatComponentText(EnumChatFormatting.GRAY+damageFormatted+EnumChatFormatting.RESET);
replacementMap.put(hashCode, ret);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
index 2fa8d5be..186f4abc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java
@@ -168,8 +168,8 @@ public class DwarvenMinesTextures {
if(modZ < 0) modZ += 16;
ChunkCoordIntPair offset = new ChunkCoordIntPair(modX, modZ);
- if(map.containsKey(offset)) {
- IgnoreColumn ignore = map.get(offset);
+ IgnoreColumn ignore = map.get(offset);
+ if(ignore != null) {
if(ignore.always) {
return 1;
} else {
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 f3a21b1d..a2276b0e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
@@ -53,13 +53,13 @@ public class ItemCooldowns {
}
public static long getTreecapCooldownWithPet(){
- if (NotEnoughUpdates.INSTANCE.config.treecap.enableMonkeyCheck && PetInfo.currentPet != null) {
- PetInfo.pet pet = PetInfo.currentPet;
+ if (NotEnoughUpdates.INSTANCE.config.treecap.enableMonkeyCheck && PetInfoOverlay.currentPet != null) {
+ PetInfoOverlay.Pet pet = PetInfoOverlay.currentPet;
if (pet.petLevel != null &&
pet.petType.equalsIgnoreCase("monkey") &&
- pet.rarity.equals(PetInfo.Rarity.LEGENDARY)
+ pet.rarity.equals(PetInfoOverlay.Rarity.LEGENDARY)
) {
- return 2000 - (int) (2000 * (0.005 * (int) PetInfo.currentPet.petLevel.level));
+ return 2000 - (int) (2000 * (0.005 * (int) PetInfoOverlay.currentPet.petLevel.level));
}
}
return 2000;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfo.java
deleted file mode 100644
index 187ca897..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfo.java
+++ /dev/null
@@ -1,372 +0,0 @@
-package io.github.moulberry.notenoughupdates.miscfeatures;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor;
-import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
-import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
-import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.ProfileApiSyncer;
-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.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.client.event.ClientChatReceivedEvent;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.Loader;
-import net.minecraftforge.fml.common.eventhandler.EventPriority;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.apache.commons.lang3.text.WordUtils;
-
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class PetInfo {
-
- private static final Pattern XP_GAIN_AND_SKILL_PATTERN = Pattern.compile("\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy) (\\(([0-9.,]+)/([0-9.,]+)\\))");
- private static final Pattern XP_BOOST_PATTERN = Pattern.compile("PET_ITEM_(COMBAT|FISHING|MINING|FORAGING|ALL|FARMING)_(SKILL|SKILLS)_BOOST_(COMMON|UNCOMMON|RARE|EPIC)");
-
- public enum Rarity {
- COMMON(0, 0, 1, EnumChatFormatting.WHITE),
- UNCOMMON(6, 1, 2, EnumChatFormatting.GREEN),
- RARE(11, 2, 3, EnumChatFormatting.BLUE),
- EPIC(16, 3, 4, EnumChatFormatting.DARK_PURPLE),
- LEGENDARY(20, 4, 5, EnumChatFormatting.GOLD),
- MYTHIC(20, 4, 5, EnumChatFormatting.LIGHT_PURPLE);
-
- public int petOffset;
- public EnumChatFormatting chatFormatting;
- public int petId;
- public int beastcreatMultiplyer;
-
- Rarity(int petOffset, int petId, int beastcreatMultiplyer, EnumChatFormatting chatFormatting){
- this.chatFormatting = chatFormatting;
- this.petOffset = petOffset;
- this.petId = petId;
- this.beastcreatMultiplyer = beastcreatMultiplyer;
- }
-
- public static Rarity getRarityFromColor(EnumChatFormatting chatFormatting){
- for (int i = 0; i < Rarity.values().length; i++) {
- if (Rarity.values()[i].chatFormatting.equals(chatFormatting))
- return Rarity.values()[i];
- }
- return COMMON;
- }
- }
-
- public static class pet {
- public String petType;
- public double petExp;
- public Rarity rarity;
- public GuiProfileViewer.PetLevel petLevel;
- public String petXpType;
- public String petItem;
- }
-
- public static pet currentPet = null;
- public static HashMap<String, pet> petList = new HashMap<>();
-
- public static double currentXp = 0.0;
- public static String currentXpType = "";
- public static int tamingLevel = 1;
- public static double beastMultiplier = 0;
- public static boolean ignoreNextXp = false;
-
- public static void clearPet(){ currentPet = null; }
-
- public float getLevelPercent(){
- DecimalFormat df = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
- try {
- return Float.parseFloat(df.format(currentPet.petLevel.levelPercentage * 100f ));
- }catch (Exception ignored){ return 0; }
- }
-
- private static void getAndSetPet(ProfileViewer.Profile profile) {
- JsonObject petObject = profile.getPetsInfo(profile.getLatestProfile());
- JsonObject skillInfo = profile.getSkillInfo(profile.getLatestProfile());
- JsonObject invInfo = profile.getInventoryInfo(profile.getLatestProfile());
- JsonObject profileInfo = profile.getProfileInformation(profile.getLatestProfile());
- if (invInfo != null && profileInfo != null){
- JsonObject stats = profileInfo.get("stats").getAsJsonObject();
- boolean hasBeastmasterCrest = false;
- Rarity currentBeastRarity = Rarity.COMMON;
- for (JsonElement talisman : invInfo.get("talisman_bag").getAsJsonArray()) {
- if (talisman.isJsonNull()) continue;
- String internalName = talisman.getAsJsonObject().get("internalname").getAsString();
- if (internalName.startsWith("BEASTMASTER_CREST")) {
- hasBeastmasterCrest = true;
- try {
- Rarity talismanRarity = Rarity.valueOf(internalName.replace("BEASTMASTER_CREST_", ""));
- if (talismanRarity.beastcreatMultiplyer > currentBeastRarity.beastcreatMultiplyer) currentBeastRarity = talismanRarity;
- } catch (Exception ignored) {}
- }
- }
- if (hasBeastmasterCrest) {
- if (stats.has("mythos_kills")) {
- int mk = stats.get("mythos_kills").getAsInt();
- double petXpBoost = mk > 10000 ? 1 : mk > 7500 ? 0.9 : mk > 5000 ? 0.8 : mk > 2500 ? 0.7 :
- mk > 1000 ? 0.6 : mk > 500 ? 0.5 : mk > 250 ? 0.4 : mk > 100 ? 0.3 : mk > 25 ? 0.2 : 0.1;
- beastMultiplier = petXpBoost * currentBeastRarity.beastcreatMultiplyer;
- }else beastMultiplier = 0.1 * currentBeastRarity.beastcreatMultiplyer;
- }
- }
- if (skillInfo != null) tamingLevel = skillInfo.get("level_skill_taming").getAsInt();
- JsonObject petsJson = Constants.PETS;
- if (petsJson != null) {
- if (petObject != null) {
- boolean hasActivePet = false;
- petList.clear();
-
- for (int i = 0; i < petObject.getAsJsonArray("pets").size(); i++) {
- JsonElement petElement = petObject.getAsJsonArray("pets").get(i);
- JsonObject petObj = petElement.getAsJsonObject();
- pet pet = new pet();
- pet.petType = petObj.get("type").getAsString();
- Rarity rarity;
- try {
- rarity = Rarity.valueOf(petObj.get("tier").getAsString());
- } catch (Exception ignored) {
- rarity = Rarity.COMMON;
- }
- pet.rarity = rarity;
- pet.petExp = petObj.get("exp").getAsDouble();
- pet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), rarity.petOffset, (float) pet.petExp);
- JsonElement heldItem = petObj.get("heldItem");
- pet.petItem = heldItem.isJsonNull() ? null : heldItem.getAsString();
- JsonObject petTypes = petsJson.get("pet_types").getAsJsonObject();
- pet.petXpType = petTypes.has(pet.petType) ? petTypes.get(pet.petType.toUpperCase()).getAsString().toLowerCase() : "unknown";
-
- petList.put(pet.petType + ";" + pet.rarity.petId, pet);
- if (petObj.get("active").getAsBoolean()) {
- hasActivePet = true;
- if (currentPet == null || (pet.petType.equalsIgnoreCase(currentPet.petType) && pet.rarity.equals(currentPet.rarity))) {
- if (currentPet != null && ((currentPet.petLevel.level == pet.petLevel.level && currentPet.petLevel.levelPercentage > pet.petLevel.levelPercentage) || currentPet.petLevel.level > pet.petLevel.level))
- pet.petLevel = currentPet.petLevel;
- currentPet = pet;
- }
- }
- }
- if (!hasActivePet){
- clearPet();
- }
- }
- }
- }
-
- public static void longTick(){
- NEUConfig config = NotEnoughUpdates.INSTANCE.config;
- int updateTime = 90000;
- if ((config.treecap.enableMonkeyCheck || config.notifications.showWrongPetMsg) && !config.overlay.enablePetInfo) updateTime = 300000;
-
- if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()){
- ProfileApiSyncer.getInstance().requestResync("petinfo", updateTime, () -> {}, PetInfo::getAndSetPet);
- }
- }
-
- public static float getCurrentLevelReqs(float level, pet pet){
- JsonObject petsJson = Constants.PETS;
- if (petsJson != null){
- return petsJson.get("pet_levels").getAsJsonArray().get((int) (level+pet.rarity.petOffset)).getAsFloat();
- }
- return 0;
- }
-
- public static double getBoostMultiplyer(String boostName){
- if (boostName == null) return 1;
- if (boostName.equalsIgnoreCase("PET_ITEM_ALL_SKILLS_BOOST_COMMON")) {
- return 1.1;
- }else if (boostName.equalsIgnoreCase("ALL_SKILLS_SUPER_BOOST")){
- return 1.2;
- }else if (boostName.endsWith("epic")){
- return 1.5;
- }else if (boostName.endsWith("rare")){
- return 1.4;
- }else if (boostName.endsWith("uncommon")){
- return 1.3;
- }else if (boostName.endsWith("common")){
- return 1.2;
- }
- else return 1;
- }
-
- public static double getXpGain(pet pet, double xp, String xpType){
- double tamingPercent = 1.0 + (tamingLevel / 100f);
- xp = xp * tamingPercent;
- xp = xp + (xp * beastMultiplier);
- if (pet.petXpType != null && !pet.petXpType.equalsIgnoreCase(xpType)){
- xp = ((xpType.equalsIgnoreCase("alchemy") && !pet.petXpType.equalsIgnoreCase("alchemy")) || xpType.equalsIgnoreCase("enchanting") ) ?
- xp * 0.08 : xp * 0.33;
- }
- if (xpType.equalsIgnoreCase("mining") || xpType.equalsIgnoreCase("fishing")){
- xp = xp * 1.5;
- }
- if (pet.petItem != null) {
- Matcher petItemMatcher = XP_BOOST_PATTERN.matcher(pet.petItem);
- if ((petItemMatcher.matches() && petItemMatcher.group(1).equalsIgnoreCase(pet.petXpType)) || pet.petItem.equalsIgnoreCase("ALL_SKILLS_SUPER_BOOST"))
- xp = xp * getBoostMultiplyer(pet.petItem);
- }
- return xp;
- }
-
-
- @SubscribeEvent
- public void onOverlayDrawn(RenderGameOverlayEvent.Post event) {
- NEUConfig config = NotEnoughUpdates.INSTANCE.config;
- if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && config.overlay.enablePetInfo && ((event.type == null && Loader.isModLoaded("labymod")) ||
- event.type == RenderGameOverlayEvent.ElementType.ALL)
- ){
- Minecraft mc = Minecraft.getMinecraft();
- if (mc.gameSettings.showDebugInfo ||
- (mc.gameSettings.keyBindPlayerList.isKeyDown() &&
- (!mc.isIntegratedServerRunning() ||
- mc.thePlayer.sendQueue.getPlayerInfoMap().size() > 1))) {
- return;
- }
-
- if (currentPet != null && currentPet.petLevel != null && !currentPet.petType.isEmpty()) {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-
- FontRenderer font = mc.fontRendererObj;
-
- int overlayStyle = config.overlay.petInfoOverlayStyle;
-
- String petName = EnumChatFormatting.GREEN + "[Lvl " + (int) currentPet.petLevel.level + "] " + currentPet.rarity.chatFormatting +
- WordUtils.capitalizeFully(currentPet.petType.replace("_", " "));
- String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat((currentPet.petLevel.currentLevelRequirement * currentPet.petLevel.levelPercentage), 0) + "/" + Utils.shortNumberFormat(currentPet.petLevel.currentLevelRequirement, 0) + EnumChatFormatting.YELLOW + " (" + getLevelPercent() + "%)";
-
- int xPos = config.overlay.petInfoPosition.getAbsX(scaledResolution, Math.max(font.getStringWidth(petName), font.getStringWidth(lvlString)) + 20);
- int yPos = config.overlay.petInfoPosition.getAbsY(scaledResolution, (currentPet.petLevel.level < 100 ? 22 : 11)) + 2;
-
- if (!(mc.currentScreen instanceof GuiPositionEditor) && (overlayStyle == 0 || overlayStyle == 4))
- Gui.drawRect(xPos, yPos-2, xPos+Math.max(font.getStringWidth(lvlString), font.getStringWidth(petName))+22, yPos+(currentPet.petLevel.level < 100 ? 20 : 16), 0x80000000);
-
- if (overlayStyle == 3) {
- for (int xO = -2; xO <= 2; xO++) {
- for (int yO = -2; yO <= 2; yO++) {
- if (Math.abs(xO) != Math.abs(yO)) {
- font.drawString(Utils.cleanColour(petName), xPos + 20 + xO / 2f, yPos + (currentPet.petLevel.level < 100 ? 0 : 4) + yO / 2f, 0x000000, false);
- }
- }
- }
- }
-
- font.drawString(petName, xPos + 20, yPos + (currentPet.petLevel.level < 100 ? 0 : 4), 0xffffff, overlayStyle == 2 || overlayStyle == 4);
- if (currentPet.petLevel.level < 100){
- if (overlayStyle == 3) {
- for (int xO = -2; xO <= 2; xO++) {
- for (int yO = -2; yO <= 2; yO++) {
- if (Math.abs(xO) != Math.abs(yO)) {
- font.drawString(Utils.cleanColour(lvlString), xPos + 20 + xO / 2f, yPos + font.FONT_HEIGHT + yO / 2f, 0x000000, false);
- }
- }
- }
- }
- font.drawString(lvlString, xPos + 20, yPos + font.FONT_HEIGHT, 0xffffff, overlayStyle == 2 || overlayStyle == 4);
- }
-
- JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.petType+";"+currentPet.rarity.petId);
- if(petItem != null) {
- ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem, false, false, false);
- Utils.drawItemStack(stack, xPos, yPos);
- }
- GlStateManager.color(0,0,0);
- }
- }
- }
-
- @SubscribeEvent
- public void switchWorld(WorldEvent.Load event) {
- if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
- ProfileApiSyncer.getInstance().requestResync("petinfo", 10000, () -> {
- }, PetInfo::getAndSetPet);
- }
- }
-
- @SubscribeEvent(priority = EventPriority.HIGHEST)
- public void onChatReceived(ClientChatReceivedEvent event) {
- NEUConfig config = NotEnoughUpdates.INSTANCE.config;
- if (NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && (config.overlay.enablePetInfo || config.treecap.enableMonkeyCheck || config.notifications.showWrongPetMsg)) {
- if (event.type == 0) {
- String chatMessage = Utils.cleanColour(event.message.getUnformattedText());
- String petLevelMessage = "your " + (currentPet != null ? currentPet.petType.toLowerCase().replace("_", " ") : "") + " levelled up to level";
- if (chatMessage.toLowerCase().startsWith("you summoned your")) {
- String pet = chatMessage.trim().toUpperCase().replace("YOU SUMMONED YOUR ", "").replace("!", "").replace(" ", "_");
- Rarity rarity = event.message.getSiblings().size() == 3 ? Rarity.getRarityFromColor(event.message.getSiblings().get(1).getChatStyle().getColor()) : Rarity.COMMON;
- if (petList.containsKey(pet + ";" + rarity.petId)) {
- if (currentPet != null) petList.put(currentPet.petType + ";" + currentPet.rarity.petId, currentPet);
- pet summonedPet = new pet();
- summonedPet.petType = pet;
- summonedPet.rarity = rarity;
- summonedPet.petLevel = petList.get(pet + ";" + rarity.petId).petLevel;
- summonedPet.petXpType = petList.get(pet + ";" + rarity.petId).petXpType;
- currentPet = summonedPet;
- }
- } else if (chatMessage.toLowerCase().startsWith("you despawned your")) {
- if (currentPet != null) {
- petList.put(currentPet.petType + ";" + currentPet.rarity.petId, currentPet);
- }
- clearPet();
- } else if (chatMessage.toLowerCase().startsWith(petLevelMessage)) {
- if (currentPet != null) {
- try {
- ignoreNextXp = true;
- currentPet.petLevel.level = Integer.parseInt(chatMessage.toLowerCase().replace(petLevelMessage, "").replace("!", "").replace(" ", ""));
- currentPet.petLevel.levelPercentage = 0;
- currentPet.petLevel.currentLevelRequirement = getCurrentLevelReqs(currentPet.petLevel.level, currentPet);
- } catch (Exception ignored) {}
- }
- } else if (chatMessage.toLowerCase().contains("switching to profile")) {
- clearPet();
- petList.clear();
- }
- }
- if (event.type == 2) {
- String[] parts = Utils.cleanColour(event.message.getUnformattedText()).split(" {3,}");
- if (parts.length == 3) {
- Matcher matcher = XP_GAIN_AND_SKILL_PATTERN.matcher(parts[1].trim());
- if (currentPet != null && matcher.matches()) {
- String oldXpType = currentXpType;
- currentXpType = matcher.group(2);
- try {
- double actionXp = Double.parseDouble(matcher.group(4).replace(",", ""));
- if (actionXp != currentXp && actionXp != 0) {
- if (NotEnoughUpdates.INSTANCE.config.notifications.showWrongPetMsg &&
- currentXpType.equalsIgnoreCase(oldXpType) &&
- !currentXpType.equalsIgnoreCase(currentPet.petXpType)
- ){
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED +
- "[NEU]" + EnumChatFormatting.GOLD + " \u26A0 You're using a " + WordUtils.capitalizeFully(currentPet.petXpType) + " pet while gathering " + WordUtils.capitalizeFully(currentXpType) + " skill xp."));
- }
- double xpGain = !currentXpType.equalsIgnoreCase(oldXpType) ? Double.parseDouble(matcher.group(1)) : actionXp - currentXp;
- currentXp = actionXp;
- double xp = currentPet.petLevel.levelPercentage * currentPet.petLevel.currentLevelRequirement;
- double newXp = xp + getXpGain(currentPet, xpGain, currentXpType);
- if (ignoreNextXp) {
- //TODO : This needs to be changed to a better system as you can lose accuracy of levels with this,
- // will fix it self when it syncs to the api
- ignoreNextXp = false;
- } else {
- currentPet.petExp = newXp;
- currentPet.petLevel.levelPercentage = (float) (currentPet.petExp / currentPet.petLevel.currentLevelRequirement);
- }
- }
- }catch (NumberFormatException ignored){}
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
new file mode 100644
index 00000000..51a9dcd6
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -0,0 +1,646 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import com.google.common.collect.Lists;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
+import io.github.moulberry.notenoughupdates.overlays.TextOverlayStyle;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
+import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.ProfileApiSyncer;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import io.github.moulberry.notenoughupdates.util.XPInformation;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.apache.commons.lang3.text.WordUtils;
+import org.lwjgl.util.vector.Vector2f;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.*;
+import java.util.function.Supplier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class PetInfoOverlay extends TextOverlay {
+
+ private static final Pattern XP_BOOST_PATTERN = Pattern.compile("PET_ITEM_(COMBAT|FISHING|MINING|FORAGING|ALL|FARMING)_(SKILL|SKILLS)_BOOST_(COMMON|UNCOMMON|RARE|EPIC)");
+
+ public PetInfoOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) {
+ super(position, dummyStrings, styleSupplier);
+ }
+
+ public enum Rarity {
+ COMMON(0, 0, 1, EnumChatFormatting.WHITE),
+ UNCOMMON(6, 1, 2, EnumChatFormatting.GREEN),
+ RARE(11, 2, 3, EnumChatFormatting.BLUE),
+ EPIC(16, 3, 4, EnumChatFormatting.DARK_PURPLE),
+ LEGENDARY(20, 4, 5, EnumChatFormatting.GOLD),
+ MYTHIC(20, 4, 5, EnumChatFormatting.LIGHT_PURPLE);
+
+ public int petOffset;
+ public EnumChatFormatting chatFormatting;
+ public int petId;
+ public int beastcreatMultiplyer;
+
+ Rarity(int petOffset, int petId, int beastcreatMultiplyer, EnumChatFormatting chatFormatting) {
+ this.chatFormatting = chatFormatting;
+ this.petOffset = petOffset;
+ this.petId = petId;
+ this.beastcreatMultiplyer = beastcreatMultiplyer;
+ }
+
+ public static Rarity getRarityFromColor(EnumChatFormatting chatFormatting) {
+ for(int i = 0; i < Rarity.values().length; i++) {
+ if(Rarity.values()[i].chatFormatting.equals(chatFormatting))
+ return Rarity.values()[i];
+ }
+ return COMMON;
+ }
+ }
+
+ public static class Pet {
+ public String petType;
+ public Rarity rarity;
+ public GuiProfileViewer.PetLevel petLevel;
+ public String petXpType;
+ public String petItem;
+ }
+
+ private static long lastXpGain = 0;
+ public static Pet currentPet = null;
+ public static HashMap<String, Set<Pet>> petList = new HashMap<>();
+
+ public static int tamingLevel = 1;
+ public static float beastMultiplier = 0;
+ public static boolean setActivePet = false;
+
+ private long lastUpdate = 0;
+ private float levelXpLast = 0;
+
+ private LinkedList<Float> xpGainQueue = new LinkedList<>();
+ private float xpGainHourLast = -1;
+ private float xpGainHour = -1;
+
+ public static void clearPet() {
+ if(currentPet != null) {
+ petList.computeIfAbsent(currentPet.petType + ";" + currentPet.rarity.petId, k->new HashSet<>()).add(currentPet);
+ }
+ currentPet = null;
+ }
+
+ public float getLevelPercent() {
+ DecimalFormat df = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ try {
+ return Float.parseFloat(df.format(currentPet.petLevel.levelPercentage * 100f));
+ } catch(Exception ignored) {
+ return 0;
+ }
+ }
+
+ private static Pet getClosestPet(Pet pet) {
+ return getClosestPet(pet.petType, pet.rarity.petId, pet.petItem, pet.petLevel.level);
+ }
+
+ private static Pet getClosestPet(String petType, int petId, String petItem, float petLevel) {
+ Set<Pet> pets = petList.get(petType + ";" + petId);
+ if(pets == null || pets.isEmpty()) {
+ return null;
+ }
+
+ if(pets.size() == 1) {
+ return pets.iterator().next();
+ }
+
+ String searchItem = petItem;
+
+ Set<Pet> itemMatches = new HashSet<>();
+ for(Pet pet : pets) {
+ if((searchItem == null && pet.petItem == null) ||
+ (searchItem.equals(pet.petItem))) {
+ itemMatches.add(pet);
+ }
+ }
+
+ if(itemMatches.size() == 1) {
+ return itemMatches.iterator().next();
+ }
+ if(itemMatches.size() > 1) {
+ pets = itemMatches;
+ }
+
+ float closestXp = -1;
+ Pet closestPet = null;
+
+ for(Pet pet : pets) {
+ float distXp = Math.abs(pet.petLevel.level - petLevel);
+
+ if(closestPet == null || distXp < closestXp) {
+ closestXp = distXp;
+ closestPet = pet;
+ }
+ }
+
+ if(closestPet != null) {
+ return closestPet;
+ } else {
+ return pets.iterator().next();
+ }
+ }
+
+ private static void getAndSetPet(ProfileViewer.Profile profile) {
+ JsonObject petObject = profile.getPetsInfo(profile.getLatestProfile());
+ JsonObject skillInfo = profile.getSkillInfo(profile.getLatestProfile());
+ JsonObject invInfo = profile.getInventoryInfo(profile.getLatestProfile());
+ JsonObject profileInfo = profile.getProfileInformation(profile.getLatestProfile());
+ if(invInfo != null && profileInfo != null) {
+ JsonObject stats = profileInfo.get("stats").getAsJsonObject();
+ boolean hasBeastmasterCrest = false;
+ Rarity currentBeastRarity = Rarity.COMMON;
+ for(JsonElement talisman : invInfo.get("talisman_bag").getAsJsonArray()) {
+ if(talisman.isJsonNull()) continue;
+ String internalName = talisman.getAsJsonObject().get("internalname").getAsString();
+ if(internalName.startsWith("BEASTMASTER_CREST")) {
+ hasBeastmasterCrest = true;
+ try {
+ Rarity talismanRarity = Rarity.valueOf(internalName.replace("BEASTMASTER_CREST_", ""));
+ if(talismanRarity.beastcreatMultiplyer > currentBeastRarity.beastcreatMultiplyer)
+ currentBeastRarity = talismanRarity;
+ } catch(Exception ignored) {
+ }
+ }
+ }
+ if(hasBeastmasterCrest) {
+ if(stats.has("mythos_kills")) {
+ int mk = stats.get("mythos_kills").getAsInt();
+ float petXpBoost = mk > 10000 ? 1f : mk > 7500 ? 0.9f : mk > 5000 ? 0.8f : mk > 2500 ? 0.7f :
+ mk > 1000 ? 0.6f : mk > 500 ? 0.5f : mk > 250 ? 0.4f : mk > 100 ? 0.3f : mk > 25 ? 0.2f : 0.1f;
+ beastMultiplier = petXpBoost * currentBeastRarity.beastcreatMultiplyer;
+ } else {
+ beastMultiplier = 0.1f * currentBeastRarity.beastcreatMultiplyer;
+ }
+ }
+ }
+ if(skillInfo != null) tamingLevel = skillInfo.get("level_skill_taming").getAsInt();
+ JsonObject petsJson = Constants.PETS;
+ if(petsJson != null) {
+ if(petObject != null) {
+ boolean forceUpdateLevels = System.currentTimeMillis() - lastXpGain > 30000;
+ Set<String> foundPets = new HashSet<>();
+ Set<Pet> addedPets = new HashSet<>();
+ for(int i = 0; i < petObject.getAsJsonArray("pets").size(); i++) {
+ JsonElement petElement = petObject.getAsJsonArray("pets").get(i);
+ JsonObject petObj = petElement.getAsJsonObject();
+ Pet pet = new Pet();
+ pet.petType = petObj.get("type").getAsString();
+ Rarity rarity;
+ try {
+ rarity = Rarity.valueOf(petObj.get("tier").getAsString());
+ } catch(Exception ignored) {
+ rarity = Rarity.COMMON;
+ }
+ pet.rarity = rarity;
+ pet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), rarity.petOffset, petObj.get("exp").getAsFloat());
+ JsonElement heldItem = petObj.get("heldItem");
+ pet.petItem = heldItem.isJsonNull() ? null : heldItem.getAsString();
+ JsonObject petTypes = petsJson.get("pet_types").getAsJsonObject();
+ pet.petXpType = petTypes.has(pet.petType) ? petTypes.get(pet.petType.toUpperCase()).getAsString().toLowerCase() : "unknown";
+
+ Pet closest = null;
+ if(petList.containsKey(pet.petType + ";" + pet.rarity.petId)) {
+ closest = getClosestPet(pet);
+ if(addedPets.contains(closest)) {
+ closest = null;
+ }
+
+ if(closest != null) {
+ if(!forceUpdateLevels || Math.floor(pet.petLevel.level) < Math.floor(closest.petLevel.level)) {
+ pet.petLevel = closest.petLevel;
+ }
+ petList.get(pet.petType + ";" + pet.rarity.petId).remove(closest);
+ }
+ }
+ foundPets.add(pet.petType + ";" + pet.rarity.petId);
+ petList.computeIfAbsent(pet.petType + ";" + pet.rarity.petId, k->new HashSet<>()).add(pet);
+ addedPets.add(pet);
+
+ if(petObj.get("active").getAsBoolean()) {
+ if(currentPet == null && !setActivePet) {
+ currentPet = pet;
+ } else if(closest == currentPet) {
+ currentPet = pet;
+ }
+ }
+ }
+ petList.keySet().retainAll(foundPets);
+ setActivePet = true;
+ }
+ }
+ }
+
+ private float interp(float now, float last) {
+ float interp = now;
+ if(last >= 0 && last != now) {
+ float factor = (System.currentTimeMillis()-lastUpdate)/1000f;
+ factor = LerpUtils.clampZeroOne(factor);
+ interp = last + (now - last) * factor;
+ }
+ return interp;
+ }
+
+ @Override
+ public void updateFrequent() {
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.enablePetInfo || currentPet == null) {
+ overlayStrings = null;
+ } else {
+ float levelXp = interp(currentPet.petLevel.levelXp, levelXpLast);
+ if(levelXp < 0) levelXp = 0;
+
+ String petName = EnumChatFormatting.GREEN + "[Lvl " + (int) currentPet.petLevel.level + "] " + currentPet.rarity.chatFormatting +
+ WordUtils.capitalizeFully(currentPet.petType.replace("_", " "));
+
+ String lvlStringShort = EnumChatFormatting.AQUA + "" + roundFloat(levelXp) + "/" +
+ roundFloat(currentPet.petLevel.currentLevelRequirement)
+ + EnumChatFormatting.YELLOW + " (" + getLevelPercent() + "%)";
+
+ String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat(levelXp, 0) + "/" +
+ Utils.shortNumberFormat(currentPet.petLevel.currentLevelRequirement, 0)
+ + EnumChatFormatting.YELLOW + " (" + getLevelPercent() + "%)";
+
+ float xpGain = interp(xpGainHour, xpGainHourLast);
+ if(xpGain < 0) xpGain = 0;
+ String xpGainString = EnumChatFormatting.AQUA + "XP/h: " +
+ EnumChatFormatting.YELLOW + roundFloat(xpGain);
+ if(xpGain > 0 && xpGainHour == xpGainHourLast) xpGainString += EnumChatFormatting.RED + " (PAUSED)";
+
+ String totalXpString = EnumChatFormatting.AQUA + "Total XP: " + EnumChatFormatting.YELLOW + roundFloat(currentPet.petLevel.totalXp);
+
+ String petItemStr = EnumChatFormatting.AQUA+ "Held Item: " + EnumChatFormatting.RED + "None";
+ if(currentPet.petItem != null) {
+ JsonObject json = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.petItem);
+ if(json != null) {
+ String name = NotEnoughUpdates.INSTANCE.manager.jsonToStack(json).getDisplayName();
+ petItemStr = EnumChatFormatting.AQUA + "Held Item: " + name;
+ }
+ }
+
+ String etaStr = null;
+ float remaining = currentPet.petLevel.currentLevelRequirement - currentPet.petLevel.levelXp;
+ if(remaining > 0) {
+ if(xpGain < 1000) {
+ etaStr = EnumChatFormatting.AQUA+"Until L"+(int)(currentPet.petLevel.level+1)+": " +
+ EnumChatFormatting.YELLOW+"N/A";
+ } else {
+ etaStr = EnumChatFormatting.AQUA+"Until L"+(int)(currentPet.petLevel.level+1)+": " +
+ EnumChatFormatting.YELLOW + Utils.prettyTime((long)(remaining)*1000*60*60/(long)xpGain);
+ }
+ }
+
+ String etaMaxStr = null;
+ float remainingMax = currentPet.petLevel.maxXP - currentPet.petLevel.totalXp;
+ if(remaining > 0) {
+ if(xpGain < 1000) {
+ etaMaxStr = EnumChatFormatting.AQUA+"Until L100: " +
+ EnumChatFormatting.YELLOW+"N/A";
+ } else {
+ etaMaxStr = EnumChatFormatting.AQUA+"Until L100: " +
+ EnumChatFormatting.YELLOW + Utils.prettyTime((long)(remainingMax)*1000*60*60/(long)xpGain);
+ }
+ }
+
+ overlayStrings = new ArrayList<>();
+
+ for(int index : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) {
+ switch(index) {
+ case 0:
+ overlayStrings.add(petName); break;
+ case 1:
+ overlayStrings.add(lvlStringShort); break;
+ case 2:
+ overlayStrings.add(lvlString); break;
+ case 3:
+ overlayStrings.add(xpGainString); break;
+ case 4:
+ overlayStrings.add(totalXpString); break;
+ case 5:
+ overlayStrings.add(petItemStr); break;
+ case 6:
+ if(etaStr != null) overlayStrings.add(etaStr); break;
+ case 7:
+ if(etaMaxStr != null) overlayStrings.add(etaMaxStr); break;
+ }
+ }
+
+ }
+ }
+
+ public void update() {
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.enablePetInfo && !NotEnoughUpdates.INSTANCE.config.treecap.enableMonkeyCheck
+ && !NotEnoughUpdates.INSTANCE.config.notifications.showWrongPetMsg) {
+ overlayStrings = null;
+ return;
+ }
+
+ NEUConfig config = NotEnoughUpdates.INSTANCE.config;
+ int updateTime = 60000;
+ if((config.treecap.enableMonkeyCheck || config.notifications.showWrongPetMsg) && !config.petOverlay.enablePetInfo)
+ updateTime = 300000;
+
+ if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ if(petList.isEmpty()) {
+ ProfileViewer.Profile profile = NotEnoughUpdates.profileViewer.getProfileRaw(Minecraft.getMinecraft().thePlayer
+ .getUniqueID().toString().replace("-", ""));
+ if(profile != null) {
+ getAndSetPet(profile);
+ }
+ }
+
+ ProfileApiSyncer.getInstance().requestResync("petinfo", updateTime, () -> {
+ }, PetInfoOverlay::getAndSetPet);
+ }
+
+ if(currentPet == null) {
+ overlayStrings = null;
+ } else {
+ lastUpdate = System.currentTimeMillis();
+ levelXpLast = currentPet.petLevel.levelXp;
+ updatePetLevels();
+ }
+ }
+
+ @Override
+ protected Vector2f getSize(List<String> strings) {
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) return super.getSize(strings);
+ return super.getSize(strings).translate(25, 0);
+ }
+
+ @Override
+ protected Vector2f getTextOffset() {
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) return super.getTextOffset();
+ if(this.styleSupplier.get() != TextOverlayStyle.BACKGROUND) return super.getTextOffset().translate(30, 0);
+ return super.getTextOffset().translate(25, 0);
+ }
+
+ @Override
+ public void renderDummy() {
+ super.renderDummy();
+
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) return;
+
+ JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROCK;0");
+ if(petItem != null) {
+ Vector2f position = getPosition(overlayWidth, overlayHeight);
+ int x = (int)position.x;
+ int y = (int)position.y;
+
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem);
+ GlStateManager.enableDepth();
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(x-2, y-2, 0);
+ GlStateManager.scale(2, 2, 1);
+ Utils.drawItemStack(stack, 0, 0);
+ GlStateManager.popMatrix();
+ }
+ }
+
+ @Override
+ public void render() {
+ super.render();
+
+ if(currentPet == null) {
+ overlayStrings = null;
+ return;
+ }
+
+ if(overlayStrings == null) {
+ return;
+ }
+
+ if(!NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) return;
+
+ JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.petType + ";" + currentPet.rarity.petId);
+ if(petItem != null) {
+ Vector2f position = getPosition(overlayWidth, overlayHeight);
+ int x = (int)position.x;
+ int y = (int)position.y;
+
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem);
+ GlStateManager.enableDepth();
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(x-2, y-2, 0);
+ GlStateManager.scale(2, 2, 1);
+ Utils.drawItemStack(stack, 0, 0);
+ GlStateManager.popMatrix();
+ }
+ }
+
+ public static float getBoostMultiplier(String boostName) {
+ if(boostName == null) return 1;
+ boostName = boostName.toLowerCase();
+ if(boostName.equalsIgnoreCase("PET_ITEM_ALL_SKILLS_BOOST_COMMON")) {
+ return 1.1f;
+ } else if(boostName.equalsIgnoreCase("ALL_SKILLS_SUPER_BOOST")) {
+ return 1.2f;
+ } else if(boostName.endsWith("epic")) {
+ return 1.5f;
+ } else if(boostName.endsWith("rare")) {
+ return 1.4f;
+ } else if(boostName.endsWith("uncommon")) {
+ return 1.3f;
+ } else if(boostName.endsWith("common")) {
+ return 1.2f;
+ } else {
+ return 1;
+ }
+ }
+
+ private static List<String> validXpTypes = Lists.newArrayList("mining","foraging","enchanting","farming","combat","fishing","alchemy");
+
+ public static float getXpGain(Pet pet, float xp, String xpType) {
+ if(validXpTypes == null) validXpTypes = Lists.newArrayList("mining","foraging","enchanting","farming","combat","fishing","alchemy");
+ if(!validXpTypes.contains(xpType.toLowerCase())) return 0;
+
+ float tamingPercent = 1.0f + (tamingLevel / 100f);
+ xp = xp * tamingPercent;
+ xp = xp + (xp * beastMultiplier / 100f);
+ if(pet.petXpType != null && !pet.petXpType.equalsIgnoreCase(xpType)) {
+ xp = xp / 3f;
+
+ if(xpType.equalsIgnoreCase("alchemy") || xpType.equalsIgnoreCase("enchanting")) {
+ xp = xp / 4f;
+ }
+ }
+ if(xpType.equalsIgnoreCase("mining") || xpType.equalsIgnoreCase("fishing")) {
+ xp = xp * 1.5f;
+ }
+ if(pet.petItem != null) {
+ Matcher petItemMatcher = XP_BOOST_PATTERN.matcher(pet.petItem);
+ if((petItemMatcher.matches() && petItemMatcher.group(1).equalsIgnoreCase(xpType))
+ || pet.petItem.equalsIgnoreCase("ALL_SKILLS_SUPER_BOOST")) {
+ xp = xp * getBoostMultiplier(pet.petItem);
+ }
+ }
+ return xp;
+ }
+
+ private final HashMap<String, Float> skillInfoMapLast = new HashMap<>();
+ public void updatePetLevels() {
+ HashMap<String, XPInformation.SkillInfo> skillInfoMap = XPInformation.getInstance().getSkillInfoMap();
+
+ long currentTime = System.currentTimeMillis();
+
+ float totalGain = 0;
+
+ for(Map.Entry<String, XPInformation.SkillInfo> entry : skillInfoMap.entrySet()) {
+ float skillXp = entry.getValue().totalXp;
+ if(skillInfoMapLast.containsKey(entry.getKey())) {
+ float skillXpLast = skillInfoMapLast.get(entry.getKey());
+
+ if(skillXpLast <= 0) {
+ skillInfoMapLast.put(entry.getKey(), skillXp);
+ } else if(skillXp > skillXpLast) {
+ lastXpGain = currentTime;
+
+ float deltaXp = skillXp - skillXpLast;
+
+ float gain = getXpGain(currentPet, deltaXp, entry.getKey().toUpperCase());
+ totalGain += gain;
+
+ skillInfoMapLast.put(entry.getKey(), skillXp);
+ }
+ } else {
+ skillInfoMapLast.put(entry.getKey(), skillXp);
+ }
+ }
+
+ xpGainHourLast = xpGainHour;
+ if(totalGain > 0) {
+ currentPet.petLevel.totalXp += totalGain;
+
+ xpGainQueue.add(0, totalGain);
+ while(xpGainQueue.size() > 20) {
+ xpGainQueue.removeLast();
+ }
+
+ float tot = 0;
+ for(float f : xpGainQueue) tot += f;
+
+ xpGainHour = tot*(60*60)/xpGainQueue.size();
+ }
+
+ JsonObject petsJson = Constants.PETS;
+ if(currentPet != null && petsJson != null) {
+ currentPet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), currentPet.rarity.petOffset, currentPet.petLevel.totalXp);
+ }
+ }
+
+ public String roundFloat(float f) {
+ if(f % 1 < 0.05f) {
+ return NumberFormat.getNumberInstance().format((int)f);
+ } else {
+ String s = Utils.floatToString(f, 1);
+ if(s.contains(".")) {
+ return NumberFormat.getNumberInstance().format((int)f) + '.' + s.split("\\.")[1];
+ } else if(s.contains(",")) {
+ return NumberFormat.getNumberInstance().format((int)f) + ',' + s.split("\\.")[1];
+ } else {
+ return s;
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void switchWorld(WorldEvent.Load event) {
+ if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
+ ProfileApiSyncer.getInstance().requestResync("petinfo_quick", 10000, () -> {
+ }, PetInfoOverlay::getAndSetPet);
+ }
+ }
+
+ private int lastLevelHovered = 0;
+ private String lastItemHovered = null;
+
+ private HashMap<String, String> itemMap = null;
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onTooltip(ItemTooltipEvent event) {
+ for(String line : event.toolTip) {
+ if(line.startsWith("\u00a7o\u00a77[Lvl ")) {
+ lastItemHovered = null;
+
+ String after = line.substring("\u00a7o\u00a77[Lvl ".length());
+ if(after.contains("]")) {
+ String levelStr = after.split("]")[0];
+
+ try {
+ lastLevelHovered = Integer.parseInt(levelStr.trim());
+ } catch(Exception ignored) {}
+ }
+ } else if(line.startsWith("\u00a75\u00a7o\u00a76Held Item: ")) {
+ String after = line.substring("\u00a75\u00a7o\u00a76Held Item: ".length());
+
+ if(itemMap == null) {
+ itemMap = new HashMap<>();
+
+ for(Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager.getItemInformation().entrySet()) {
+ if(entry.getKey().equals("ALL_SKILLS_SUPER_BOOST") ||
+ XP_BOOST_PATTERN.matcher(entry.getKey()).matches()) {
+ ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(entry.getValue());
+ itemMap.put(stack.getDisplayName(), entry.getKey());
+ }
+ }
+ }
+
+ if(itemMap.containsKey(after)) {
+ lastItemHovered = itemMap.get(after);
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onChatReceived(ClientChatReceivedEvent event) {
+ NEUConfig config = NotEnoughUpdates.INSTANCE.config;
+ if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && (config.petOverlay.enablePetInfo || config.treecap.enableMonkeyCheck || config.notifications.showWrongPetMsg)) {
+ if(event.type == 0) {
+ String chatMessage = Utils.cleanColour(event.message.getUnformattedText());
+ if(chatMessage.toLowerCase().startsWith("you summoned your")) {
+ clearPet();
+
+ String pet = chatMessage.trim().toUpperCase().replace("YOU SUMMONED YOUR ", "").replace("!", "").replace(" ", "_");
+ Rarity rarity = event.message.getSiblings().size() == 3 ? Rarity.getRarityFromColor(event.message.getSiblings().get(1).getChatStyle().getColor()) : Rarity.COMMON;
+
+ if(petList.containsKey(pet + ";" + rarity.petId)) {
+ Set<Pet> pets = petList.get(pet + ";" + rarity.petId);
+
+ System.out.println(lastItemHovered + ":" + lastLevelHovered);
+ if(pets.size() == 1) {
+ currentPet = pets.iterator().next();
+ } else {
+ currentPet = getClosestPet(pet, rarity.petId, lastItemHovered, lastLevelHovered);
+ }
+ }
+ } else if(chatMessage.toLowerCase().startsWith("you despawned your")) {
+ clearPet();
+ } else if(chatMessage.toLowerCase().contains("switching to profile")) {
+ clearPet();
+ petList.clear();
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySkullRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySkullRenderer.java
new file mode 100644
index 00000000..9f13ee41
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySkullRenderer.java
@@ -0,0 +1,24 @@
+package io.github.moulberry.notenoughupdates.mixins;
+
+import com.mojang.authlib.GameProfile;
+import io.github.moulberry.notenoughupdates.miscfeatures.CustomSkulls;
+import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
+import net.minecraft.util.EnumFacing;
+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(TileEntitySkullRenderer.class)
+public class MixinTileEntitySkullRenderer {
+
+ @Inject(method="renderSkull", at=@At("HEAD"), cancellable = true)
+ public void renderSkull(float xOffset, float yOffset, float zOffset, EnumFacing placedDirection,
+ float rotationDeg, int skullType, GameProfile skullOwner, int damage, CallbackInfo ci) {
+ if(CustomSkulls.getInstance().renderSkull(xOffset, yOffset, zOffset, placedDirection, rotationDeg, skullType, skullOwner, damage)) {
+ ci.cancel();
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 45d6705a..9da74db9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -63,13 +63,14 @@ public class NEUConfig extends Config {
editOverlay(activeConfigCategory, OverlayManager.farmingOverlay, skillOverlays.farmingPosition);
return;
case 4:
- Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(
- NotEnoughUpdates.INSTANCE.config.overlay.petInfoPosition,
+ editOverlay(activeConfigCategory, OverlayManager.petInfoOverlay, petOverlay.petInfoPosition);
+ /*Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(
+ NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoPosition,
150, 22, () -> {
}, () -> {
}, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(
new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, activeConfigCategoryF))
- ));
+ ));*/
return;
}
}
@@ -197,10 +198,10 @@ public class NEUConfig extends Config {
@Expose
@Category(
- name = "Overlays",
- desc = "Overlays"
+ name = "Pet Overlay",
+ desc = "Pet Overlay"
)
- public Overlay overlay = new Overlay();
+ public PetOverlay petOverlay = new PetOverlay();
@Expose
@Category(
@@ -308,11 +309,13 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
- name = "Commas in Damage Numbers",
- desc = "Add a comma to damage number indicators to make it more readable"
+ name = "Damage Indicator Style",
+ desc = "Change the style of Skyblock damage indicators to be easier to read"
)
- @ConfigEditorBoolean
- public boolean damageCommas = true;
+ @ConfigEditorDropdown(
+ values = {"Off", "Commas", "Shortened"}
+ )
+ public int damageCommas = 1;
}
public static class Notifications {
@@ -1136,10 +1139,10 @@ public class NEUConfig extends Config {
)
@ConfigEditorBoolean
- public boolean enableMonkeyCheck = false;
+ public boolean enableMonkeyCheck = true;
}
- public static class Overlay {
+ public static class PetOverlay {
@Expose
@ConfigOption(
name = "Enable Pet Info Overlay",
@@ -1157,7 +1160,33 @@ public class NEUConfig extends Config {
runnableId = 4,
buttonText = "Edit"
)
- public Position petInfoPosition = new Position(0, 15);
+ public Position petInfoPosition = new Position(-1, -1);
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Overlay Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rEquip a pet to show the overlay"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a7a[Lvl 37] \u00a7fRock",
+ "\u00a7b2,312.9/2,700\u00a7e (85.7%)",
+ "\u00a7b2.3k/2.7k\u00a7e (85.7%)",
+ "\u00a7bXP/h: \u00a7e27,209",
+ "\u00a7bTotal XP: \u00a7e30,597.9",
+ "\u00a7bHeld Item: \u00a7fMining Exp Boost",
+ "\u00a7bUntil L38: \u00a7e5m13s",
+ "\u00a7bUntil L100: \u00a7e2d13h"}
+ )
+ public List<Integer> petOverlayText = new ArrayList<>(Arrays.asList(0, 2, 3, 6, 4));
+
+ @Expose
+ @ConfigOption(
+ name = "Pet Overlay Icon",
+ desc = "Show the icon of the pet you have equiped in the overlay"
+ )
+ @ConfigEditorBoolean
+ public boolean petOverlayIcon = true;
@Expose
@ConfigOption(
@@ -1165,7 +1194,7 @@ public class NEUConfig extends Config {
desc = "Change the style of the Pet Info overlay"
)
@ConfigEditorDropdown(
- values = {"Background", "No Shadow", "Shadow Only", "Full Shadow", "With Shadow"}
+ values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"}
)
public int petInfoOverlayStyle = 0;
}
@@ -1222,7 +1251,7 @@ public class NEUConfig extends Config {
@Expose
@ConfigOption(
name = "Enable Search GUI",
- desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI"
+ desc = "Use the advanced search GUI with autocomplete and history instead of the normal sign GUI\n\u00a7eStar Selection Texture: Johnny#4567"
)
@ConfigEditorBoolean
public boolean enableSearchOverlay = true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
index 5d91e268..83e0859f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -338,7 +338,7 @@ public class NEUConfigEditor extends GuiElement {
int innerLeft = x+149+innerPadding;
int innerRight = x+xSize-5-innerPadding;
- int dWheel = Mouse.getDWheel();
+ int dWheel = Mouse.getEventDWheel();
if(mouseY > innerTop && mouseY < innerBottom && dWheel != 0) {
if(dWheel < 0) {
dWheel = -1;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
index 3401bb21..83c7962e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
@@ -7,6 +7,7 @@ import io.github.moulberry.notenoughupdates.core.GuiElementTextField;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.mixins.GuiEditSignAccessor;
import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
+import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -33,13 +34,19 @@ import java.util.concurrent.atomic.AtomicInteger;
public class AuctionSearchOverlay {
- private static final ResourceLocation SEARCH_OVERLAY_TEXTURE = new ResourceLocation("notenoughupdates:ah_search_overlay.png");
+ private static final ResourceLocation SEARCH_OVERLAY_TEXTURE = new ResourceLocation("notenoughupdates:auc_search/ah_search_overlay.png");
+ private static final ResourceLocation STAR = new ResourceLocation("notenoughupdates:auc_search/star.png");
+ private static final ResourceLocation STAR_BOARD = new ResourceLocation("notenoughupdates:auc_search/star_board.png");
private static GuiElementTextField textField = new GuiElementTextField("", 200, 20, 0);
private static boolean searchFieldClicked = false;
private static String searchString = "";
+ private static String searchStringExtra = "";
private static Splitter SPACE_SPLITTER = Splitter.on(" ").omitEmptyStrings().trimResults();
+ private static int selectedStars = 0;
+ private static boolean atLeast = true;
+
private static final int AUTOCOMPLETE_HEIGHT = 118;
private static final Set<String> autocompletedItems = new LinkedHashSet<>();
@@ -103,8 +110,27 @@ public class AuctionSearchOverlay {
}
Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE);
+ GlStateManager.color(1, 1, 1, 1);
Utils.drawTexturedRect(width/2-100, topY-1, 203, h, 0, 203/512f, 0, h/256f, GL11.GL_NEAREST);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(STAR_BOARD);
+ Utils.drawTexturedRect(width/2+105, topY+27, 55, 13, GL11.GL_NEAREST);
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(STAR);
+ GlStateManager.color(1, 1, 1, 1);
+ int stars = atLeast && selectedStars > 0 ? 5 : selectedStars;
+ for(int i=0; i<stars; i++) {
+ if(i >= selectedStars) {
+ GlStateManager.color(1, 1, 1, 0.3f);
+ }
+ Utils.drawTexturedRect(width/2+108+10*i, topY+29, 9, 10, GL11.GL_NEAREST);
+ }
+
+ Gui.drawRect(width/2+106, topY+42, width/2+115, topY+51, 0xffffffff);
+ Gui.drawRect(width/2+107, topY+43, width/2+114, topY+50, 0xff000000);
+ if(atLeast) Gui.drawRect(width/2+108, topY+44, width/2+113, topY+49, 0xffffffff);
+ Minecraft.getMinecraft().fontRendererObj.drawString("At Least?", width/2+117, topY+43, 0xffffff);
+
Minecraft.getMinecraft().fontRendererObj.drawString("Enter Query:", width/2-100, topY-10, 0xdddddd, true);
textField.setText(searchString);
@@ -168,12 +194,25 @@ public class AuctionSearchOverlay {
}
public static void close() {
+ if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.keepPreviousSearch) {
+ search();
+ } else {
+ synchronized(autocompletedItems) {
+ autocompletedItems.clear();
+ }
+ }
+
+
TileEntitySign tes = ((GuiEditSignAccessor)Minecraft.getMinecraft().currentScreen).getTileSign();
- if(searchString.length() <= 15) {
- tes.signText[0] = new ChatComponentText(searchString.substring(0, Math.min(searchString.length(), 15)));
+ String search = searchString.trim();
+ if(searchStringExtra != null && !searchStringExtra.isEmpty()) {
+ search += " " + searchStringExtra.trim();
+ }
+ if(search.length() <= 15) {
+ tes.signText[0] = new ChatComponentText(search.substring(0, Math.min(search.length(), 15)));
} else {
- List<String> words = SPACE_SPLITTER.splitToList(searchString);
+ List<String> words = SPACE_SPLITTER.splitToList(search);
StringBuilder line0 = new StringBuilder();
StringBuilder line1 = new StringBuilder();
@@ -233,67 +272,74 @@ public class AuctionSearchOverlay {
private static ExecutorService searchES = Executors.newSingleThreadExecutor();
private static AtomicInteger searchId = new AtomicInteger(0);
- public static void keyEvent() {
- if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
- close();
- if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.escFullClose) {
- Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));
- }
- } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
- close();
- } else if(Keyboard.getEventKeyState()) {
- textField.setText(searchString);
- textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
- searchString = textField.getText();
+ public static void search() {
+ final int thisSearchId = searchId.incrementAndGet();
- final int thisSearchId = searchId.incrementAndGet();
+ searchES.submit(() -> {
+ if(thisSearchId != searchId.get()) return;
- searchES.submit(() -> {
- if(thisSearchId != searchId.get()) return;
+ List<String> title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:"+searchString.trim()));
- List<String> title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:"+searchString.trim()));
+ if(thisSearchId != searchId.get()) return;
- if(thisSearchId != searchId.get()) return;
-
- if(!searchString.trim().contains(" ")) {
- StringBuilder sb = new StringBuilder();
- for(char c : searchString.toCharArray()) {
- sb.append(c).append(" ");
- }
- title.addAll(NotEnoughUpdates.INSTANCE.manager.search("title:"+sb.toString().trim()));
+ if(!searchString.trim().contains(" ")) {
+ StringBuilder sb = new StringBuilder();
+ for(char c : searchString.toCharArray()) {
+ sb.append(c).append(" ");
}
+ title.addAll(NotEnoughUpdates.INSTANCE.manager.search("title:"+sb.toString().trim()));
+ }
- if(thisSearchId != searchId.get()) return;
+ if(thisSearchId != searchId.get()) return;
- List<String> desc = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("desc:"+searchString.trim()));
- desc.removeAll(title);
+ List<String> desc = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("desc:"+searchString.trim()));
+ desc.removeAll(title);
- if(thisSearchId != searchId.get()) return;
+ if(thisSearchId != searchId.get()) return;
- Set<String> auctionableItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBinKeySet();
- auctionableItems.addAll(NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet());
+ Set<String> auctionableItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getLowestBinKeySet();
+ auctionableItems.addAll(NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfoKeySet());
- if(!auctionableItems.isEmpty()) {
- title.retainAll(auctionableItems);
- desc.retainAll(auctionableItems);
+ if(!auctionableItems.isEmpty()) {
+ title.retainAll(auctionableItems);
+ desc.retainAll(auctionableItems);
- title.sort(salesComparator);
- desc.sort(salesComparator);
- } else {
- Set<String> bazaarItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarKeySet();
+ title.sort(salesComparator);
+ desc.sort(salesComparator);
+ } else {
+ Set<String> bazaarItems = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarKeySet();
- title.removeAll(bazaarItems);
- desc.removeAll(bazaarItems);
- }
+ title.removeAll(bazaarItems);
+ desc.removeAll(bazaarItems);
+ }
- if(thisSearchId != searchId.get()) return;
+ if(thisSearchId != searchId.get()) return;
- synchronized(autocompletedItems) {
- autocompletedItems.clear();
- autocompletedItems.addAll(title);
- autocompletedItems.addAll(desc);
- }
- });
+ synchronized(autocompletedItems) {
+ autocompletedItems.clear();
+ autocompletedItems.addAll(title);
+ autocompletedItems.addAll(desc);
+ }
+ });
+ }
+
+ public static void keyEvent() {
+ if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
+ searchStringExtra = "";
+ close();
+ if(NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.escFullClose) {
+ Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));
+ }
+ } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
+ searchStringExtra = "";
+ close();
+ } else if(Keyboard.getEventKeyState()) {
+ textField.setFocus(true);
+ textField.setText(searchString);
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
+ searchString = textField.getText();
+
+ search();
}
}
@@ -311,6 +357,29 @@ public class AuctionSearchOverlay {
topY = height/2 - h/2 + 5;
}
+ if(Mouse.getEventButtonState() && mouseX > width/2+105 && mouseX < width/2+105+55 &&
+ mouseY > topY+27 && mouseY < topY+40) {
+ int starClicked = 5;
+ for(int i=1; i<=5; i++) {
+ if(mouseX < width/2+108+10*i) {
+ starClicked = i;
+ break;
+ }
+ }
+ if(selectedStars == starClicked) {
+ selectedStars = 0;
+ } else {
+ selectedStars = starClicked;
+ }
+ return;
+ }
+
+ if(Mouse.getEventButtonState() && mouseX >= width/2+106 && mouseX <= width/2+116 &&
+ mouseY >= topY+42 && mouseY <= topY+50) {
+ atLeast = !atLeast;
+ return;
+ }
+
if(!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && searchFieldClicked) {
textField.mouseClickMove(mouseX-2, topY+10, 0, 0);
}
@@ -333,8 +402,10 @@ public class AuctionSearchOverlay {
}
}
} else if(mouseX < width/2+75) {
+ searchStringExtra = "";
close();
} else if(mouseX < width/2+100) {
+ searchStringExtra = "";
close();
Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(Minecraft.getMinecraft().thePlayer.openContainer.windowId));
NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(
@@ -353,6 +424,19 @@ public class AuctionSearchOverlay {
if(searchString.contains("Enchanted Book") && str.contains(";")) {
searchString = WordUtils.capitalizeFully(str.split(";")[0].replace("_", " "));
}
+
+ JsonObject essenceCosts = Constants.ESSENCECOSTS;
+ searchStringExtra = "";
+ if(essenceCosts != null && essenceCosts.has(str) && selectedStars > 0) {
+ for(int i=0; i<selectedStars; i++) {
+ searchStringExtra += "\u272A";
+ }
+ if(selectedStars < 5 && !atLeast) {
+ searchStringExtra += " ";
+ searchStringExtra += stack.getItem().getItemStackDisplayName(stack).substring(0, 1);
+ }
+ }
+
close();
return;
}
@@ -369,6 +453,7 @@ public class AuctionSearchOverlay {
String s = NotEnoughUpdates.INSTANCE.config.hidden.previousAuctionSearches.get(i);
if(mouseX >= width/2-95 && mouseX <= width/2+95 && mouseY >= topY+45+AUTOCOMPLETE_HEIGHT+i*10 && mouseY <= topY+45+AUTOCOMPLETE_HEIGHT+i*10+10) {
searchString = s;
+ searchStringExtra = "";
close();
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
index affc86ef..98761e04 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingOverlay.java
@@ -23,6 +23,7 @@ public class FarmingOverlay extends TextOverlay {
private long lastUpdate = -1;
private int counterLast = -1;
private int counter = -1;
+ private boolean dicerHeld = false;
private float cropsPerSecondLast = 0;
private float cropsPerSecond = 0;
private LinkedList<Integer> counterQueue = new LinkedList<>();
@@ -86,6 +87,9 @@ public class FarmingOverlay extends TextOverlay {
} else {
skillType = "Farming";
}
+ if(internalname != null && (internalname.equals("MELON_DICER") || internalname.equals("PUMPKIN_DICER"))) {
+ dicerHeld = true;
+ }
skillInfoLast = skillInfo;
skillInfo = XPInformation.getInstance().getSkillInfo(skillType);
@@ -97,7 +101,7 @@ public class FarmingOverlay extends TextOverlay {
if(delta > 0 && delta < 1000) {
xpGainQueue.add(0, delta);
- while (xpGainQueue.size() > 120) {
+ while (xpGainQueue.size() > 20) {
xpGainQueue.removeLast();
}
@@ -130,7 +134,7 @@ public class FarmingOverlay extends TextOverlay {
cropsPerSecond = (first - last)/3f;
}
- if(counter != -1) {
+ if(counter != -1 || dicerHeld) {
overlayStrings = new ArrayList<>();
} else {
overlayStrings = null;
@@ -142,25 +146,30 @@ public class FarmingOverlay extends TextOverlay {
public void updateFrequent() {
super.updateFrequent();
- if(counter < 0) {
+ if(counter < 0 && !dicerHeld) {
overlayStrings = null;
} else {
HashMap<Integer, String> lineMap = new HashMap<>();
overlayStrings = new ArrayList<>();
- int counterInterp = (int)interp(counter, counterLast);
-
NumberFormat format = NumberFormat.getIntegerInstance();
- lineMap.put(0, EnumChatFormatting.AQUA+"Counter: "+EnumChatFormatting.YELLOW+format.format(counterInterp));
- if(cropsPerSecondLast == cropsPerSecond && cropsPerSecond <= 0) {
- lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+"N/A");
- } else {
- float cpsInterp = interp(cropsPerSecond, cropsPerSecondLast);
+ if(counter >= 0) {
+ int counterInterp = (int)interp(counter, counterLast);
+
+ lineMap.put(0, EnumChatFormatting.AQUA+"Counter: "+EnumChatFormatting.YELLOW+format.format(counterInterp));
+ }
+
+ if(counter >= 0) {
+ if(cropsPerSecondLast == cropsPerSecond && cropsPerSecond <= 0) {
+ lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+"N/A");
+ } else {
+ float cpsInterp = interp(cropsPerSecond, cropsPerSecondLast);
- lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+
- String.format("%.2f", cpsInterp*60));
+ lineMap.put(1, EnumChatFormatting.AQUA+"Crops/m: "+EnumChatFormatting.YELLOW+
+ String.format("%.2f", cpsInterp*60));
+ }
}
float xpInterp = xpGainHour;
@@ -237,7 +246,7 @@ public class FarmingOverlay extends TextOverlay {
String.format("%.2f", yaw)+EnumChatFormatting.BOLD+"\u1D52");
for(int strIndex : NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingText) {
- if(lineMap.containsKey(strIndex)) {
+ if(lineMap.get(strIndex) != null) {
overlayStrings.add(lineMap.get(strIndex));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
index 1f0cafbd..55ed608b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.overlays;
import com.google.common.collect.Lists;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import java.util.ArrayList;
import java.util.List;
@@ -12,6 +13,7 @@ public class OverlayManager {
public static MiningOverlay miningOverlay;
public static FarmingOverlay farmingOverlay;
+ public static PetInfoOverlay petInfoOverlay;
public static final List<TextOverlay> textOverlays = new ArrayList<>();
static {
@@ -54,8 +56,32 @@ public class OverlayManager {
return TextOverlayStyle.BACKGROUND;
});
+ List<String> petInfoDummy = Lists.newArrayList("\u00a7a[Lvl 37] \u00a7fRock",
+ "\u00a7b2,312.9/2,700\u00a7e (85.7%)",
+ "\u00a7b2.3k/2.7k\u00a7e (85.7%)",
+ "\u00a7bXP/h: \u00a7e27,209",
+ "\u00a7bTotal XP: \u00a7e30,597.9",
+ "\u00a7bHeld Item: \u00a7fMining Exp Boost",
+ "\u00a7bUntil L38: \u00a7e5m13s",
+ "\u00a7bUntil L100: \u00a7e2d13h");
+ petInfoOverlay = new PetInfoOverlay(NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoPosition, () -> {
+ List<String> strings = new ArrayList<>();
+ for(int i : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) {
+ if(i >= 0 && i < petInfoDummy.size()) strings.add(petInfoDummy.get(i));
+ }
+ return strings;
+ }, () -> {
+ int style = NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoOverlayStyle;
+ if(style >= 0 && style < TextOverlayStyle.values().length) {
+ return TextOverlayStyle.values()[style];
+ }
+ return TextOverlayStyle.BACKGROUND;
+ });
+
textOverlays.add(miningOverlay);
textOverlays.add(farmingOverlay);
+ textOverlays.add(petInfoOverlay);
+
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
index 54988e70..8e1742cd 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java
@@ -30,6 +30,7 @@ public class RancherBootOverlay {
private static boolean textFieldClicked = false;
public static boolean shouldReplace() {
+ if(true) return false;
//if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false;
if(!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) return false;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
index 30f2a9fb..55500f91 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
@@ -18,7 +18,7 @@ import java.util.function.Supplier;
public abstract class TextOverlay {
private Position position;
- private Supplier<TextOverlayStyle> styleSupplier;
+ protected Supplier<TextOverlayStyle> styleSupplier;
public int overlayWidth = -1;
public int overlayHeight = -1;
public List<String> overlayStrings = null;
@@ -43,24 +43,7 @@ public abstract class TextOverlay {
List<String> dummyStrings = this.dummyStrings.get();
if(dummyStrings != null) {
- int overlayHeight = 0;
- int overlayWidth = 0;
- for(String s : dummyStrings) {
- if(s == null) {
- overlayHeight += 3;
- continue;
- }
- for(String s2 : s.split("\n")) {
- int sWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(s2);
- if(sWidth > overlayWidth) {
- overlayWidth = sWidth;
- }
- overlayHeight += 10;
- }
- }
- overlayHeight -= 2;
-
- return new Vector2f(overlayWidth+PADDING_X*2, overlayHeight+PADDING_Y*2);
+ return getSize(dummyStrings);
}
return new Vector2f(100, 50);
}
@@ -85,11 +68,9 @@ public abstract class TextOverlay {
render(overlayStrings);
}
- private void render(List<String> strings) {
- if(strings == null) return;
-
- overlayHeight = 0;
- overlayWidth = 0;
+ protected Vector2f getSize(List<String> strings) {
+ int overlayHeight = 0;
+ int overlayWidth = 0;
for(String s : strings) {
if(s == null) {
overlayHeight += 3;
@@ -105,19 +86,58 @@ public abstract class TextOverlay {
}
overlayHeight -= 2;
+ int paddingX = 0;
+ int paddingY = 0;
+ if(styleSupplier.get() == TextOverlayStyle.BACKGROUND) {
+ paddingX = PADDING_X;
+ paddingY = PADDING_Y;
+ }
+ return new Vector2f(overlayWidth+paddingX*2, overlayHeight+paddingY*2);
+ }
+
+ protected Vector2f getTextOffset() {
+ return new Vector2f();
+ }
+
+ protected Vector2f getPosition(int overlayWidth, int overlayHeight) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- int x = position.getAbsX(scaledResolution, overlayWidth+PADDING_X*2);
- int y = position.getAbsY(scaledResolution, overlayHeight+PADDING_Y*2);
+ int x = position.getAbsX(scaledResolution, overlayWidth);
+ int y = position.getAbsY(scaledResolution, overlayHeight);
+
+ return new Vector2f(x, y);
+ }
+
+ private void render(List<String> strings) {
+ if(strings == null) return;
+
+ Vector2f size = getSize(strings);
+ overlayHeight = (int)size.y;
+ overlayWidth = (int)size.x;
+
+ Vector2f position = getPosition(overlayWidth, overlayHeight);
+ int x = (int)position.x;
+ int y = (int)position.y;
TextOverlayStyle style = styleSupplier.get();
- if(style == TextOverlayStyle.BACKGROUND) Gui.drawRect(x, y, x+overlayWidth+PADDING_X*2, y+overlayHeight+PADDING_Y*2, 0x80000000);
+ if(style == TextOverlayStyle.BACKGROUND) Gui.drawRect(x, y, x+overlayWidth, y+overlayHeight, 0x80000000);
GlStateManager.enableBlend();
GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ int paddingX = 0;
+ int paddingY = 0;
+ if(styleSupplier.get() == TextOverlayStyle.BACKGROUND) {
+ paddingX = PADDING_X;
+ paddingY = PADDING_Y;
+ }
+
+ Vector2f textOffset = getTextOffset();
+ paddingX += (int) textOffset.x;
+ paddingY += (int) textOffset.y;
+
int yOff = 0;
for(String s : strings) {
if(s == null) {
@@ -130,14 +150,14 @@ public abstract class TextOverlay {
for(int yO=-2; yO<=2; yO++) {
if(Math.abs(xO) != Math.abs(yO)) {
Minecraft.getMinecraft().fontRendererObj.drawString(clean,
- x+PADDING_X+xO/2f, y+PADDING_Y+yOff+yO/2f,
+ x+paddingX+xO/2f, y+paddingY+yOff+yO/2f,
new Color(0, 0, 0, 200/Math.max(Math.abs(xO), Math.abs(yO))).getRGB(), false);
}
}
}
}
Minecraft.getMinecraft().fontRendererObj.drawString(s2,
- x+PADDING_X, y+PADDING_Y+yOff, 0xffffff, style == TextOverlayStyle.MC_SHADOW);
+ x+paddingX, y+paddingY+yOff, 0xffffff, style == TextOverlayStyle.MC_SHADOW);
yOff += 10;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index c47a1091..98078bb8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -1015,23 +1015,24 @@ public class GuiProfileViewer extends GuiScreen {
public float currentLevelRequirement;
public float maxXP;
public float levelPercentage;
+ public float levelXp;
+ public float totalXp;
}
public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) {
float xpTotal = 0;
float level = 1;
float currentLevelRequirement = 0;
- float remainingToNextLevel = 0;
+ float currentLevelProgress = 0;
boolean addLevel = true;
for(int i=offset; i<offset+99; i++) {
-
if(addLevel) {
currentLevelRequirement = levels.get(i).getAsFloat();
xpTotal += currentLevelRequirement;
if(xpTotal > exp) {
- remainingToNextLevel = (exp-(xpTotal-currentLevelRequirement))/currentLevelRequirement;
+ currentLevelProgress = (exp-(xpTotal-currentLevelRequirement));
addLevel = false;
} else {
level += 1;
@@ -1041,7 +1042,7 @@ public class GuiProfileViewer extends GuiScreen {
}
}
- level += remainingToNextLevel;
+ level += currentLevelProgress/currentLevelRequirement;
if(level <= 0) {
level = 1;
} else if(level > 100) {
@@ -1051,7 +1052,9 @@ public class GuiProfileViewer extends GuiScreen {
levelObj.level = level;
levelObj.currentLevelRequirement = currentLevelRequirement;
levelObj.maxXP = xpTotal;
- levelObj.levelPercentage = remainingToNextLevel;
+ levelObj.levelPercentage = currentLevelProgress/currentLevelRequirement;
+ levelObj.levelXp = currentLevelProgress;
+ levelObj.totalXp = exp;
return levelObj;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index f13f562e..3c195957 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -657,7 +657,6 @@ public class ProfileViewer {
float totalSkillXP = experience_skill_taming + experience_skill_mining + experience_skill_foraging
+ experience_skill_enchanting + experience_skill_carpentry + experience_skill_farming
+ experience_skill_combat + experience_skill_fishing + experience_skill_alchemy
- + experience_skill_catacombs
+ experience_skill_runecrafting;
if(totalSkillXP <= 0) {
@@ -1073,6 +1072,10 @@ public class ProfileViewer {
return;
}
+ public Profile getProfileRaw(String uuid) {
+ return uuidToProfileMap.get(uuid);
+ }
+
public Profile getProfile(String uuid, Consumer<Profile> callback) {
Profile profile = uuidToProfileMap.computeIfAbsent(uuid, k -> new Profile(uuid));
if(profile.playerInformation != null) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
index 7277f884..0652ee9d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
@@ -32,7 +32,11 @@ public class XPInformation {
private HashMap<String, SkillInfo> skillInfoMap = new HashMap<>();
private static Splitter SPACE_SPLITTER = Splitter.on(" ").omitEmptyStrings().trimResults();
- private static Pattern SKILL_PATTERN = Pattern.compile("\\+(\\d+(?:\\.\\d+)?) (.+) \\((\\d+(?:,\\d+)*(?:\\.\\d+)?)/(\\d+(?:,\\d+)*(?:\\.\\d+)?)\\)");
+ private static Pattern SKILL_PATTERN = Pattern.compile("\\+(\\d+(?:,\\d+)*(?:\\.\\d+)?) (.+) \\((\\d+(?:,\\d+)*(?:\\.\\d+)?)/(\\d+(?:,\\d+)*(?:\\.\\d+)?)\\)");
+
+ public HashMap<String, SkillInfo> getSkillInfoMap() {
+ return skillInfoMap;
+ }
public SkillInfo getSkillInfo(String skillName) {
return skillInfoMap.get(skillName.toLowerCase());
diff --git a/src/main/resources/assets/notenoughupdates/ah_search_overlay.png b/src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay.png
index 3e21edda..3e21edda 100644
--- a/src/main/resources/assets/notenoughupdates/ah_search_overlay.png
+++ b/src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/auc_search/star.png b/src/main/resources/assets/notenoughupdates/auc_search/star.png
new file mode 100644
index 00000000..f0e86860
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/auc_search/star.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/auc_search/star_board.png b/src/main/resources/assets/notenoughupdates/auc_search/star_board.png
new file mode 100644
index 00000000..8251731f
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/auc_search/star_board.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/elephant.png b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/elephant.png
new file mode 100644
index 00000000..0a8a46f0
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/elephant.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/moul_hat.json b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/moul_hat.json
new file mode 100644
index 00000000..517fb881
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/moul_hat.json
@@ -0,0 +1,204 @@
+{
+ "credit": "for some random ass australian",
+ "textures": {
+ "0": "australia/spartan",
+ "particle": "australia/spartan"
+ },
+ "elements": [
+ {
+ "from": [4, -1, 12],
+ "to": [12, 5, 13],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 7, 20]},
+ "faces": {
+ "north": {"uv": [9.75, 2.5, 11.75, 4], "texture": "#0"},
+ "east": {"uv": [0, 0, 1, 6], "texture": "#missing"},
+ "south": {"uv": [9.75, 2.5, 11.75, 4], "texture": "#0"},
+ "west": {"uv": [0, 0, 1, 6], "texture": "#missing"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [4, 2.5, 4.5, 2.75], "texture": "#0"}
+ }
+ },
+ {
+ "from": [4, 4, 4],
+ "to": [12, 5, 12],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 12, 12]},
+ "faces": {
+ "north": {"uv": [0, 0, 8, 1], "texture": "#missing"},
+ "east": {"uv": [0, 0, 8, 1], "texture": "#missing"},
+ "south": {"uv": [0, 0, 8, 1], "texture": "#missing"},
+ "west": {"uv": [0, 0, 8, 1], "texture": "#missing"},
+ "up": {"uv": [0.25, 5.25, 1.75, 6.75], "texture": "#0"},
+ "down": {"uv": [0.25, 5.25, 1.75, 6.75], "texture": "#0"}
+ }
+ },
+ {
+ "from": [4, 2, 3],
+ "to": [12, 5, 4],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 10, 11]},
+ "faces": {
+ "north": {"uv": [4, 2.5, 6, 3.25], "texture": "#0"},
+ "east": {"uv": [0, 0, 1, 3], "texture": "#missing"},
+ "south": {"uv": [0, 0, 8, 3], "texture": "#missing"},
+ "west": {"uv": [0, 0, 1, 3], "texture": "#missing"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [0, 0, 8, 1], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [4, -6, 3],
+ "to": [6, 0, 4],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 2, 11]},
+ "faces": {
+ "north": {"uv": [1, 2.5, 1.5, 4], "texture": "#0"},
+ "east": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"},
+ "south": {"uv": [0, 2.5, 0.5, 4], "texture": "#0"},
+ "west": {"uv": [3.25, 2.5, 3.5, 3.25], "texture": "#0"},
+ "up": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"},
+ "down": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"}
+ }
+ },
+ {
+ "from": [10, -6, 3],
+ "to": [12, 0, 4],
+ "rotation": {"angle": 0, "axis": "y", "origin": [18, 2, 11]},
+ "faces": {
+ "north": {"uv": [0, 2.5, 0.5, 4], "texture": "#0"},
+ "east": {"uv": [3.25, 2.5, 3.5, 3.25], "texture": "#0"},
+ "south": {"uv": [1, 2.5, 1.5, 4], "texture": "#0"},
+ "west": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"},
+ "up": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"},
+ "down": {"uv": [1.75, 2.5, 2, 4], "texture": "#0"}
+ }
+ },
+ {
+ "from": [7, -1, 3.5],
+ "to": [9, 2, 4.5],
+ "rotation": {"angle": 0, "axis": "y", "origin": [15, 7, 11]},
+ "faces": {
+ "north": {"uv": [3, 2.5, 3.5, 3.25], "texture": "#0"},
+ "east": {"uv": [3, 2.5, 3.25, 3.25], "texture": "#0"},
+ "south": {"uv": [3, 2.5, 3.5, 3.25], "texture": "#0"},
+ "west": {"uv": [3, 2.5, 3.25, 3.25], "texture": "#0"},
+ "up": {"uv": [0, 0, 2, 1], "texture": "#missing"},
+ "down": {"uv": [13.5, 2.75, 14, 3], "texture": "#0"}
+ }
+ },
+ {
+ "from": [3, -4, 3],
+ "to": [4, 5, 8],
+ "rotation": {"angle": 0, "axis": "y", "origin": [11, 4, 11]},
+ "faces": {
+ "north": {"uv": [6, 2.5, 6.25, 4.75], "texture": "#0"},
+ "east": {"uv": [13.5, 2.5, 14.75, 4.75], "texture": "#0"},
+ "south": {"uv": [0, 0, 1, 9], "texture": "#missing"},
+ "west": {"uv": [6.75, 2.5, 8, 4.75], "texture": "#0"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [0, 0, 1, 5], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [12, -4, 3],
+ "to": [13, 5, 8],
+ "rotation": {"angle": 0, "axis": "y", "origin": [20, 4, 11]},
+ "faces": {
+ "north": {"uv": [6, 2.5, 6.25, 4.75], "texture": "#0"},
+ "east": {"uv": [13.5, 2.5, 14.75, 4.75], "texture": "#0"},
+ "south": {"uv": [0, 0, 1, 9], "texture": "#missing"},
+ "west": {"uv": [6.75, 2.5, 8, 4.75], "texture": "#0"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [0, 0, 1, 5], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [3, -2, 8],
+ "to": [4, 5, 13],
+ "rotation": {"angle": 0, "axis": "y", "origin": [11, 6, 16]},
+ "faces": {
+ "north": {"uv": [0, 0, 1, 7], "texture": "#missing"},
+ "east": {"uv": [12.25, 2.5, 13.5, 4.25], "texture": "#0"},
+ "south": {"uv": [6, 2.5, 6.25, 4.25], "texture": "#0"},
+ "west": {"uv": [8, 2.5, 9.25, 4.25], "texture": "#0"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [0, 0, 1, 5], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [12, -2, 8],
+ "to": [13, 5, 13],
+ "rotation": {"angle": 0, "axis": "y", "origin": [20, 6, 16]},
+ "faces": {
+ "north": {"uv": [0, 0, 1, 7], "texture": "#missing"},
+ "east": {"uv": [12.25, 2.5, 13.5, 4.25], "texture": "#0"},
+ "south": {"uv": [6, 2.5, 6.25, 4.25], "texture": "#0"},
+ "west": {"uv": [8, 2.5, 9.25, 4.25], "texture": "#0"},
+ "up": {"uv": [1.75, 5, 2, 7], "texture": "#0"},
+ "down": {"uv": [0, 0, 1, 5], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [4, -1, 13],
+ "to": [12, 0, 16],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 7, 21]},
+ "faces": {
+ "north": {"uv": [0, 0, 8, 1], "texture": "#missing"},
+ "east": {"uv": [4, 2.5, 4.5, 2.75], "texture": "#0"},
+ "south": {"uv": [9.75, 3.75, 11.75, 4], "texture": "#0"},
+ "west": {"uv": [4, 2.5, 4.5, 2.75], "texture": "#0"},
+ "up": {"uv": [9.75, 3.25, 11.75, 4], "texture": "#0"},
+ "down": {"uv": [9.75, 3.75, 11.75, 4.5], "texture": "#0"}
+ }
+ },
+ {
+ "from": [7, 5.7, 2],
+ "to": [9, 14.7, 8],
+ "rotation": {"angle": -22.5, "axis": "x", "origin": [15, 14, 10]},
+ "faces": {
+ "north": {"uv": [2, 0, 2.5, 2.25], "texture": "#0"},
+ "east": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "south": {"uv": [0, 0, 2, 9], "texture": "#missing"},
+ "west": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "up": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"},
+ "down": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"}
+ }
+ },
+ {
+ "from": [7.01, 4.88135, 7.88436],
+ "to": [8.99, 13.88135, 13.88436],
+ "rotation": {"angle": 0, "axis": "x", "origin": [15.01, 13.18135, 15.88436]},
+ "faces": {
+ "north": {"uv": [0, 0, 1.98, 9], "texture": "#missing"},
+ "east": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "south": {"uv": [0, 0, 1.98, 9], "texture": "#missing"},
+ "west": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "up": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"},
+ "down": {"uv": [0, 0, 1.98, 6], "texture": "#missing"}
+ }
+ },
+ {
+ "from": [7.02, -0.57048, 11.04624],
+ "to": [8.98, 8.42952, 17.04624],
+ "rotation": {"angle": 45, "axis": "x", "origin": [15.02, 7.72952, 19.04624]},
+ "faces": {
+ "north": {"uv": [0, 0, 1.96, 9], "texture": "#missing"},
+ "east": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "south": {"uv": [0, 0, 1.96, 9], "texture": "#missing"},
+ "west": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "up": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"},
+ "down": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"}
+ }
+ },
+ {
+ "from": [7.03, 3.63871, 12.127],
+ "to": [8.97, 9.63871, 18.127],
+ "rotation": {"angle": 0, "axis": "x", "origin": [15, 17.33871, 19.127]},
+ "faces": {
+ "north": {"uv": [0, 0, 1.94, 9], "rotation": 180, "texture": "#missing"},
+ "east": {"uv": [0, 0, 1.5, 2.25], "texture": "#0"},
+ "south": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"},
+ "west": {"uv": [0, 0.75, 1.5, 2.25], "rotation": 90, "texture": "#0"},
+ "up": {"uv": [0, 0, 1.94, 6], "texture": "#missing"},
+ "down": {"uv": [2, 0, 2.5, 1.75], "texture": "#0"}
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/spartan.png b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/spartan.png
new file mode 100644
index 00000000..95d484e3
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/custom_skull_textures/australia/spartan.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/custom_skull_textures/customskull.json b/src/main/resources/assets/notenoughupdates/custom_skull_textures/customskull.json
new file mode 100644
index 00000000..dddd7878
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/custom_skull_textures/customskull.json
@@ -0,0 +1,7 @@
+{
+ "comment": "custom models override textures, remove the 'model' part below to make it use the elephant texture",
+ "f69ba621-a8b6-31a7-8de1-dc7ade140e1d": {
+ "model": "australia/moul_hat",
+ "texture": "australia/elephant"
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/hhh.json b/src/main/resources/assets/notenoughupdates/hhh.json
new file mode 100644
index 00000000..1d34aafc
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/hhh.json
@@ -0,0 +1,22 @@
+{
+ "credit": "Made with Blockbench",
+ "textures": {
+ "0": "Desktop/hhhh",
+ "particle": "Desktop/hhhh"
+ },
+ "elements": [
+ {
+ "from": [4, -4, 4],
+ "to": [12, 4, 12],
+ "rotation": {"angle": 0, "axis": "y", "origin": [12, 4, 12]},
+ "faces": {
+ "north": {"uv": [0, 0, 8, 8], "texture": "#0"},
+ "east": {"uv": [0, 0, 8, 8], "texture": "#0"},
+ "south": {"uv": [0, 0, 8, 8], "texture": "#0"},
+ "west": {"uv": [0, 0, 8, 8], "texture": "#0"},
+ "up": {"uv": [0, 0, 8, 8], "texture": "#0"},
+ "down": {"uv": [0, 0, 8, 8], "texture": "#0"}
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag
index e3f7feba..e3f7feba 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/biscuit_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/biscuit_cape/biscuit_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag
index bfc089bb..bfc089bb 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/cape/cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/fade_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag
index 33d6b341..33d6b341 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/fade_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/fade_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/fade_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/fade_cape/fade_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag
index 9fb35990..9fb35990 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/lava_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/lava_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/lava_cape/lava_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag
index 1dc5e1c8..1dc5e1c8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/mcworld_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/mcworld_cape/mcworld_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/negative.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag
index a601bd0c..a601bd0c 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/negative.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/negative.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert
index 9ccbcd6f..9ccbcd6f 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/negative.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/negative/negative.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/shiny_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag
index 77e2c5eb..77e2c5eb 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/shiny_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/shiny_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/shiny_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/shiny_cape/shiny_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag
index e3e5d56e..e3e5d56e 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/space_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.vert
index 2b5c48f8..2b5c48f8 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/space_cape.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/space_cape/space_cape.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/void.frag b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag
index 3809c133..3809c133 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/void.frag
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.frag
diff --git a/src/main/resources/assets/notenoughupdates/shaders/void.vert b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert
index 0cc39c90..0cc39c90 100644
--- a/src/main/resources/assets/notenoughupdates/shaders/void.vert
+++ b/src/main/resources/assets/notenoughupdates/shaders/capes/void/void.vert
diff --git a/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.frag
deleted file mode 100644
index c4472679..00000000
--- a/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-#version 120
-
-varying vec4 passColour;
-varying vec3 passNormal;
-uniform sampler2D textureIn;
-
-uniform int millis;
-
-void main() {
- vec4 texture = texture2D(textureIn, gl_TexCoord[0].st);
-
- gl_FragColor = vec4(texture.rgb*shading, gl_FragColor.a);
-}
diff --git a/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.vert
deleted file mode 100644
index 2b5c48f8..00000000
--- a/src/main/resources/assets/notenoughupdates/shaders/lightning_cape.vert
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 120
-
-varying vec4 passColour;
-varying vec3 passNormal;
-
-void main() {
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_TexCoord[0] = gl_MultiTexCoord0;
-
- passColour = gl_Color;
- passNormal = normalize(gl_Normal);
-} \ No newline at end of file
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index 5a71282c..3b8669cb 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -25,6 +25,7 @@
"MixinEffectRenderer",
"MixinRendererLivingEntity",
"GuiEditSignAccessor",
- "MixinGuiScreen"
+ "MixinGuiScreen",
+ "MixinTileEntitySkullRenderer"
]
} \ No newline at end of file