From 38a65e1d183cde880fd0e88b22d5f58f3b487167 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sun, 28 Feb 2021 00:09:13 +0900 Subject: fix bugs, add new feature --- .../features/impl/boss/FeatureHideAnimals.java | 57 ++++++++++++++++ .../impl/boss/FeatureThornSpiritBowTimer.java | 78 ++++++++++++++++++++++ .../impl/dungeon/FeatureDungeonDeaths.java | 1 + .../features/impl/etc/FeatureRepartyCommand.java | 11 +++ 4 files changed, 147 insertions(+) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java new file mode 100644 index 00000000..66399235 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java @@ -0,0 +1,57 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +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.EntityLivingRenderListener; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.client.event.RenderLivingEvent; + + +public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRenderListener { + public FeatureHideAnimals() { + super("Bossfight", "Hide animals on f4", "Hide Soirit Animals on F4. \nClick on Edit for precise setting", "bossfight.hideanimals", false); + parameters.put("sheep", new FeatureParameter("sheep", "Hide Sheeps", "Hide Sheeps", true, "boolean")); + parameters.put("cow", new FeatureParameter("cow", "Hide Cows", "Hide Cows", true, "boolean")); + parameters.put("chicken", new FeatureParameter("chicken", "Hide Chickens", "Hide Chickens", true, "boolean")); + parameters.put("wolf", new FeatureParameter("wolf", "Hide Wolves", "Hide Wolves", true, "boolean")); + parameters.put("rabbit", new FeatureParameter("rabbit", "Hide Rabbits", "Hide Rabbits", true, "boolean")); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { + if (!isEnabled()) return; + if (!skyblockStatus.isOnDungeon()) return; + if (skyblockStatus.getContext().getBossfightProcessor() == null) return; + if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + + if (renderPlayerEvent.entity instanceof EntitySheep && this.getParameter("sheep").getValue()) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityCow && this.getParameter("cow").getValue() ) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityChicken && this.getParameter("chicken").getValue()) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityWolf && this.getParameter("wolf").getValue()) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityRabbit && this.getParameter("rabbit").getValue()) { + renderPlayerEvent.setCanceled(true); + } + } + + @Override + public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { + + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java new file mode 100644 index 00000000..26ccaa1b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java @@ -0,0 +1,78 @@ +package kr.syeyoung.dungeonsguide.features.impl.boss; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.TitleListener; +import kr.syeyoung.dungeonsguide.features.text.StyledText; +import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.features.text.TextStyle; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatListener, TitleListener { + public FeatureThornSpiritBowTimer() { + super("Bossfight", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay", false, getFontRenderer().getStringWidth("Spirit Bow Destruction: 2m 00s"), getFontRenderer().FONT_HEIGHT); + getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); + getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); + getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + private static final List dummyText= new ArrayList(); + static { + dummyText.add(new StyledText("Spirit Bow Destruction","title")); + dummyText.add(new StyledText(": ","separator")); + dummyText.add(new StyledText("1s","time")); + } + @Override + public boolean isHUDViewable() { + return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn && time > System.currentTimeMillis(); + } + + @Override + public List getUsedTextStyle() { + return Arrays.asList(new String[] { + "title", "separator", "time" + }); + } + + @Override + public List getDummyText() { + return dummyText; + } + + @Override + public List getText() { + List actualBit = new ArrayList(); + actualBit.add(new StyledText("Spirit Bow Destruction","title")); + actualBit.add(new StyledText(": ","separator")); + actualBit.add(new StyledText(TextUtils.formatTime(time - System.currentTimeMillis()),"time")); + return actualBit; + } + private long time = 0; + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + if (clientChatReceivedEvent.message.getFormattedText().equals("§r§a§lThe §r§5§lSpirit Bow §r§a§lhas dropped!§r")) { + time = System.currentTimeMillis() + 16000; + } + } + + @Override + public void onTitle(S45PacketTitle renderPlayerEvent) { + if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + if (renderPlayerEvent.getMessage().getFormattedText().contains("picked up")) { + time = System.currentTimeMillis() + 21000; + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java index 28be7b78..7557820c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java @@ -72,6 +72,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener text.add(new StyledText(death.getKey(),"username")); text.add(new StyledText(": ","separator")); text.add(new StyledText(death.getValue()+"\n","deaths")); + deathsCnt += death.getValue(); } text.add(new StyledText("Total Deaths","total")); text.add(new StyledText(": ","separator")); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java new file mode 100644 index 00000000..5212b3ed --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java @@ -0,0 +1,11 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +public class FeatureRepartyCommand extends SimpleFeature { + public FeatureRepartyCommand() { + super("ETC", "Enable Reparty Command From DG", "if you disable, /dg reparty will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.reparty"); + parameters.put("command", new FeatureParameter("command", "The Command", "Command that the reparty will be bound to", "reparty", "string")); + } +} -- cgit