From 917ca305d875924863cfcae7f1cb8d805a98122d Mon Sep 17 00:00:00 2001 From: syeyoung <42869671+cyoung06@users.noreply.github.com> Date: Tue, 15 Dec 2020 16:56:06 +0900 Subject: this works fantasticallyas --- .../dungeonsguide/dungeon/actions/ActionChangeState.java | 2 ++ .../kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java | 1 + .../syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java | 1 + .../syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java | 1 + .../kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java | 4 +++- .../dungeonsguide/dungeon/actions/tree/ActionTree.java | 4 ++++ .../dungeonsguide/roomedit/panes/ActionDisplayPane.java | 8 ++++---- .../dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java | 10 +++++++++- src/main/resources/roomdata/datas.txt | 2 +- 9 files changed, 26 insertions(+), 7 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 9aeac9e8..37acd018 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java @@ -3,12 +3,14 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.HashSet; import java.util.Set; @Data public class ActionChangeState implements Action{ + @EqualsAndHashCode.Exclude private Set preRequisite2 = new HashSet(); private String mechanicName; 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 b3a4cc92..8c745385 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java @@ -5,6 +5,7 @@ import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import java.util.HashSet; 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 595e66c7..0aea2d97 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java @@ -5,6 +5,7 @@ import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import java.util.HashSet; 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 151fe96c..80a39564 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java @@ -5,6 +5,7 @@ import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import java.util.HashSet; 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 e1eba8b7..ff26fe20 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java @@ -1,9 +1,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import com.google.common.base.Predicate; +import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.entity.Entity; import java.util.HashSet; @@ -13,7 +15,7 @@ import java.util.Set; public class ActionKill implements Action { private Set preRequisite = new HashSet(); private OffsetPoint target; - private Predicate predicate; + private Predicate predicate = Predicates.alwaysFalse(); private int radius; public ActionKill(OffsetPoint target) { 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 334f7c2b..009924cf 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 @@ -35,6 +35,10 @@ public class ActionTree { tree.setChildren(set); return tree; } + public static ActionTree buildActionTree(Action actions, DungeonRoom dungeonRoom) { + return buildActionTree(null, actions, dungeonRoom, new HashMap()); + } + private static ActionTree buildActionTree(ActionTree parent, Action action, DungeonRoom dungeonRoom, Map alreadyBuilt) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java index 974e46b5..22b7fc2a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomedit.panes; import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; @@ -12,6 +13,7 @@ import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; import java.awt.*; import java.util.ArrayList; +import java.util.Collections; import java.util.Set; public class ActionDisplayPane extends MPanel { @@ -42,10 +44,8 @@ public class ActionDisplayPane extends MPanel { String text = textField.getText(); String target = text.split(":")[0]; String state = text.split(":")[1]; - - DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(target); - Set actionSet = mechanic.getAction(state, dungeonRoom); - ActionTree tree= ActionTree.buildActionTree(actionSet, dungeonRoom); + ActionChangeState actionChangeState = new ActionChangeState(target, state); + ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); displayPane = new ActionTreeDisplayPane(dungeonRoom, tree); displayPane.setBounds(new Rectangle(0,25,bounds.width,bounds.height-25)); 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 e19af8d8..21d0fd9f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java @@ -27,6 +27,8 @@ public class ActionTreeDisplayPane extends MPanel { private int offsetX = 0; private int offsetY = 0; + private float scale; + private DungeonRoom dungeonRoom; private ActionTree tree; public ActionTreeDisplayPane(DungeonRoom dungeonRoom, ActionTree tree) { @@ -42,7 +44,7 @@ public class ActionTreeDisplayPane extends MPanel { GL11.glPushMatrix(); GL11.glTranslated(offsetX, offsetY, 0); - GL11.glScaled(0.5,0.5,1); + GL11.glScaled(scale,scale,1); renderTree(tree, 5, 5, Minecraft.getMinecraft().fontRendererObj, null, new HashMap()); GL11.glPopMatrix(); } @@ -152,4 +154,10 @@ public class ActionTreeDisplayPane extends MPanel { lastX = absMouseX; lastY = absMouseY; } + + @Override + public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { + if (scrollAmount > 0) scale += 0.1; + if (scrollAmount < 0) scale -= 0.1; + } } diff --git a/src/main/resources/roomdata/datas.txt b/src/main/resources/roomdata/datas.txt index ef7498c2..5fa261a7 100644 --- a/src/main/resources/roomdata/datas.txt +++ b/src/main/resources/roomdata/datas.txt @@ -9,4 +9,4 @@ roomdata/cf44c95c-950e-49e0-aa4c-82c2b18d0acc.roomdata roomdata/d3e61abf-4198-4520-a950-a03761a0eb6f.roomdata roomdata/ffd5411b-6ff4-4f60-b387-72f00510ec50.roomdata roomdata/b2dce4ed-2bda-4303-a4d7-3ebb914db318.roomdata -roomdata/d8f40437-348d-401d-95d4-cbae79297d97.roomdata \ No newline at end of file +roomdata/8482a37b-a393-48c9-80da-cd8d83b1a37e.roomdata \ No newline at end of file -- cgit