From be483e502d1db2ea4a552169034c7b4546197444 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 19:42:08 +0200 Subject: Add toggle for etherwarp overlay text --- .../moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') 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 83ad8a0d..cc13f59a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -301,7 +301,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(usingEtherwarp) { + if(usingEtherwarp && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableEtherwarpHelperOverlay) { String denyTpReason = null; if(etherwarpRaycast == null) { denyTpReason = "Too far!"; -- cgit From eb585a6d526b3d5e5e6dea74a203ef2122637792 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 15:35:52 +0200 Subject: Redid bonemerang overlay --- .../miscfeatures/CustomItemEffects.java | 61 +--------------------- 1 file changed, 2 insertions(+), 59 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') 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 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 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) { -- cgit From 20876c7a8a15aad04cf99c9f4214e0f8b6a462b2 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 12 Aug 2021 16:14:34 +0200 Subject: Add prismapump overlay toggle --- .../moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') 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 2f9d326e..3ca05dea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -795,7 +795,7 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET")) && + } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); -- cgit From f86196a74db27d5492020e514b6c0d819b82fdc2 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 20:02:25 +0200 Subject: fixes --- .../miscfeatures/CustomItemEffects.java | 60 ++++++++++++++-------- 1 file changed, 38 insertions(+), 22 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') 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 3ca05dea..0f4e2f4d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -45,6 +45,8 @@ import java.awt.*; import java.io.ByteArrayInputStream; import java.util.*; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CustomItemEffects { @@ -59,7 +61,7 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; - + private final Pattern etherwarpDistancePattern = Pattern.compile("up to (?\\d{2}) blocks away\\."); public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -262,7 +264,10 @@ public class CustomItemEffects { denyTpReason = "Not solid!"; } else { WorldClient world = Minecraft.getMinecraft().theWorld; - if(world.getBlockState(pos.add(0, 1, 0)).getBlock() != Blocks.air || + Block above = world.getBlockState(pos.add(0, 1, 0)).getBlock(); + if(above != Blocks.air && above.isCollidable() && + above.getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, pos.add(0, 1, 0), + world.getBlockState(pos.add(0, 1, 0))) != null || world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { denyTpReason = "No air above!"; } @@ -543,34 +548,45 @@ public class CustomItemEffects { } if(usingEtherwarp) { - etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, 60, 0.1f); + int dist = 0; + for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(held.getTagCompound())) { + String cleaned = Utils.cleanColour(line); + Matcher matcher = etherwarpDistancePattern.matcher(cleaned); + if (matcher.matches()) { + dist = Integer.parseInt(matcher.group("distance")); + break; + } + } + if (dist != 0) { + etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, dist, 0.1f); - if(etherwarpRaycast != null) { - AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) - .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); - drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + if (etherwarpRaycast != null) { + AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) + .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); + drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.disableDepth(); - drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.enableDepth(); + GlStateManager.disableDepth(); + drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - float distFactor = 1 - (float)Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))/60; + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + float distFactor = 1 - (float) Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())) / 60; - targetFOVMult = distFactor*distFactor*distFactor*0.75f + 0.25f; - if(targetFOVMult < 0.25f) targetFOVMult = 0.25f; + targetFOVMult = distFactor * distFactor * distFactor * 0.75f + 0.25f; + if (targetFOVMult < 0.25f) targetFOVMult = 0.25f; - targetSensMult = distFactor*0.76f + 0.25f; + targetSensMult = distFactor * 0.76f + 0.25f; + } + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + targetFOVMult = lastFOVMult; } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - targetFOVMult = lastFOVMult; - } - return; + return; + } } } } -- cgit From d7c31c78fe6cf41de8f0140f00a94d57fbea22be Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 25 Aug 2021 09:51:17 +0200 Subject: Fix fetchur crash/disable BuilderW/BZ/Prisma overlay when not on Pisland --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java') 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 0f4e2f4d..d7d27f99 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -283,10 +283,12 @@ public class CustomItemEffects { } } + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && Minecraft.getMinecraft().objectMouseOver != null && - Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && onPrivateIsland) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( @@ -528,6 +530,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); if(heldInternal != null) { + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); EntityPlayer player = event.player; double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.partialTicks; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; @@ -592,8 +595,8 @@ public class CustomItemEffects { } if(heldInternal.equals("BLOCK_ZAPPER")) { - boolean privateIs = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); - if (!privateIs || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || + + if (!onPrivateIsland || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || event.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { zapperBlocks.clear(); return; @@ -729,7 +732,7 @@ public class CustomItemEffects { GlStateManager.disableBlend(); } } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) { - if(heldInternal.equals("BUILDERS_WAND")) { + if(heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) { 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)); @@ -811,7 +814,7 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay) && + } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); @@ -893,7 +896,7 @@ public class CustomItemEffects { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING")) && + } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING") && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos target = event.target.getBlockPos(); IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target); -- cgit