aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java40
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java58
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java2
5 files changed, 105 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
index e9f8e713..ee4ce4cc 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java
@@ -52,6 +52,9 @@ public class DungeonContext {
@Getter
@Setter
private int BossRoomEnterSeconds = -1;
+ @Getter
+ @Setter
+ private BlockPos bossroomSpawnPos = null;
@Getter
@Setter
@@ -75,6 +78,7 @@ public class DungeonContext {
if (mapProcessor.isInitialized() && BossRoomEnterSeconds == -1 && !roomBoundary.contains(mapProcessor.worldPointToMapPoint(Minecraft.getMinecraft().thePlayer.getPositionVector()))) {
BossRoomEnterSeconds = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000;
+ bossroomSpawnPos = Minecraft.getMinecraft().thePlayer.getPosition();
MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent());
DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName());
if (doorFinder != null) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index 5a791c99..8a68ad91 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -3,10 +3,7 @@ package kr.syeyoung.dungeonsguide.features;
import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebuggableMap;
import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomCoordDisplay;
import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo;
-import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureAutoReparty;
-import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureBossHealth;
-import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureBoxRealLivid;
-import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice;
+import kr.syeyoung.dungeonsguide.features.impl.boss.*;
import kr.syeyoung.dungeonsguide.features.impl.dungeon.*;
import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureCooldownCounter;
import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureDisableMessage;
@@ -71,6 +68,7 @@ public class FeatureRegistry {
public static final FeatureAutoReparty BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty());
public static final FeatureBoxRealLivid BOSSFIGHT_BOX_REALLIVID = register(new FeatureBoxRealLivid());
public static final FeatureBossHealth BOSSFIGHT_HEALTH = register(new FeatureBossHealth());
+ public static final FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage());
public static final FeatureInstaCloseChest DUNGEON_INSTACLOSE = register(new FeatureInstaCloseChest());
public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java
new file mode 100644
index 00000000..c1ca2882
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java
@@ -0,0 +1,40 @@
+package kr.syeyoung.dungeonsguide.features.impl.boss;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn;
+import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.gui.FontRenderer;
+
+import java.awt.*;
+import java.util.List;
+
+public class FeatureThornBearPercentage extends GuiFeature {
+ public FeatureThornBearPercentage() {
+ super("Bossfight", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear", true, getFontRenderer().getStringWidth("Spirit Bear: 50%"), getFontRenderer().FONT_HEIGHT);
+ this.setEnabled(true);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+ if (!(context.getBossfightProcessor() instanceof BossfightProcessorThorn)) return;
+ int percentage = (int) (((BossfightProcessorThorn) context.getBossfightProcessor()).calculatePercentage() * 100);
+ FontRenderer fr = getFontRenderer();
+ fr.drawString("Spirit Bear: "+percentage+"%", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ fr.drawString("Spirit Bear: 50%", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java
index ec37d65a..f4e9435e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java
@@ -1,20 +1,53 @@
package kr.syeyoung.dungeonsguide.roomprocessor.bossfight;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingEvent;
+import java.awt.*;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public class BossfightProcessorThorn extends GeneralBossfightProcessor {
+
+
public BossfightProcessorThorn() {
addPhase(GeneralBossfightProcessor.PhaseData.builder()
.phase("fight").build()
);
+
+ w= e.getDungeonsGuide().getSkyblockStatus().getContext().getWorld();
}
+ private final Set<BlockPos> progressBar = new HashSet<BlockPos>();
+ private final World w;
+ private int ticksPassed = 0;
+
+ @Override
+ public void tick() {
+ ticksPassed++;
+ if (ticksPassed == 20) {
+ for (int x = -30; x <= 30; x++) {
+ for (int y = -30; y <= 30; y++) {
+ BlockPos newPos = new BlockPos(205 + x, 77, 205 + y);
+ Block b = w.getBlockState(newPos).getBlock();
+ if (b == Blocks.coal_block || b == Blocks.sea_lantern)
+ progressBar.add(newPos);
+ }
+ }
+ }
+ }
@Override
public List<HealthData> getHealths() {
@@ -22,4 +55,29 @@ public class BossfightProcessorThorn extends GeneralBossfightProcessor {
healths.add(new HealthData("Thorn", (int) Math.round(BossStatus.healthScale * 4),4, true));
return healths;
}
+
+ public double calculatePercentage() {
+ int total = progressBar.size(), lit = 0;
+ if (total == 0) return 0;
+ for (BlockPos pos : progressBar) {
+ if (w.getBlockState(pos).getBlock() == Blocks.prismarine) lit++;
+ }
+ return lit / (double)total;
+ }
+
+ @Override
+ public void drawWorld(float partialTicks) {
+ super.drawWorld(partialTicks);
+ if (!FeatureRegistry.DEBUG.isEnabled()) return;
+ try {
+ BlockPos pos = new BlockPos(205,77, 205);
+ RenderUtils.highlightBlock(pos, new Color(0, 255, 255, 50), partialTicks, false);
+ for (BlockPos pos2 : progressBar) {
+ RenderUtils.highlightBlock(pos2, w.getBlockState(pos2).getBlock() == Blocks.sea_lantern ?
+ new Color(0, 255, 0, 50) : new Color(255,0,0, 50), partialTicks, false);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
index ec40d44c..c9395708 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
@@ -245,7 +245,7 @@ public class RenderUtils {
GlStateManager.disableTexture2D();
if (!depth) {
- GlStateManager.disableDepth();
+ GlStateManager.disableDepth(); GL11.glDisable(GL11.GL_DEPTH_TEST);
GlStateManager.depthMask(false);
}
GlStateManager.color(c.getRed() /255.0f, c.getGreen() / 255.0f, c.getBlue()/ 255.0f, c.getAlpha()/ 255.0f);