From 2a60380de52cce7a895e8200751e8e854178796a Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 2 Oct 2021 23:37:44 +0900 Subject: - Block Changed Event - Optimization on JPS Pathfinder --- .../dungeonsguide/roomprocessor/GeneralRoomProcessor.java | 10 ++++++++++ .../kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java | 3 +++ .../bombdefuse/chambers/GeneralDefuseChamberProcessor.java | 5 +++++ .../roomprocessor/bossfight/GeneralBossfightProcessor.java | 5 +++++ 4 files changed, 23 insertions(+) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomprocessor') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index c0696a9e..0b002161 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -30,8 +30,10 @@ 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.events.BlockUpdateEvent; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; @@ -72,6 +74,7 @@ public class GeneralRoomProcessor implements RoomProcessor { } private boolean ticked = false; + @Override public void tick() { if (!ticked && FeatureRegistry.SECRET_AUTO_START.isEnabled()) @@ -412,6 +415,13 @@ public class GeneralRoomProcessor implements RoomProcessor { } } } + @Override + public void onBlockUpdate(BlockUpdateEvent blockUpdateEvent) { + for (Tuple updatedBlock : blockUpdateEvent.getUpdatedBlocks()) { + if (updatedBlock.getSecond().equals(NodeProcessorDungeonRoom.preBuilt)) continue; + dungeonRoom.resetBlock(updatedBlock.getFirst()); + } + } public static class Generator implements RoomProcessorGenerator { @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java index 0f4cce7c..848bd71a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.event.GuiScreenEvent; @@ -46,4 +47,6 @@ public interface RoomProcessor { void onInteract(PlayerInteractEntityEvent event); void onInteractBlock(PlayerInteractEvent event); + + void onBlockUpdate(BlockUpdateEvent blockUpdateEvent); } \ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java index 6ea0fd95..823e322b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; import kr.syeyoung.dungeonsguide.Keybinds; +import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; import lombok.Getter; @@ -83,6 +84,10 @@ public abstract class GeneralDefuseChamberProcessor implements ChamberProcessor @Override public void actionbarReceived(IChatComponent chat) { + } + @Override + public void onBlockUpdate(BlockUpdateEvent blockUpdateEvent) { + } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java index 8ea4b5a6..1d297a0d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import lombok.*; import net.minecraft.entity.boss.BossStatus; @@ -126,6 +127,10 @@ public abstract class GeneralBossfightProcessor implements BossfightProcessor { @Override public void onEntityDeath(LivingDeathEvent deathEvent) { + } + @Override + public void onBlockUpdate(BlockUpdateEvent blockUpdateEvent) { + } public void onPhaseChange() {} -- cgit