diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-12 18:33:55 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-12 18:33:55 +0900 |
commit | bbbf49cef6d8ed46b3fc5d69ff880137e62084de (patch) | |
tree | e141602a5cee61ace54dda0f68288dc531cb9ef8 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java | |
parent | 75aa91678c2dfdf844ecfcbb68bcf9389028ca4e (diff) | |
download | Skyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.tar.gz Skyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.tar.bz2 Skyblock-Dungeons-Guide-bbbf49cef6d8ed46b3fc5d69ff880137e62084de.zip |
secrets!
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java new file mode 100644 index 00000000..55b79e59 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -0,0 +1,84 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics; + +import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.*; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.Data; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.util.*; +import java.util.List; + +@Data +public class DungeonTomb implements DungeonMechanic, RouteBlocker { + private OffsetPointSet secretPoint = new OffsetPointSet(); + private List<String> preRequisite = new ArrayList<String>(); + + + @Override + public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (!"broken".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb"); + if (!isBlocking(dungeonRoom)) { + return Collections.emptySet(); + } + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + { + ActionClickSet actionClick; + preRequisites.add(actionClick = new ActionClickSet(secretPoint)); + actionClick.setPredicate(PredicateSuperBoom.INSTANCE); + preRequisites = actionClick.getPreRequisite(); + } + { + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0)); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + } + { + for (String str : preRequisite) { + 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) { + if (secretPoint.getOffsetPointList().isEmpty()) return; + OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0); + BlockPos pos = firstpt.getBlockPos(dungeonRoom); + RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFF000000, 2f, true, false, partialTicks); + + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); + } + } + + @Override + public boolean isBlocking(DungeonRoom dungeonRoom) { + for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { + if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true; + } + return false; + } + + public DungeonTomb clone() throws CloneNotSupportedException { + DungeonTomb dungeonSecret = new DungeonTomb(); + dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); + dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + return dungeonSecret; + } +} |