aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-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
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java26
3 files changed, 71 insertions, 6 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);
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
index a3464503..5733eca5 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
@@ -13,9 +13,11 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.entity.passive.EntityBat;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
+import net.minecraft.util.Vector3d;
import org.lwjgl.opengl.GL11;
import javax.vecmath.Vector3f;
@@ -625,14 +627,26 @@ public class RenderUtils {
int rgb = RenderUtils.getColorAt(entity.posX % 20,entity.posY % 20,c);
GlStateManager.color(((rgb >> 16) &0XFF)/ 255.0f, ((rgb>>8) &0XFF)/ 255.0f, (rgb & 0xff)/ 255.0f, ((rgb >> 24) & 0xFF) / 255.0f);
- AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4);
-
+ AxisAlignedBB axisAlignedBB;
+ if (entity instanceof EntityArmorStand) {
+ axisAlignedBB = AxisAlignedBB.fromBounds(-0.4, -0.5, -0.4, 0.4, 1.5, 0.4);
+ } else if (entity instanceof EntityBat) {
+ axisAlignedBB = AxisAlignedBB.fromBounds(-0.4, -0.4, -0.4, 0.4, 0.4, 0.4);
+ } else {
+ axisAlignedBB = AxisAlignedBB.fromBounds(-0.4, -0.5, -0.4, 0.4, 1.5, 0.4);
+ }
- GlStateManager.translate(-0.4 + entity.posX, -1.5 + entity.posY, -0.4 + entity.posZ);
+ Vec3 renderPos = new Vec3(
+ (float) (entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks),
+ (float) (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks),
+ (float) (entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks)
+ );
+ System.out.println(renderPos);
+ GlStateManager.translate(axisAlignedBB.minX + renderPos.xCoord, axisAlignedBB.minY + renderPos.yCoord, axisAlignedBB.minZ + renderPos.zCoord);
- double x = 0.8;
- double y = 1.5;
- double z = 0.8;
+ double x = axisAlignedBB.maxX - axisAlignedBB.minX;
+ double y = axisAlignedBB.maxY - axisAlignedBB.minY;
+ double z = axisAlignedBB.maxZ - axisAlignedBB.minZ;
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3d(0, 0, 0);
GL11.glVertex3d(0, 0, z);