diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-15 01:23:36 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-15 01:23:36 +0900 |
commit | c4448fea149d2638f126813deba6406a7a15d67d (patch) | |
tree | 7701c48f47dc95644acfae4756596b6b9a089dff /src/main/java/kr/syeyoung/dungeonsguide | |
parent | 496efb764360cd26fa40982532048aa18ae4c6be (diff) | |
download | Skyblock-Dungeons-Guide-c4448fea149d2638f126813deba6406a7a15d67d.tar.gz Skyblock-Dungeons-Guide-c4448fea149d2638f126813deba6406a7a15d67d.tar.bz2 Skyblock-Dungeons-Guide-c4448fea149d2638f126813deba6406a7a15d67d.zip |
predicate equals and more edits
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
23 files changed, 114 insertions, 39 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java index b17625d7..9aeac9e8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; @@ -22,11 +23,13 @@ public class ActionChangeState implements Action{ public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { Set<Action> set = new HashSet<Action>(); set.addAll(preRequisite2); - set.addAll(dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName).getAction(state, dungeonRoom)); + DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName); + if (mechanic!= null) + set.addAll(mechanic.getAction(state, dungeonRoom)); return set; } @Override public String toString() { - return "ChangeState\n\ttarget: "+mechanicName+"\n\tstate: "+state; + return "ChangeState\n- target: "+mechanicName+"\n- state: "+state; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java index 13e4ee76..b3a4cc92 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java @@ -27,6 +27,6 @@ public class ActionClick implements Action { @Override public String toString() { - return "Click\n\ttarget: "+target.toString()+"\n\tpredicate: "+predicate.getClass().getSimpleName(); + return "Click\n- target: "+target.toString()+"\n- predicate: "+predicate.getClass().getSimpleName(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java index 454bfad3..595e66c7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java @@ -27,6 +27,6 @@ public class ActionClickSet implements Action { @Override public String toString() { - return "ClickSet\n\ttargets size: "+target.getOffsetPointList().size()+"\n\tpredicate: "+predicate.getClass().getSimpleName(); + return "ClickSet\n- targets size: "+target.getOffsetPointList().size()+"\n- predicate: "+predicate.getClass().getSimpleName(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java index ad2eb5e2..151fe96c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java @@ -27,6 +27,6 @@ public class ActionDropItem implements Action { @Override public String toString() { - return "DropItem\n\ttarget: "+target.toString()+"\n\tpredicate: "+predicate.getClass().getSimpleName(); + return "DropItem\n- target: "+target.toString()+"\n- predicate: "+predicate.getClass().getSimpleName(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java index 162d0345..e1eba8b7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java @@ -27,6 +27,6 @@ public class ActionKill implements Action { @Override public String toString() { - return "KillEntity\n\ttarget: "+target.toString()+"\n\tradius: "+radius+"\n\tpredicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName()); + return "KillEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java index 15bc9814..a2aee8da 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -24,6 +24,6 @@ public class ActionMove implements Action { @Override public String toString() { - return "Move\n\ttarget: "+target.toString(); + return "Move\n- target: "+target.toString(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java index 3e3f3016..91bd79e7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -23,6 +23,6 @@ public class ActionMoveNearestAir implements Action { @Override public String toString() { - return "MoveNearestAir\n\ttarget: "+target.toString(); + return "MoveNearestAir\n- target: "+target.toString(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java index 1db6767c..334f7c2b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.dungeon.actions.Action; import kr.syeyoung.dungeonsguide.dungeon.actions.ActionRoot; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.HashMap; import java.util.HashSet; @@ -12,10 +13,14 @@ import java.util.Set; @Data public class ActionTree { + @EqualsAndHashCode.Exclude private ActionTree parent; private Action current; private Set<ActionTree> children; + @Override + public int hashCode() { return current == null ? 0 : current.hashCode(); } + public static ActionTree buildActionTree(Set<Action> actions, DungeonRoom dungeonRoom) { ActionRoot root = new ActionRoot(); @@ -31,6 +36,7 @@ public class ActionTree { return tree; } + private static ActionTree buildActionTree(ActionTree parent, Action action, DungeonRoom dungeonRoom, Map<Action, ActionTree> alreadyBuilt) { if (action == null) return null; if (alreadyBuilt.containsKey(action)) return alreadyBuilt.get(action); 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 fe89b7cb..701f9a4a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -45,6 +45,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java index cbf7520f..d496b450 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java @@ -20,7 +20,8 @@ import java.util.*; @Data public class DungeonDoor implements DungeonMechanic, RouteBlocker { private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> preRequisite = new ArrayList<String>(); + private List<String> openPreRequisite = new ArrayList<String>(); + private List<String> closePreRequisite = new ArrayList<String>(); @Override @@ -43,9 +44,18 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker { preRequisites = actionMove.getPreRequisite(); } { - for (String str : preRequisite) { - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); + if (state.equalsIgnoreCase("open")) { + for (String str : openPreRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + } else { + for (String str : closePreRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } } } return base; @@ -75,7 +85,8 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker { public DungeonDoor clone() throws CloneNotSupportedException { DungeonDoor dungeonSecret = new DungeonDoor(); dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + dungeonSecret.openPreRequisite = new ArrayList<String>(openPreRequisite); + dungeonSecret.closePreRequisite = new ArrayList<String>(closePreRequisite); return dungeonSecret; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java index 9fe0165f..01b3323e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -37,6 +37,7 @@ public class DungeonLever implements DungeonMechanic { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java index 3ee41f1b..9027f0dc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java @@ -44,6 +44,7 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java index d9b396f0..a1500fa7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java @@ -22,7 +22,7 @@ public class DungeonOnewayLever implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); + if (!("triggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { @@ -37,6 +37,7 @@ public class DungeonOnewayLever implements DungeonMechanic { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java index da126215..ab33a5db 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -39,6 +39,7 @@ public class DungeonPressurePlate implements DungeonMechanic { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index e5b8d54a..91ede235 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -64,6 +64,7 @@ public class DungeonSecret implements DungeonMechanic { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java index ce74e955..86c6a818 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -45,6 +45,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { } { for (String str : preRequisite) { + if (str.isEmpty()) continue; ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); preRequisites.add(actionChangeState); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java index 136efd0e..5eb38597 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java @@ -14,4 +14,9 @@ public class PredicateBat implements Predicate<Entity> { public boolean apply(@Nullable Entity input) { return input instanceof EntityBat; } + + @Override + public boolean equals(Object o) { + return o == this || o != null && (o.getClass() == this.getClass()); + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java index ccc1b017..6054c268 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java @@ -12,4 +12,9 @@ public class PredicateSuperBoom implements Predicate<ItemStack> { public boolean apply(@Nullable ItemStack input) { return false; } + + @Override + public boolean equals(Object o) { + return o == this || o != null && (o.getClass() == this.getClass()); + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java index d916f15f..9f641a63 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java @@ -29,7 +29,9 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { private MLabel label; private MValue<OffsetPointSet> value; private MTextField preRequisite; - private MLabelAndElement preRequisite2; + private MLabelAndElement preRequisite_par; + private MTextField preRequisite2; + private MLabelAndElement preRequisite2_par; private MButton updateOnlyAir; public ValueEditDoor(final Parameter parameter2) { @@ -67,13 +69,24 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { preRequisite = new MTextField() { @Override public void edit(String str) { - dungeonDoor.setPreRequisite(Arrays.asList(str.split(","))); + dungeonDoor.setOpenPreRequisite(Arrays.asList(str.split(","))); } }; - preRequisite.setText(TextUtils.join(dungeonDoor.getPreRequisite(), ",")); - preRequisite2 = new MLabelAndElement("Req.",preRequisite); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); - add(preRequisite2); + preRequisite.setText(TextUtils.join(dungeonDoor.getOpenPreRequisite(), ",")); + preRequisite_par = new MLabelAndElement("Open Req.",preRequisite); + preRequisite_par.setBounds(new Rectangle(0,60,bounds.width,20)); + add(preRequisite_par); + + preRequisite2 = new MTextField() { + @Override + public void edit(String str) { + dungeonDoor.setClosePreRequisite(Arrays.asList(str.split(","))); + } + }; + preRequisite2.setText(TextUtils.join(dungeonDoor.getClosePreRequisite(), ",")); + preRequisite2_par = new MLabelAndElement("Close Req.",preRequisite2); + preRequisite2_par.setBounds(new Rectangle(0,80,bounds.width,20)); + add(preRequisite2_par); } @Override @@ -81,7 +94,8 @@ public class ValueEditDoor extends MPanel implements ValueEdit<DungeonDoor> { label.setBounds(new Rectangle(0,0,bounds.width, 20)); value.setBounds(new Rectangle(0,20,bounds.width, 20)); updateOnlyAir.setBounds(new Rectangle(0,40,bounds.width, 20)); - preRequisite2.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite_par.setBounds(new Rectangle(0,60,bounds.width,20)); + preRequisite2_par.setBounds(new Rectangle(0,80,bounds.width,20)); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java index 7bc41e1f..1d18fcb2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java @@ -62,7 +62,7 @@ public class ValueEditLever extends MPanel implements ValueEdit<DungeonLever> { } }; target.setText(dungeonLever.getTriggering()); - target2 = new MLabelAndElement("Req.",target); + target2 = new MLabelAndElement("Target",target); target2.setBounds(new Rectangle(0,60,bounds.width,20)); add(target2); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java index 90edcb63..be88158e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java @@ -65,7 +65,7 @@ public class ValueEditOnewayLever extends MPanel implements ValueEdit<DungeonOne } }; target.setText(dungeonLever.getTriggering()); - target2 = new MLabelAndElement("Req.",target); + target2 = new MLabelAndElement("Target",target); target2.setBounds(new Rectangle(0,60,bounds.width,20)); add(target2); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java index 80e05b05..56d09c7a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java @@ -65,7 +65,7 @@ public class ValueEditPressurePlate extends MPanel implements ValueEdit<DungeonP } }; target.setText(dungeonPressureplate.getTriggering()); - target2 = new MLabelAndElement("Req.",target); + target2 = new MLabelAndElement("Target",target); target2.setBounds(new Rectangle(0,60,bounds.width,20)); add(target2); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java index 20c5242d..e19af8d8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java @@ -41,7 +41,8 @@ public class ActionTreeDisplayPane extends MPanel { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; GL11.glPushMatrix(); - GL11.glTranslated(-offsetX, -offsetY, 0); + GL11.glTranslated(offsetX, offsetY, 0); + GL11.glScaled(0.5,0.5,1); renderTree(tree, 5, 5, Minecraft.getMinecraft().fontRendererObj, null, new HashMap<ActionTree, Point>()); GL11.glPopMatrix(); } @@ -53,12 +54,23 @@ public class ActionTreeDisplayPane extends MPanel { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - WorldRenderer renderer = Tessellator.getInstance().getWorldRenderer(); - GlStateManager.color(255,0,0, 255); - renderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - renderer.pos(pt.x, pt.y, 0).endVertex(); - renderer.pos(drawLineFrom.x, drawLineFrom.y, 0).endVertex(); - Tessellator.getInstance().draw(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glLineWidth(1); + GL11.glColor4f(1, 0, 0, 1); + GL11.glBegin(2); + GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); + GL11.glVertex2d(pt.x, pt.y); + GL11.glEnd(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glDisable(GL11.GL_BLEND); GlStateManager.popMatrix(); GlStateManager.popAttrib(); return 0; @@ -68,12 +80,24 @@ public class ActionTreeDisplayPane extends MPanel { if (drawLineFrom != null) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - WorldRenderer renderer = Tessellator.getInstance().getWorldRenderer(); - GlStateManager.color(255,255,255, 255); - renderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); - renderer.pos(x + dim.width, y, 0).endVertex(); - renderer.pos(drawLineFrom.x, drawLineFrom.y, 0).endVertex(); - Tessellator.getInstance().draw(); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glLineWidth(1); + GL11.glColor4f(1, 1, 1, 1); + GL11.glBegin(2); + GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); + GL11.glVertex2d(x + dim.width / 2, y); + GL11.glEnd(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glDisable(GL11.GL_BLEND); GlStateManager.popMatrix(); GlStateManager.popAttrib(); } @@ -84,7 +108,7 @@ public class ActionTreeDisplayPane extends MPanel { for (ActionTree tree:actionTree.getChildren()) { xOff += renderTree(tree, x + xOff, y + dim.height + 10, fr, pt, drawmPoints) + 10; } - return xOff; + return Math.max(xOff, dim.width); } public Dimension renderAction(Action action, int x, int y, FontRenderer fr) { @@ -99,7 +123,7 @@ public class ActionTreeDisplayPane extends MPanel { Gui.drawRect(x,y,x + maxWidth +10, y + height + 10, 0xff000000); Gui.drawRect(x+1,y+1,x + maxWidth +8, y + height + 8, 0xff4d4d4d); for (int i = 0; i < lines.length; i++) { - fr.drawString(lines[i], 5, 5 + i*(fr.FONT_HEIGHT + offset), 0xffffffff); + fr.drawString(lines[i], x + 5, y + 5 + i*(fr.FONT_HEIGHT + offset), 0xffffffff); } return new Dimension(maxWidth + 10, height + 10); |