aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java62
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java59
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java118
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java7
12 files changed, 283 insertions, 70 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 9872e70e..19bd0dfa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -654,7 +654,7 @@ public class NEUOverlay extends Gui {
public void mouseInputInv() {
if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer) {
- if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) {
+ if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen);
if(slot != null) {
ItemStack hover = slot.getStack();
@@ -712,7 +712,7 @@ public class NEUOverlay extends Gui {
manager.showRecipe(item);
} else if(Mouse.getEventButton() == 1) {
showInfo(item);
- } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) {
+ } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
textField.setText("id:"+item.get("internalname").getAsString());
updateSearch();
searchMode = true;
@@ -745,7 +745,7 @@ public class NEUOverlay extends Gui {
manager.showRecipe(item);
} else if(Mouse.getEventButton() == 1) {
showInfo(item);
- } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) {
+ } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
textField.setText("id:"+item.get("internalname").getAsString());
updateSearch();
searchMode = true;
@@ -1037,7 +1037,7 @@ public class NEUOverlay extends Gui {
Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(manager,
internalname.get(), item));
return true;
- } else if(keyPressed == manager.keybindItemSelect.getKeyCode()) {
+ } else if(keyPressed == manager.keybindItemSelect.getKeyCode() && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
textField.setText("id:"+internalname.get());
itemPaneOpen = true;
updateSearch();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 205c0ce8..da35d6ab 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -233,6 +233,63 @@ public class NotEnoughUpdates {
}
});*/
+ SimpleCommand neuhelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() {
+ public void processCommand(ICommandSender sender, String[] args) {
+ ArrayList<String> neuHelpMessages = Lists.newArrayList(
+ "\u00a75\u00a7lNotEnoughUpdates commands",
+ "\u00a76/neu \u00a77- opens the neu gui",
+ "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer",
+ "\u00a76/neusouls \u00a7r\u00a77- fairy souls waypoints",
+ "\u00a76/neubuttons \u00a7r\u00a77- add custom inventory buttons",
+ "\u00a76/neuec \u00a7r\u00a77- recolour enchantment text",
+
+ "\u00a76/join {floor} \u00a7r\u00a77- quickly join a dungeon {4/f7/m5}",
+ "\u00a76/neucosmetics \u00a7r\u00a77- open the cosmetic gui",
+ "\u00a76/neurename \u00a7r\u00a77- rename/customize items/armor",
+ "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer's catacombs page",
+ "\u00a76/neulinks \u00a7r\u00a77- links to neu/moulberry",
+ "\u00a76/neuoverlay \u00a7r\u00a77- inventory overlay placement command",
+ "\u00a76/neuah \u00a7r\u00a77- neu's custom Auction house gui",
+ "\u00a76/neumap \u00a7r\u00a77- opens the dungeon map gui",
+ "\u00a76/neucalendar \u00a7r\u00a77- opens neu's custom calendar gui",
+ "",
+ "\u00a76\u00a7lOld commands:",
+ "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- quickly get stats for a user",
+ "",
+ "\u00a76\u00a7lDebug commands:",
+ "\u00a76/neustats \u00a7r\u00a77- copies pc info to clipboard",
+ "\u00a76/neustats modlist \u00a7r\u00a77- copies mod list info to clipboard",
+ "\u00a76/neuresetrepo \u00a7r\u00a77- resets the repo",
+ "\u00a76/neureloadrepo \u00a7r\u00a77- reloads the repo",
+ "",
+ "\u00a76\u00a7lDev commands:",
+ "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc");
+ for (int i = 0; i < neuHelpMessages.size(); i++) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i)
+ ));
+
+ }
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev) {
+ ArrayList<String> neuDevHelpMessages = Lists.newArrayList(
+ "\u00a76/neudevtest \u00a7r\u00a77- dev test command",
+ "\u00a76/neuzeephere \u00a7r\u00a77- sphere",
+ "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen");
+
+ for (int i = 0; i < neuDevHelpMessages.size(); i++) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i)
+ ));
+
+ }
+ }
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\""));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional."));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything"));
+ }
+ });
+
SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() {
public void processCommand(ICommandSender sender, String[] args) {
NEUEventListener.displayNotification(Lists.newArrayList(
@@ -1183,7 +1240,7 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand);
ClientCommandHandler.instance.registerCommand(cosmeticsCommand);
ClientCommandHandler.instance.registerCommand(linksCommand);
- ClientCommandHandler.instance.registerCommand(gamemodesCommand);
+ //ClientCommandHandler.instance.registerCommand(gamemodesCommand);
ClientCommandHandler.instance.registerCommand(stWhyCommand);
ClientCommandHandler.instance.registerCommand(buttonsCommand);
ClientCommandHandler.instance.registerCommand(resetRepoCommand);
@@ -1200,7 +1257,7 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(packDevCommand);
if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand);
ClientCommandHandler.instance.registerCommand(peekCommand);
- ClientCommandHandler.instance.registerCommand(tutorialCommand);
+ //ClientCommandHandler.instance.registerCommand(tutorialCommand);
ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand);
ClientCommandHandler.instance.registerCommand(enchantColourCommand);
ClientCommandHandler.instance.registerCommand(neuAhCommand);
@@ -1212,6 +1269,7 @@ public class NotEnoughUpdates {
ClientCommandHandler.instance.registerCommand(dungeonWinTest);
ClientCommandHandler.instance.registerCommand(calendarCommand);
ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand());
+ ClientCommandHandler.instance.registerCommand(neuhelp);
BackgroundBlur.registerListener();
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 01b27f3d..658f72df 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java
@@ -22,6 +22,7 @@ import net.minecraft.client.shader.Shader;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
@@ -1516,6 +1517,10 @@ public class DungeonMap {
renderMap(pos.getAbsX(scaledResolution, size/2)+size/2, pos.getAbsY(scaledResolution, size/2)+size/2,
colourMap, decorations, roomSizeBlocks, actualPlayers, true, event.partialTicks);
Utils.pushGuiScale(-1);
+ } else if(stack != null && Item.getIdFromItem(stack.getItem()) == 399){
+ //This should clear the map if you're in the dungeon boss room
+ //so when you're holding a bow it doesnt show the map anymore
+ this.colourMap = null;
}
}
}
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 cc13f59a..2f9d326e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -59,10 +59,7 @@ public class CustomItemEffects {
public long lastUsedHyperion = 0;
- private boolean heldBonemerang = false;
- public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>();
- public boolean bonemerangBreak = false;
public int aoteTeleportationMillis = 0;
public Vector3f aoteTeleportationCurr = null;
@@ -197,55 +194,7 @@ public class CustomItemEffects {
tick++;
if(tick > Integer.MAX_VALUE/2) tick = 0;
- heldBonemerang = false;
- bonemerangBreak = false;
- bonemeragedEntities.clear();
- if(Minecraft.getMinecraft().thePlayer == null) return;
- if(Minecraft.getMinecraft().theWorld == null) return;
-
- ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
-
- String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
- if(internal != null && internal.equals("BONE_BOOMERANG")) {
- heldBonemerang = true;
-
- EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
- float stepSize = 0.15f;
- float bonemerangDistance = 15;
-
- Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ);
- Vec3 look = p.getLook(0);
-
- Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord);
- step.scale(stepSize / step.length());
-
- for(int i=0; i<Math.floor(bonemerangDistance/stepSize)-2; i++) {
- AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.75f, position.y - 0.1, position.z - 0.75f,
- position.x + 0.75f, position.y + 0.25, position.z + 0.75);
-
- BlockPos blockPos = new BlockPos(position.x, position.y, position.z);
-
- if(!Minecraft.getMinecraft().theWorld.isAirBlock(blockPos) &&
- Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock().isFullCube()) {
- if(NotEnoughUpdates.INSTANCE.config.itemOverlays.showBreak) {
- bonemerangBreak = true;
- }
- break;
- }
- if(NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) {
- List<Entity> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb);
- for(Entity entity : entities) {
- if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) {
- if(!bonemeragedEntities.contains(entity)) {
- bonemeragedEntities.add((EntityLivingBase)entity);
- }
- }
- }
- }
- position.translate(step.x, step.y, step.z);
- }
- }
}
private float lastPartialTicks = 0;
@@ -329,14 +278,8 @@ public class CustomItemEffects {
}
}
- if(heldBonemerang) {
- if(bonemerangBreak) {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- Utils.drawStringCentered(EnumChatFormatting.RED+"Bonemerang will break!",
- Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0);
- }
- } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay &&
+
+ if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay &&
Minecraft.getMinecraft().objectMouseOver != null &&
Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
index 256cf03f..cd128ebe 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java
@@ -79,6 +79,14 @@ public class SlotLocking {
private boolean lockKeyHeld = false;
private Slot pairingSlot = null;
+ private Slot realSlot = null;
+
+ public void setRealSlot(Slot slot){
+ realSlot = slot;
+ }
+
+ public Slot getRealSlot(){ return realSlot;}
+
public void loadConfig(File file) {
try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
config = GSON.fromJson(reader, SlotLockingConfig.class);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index e527e18e..3ed16e76 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -101,7 +101,10 @@ public abstract class MixinGuiContainer extends GuiScreen {
@Inject(method="drawScreen", at=@At("RETURN"))
public void drawScreen(CallbackInfo ci) {
if(theSlot != null && SlotLocking.getInstance().isSlotLocked(theSlot)) {
+ SlotLocking.getInstance().setRealSlot(theSlot);
theSlot = null;
+ } else if( theSlot == null){
+ SlotLocking.getInstance().setRealSlot(null);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
index a71fd6f8..7a1be4de 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
@@ -1,7 +1,9 @@
package io.github.moulberry.notenoughupdates.mixins;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
import io.github.moulberry.notenoughupdates.miscfeatures.DamageCommas;
+import io.github.moulberry.notenoughupdates.overlays.BonemerangOverlay;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -30,7 +32,7 @@ public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> {
@Inject(method="getColorMultiplier", at=@At("HEAD"), cancellable = true)
public void getColorMultiplier(T entitylivingbaseIn, float lightBrightness,
float partialTickTime, CallbackInfoReturnable<Integer> cir) {
- if(CustomItemEffects.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) {
+ if(BonemerangOverlay.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn) && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) {
cir.setReturnValue(0x80ff9500);
}
}
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 543d5bdd..261be236 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -82,6 +82,9 @@ public class NEUConfig extends Config {
case 8:
NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour();
return;
+ case 9:
+ editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition);
+ return;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
index 501bc8ae..5b7dbbb0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
@@ -1,8 +1,13 @@
package io.github.moulberry.notenoughupdates.options.seperateSections;
import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
public class ItemOverlays {
@ConfigOption(
name = "Treecapitator Overlay",
@@ -200,6 +205,15 @@ public class ItemOverlays {
@Expose
@ConfigOption(
+ name = "Enable Bonemerang Overlay",
+ desc = "Shows info about the bonemerang while holding it."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean enableBonemerangOverlay = true;
+
+ @Expose
+ @ConfigOption(
name = "Highlight Targeted Entities",
desc = "Highlight entities that will be hit by your bonemerang"
)
@@ -209,12 +223,51 @@ public class ItemOverlays {
@Expose
@ConfigOption(
- name = "Break Warning",
- desc = "Show a warning below your crosshair if the bonemerang will break on a block"
+ name = "Bonemerang Overlay Position",
+ desc = "The position of the Bonemerang overlay."
+ )
+ @ConfigEditorButton(
+ runnableId = 9,
+ buttonText = "Edit"
+ )
+ @ConfigAccordionId(id = 3)
+ public Position bonemerangPosition = new Position(-1, -1);
+
+ @Expose
+ @ConfigOption(
+ name = "Bonemerang Overlay Text",
+ desc = "\u00a7eDrag text to change the appearance of the overlay\n" +
+ "\u00a7rHold a Bonemerang to display the overlay"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {"\u00a74Gonna break",
+ "\u00a77Targets: \u00a76\u00a7l10"
+ }
+ )
+ @ConfigAccordionId(id = 3)
+ public List<Integer> bonemerangOverlayText = new ArrayList<>(Arrays.asList(0, 1));
+
+ @Expose
+ @ConfigOption(
+ name = "Bonemerang Overlay Style",
+ desc = "Change the style of the Bonemerang overlay"
+ )
+ @ConfigEditorDropdown(
+ values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"}
+ )
+ @ConfigAccordionId(id = 3)
+ public int bonemerangOverlayStyle = 0;
+ @Expose
+ @ConfigOption(
+ name = "Fast update",
+ desc = "Updates the bonemerang overlay faster.\n"+
+ "Might cause some lag."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
- public boolean showBreak = true;
+ public boolean bonemerangFastUpdate = false;
+
+
@ConfigOption(
name = "Minion Crystal Radius Overlay",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java
new file mode 100644
index 00000000..7d54cf47
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java
@@ -0,0 +1,118 @@
+package io.github.moulberry.notenoughupdates.overlays;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.config.Position;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.Vec3;
+import org.lwjgl.util.vector.Vector3f;
+
+import java.util.*;
+import java.util.function.Supplier;
+
+import static net.minecraft.util.EnumChatFormatting.DARK_AQUA;
+
+public class BonemerangOverlay extends TextOverlay{
+ public BonemerangOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) {
+ super(position, dummyStrings, styleSupplier);
+ INSTANCE = this;
+ }
+ public static BonemerangOverlay INSTANCE;
+
+
+ public final Set<EntityLivingBase> bonemeragedEntities = new HashSet<>();
+
+
+
+ @Override
+ public void updateFrequent() {
+ if(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){
+ updateOverlay();
+ }
+
+ }
+
+ @Override
+ public void update() {
+ if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){
+ updateOverlay();
+ }
+
+ }
+
+ private void updateOverlay(){
+ if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted){
+ overlayStrings = null;
+ return;
+ }
+ overlayStrings = new ArrayList<>();
+
+
+ bonemeragedEntities.clear();
+ if(Minecraft.getMinecraft().thePlayer == null) return;
+ if(Minecraft.getMinecraft().theWorld == null) return;
+
+ ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
+
+ String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+
+ if(internal != null && internal.equals("BONE_BOOMERANG")) {
+ HashMap<Integer, String> map = new HashMap<>();
+
+
+ EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
+ float stepSize = 0.15f;
+ float bonemerangDistance = 15;
+
+ Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ);
+ Vec3 look = p.getLook(0);
+
+ Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord);
+ step.scale(stepSize / step.length());
+
+ for(int i=0; i<Math.floor(bonemerangDistance/stepSize)-2; i++) {
+ AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.75f, position.y - 0.1, position.z - 0.75f,
+ position.x + 0.75f, position.y + 0.25, position.z + 0.75);
+
+ BlockPos blockPos = new BlockPos(position.x, position.y, position.z);
+
+ if(!Minecraft.getMinecraft().theWorld.isAirBlock(blockPos) &&
+ Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock().isFullCube()) {
+ map.put(0, EnumChatFormatting.RED + "Bonemerang will break!");
+ break;
+ }
+
+
+ List<Entity> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb);
+ for (Entity entity : entities) {
+ if (entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) {
+ if (!bonemeragedEntities.contains(entity)) {
+ bonemeragedEntities.add((EntityLivingBase) entity);
+ }
+ }
+ }
+
+ position.translate(step.x, step.y, step.z);
+ }
+ if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay) {
+
+ map.put(1, EnumChatFormatting.GRAY + "Targets: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + bonemeragedEntities.size());
+ for (int index : NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayText) {
+ if (map.containsKey(index)) {
+ overlayStrings.add(map.get(index));
+ }
+ }
+ }
+
+ }
+
+ if(overlayStrings.isEmpty()) overlayStrings = null;
+ }
+}
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 357815b7..3c1f2e3a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
@@ -15,6 +15,7 @@ public class OverlayManager {
public static FarmingOverlay farmingOverlay;
public static PetInfoOverlay petInfoOverlay;
public static TimersOverlay timersOverlay;
+ public static BonemerangOverlay bonemerangOverlay;
public static final List<TextOverlay> textOverlays = new ArrayList<>();
static {
@@ -108,9 +109,23 @@ public class OverlayManager {
return TextOverlayStyle.BACKGROUND;
});
+ List<String> bonemerangDummy = Lists.newArrayList(
+ "\u00a74Gonna break",
+ "\u00a77Targets: \u00a76\u00a7lLike alot"
+ );
+ bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> {
+ int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle;
+ if(style >= 0 && style < TextOverlayStyle.values().length) {
+ return TextOverlayStyle.values()[style];
+ }
+ return TextOverlayStyle.BACKGROUND;
+ });
+
+
textOverlays.add(miningOverlay);
textOverlays.add(farmingOverlay);
textOverlays.add(petInfoOverlay);
+ textOverlays.add(bonemerangOverlay);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index a4af51ca..5ca9b316 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -8,6 +8,7 @@ import com.mojang.authlib.Agent;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.util.TexLoc;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -433,7 +434,11 @@ public class Utils {
}
public static Slot getSlotUnderMouse(GuiContainer container) {
- return (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u");
+ Slot slot = (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u");
+ if(slot == null){
+ slot = SlotLocking.getInstance().getRealSlot();
+ }
+ return slot;
}
public static void drawTexturedRect(float x, float y, float width, float height) {