aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-08-07 16:37:55 -0400
committerbowser0000 <bowser0000@gmail.com>2022-08-07 16:37:55 -0400
commit1a0a3ca6e58adf11729fa9078150e3b140b6bfed (patch)
treec71f3ca9b8027ee02472df6c2027584f4d43d187 /src/main/java
parent3482eff013fb83a7969847ee3acf1419438efc0f (diff)
downloadSkyblockMod-1a0a3ca6e58adf11729fa9078150e3b140b6bfed.tar.gz
SkyblockMod-1a0a3ca6e58adf11729fa9078150e3b140b6bfed.tar.bz2
SkyblockMod-1a0a3ca6e58adf11729fa9078150e3b140b6bfed.zip
Fix minions showing across profiles
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/Danker/features/MinionLastCollected.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/MinionLastCollected.java b/src/main/java/me/Danker/features/MinionLastCollected.java
index 7079f40..d793970 100644
--- a/src/main/java/me/Danker/features/MinionLastCollected.java
+++ b/src/main/java/me/Danker/features/MinionLastCollected.java
@@ -13,6 +13,7 @@ import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C02PacketUseEntity;
+import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -72,6 +73,7 @@ public class MinionLastCollected {
public void onWorldRender(RenderWorldLastEvent event) {
if (ToggleCommand.minionLastCollected && Utils.inSkyblock && Utils.tabLocation.equals("Private Island")) {
for (Minion minion : minions) {
+ if (!minionExistsAtPos(minion.pos)) continue;
RenderUtils.draw3DString(minion.pos.getX() + 0.5, minion.pos.getY() + 2.2, minion.pos.getZ() + 0.5, minion.getTimeCollected(), LAST_COLLECTED_COLOUR, event.partialTicks);
}
}
@@ -98,6 +100,12 @@ public class MinionLastCollected {
return null;
}
+ public boolean minionExistsAtPos(BlockPos pos) {
+ AxisAlignedBB aabb = new AxisAlignedBB(pos, pos.add(1, 1, 1));
+ List<EntityArmorStand> entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityArmorStand.class, aabb);
+ return entities.size() > 0; // just assume theres a minion there
+ }
+
public static void save() {
try (FileWriter writer = new FileWriter(configFile)) {
new GsonBuilder().create().toJson(minions, writer);