aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java3
-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.java50
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java112
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java15
6 files changed, 181 insertions, 63 deletions
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/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
index a71fd6f8..ee71a995 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.mixins;
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 +31,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)) {
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..82f73891 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",
@@ -209,12 +214,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..e8d34ec7
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java
@@ -0,0 +1,112 @@
+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(){
+ 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;
+ }
+
+ 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);
+ }
+
+ 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);
}