diff options
author | syeyoung <cyong06@naver.com> | 2021-02-12 00:03:42 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-12 00:03:42 +0900 |
commit | 89c82ad1fea9fd0a8e32a5e818c6c01856cdd660 (patch) | |
tree | eb989b2e58b2b18480d41a262b9cabf1a0ba387d /src/main/java/kr/syeyoung/dungeonsguide | |
parent | 505cb6fc92e7d2c7412b43f459796791ca36e5a3 (diff) | |
download | Skyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.tar.gz Skyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.tar.bz2 Skyblock-Dungeons-Guide-89c82ad1fea9fd0a8e32a5e818c6c01856cdd660.zip |
YES
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
19 files changed, 430 insertions, 33 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java index 44251237..0acde584 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java @@ -20,6 +20,8 @@ public class TCTextStyle implements TypeConverter<TextStyle> { textStyle.setBackground(element.getAsJsonObject().has("background") ? TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("background")) : new AColor(0x00777777, true)); textStyle.setGroupName(element.getAsJsonObject().get("group").getAsString()); + if (element.getAsJsonObject().has("shadow")) + textStyle.setShadow(element.getAsJsonObject().get("shadow").getAsBoolean()); return textStyle; } @@ -29,6 +31,7 @@ public class TCTextStyle implements TypeConverter<TextStyle> { jsonObject.add("color", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getColor())); jsonObject.add("background", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getBackground())); jsonObject.addProperty("group", element.getGroupName()); + jsonObject.addProperty("shadow", element.isShadow()); return jsonObject; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java index 04b839e6..3dcae148 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java @@ -59,6 +59,8 @@ public class ActionBreakWithSuperBoom extends AbstractAction { GlStateManager.translate(-x_fix, -y_fix, -z_fix); GlStateManager.disableLighting(); GlStateManager.enableAlpha(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.enableBlend(); Tessellator tessellator = Tessellator.getInstance(); @@ -74,7 +76,7 @@ public class ActionBreakWithSuperBoom extends AbstractAction { GlStateManager.enableLighting(); GlStateManager.popMatrix(); - RenderUtils.highlightBlock(blockpos, new Color(0, 255,255,50), partialTicks, false); + RenderUtils.highlightBlock(blockpos, new Color(0, 255,255,50), partialTicks, true); RenderUtils.drawTextAtWorld("Superboom", blockpos.getX() + 0.5f, blockpos.getY() + 0.5f, blockpos.getZ() + 0.5f, 0xFFFFFF00, 0.03f, false, false, partialTicks); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java index 2fdfec96..78ae7ab9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java @@ -6,6 +6,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; import javax.vecmath.Vector2d; import java.io.Serializable; @@ -13,6 +14,8 @@ import java.io.Serializable; @Data @AllArgsConstructor public class OffsetPoint implements Cloneable, Serializable { + private static final long serialVersionUID = 3102336358774967540L; + private int x; private int y; private int z; @@ -20,6 +23,10 @@ public class OffsetPoint implements Cloneable, Serializable { public OffsetPoint(DungeonRoom dungeonRoom, BlockPos pos) { setPosInWorld(dungeonRoom, pos); } + public OffsetPoint(DungeonRoom dungeonRoom, Vec3 pos) { + setPosInWorld(dungeonRoom, new BlockPos((int)pos.xCoord, (int)pos.yCoord, (int)pos.zCoord)); + } + public void setPosInWorld(DungeonRoom dungeonRoom, BlockPos pos) { Vector2d vector2d = new Vector2d(pos.getX() - dungeonRoom.getMin().getX(), pos.getZ() - dungeonRoom.getMin().getZ()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java index 9b32802f..5ba3f21c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -46,11 +46,11 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { Set<Action> preRequisites = base = new HashSet<Action>(); { ActionBreakWithSuperBoom actionClick; - preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); + preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint())); preRequisites = actionClick.getPreRequisite(); } { - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0)); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); } @@ -113,6 +113,6 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { @Override public OffsetPoint getRepresentingPoint() { - return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0); + return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(secretPoint.getOffsetPointList().size() / 2); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java new file mode 100755 index 00000000..6cd7238a --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java @@ -0,0 +1,81 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionInteract; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.Data; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Data +public class DungeonDummy implements DungeonMechanic { + private OffsetPoint secretPoint = new OffsetPoint(0,0,0); + private List<String> preRequisite = new ArrayList<String>(); + + + @Override + public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + { + ActionMove actionMove = new ActionMove(secretPoint); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + } + { + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + } + return base; + } + + @Override + public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { + BlockPos pos = getSecretPoint().getBlockPos(dungeonRoom); + RenderUtils.highlightBlock(pos, color,partialTicks); + RenderUtils.drawTextAtWorld("D-"+name, pos.getX() +0.5f, pos.getY()+0.375f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + } + + + public DungeonDummy clone() throws CloneNotSupportedException { + DungeonDummy dungeonSecret = new DungeonDummy(); + dungeonSecret.secretPoint = (OffsetPoint) secretPoint.clone(); + dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + return dungeonSecret; + } + + + @Override + public String getCurrentState(DungeonRoom dungeonRoom) { + return "no-state"; + } + + @Override + public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { + return Sets.newHashSet("navigate"); + } + @Override + public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { + return Sets.newHashSet("no-state","navigate"); + } + @Override + public OffsetPoint getRepresentingPoint() { + return secretPoint; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index d34e7eee..b507ba47 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureCooldownCounter; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureDisableMessage; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipDungeonStat; import kr.syeyoung.dungeonsguide.features.impl.etc.FeatureTooltipPrice; +import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureActions; import kr.syeyoung.dungeonsguide.features.impl.secret.FeatureMechanicBrowse; import lombok.Getter; @@ -88,5 +89,6 @@ public class FeatureRegistry { public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap()); public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); + public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java new file mode 100644 index 00000000..888f4d8c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java @@ -0,0 +1,123 @@ +package kr.syeyoung.dungeonsguide.features.impl.secret; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.features.text.StyledText; +import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.MathHelper; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureActions extends TextHUDFeature { + public FeatureActions() { + super("Secret", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public boolean doesScaleWithHeight() { + return false; + } + + @Override + public boolean isHUDViewable() { + if (Minecraft.getMinecraft().currentScreen != null) return false; + if (!skyblockStatus.isOnDungeon()) return false; + if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return false; + DungeonContext context = skyblockStatus.getContext(); + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom == null) return false; + if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return false; + return true; + } + + private static final List<StyledText> dummyText= new ArrayList<StyledText>(); + static { + dummyText.add(new StyledText("Pathfinding ","pathfinding")); + dummyText.add(new StyledText("Secret ","mechanic")); + dummyText.add(new StyledText("-> ","separator")); + dummyText.add(new StyledText("Found\n","state")); + dummyText.add(new StyledText("> ","current")); + dummyText.add(new StyledText("1","number")); + dummyText.add(new StyledText(". ","dot")); + dummyText.add(new StyledText("Move ","action")); + dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline")); + dummyText.add(new StyledText(" ","current")); + dummyText.add(new StyledText("2","number")); + dummyText.add(new StyledText(". ","dot")); + dummyText.add(new StyledText("Click ","action")); + dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline")); + dummyText.add(new StyledText(" ","current")); + dummyText.add(new StyledText("3","number")); + dummyText.add(new StyledText(". ","dot")); + dummyText.add(new StyledText("Profit ","action")); + } + + @Override + public List<String> getUsedTextStyle() { + return Arrays.asList(new String[] { + "pathfinding","mechanic","separator","state","current", "number", "dot", "action", "afterline" + }); + } + + @Override + public List<StyledText> getDummyText() { + return dummyText; + } + + + @Override + public List<StyledText> getText() { + List<StyledText> actualBit = new ArrayList<StyledText>(); + + DungeonContext context = skyblockStatus.getContext(); + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + + ActionRoute path = ((GeneralRoomProcessor)dungeonRoom.getRoomProcessor()).getPath(); + + if (path != null) { + actualBit.add(new StyledText("Pathfinding ","pathfinding")); + actualBit.add(new StyledText(path.getMechanic()+" ","mechanic")); + actualBit.add(new StyledText("-> ","separator")); + actualBit.add(new StyledText(path.getState()+"\n","state")); + + for (int i = 0; i < path.getActions().size(); i++) { + actualBit.add(new StyledText((i == path.getCurrent() ? ">" : " ") +" ","current")); + actualBit.add(new StyledText(i+"","number")); + actualBit.add(new StyledText(". ","dot")); + Action action = path.getActions().get(i); + String[] str = action.toString().split(" "); + actualBit.add(new StyledText(str[0] + " ","action")); + for (int i1 = 1; i1 < str.length; i1++) { + actualBit.add(new StyledText(str[i1]+" ","afterline")); + } + actualBit.add(new StyledText("\n","afterline")); + } + } + return actualBit; + } +} 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 95ac96e2..6436d0e0 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 @@ -39,7 +39,7 @@ import java.util.Set; public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderListener, GuiClickListener, WorldRenderListener { public FeatureMechanicBrowse() { - super("secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); + super("Secret","Mechanic(Secret) Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); } SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); @@ -124,11 +124,11 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi ActionRoute route = grp.getPath(); fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00); } - clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x, feature.y + fr.FONT_HEIGHT + 4, feature.width , fr.FONT_HEIGHT * 10 + 4); - GL11.glEnable(GL11.GL_SCISSOR_TEST); GlStateManager.translate(0, fr.FONT_HEIGHT + 4, 0); - Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * 9 + 4, 0xFF444444); - Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT * 9 + 3, 0xFF262626); + Gui.drawRect(0, 0, feature.width, feature.height - fr.FONT_HEIGHT - 4, 0xFF444444); + Gui.drawRect(1, 1, feature.width - 1,feature.height - fr.FONT_HEIGHT - 5, 0xFF262626); + clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6); + GL11.glEnable(GL11.GL_SCISSOR_TEST); GlStateManager.translate(0, -dy, 0); GlStateManager.pushMatrix(); @@ -155,11 +155,11 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi } GlStateManager.popMatrix();; - clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 4, feature.width, fr.FONT_HEIGHT * 10 + 4); if (selected != -1) { GlStateManager.translate(feature.width, selected * fr.FONT_HEIGHT, 0); Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * possibleStates.size() + 4, 0xFF444444); Gui.drawRect(-1, 1, feature.width - 1, fr.FONT_HEIGHT * possibleStates.size() + 3, 0xFF262626); + clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6); GlStateManager.translate(2,2, 0); Point popupStart = new Point(feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy + 2); @@ -248,6 +248,18 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi } found = false; for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { + if (value.getValue() instanceof DungeonJournal) { + if (!found) { + sortedMechanics.add("Journals"); + sortedMechanicsName.add(""); + found = true; + } + sortedMechanics.add(value.getValue()); + sortedMechanicsName.add(value.getKey()); + } + } + found = false; + for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().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) { @@ -263,6 +275,14 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi @Override public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig + || Minecraft.getMinecraft().currentScreen instanceof GuiConfig + || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit + || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet + || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit + || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit) return; + + if (!skyblockStatus.isOnDungeon()) return; if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; DungeonContext context = skyblockStatus.getContext(); @@ -319,6 +339,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPostRenderLi if (preSelectedState == selectedState && preSelectedState != -1) { ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).pathfind(sortedMechanicsName.get(selected), possibleStates.get(selectedState)); + selected = -1; + selectedState = -1; + possibleStates.clear(); } selectedState = preSelectedState; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java index 06ac0fca..3a87075c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java @@ -13,6 +13,7 @@ import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MColor; import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; +import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -35,6 +36,7 @@ public class PanelTextParameterConfig extends MPanel { private MEditableAColor currentColor; private MEditableAColor backgroundColor; + private MToggleButton shadow; @Override public void onBoundsUpdate() { @@ -77,6 +79,17 @@ public class PanelTextParameterConfig extends MPanel { } }); add(backgroundColor); + shadow = new MToggleButton(); + shadow.setSize(new Dimension(20, 10)); + shadow.setBounds(new Rectangle(275 , 30, 20, 10)); + shadow.setOnToggle(new Runnable() { + @Override + public void run() { + for (String se:selected) + feature.getStylesMap().get(se).setShadow(shadow.isEnabled()); + } + }); + add(shadow); } @@ -132,6 +145,7 @@ public class PanelTextParameterConfig extends MPanel { GlStateManager.popMatrix(); fr.drawString("Text Color: ", 0, 10, 0xFFFFFFFF); fr.drawString("Background Color: ", 100, 10, 0xFFFFFFFF); + fr.drawString("Shadow: ", 0, 26, 0xFFFFFFFF); GlStateManager.popMatrix(); } @@ -177,15 +191,18 @@ public class PanelTextParameterConfig extends MPanel { if (selected.size() != 0) { currentColor.setColor(styles.get(selected.iterator().next()).getColor()); backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); + shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); } else { currentColor.setColor(new AColor(0xff555555, true)); backgroundColor.setColor(new AColor(0xff555555, true)); + shadow.setEnabled(false); } } if (selected.size() == 1) { currentColor.setColor(styles.get(selected.iterator().next()).getColor()); backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); + shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java index 4ab41379..c0e521f0 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java @@ -90,7 +90,7 @@ public abstract class TextHUDFeature extends GuiFeature { } for (String str : getUsedTextStyle()) { if (!res.containsKey(str)) - res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true))); + res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true), false)); } stylesMap = res; } @@ -175,13 +175,13 @@ public abstract class TextHUDFeature extends GuiFeature { Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, RenderUtils.getColorAt(x,y, style.getBackground())); if (!style.getColor().isChroma()) { - fr.drawString(content, x, y, style.getColor().getRGB()); + fr.drawString(content, x, y, style.getColor().getRGB(), style.isShadow()); return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT); }else { char[] charArr = content.toCharArray(); int width = 0; for (int i = 0; i < charArr.length; i++) { - fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getColorAt(x + width, y, style.getColor())); + fr.drawString(String.valueOf(charArr[i]), x + width, y, RenderUtils.getColorAt(x + width, y, style.getColor()), style.isShadow()); width += fr.getCharWidth(charArr[i]); } return new Dimension(width, fr.FONT_HEIGHT); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java index 0df4c9a5..74ee297b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java @@ -14,4 +14,5 @@ public class TextStyle { private String groupName; private AColor color; private AColor background; + private boolean shadow = false; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java index 35f020a1..ac4521c8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java @@ -37,6 +37,7 @@ public class EditingContext { @Getter private DungeonRoom room; + @Getter private Stack<GuiScreen> guiStack = new Stack<GuiScreen>(); public boolean isEditingSecrets() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java index d37e7c53..34d7f740 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MTabbedPane; import kr.syeyoung.dungeonsguide.roomedit.panes.*; +import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -21,6 +22,8 @@ public class GuiDungeonRoomEdit extends GuiScreen { private DungeonRoom room; private MTabbedPane tabbedPane; + @Getter + private SecretEditPane sep; public GuiDungeonRoomEdit(DungeonRoom room) { this.room = room; @@ -32,7 +35,7 @@ public class GuiDungeonRoomEdit extends GuiScreen { tabbedPane.addTab("General", new GeneralEditPane(room)); tabbedPane.addTab("Match", new RoomDataDisplayPane(room)); - tabbedPane.addTab("Secrets", new SecretEditPane(room)); + tabbedPane.addTab("Secrets", sep = new SecretEditPane(room)); tabbedPane.addTab("Actions", new ActionDisplayPane(room)); tabbedPane.addTab("Test", new RoommatchingPane(room)); tabbedPane.addTab("Proc.Params", new ProcessorParameterEditPane(room)); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java new file mode 100755 index 00000000..73c3df8b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java @@ -0,0 +1,104 @@ +package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; + +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDummy; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonNPC; +import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; +import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import java.awt.*; +import java.util.Arrays; +import java.util.Collections; + +public class ValueEditDummy extends MPanel implements ValueEdit<DungeonDummy> { + private Parameter parameter; + + // scroll pane + // just create + // add set + private DungeonDummy dungeonSecret; + + private MLabel label; + private MValue<OffsetPoint> value; + private MTextField preRequisite; + private MLabelAndElement preRequisite2; + + public ValueEditDummy(final Parameter parameter2) { + this.parameter = parameter2; + this.dungeonSecret = (DungeonDummy) parameter2.getNewData(); + + + label = new MLabel(); + label.setText("Dummy Point"); + label.setAlignment(MLabel.Alignment.LEFT); + add(label); + + value = new MValue(dungeonSecret.getSecretPoint(), Collections.emptyList()); + add(value); + + preRequisite = new MTextField() { + @Override + public void edit(String str) { + dungeonSecret.setPreRequisite(Arrays.asList(str.split(","))); + } + }; + preRequisite.setText(TextUtils.join(dungeonSecret.getPreRequisite(), ",")); + preRequisite2 = new MLabelAndElement("Req.",preRequisite); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); + add(preRequisite2); + } + + @Override + public void onBoundsUpdate() { + label.setBounds(new Rectangle(0,0,getBounds().width, 20)); + value.setBounds(new Rectangle(0,20,getBounds().width, 20)); + preRequisite2.setBounds(new Rectangle(0,40,getBounds().width,20)); + } + + @Override + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } + + @Override + public void renderWorld(float partialTicks) { + dungeonSecret.highlight(new Color(0,255,0,50), parameter.getName(), EditingContext.getEditingContext().getRoom(), partialTicks); + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); + } + + public static class Generator implements ValueEditCreator<ValueEditDummy> { + + @Override + public ValueEditDummy createValueEdit(Parameter parameter) { + return new ValueEditDummy(parameter); + } + + @Override + public Object createDefaultValue(Parameter parameter) { + return new DungeonDummy(); + } + + @Override + public Object cloneObj(Object object) { + try { + return ((DungeonDummy)object).clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + assert false; + return null; + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java index 322bfad5..49f45932 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java @@ -38,7 +38,7 @@ public class ValueEditNPC extends MPanel implements ValueEdit<DungeonNPC> { label = new MLabel(); - label.setText("FairySoul Point"); + label.setText("NPC Point"); label.setAlignment(MLabel.Alignment.LEFT); add(label); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java index 11e1982c..fc2584d6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -27,6 +27,7 @@ public class GeneralEditPane extends MPanel { private MLabelAndElement uuid; private MLabelAndElement name; + private MLabelAndElement secrets; private MLabelAndElement shape; private MLabelAndElement rotation; @@ -59,12 +60,24 @@ public class GeneralEditPane extends MPanel { name.setBounds(new Rectangle(0,20,getBounds().width, 20)); add(name); } + { + final MIntegerSelectionButton la = new MIntegerSelectionButton(dungeonRoom.getDungeonRoomInfo().getTotalSecrets()); + la.setOnUpdate(new Runnable() { + @Override + public void run() { + dungeonRoom.getDungeonRoomInfo().setTotalSecrets(la.getData()); + } + }); + secrets = new MLabelAndElement("Room Secrets: ", la); + secrets.setBounds(new Rectangle(0,40,getBounds().width, 20)); + add(secrets); + } { MLabel la; shape = new MLabelAndElement("Room Shape: ", la = new MLabel()); la.setText(dungeonRoom.getDungeonRoomInfo().getShape()+""); - shape.setBounds(new Rectangle(0,40,getBounds().width, 20)); + shape.setBounds(new Rectangle(0,60,getBounds().width, 20)); add(shape); } @@ -72,20 +85,20 @@ public class GeneralEditPane extends MPanel { MLabel la; rotation = new MLabelAndElement("Found Room Rotation: ", la = new MLabel()); la.setText(dungeonRoom.getRoomMatcher().getRotation()+""); - rotation.setBounds(new Rectangle(0,60,getBounds().width, 20)); + rotation.setBounds(new Rectangle(0,80,getBounds().width, 20)); add(rotation); } { MLabel la; shape2 = new MLabelAndElement("Found Room Shape: ", la = new MLabel()); la.setText(dungeonRoom.getShape()+""); - shape2.setBounds(new Rectangle(0,80,getBounds().width, 20)); + shape2.setBounds(new Rectangle(0,100,getBounds().width, 20)); add(shape2); } { final MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(new ArrayList<String>(ProcessorFactory.getProcessors()), dungeonRoom.getDungeonRoomInfo().getProcessorId()); roomProcessor = new MLabelAndElement("Room Processor: ", mStringSelectionButton); - roomProcessor.setBounds(new Rectangle(0,100,getBounds().width, 20)); + roomProcessor.setBounds(new Rectangle(0,120,getBounds().width, 20)); add(roomProcessor); mStringSelectionButton.setOnUpdate(new Runnable() { @@ -106,7 +119,7 @@ public class GeneralEditPane extends MPanel { } }); end.setBackgroundColor(Color.green); - end.setBounds(new Rectangle(0,120,getBounds().width, 20)); + end.setBounds(new Rectangle(0,140,getBounds().width, 20)); add(end); } { @@ -132,7 +145,7 @@ public class GeneralEditPane extends MPanel { } }); schematic.setBackgroundColor(Color.orange); - schematic.setBounds(new Rectangle(0,160,getBounds().width, 20)); + schematic.setBounds(new Rectangle(0,180,getBounds().width, 20)); add(schematic); } { @@ -147,7 +160,7 @@ public class GeneralEditPane extends MPanel { } }); save.setBackgroundColor(Color.green); - save.setBounds(new Rectangle(0,140,getBounds().width, 20)); + save.setBounds(new Rectangle(0,10,getBounds().width, 20)); add(save); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java index 10a40013..6225f133 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java @@ -36,6 +36,12 @@ public class SecretEditPane extends MPanel implements DynamicEditor { } } + public void createNewMechanic(String uid, DungeonMechanic data) { + MParameter parameter; + parameters.add(parameter = new MParameter(new Parameter(uid, data, data), SecretEditPane.this)); + parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); + } + public void buildElements() { { create = new MButton(); @@ -45,9 +51,7 @@ public class SecretEditPane extends MPanel implements DynamicEditor { create.setOnActionPerformed(new Runnable() { @Override public void run() { - MParameter parameter; - parameters.add(parameter = new MParameter(new Parameter(UUID.randomUUID().toString(), null, null), SecretEditPane.this)); - parameter.setBounds(new Rectangle(0,0,getBounds().width, 20)); + createNewMechanic(UUID.randomUUID().toString(), null); } }); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java index 3186facd..4437088e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java @@ -41,6 +41,7 @@ public class ValueEditRegistry { valueEditMap.put(DungeonTomb.class.getName(), new ValueEditTomb.Generator()); valueEditMap.put(DungeonBreakableWall.class.getName(), new ValueEditBreakableWall.Generator()); valueEditMap.put(DungeonJournal.class.getName(), new ValueEditJournal.Generator()); + valueEditMap.put(DungeonDummy.class.getName(), new ValueEditDummy.Generator()); valueEditMap.put(DungeonPressurePlate.class.getName(), new ValueEditPressurePlate.Generator()); valueEditMap.put(DungeonOnewayLever.class.getName(), new ValueEditOnewayLever.Generator()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 04490a1c..71c6fbc0 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -5,7 +5,9 @@ import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; @@ -16,9 +18,11 @@ 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.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; @@ -31,6 +35,7 @@ import net.minecraftforge.fml.common.gameevent.InputEvent; import java.awt.*; import java.util.Map; +import java.util.UUID; public class GeneralRoomProcessor implements RoomProcessor { @@ -51,14 +56,6 @@ public class GeneralRoomProcessor implements RoomProcessor { if (path != null) path.onRenderScreen(partialTicks); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - if (path != null) { - fr.drawString("Pathfinding " + path.getMechanic() + ":" + path.getState(), 5, 5, 0xffffffff); - for (int i = 0; i < path.getActions().size(); i++) { - fr.drawString((i == path.getCurrent() ? ">" : " ") + " " + i + ". " + path.getActions().get(i), - 5, i * 8 + 13, 0xFF00FF00); - } - } - Entity en = Minecraft.getMinecraft().objectMouseOver.entityHit; if (en == null) return;; @@ -170,6 +167,21 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void onEntityDeath(LivingDeathEvent deathEvent) { if (path != null) path.onLivingDeath(deathEvent); + if (EditingContext.getEditingContext() != null && EditingContext.getEditingContext().getRoom() == getDungeonRoom()) { + if (deathEvent.entity instanceof EntityBat) { + for (GuiScreen screen : EditingContext.getEditingContext().getGuiStack()) { + if (screen instanceof GuiDungeonRoomEdit) { + DungeonSecret secret = new DungeonSecret(); + secret.setSecretType(DungeonSecret.SecretType.BAT); + secret.setSecretPoint(new OffsetPoint(dungeonRoom, + EntitySpawnManager.getSpawnLocation().get(deathEvent.entity.getEntityId()) + )); + ((GuiDungeonRoomEdit) screen).getSep().createNewMechanic("BAT-"+UUID.randomUUID().toString(), + new DungeonSecret()); + } + } + } + } } public static class Generator implements RoomProcessorGenerator<GeneralRoomProcessor> { |