aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-26 02:15:24 +0900
committersyeyoung <cyong06@naver.com>2021-02-26 02:15:24 +0900
commitc137266fe1bf1f85ea661fcea976303dc0474b30 (patch)
treec6d5e9aadc5791b53d7ccaf798929896c060898e /src/main/java/kr/syeyoung/dungeonsguide/features
parentab5dc44e4f57d5f11da64f360e65e21866eb2f6a (diff)
downloadSkyblock-Dungeons-Guide-c137266fe1bf1f85ea661fcea976303dc0474b30.tar.gz
Skyblock-Dungeons-Guide-c137266fe1bf1f85ea661fcea976303dc0474b30.tar.bz2
Skyblock-Dungeons-Guide-c137266fe1bf1f85ea661fcea976303dc0474b30.zip
box bats!
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java50
2 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index a1fff77a..15b02a6c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -81,6 +81,7 @@ public class FeatureRegistry {
public static final FeatureInstaCloseChest DUNGEON_INSTACLOSE = register(new FeatureInstaCloseChest());
public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster());
+ public static final FeatureBoxBats DUNGEON_BOXBAT = register(new FeatureBoxBats());
public static final FeatureBoxStarMobs DUNGEON_BOXSTARMOBS = register(new FeatureBoxStarMobs());
public static final FeatureDungeonDeaths DUNGEON_DEATHS = register(new FeatureDungeonDeaths());
public static final FeatureDungeonMilestone DUNGEON_MILESTONE = register(new FeatureDungeonMilestone());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java
new file mode 100644
index 00000000..a36a6f03
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java
@@ -0,0 +1,50 @@
+package kr.syeyoung.dungeonsguide.features.impl.dungeon;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.SimpleFeature;
+import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.util.BlockPos;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+
+public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener {
+ public FeatureBoxBats() {
+ super("Dungeon", "Box Bats", "Box bats in dungeons\nDoes not appear through walls", "dungeon.batbox", true);
+ parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and bats to be boxed", 20, "integer"));
+ parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Bats", new AColor(255,0,0,50), "acolor"));
+ }
+
+
+ private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawWorld(float partialTicks) {
+ if (!isEnabled()) return;
+ if (!skyblockStatus.isOnDungeon()) return;
+
+ final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition();
+ int val = this.<Integer>getParameter("radius").getValue();
+ final int sq = val * val;
+
+ List<EntityBat> skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityBat.class, new Predicate<EntityBat>() {
+ @Override
+ public boolean apply(@Nullable EntityBat input) {
+ return input != null && input.getDistanceSq(player) < sq;
+ }
+ });
+ AColor c = this.<AColor>getParameter("color").getValue();
+ for (EntityBat entitySkeleton : skeletonList) {
+ RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true);
+ }
+ }
+}