diff options
author | syeyoung <cyoung06@naver.com> | 2023-01-21 00:50:23 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-01-21 00:50:23 +0900 |
commit | a980d55aff534ba0a1cbd1d8f538266bc39e9b5d (patch) | |
tree | 68173b8b3db9786281a9f7d8b09f6b08f2b31fd6 /mod/src/main/java/kr/syeyoung | |
parent | c04cff32cdf5f53beb3a3cda6809208ba84ffa74 (diff) | |
download | Skyblock-Dungeons-Guide-a980d55aff534ba0a1cbd1d8f538266bc39e9b5d.tar.gz Skyblock-Dungeons-Guide-a980d55aff534ba0a1cbd1d8f538266bc39e9b5d.tar.bz2 Skyblock-Dungeons-Guide-a980d55aff534ba0a1cbd1d8f538266bc39e9b5d.zip |
- organize some imports
- remove useless action chat logger, because ActionViewer HUD exists. IDK why he added it at all
- turn debuginfo and coordisplay into hud feature to get advantage of new font renderer
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/java/kr/syeyoung')
13 files changed, 114 insertions, 118 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java index 070f4fce..aeddc558 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java @@ -20,7 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.config.guiconfig; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; @@ -85,7 +85,7 @@ public class MFeature extends MPanel { button.setSize(new Dimension(50, 15)); add(button); } - if (abstractFeature instanceof GuiFeature) { + if (abstractFeature instanceof RawRenderingGuiFeature) { MButton button = new MButton(); button.setText("Relocate"); button.setOnActionPerformed(new Runnable() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java index 0f0846b5..365a1182 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java @@ -21,7 +21,6 @@ package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location; import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; import kr.syeyoung.dungeonsguide.mod.gui.MGui; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java index bf61c1fb..3bcae70b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java @@ -21,7 +21,6 @@ package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location; import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MPopupMenu; import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java index 23b30e9d..90ae8f51 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java @@ -64,7 +64,6 @@ public class ActionClick extends AbstractAction { if (target.getBlockPos(dungeonRoom).equals(event.pos) && (predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) { clicked = true; - ChatTransmitter.sendDebugChat("ACTION FINISHED: CLICK"); } } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java index c6903e7b..595744f4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java @@ -50,17 +50,10 @@ public class ActionRoute { this.state = state; this.actionRouteProperties = actionRouteProperties; - System.out.println("Creating Action Route with mechanic:" + mechanic + " State:" + state); ActionChangeState actionChangeState = new ActionChangeState(mechanic, state); ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); actions = ActionTreeUtil.linearifyActionTree(tree); actions.add(new ActionComplete()); - ChatTransmitter.sendDebugChat("Created ActionRoute with " + actions.size() + " steps"); - ChatTransmitter.sendDebugChat("========== STEPS =========="); - for (AbstractAction action : actions) { - ChatTransmitter.sendDebugChat(action.toString()); - } - ChatTransmitter.sendDebugChat("=========== END ==========="); current = 0; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/RawRenderingGuiFeature.java index d0de4225..869f6391 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/RawRenderingGuiFeature.java @@ -18,49 +18,28 @@ package kr.syeyoung.dungeonsguide.mod.features; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox; -import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size; import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer; import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext; -import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayType; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget; -import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.RenderGameOverlayEvent; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; import java.awt.*; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @Getter -public abstract class GuiFeature extends AbstractHUDFeature { +public abstract class RawRenderingGuiFeature extends AbstractHUDFeature { - protected GuiFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) { + protected RawRenderingGuiFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) { super(category, name, description, key, keepRatio, width, height); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java index 0c843fb9..ff00745f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java @@ -22,7 +22,7 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; import kr.syeyoung.dungeonsguide.mod.utils.MapUtils; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; @@ -39,7 +39,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.Arrays; -public class FeatureDebuggableMap extends GuiFeature { +public class FeatureDebuggableMap extends RawRenderingGuiFeature { public FeatureDebuggableMap() { super("Debug", "Display Debug Info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); this.setEnabled(false); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java index 272bab78..5eace9d0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java @@ -22,10 +22,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -33,32 +37,65 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.BlockPos; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import scala.actors.threadpool.Arrays; import java.awt.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; -public class FeatureRoomCoordDisplay extends GuiFeature { +public class FeatureRoomCoordDisplay extends TextHUDFeature { public FeatureRoomCoordDisplay() { super("Debug", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); this.setEnabled(false); - addParameter("color", new FeatureParameter<>("color", "Color", "Color of text", Color.yellow, "color", nval -> color = nval.getRGB())); + getStyles().add(new TextStyle("coord", new AColor(Color.yellow.getRGB(),true), new AColor(0, 0,0,0), false)); } + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - int color = 0; + private static final List<StyledText> dummyText= new ArrayList<StyledText>(); + static { + dummyText.add(new StyledText("X: 0 Y: 3 Z: 5 Facing: Z+","coord")); + } + + @Override + public List<StyledText> getDummyText() { + return dummyText; + } - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final String[] facing = {"Z+", "X-", "Z-", "X+"}; + @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; + public boolean isHUDViewable() { + if (!skyblockStatus.isOnDungeon()) return false; DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); - if (context == null) return; + if (context == null) return false; EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); if (dungeonRoom == null) { - return; + return false; + } + return true; + } + + @Override + public List<String> getUsedTextStyle() { + return Collections.singletonList("coord"); + } + + @Override + public List<StyledText> getText() { + if (!skyblockStatus.isOnDungeon()) return Collections.emptyList(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context == null) return Collections.emptyList(); + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom == null) { + return Collections.emptyList(); } int facing = (int) (thePlayer.rotationYaw + 45) % 360; @@ -67,29 +104,7 @@ public class FeatureRoomCoordDisplay extends GuiFeature { OffsetPoint offsetPoint = new OffsetPoint(dungeonRoom, new BlockPos((int)thePlayer.posX, (int)thePlayer.posY, (int)thePlayer.posZ)); - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - - double scale = getFeatureRect().getRectangle().getHeight() / fontRenderer.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fontRenderer.drawString("X: "+offsetPoint.getX()+" Y: "+offsetPoint.getY()+" Z: "+offsetPoint.getZ()+" Facing: "+ FeatureRoomCoordDisplay.facing[real], 0, 0, color); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - int facing = (int) (Minecraft.getMinecraft().thePlayer.rotationYaw + 45) % 360; - if (facing < 0) facing += 360; - double scale = getFeatureRect().getRectangle().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("X: 0 Y: 3 Z: 5 Facing: "+FeatureRoomCoordDisplay.facing[(facing / 90) % 4], 0,0, this.<Color>getParameter("color").getValue().getRGB()); + return Collections.singletonList(new StyledText("X: "+offsetPoint.getX()+" Y: "+offsetPoint.getY()+" Z: "+offsetPoint.getZ()+" Facing: "+ FeatureRoomCoordDisplay.facing[real], "coord")); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java index c1662f08..2f0c14bf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java @@ -20,11 +20,15 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -34,62 +38,72 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import java.awt.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; -public class FeatureRoomDebugInfo extends GuiFeature { +public class FeatureRoomDebugInfo extends TextHUDFeature { public FeatureRoomDebugInfo() { super("Debug", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); this.setEnabled(false); - addParameter("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color", nval -> color = nval.getRGB())); + getStyles().add(new TextStyle("info", new AColor(Color.white.getRGB(),true), new AColor(0, 0,0,0), false)); } - int color = 0; - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + private static final List<StyledText> dummyText= new ArrayList<StyledText>(); + static { + dummyText.add(new StyledText("Line 1\nLine 2\nLine 3\nLine 4\nLine 5","info")); + } + @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - if (!FeatureRegistry.DEBUG.isEnabled()) return; + public List<StyledText> getDummyText() { + return dummyText; + } + + @Override + public List<String> getUsedTextStyle() { + return Collections.singletonList("info"); + } + + @Override + public boolean isHUDViewable() { + if (!skyblockStatus.isOnDungeon()) return false; + if (!FeatureRegistry.DEBUG.isEnabled()) return false; DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); - if (context == null) return; + if (context == null) return false; + return true; + } + + @Override + public List<StyledText> getText() { + if (!skyblockStatus.isOnDungeon()) return Collections.emptyList(); + if (!FeatureRegistry.DEBUG.isEnabled()) return Collections.emptyList(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context == null) return Collections.emptyList(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + String str = ""; + if (dungeonRoom == null) { if (context.getBossfightProcessor() == null) { - fontRenderer.drawString("Where are you?!", 0, 0, 0xFFFFFF); + str += "Where are you?!"; } else { - fontRenderer.drawString("You're prob in bossfight", 0, 0, color); - fontRenderer.drawString("processor: "+context.getBossfightProcessor(), 0, 10, color); - fontRenderer.drawString("phase: "+context.getBossfightProcessor().getCurrentPhase(), 0, 20, color); - fontRenderer.drawString("nextPhase: "+ StringUtils.join(context.getBossfightProcessor().getNextPhases(), ","), 0, 30, color); - fontRenderer.drawString("phases: "+ StringUtils.join(context.getBossfightProcessor().getPhases(), ","), 0, 40, color); + str += "You're prob in bossfight\n"; + str += "processor: "+context.getBossfightProcessor()+"\n"; + str += "phase: "+context.getBossfightProcessor().getCurrentPhase()+"\n"; + str += "nextPhase: "+ StringUtils.join(context.getBossfightProcessor().getNextPhases(), ",")+"\n"; + str += "phases: "+ StringUtils.join(context.getBossfightProcessor().getPhases(), ","); } } else { - fontRenderer.drawString("you're in the room... color/shape/rot " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape() + " / "+dungeonRoom.getRoomMatcher().getRotation(), 0, 0, color); - fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 0, 10, color); - fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 0, 20, color); - fontRenderer.drawString("room state / max secret: " + dungeonRoom.getCurrentState() + " / "+dungeonRoom.getTotalSecrets(), 0, 30, color); - + str +="you're in the room... color/shape/rot " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape() + " / "+dungeonRoom.getRoomMatcher().getRotation()+"\n"; + str +="room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)")+"\n"; + str +="room name: " + dungeonRoom.getDungeonRoomInfo().getName()+"\n"; + str +="room state / max secret: " + dungeonRoom.getCurrentState() + " / "+dungeonRoom.getTotalSecrets(); } + return Collections.singletonList(new StyledText(str, "info")); } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Line 1", 0,0, color); - fr.drawString("Line 2", 0,10, color); - fr.drawString("Line 3", 0,20, color); - fr.drawString("Line 4", 0,30, color); - fr.drawString("Line 5", 0,40, color); - } - } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java index 9f5f651d..235093de 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java @@ -24,7 +24,7 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; @@ -61,7 +61,7 @@ import java.util.regex.Pattern; import static kr.syeyoung.dungeonsguide.mod.utils.TabListUtil.getString; -public class FeatureTestPepole extends GuiFeature { +public class FeatureTestPepole extends RawRenderingGuiFeature { Logger logger = LogManager.getLogger("FeatureTestPepole"); private Float scale; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java index c683b196..afffbcb8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java @@ -31,7 +31,7 @@ import kr.syeyoung.dungeonsguide.mod.events.impl.BossroomEnterEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonEndedEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import kr.syeyoung.dungeonsguide.mod.utils.TabListUtil; import net.minecraft.block.material.MapColor; @@ -62,7 +62,9 @@ import javax.vecmath.Vector2d; import java.awt.*; import java.util.List; -public class FeatureDungeonMap extends GuiFeature { +//TODO: reduce gl drawcalls somehow + +public class FeatureDungeonMap extends RawRenderingGuiFeature { private AColor backgroudColor; private AColor playerColor; private boolean shouldCacheMap; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java index 7c8b0ed6..fc3d2584 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java @@ -28,8 +28,9 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; +import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; @@ -45,7 +46,6 @@ import net.minecraft.client.gui.GuiChat; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -56,7 +56,7 @@ import java.util.Objects; import java.util.Optional; import java.util.UUID; -public class FeatureMechanicBrowse extends GuiFeature { +public class FeatureMechanicBrowse extends RawRenderingGuiFeature { private OverlayWidget lastOpen; private OverlayWidget widget; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java index 28143c40..34f76728 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java @@ -30,17 +30,13 @@ import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; import kr.syeyoung.dungeonsguide.mod.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; -import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.BreakWord; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.RichText; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.TextSpan; -import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ITextStyle; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.styles.ParentDelegatingTextStyle; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayType; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget; |