diff options
author | syeyoung <cyong06@naver.com> | 2021-02-27 00:55:04 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-27 00:57:04 +0900 |
commit | 740c141be9abb13b7b54389a408b082570945153 (patch) | |
tree | 09654da24efbee43f9a175fec025c011d5d6d950 /src/main/java/kr/syeyoung/dungeonsguide/features/impl | |
parent | 4c8212e74781dfa09c0036e94ceaf150e31da9d4 (diff) | |
download | Skyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.tar.gz Skyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.tar.bz2 Skyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.zip |
massive refactor
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl')
4 files changed, 157 insertions, 14 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java new file mode 100644 index 00000000..14d62437 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java @@ -0,0 +1,64 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; +import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.RenderPlayerEvent; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.opengl.GL11; + +import java.util.List; + + +public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListener { + public FeaturePlayerESP() { + super("Dungeon", "See players through walls", "See players through walls", "dungeon.playeresp", false); + setEnabled(false); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + private boolean preCalled = false; + @Override + public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { + if (preCalled) return; + if (!isEnabled()) return; + + DungeonContext dungeonContext = skyblockStatus.getContext(); + if (dungeonContext == null) return; + if (!dungeonContext.getPlayers().contains(renderPlayerEvent.entityPlayer.getName())) { + return; + } + + + + preCalled = true; + GlStateManager.depthFunc(GL11.GL_GEQUAL); + Entity entity = renderPlayerEvent.entityPlayer; + float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * renderPlayerEvent.partialRenderTick; + try { + renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z, f, renderPlayerEvent.partialRenderTick); + } catch (Throwable t) {} + preCalled = false; + GlStateManager.depthFunc(GL11.GL_LEQUAL); + } + + @Override + public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java new file mode 100644 index 00000000..a2ca6dab --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java @@ -0,0 +1,70 @@ +package kr.syeyoung.dungeonsguide.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.TickListener; +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.GeneralRoomProcessor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public class FeatureWatcherWarning extends TextHUDFeature implements ChatListener, DungeonEndListener { + + public FeatureWatcherWarning() { + super("Dungeon","Watcher Spawn Alert", "Alert when watcher says 'That will be enough for now'", "dungen.watcherwarn", true, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT); + getStyles().add(new TextStyle("warning", new AColor(0xFF, 0x69,0x17,255), new AColor(0, 0,0,0), false)); + setEnabled(false); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public boolean isHUDViewable() { + return warning > System.currentTimeMillis(); + } + + @Override + public List<String> getUsedTextStyle() { + return Collections.singletonList("warning"); + } + + private UUID lastRoomUID = UUID.randomUUID(); + private long warning = 0; + + private static final List<StyledText> text = new ArrayList<StyledText>(); + static { + text.add(new StyledText("Watcher finished spawning all mobs!", "warning")); + } + + @Override + public List<StyledText> getText() { + return text; + } + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.message.getFormattedText().equals("§r§c[BOSS] The Watcher§r§f: That will be enough for now.§r")) { + warning = System.currentTimeMillis() + 2500; + } + } + + @Override + public void onDungeonEnd() { + warning = 0; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index 34fd50c3..0727c36c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -12,7 +12,6 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; @@ -20,7 +19,6 @@ import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -38,7 +36,6 @@ import java.awt.*; import java.util.List; import java.util.ArrayList; import java.util.Map; -import java.util.Set; public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { @@ -164,8 +161,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis String name = sortedMechanicsName.get(i); fr.drawString(name, 3, i * fr.FONT_HEIGHT, 0xFFFFFF00); fr.drawString(" ("+ ((DungeonMechanic) obj).getCurrentState(dungeonRoom) +", "+ - (((DungeonMechanic) obj).getRepresentingPoint() != null ? - String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) obj).getRepresentingPoint().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") + (((DungeonMechanic) obj).getRepresentingPoint(dungeonRoom) != null ? + String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) obj).getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") +"m)",fr.getStringWidth(name) + 3, i * fr.FONT_HEIGHT, 0xFFAAAAAA); } else if ("$SPECIAL-CANCEL".equals(obj)) { fr.drawString("Cancel Current", 3, i * fr.FONT_HEIGHT, 0xFF00FFFF); @@ -225,7 +222,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis sortedMechanicsName.add(""); boolean found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonFairySoul) { if (!found) { sortedMechanics.add("Fairy Souls"); @@ -237,7 +234,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } } found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonSecret) { if (!found) { sortedMechanics.add("Secrets"); @@ -249,7 +246,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } } found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonTomb) { if (!found) { sortedMechanics.add("Crypts"); @@ -261,7 +258,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } } found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonNPC) { if (!found) { sortedMechanics.add("NPC"); @@ -273,7 +270,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } } found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonJournal) { if (!found) { sortedMechanics.add("Journals"); @@ -285,7 +282,19 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } } found = false; - for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { + if (value.getValue() instanceof DungeonRoomDoor){ + if (!found) { + sortedMechanics.add("Gates"); + sortedMechanicsName.add(""); + found = true; + } + sortedMechanics.add(value.getValue()); + sortedMechanicsName.add(value.getKey()); + } + } + found = false; + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonDoor || value.getValue() instanceof DungeonBreakableWall || value.getValue() instanceof DungeonLever || value.getValue() instanceof DungeonOnewayDoor || value.getValue() instanceof DungeonOnewayLever || value.getValue() instanceof DungeonPressurePlate) { if (!found) { @@ -404,8 +413,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis if (selected != -1) { if (sortedMechanics.size() <= selected) return;; ((DungeonMechanic)sortedMechanics.get(selected)).highlight(new Color(0,255,255,50), sortedMechanicsName.get(selected) +" ("+(((DungeonMechanic) - sortedMechanics.get(selected)).getRepresentingPoint() != null ? - String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) sortedMechanics.get(selected)).getRepresentingPoint().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") + sortedMechanics.get(selected)).getRepresentingPoint(dungeonRoom) != null ? + String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) sortedMechanics.get(selected)).getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") +"m)", dungeonRoom, partialTicks); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java index 785ba617..6f3a3ea7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java @@ -86,7 +86,7 @@ public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListen if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; if (!dungeonRoom.getDungeonRoomInfo().getUuid().equals(lastRoomUID)) { - for (DungeonMechanic value : dungeonRoom.getDungeonRoomInfo().getMechanics().values()) { + for (DungeonMechanic value : dungeonRoom.getMechanics().values()) { if (value instanceof DungeonFairySoul) warning = System.currentTimeMillis() + 2500; } |