diff --git a/common/src/main/java/whocraft/tardis_refined/common/items/KeyItem.java b/common/src/main/java/whocraft/tardis_refined/common/items/KeyItem.java index 47d51090b..7cfea4ee5 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/items/KeyItem.java +++ b/common/src/main/java/whocraft/tardis_refined/common/items/KeyItem.java @@ -130,21 +130,14 @@ public boolean interactMonitor(ItemStack itemStack, Player player, ControlEntity if (control.controlSpecification().control() == TRControlRegistry.MONITOR.get()) { - AtomicBoolean canTARDISTakeItem = new AtomicBoolean(false); - TardisLevelOperator.get(serverLevel).ifPresent((operator) -> { - if (operator.getTardisState() != TardisLevelOperator.STATE_EYE_OF_HARMONY || operator.getPilotingManager().isOutOfFuel()) { - PlayerUtil.sendMessage(player, ModMessages.HARDWARE_OFFLINE, true); - canTARDISTakeItem.set(false); - } else { - canTARDISTakeItem.set(true); - } - }); - - if (!keychainContains(itemStack, tardis) || !canTARDISTakeItem.get()) {return false;} + + if (keychainContains(itemStack, tardis)) {return false;} player.setItemInHand(interactionHand, addTardis(itemStack, tardis)); PlayerUtil.sendMessage(player, Component.translatable(ModMessages.MSG_KEY_BOUND, tardis.location().getPath()), true); player.playSound(SoundEvents.PLAYER_LEVELUP, 1, 0.5F); + + return true; } } diff --git a/common/src/main/java/whocraft/tardis_refined/common/network/messages/screens/OpenMonitorMessage.java b/common/src/main/java/whocraft/tardis_refined/common/network/messages/screens/OpenMonitorMessage.java index 0dbdcff65..96584e01a 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/network/messages/screens/OpenMonitorMessage.java +++ b/common/src/main/java/whocraft/tardis_refined/common/network/messages/screens/OpenMonitorMessage.java @@ -30,8 +30,8 @@ public OpenMonitorMessage(boolean desktopGenerating, TardisNavLocation currentLo public OpenMonitorMessage(FriendlyByteBuf friendlyByteBuf) { this.desktopGenerating = friendlyByteBuf.readBoolean(); - this.currentLocation = TardisNavLocation.deserialise(friendlyByteBuf.readNbt()); - this.targetLocation = TardisNavLocation.deserialise(friendlyByteBuf.readNbt()); + this.currentLocation = TardisNavLocation.deserialize(friendlyByteBuf.readNbt()); + this.targetLocation = TardisNavLocation.deserialize(friendlyByteBuf.readNbt()); this.upgradeHandlerNbt = friendlyByteBuf.readNbt(); } diff --git a/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/S2COpenCoordinatesDisplayMessage.java b/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/S2COpenCoordinatesDisplayMessage.java index ca62dc9f3..997c150d5 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/S2COpenCoordinatesDisplayMessage.java +++ b/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/S2COpenCoordinatesDisplayMessage.java @@ -33,7 +33,7 @@ public S2COpenCoordinatesDisplayMessage(List> waypoints, Coor public S2COpenCoordinatesDisplayMessage(FriendlyByteBuf friendlyByteBuf) { CompoundTag tardisNav = friendlyByteBuf.readNbt(); - tardisNavLocation = TardisNavLocation.deserialise(tardisNav); + tardisNavLocation = TardisNavLocation.deserialize(tardisNav); coordInputType = CoordInputType.valueOf(friendlyByteBuf.readUtf()); levels = new ArrayList<>(); int size = friendlyByteBuf.readInt(); diff --git a/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/UploadWaypointMessage.java b/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/UploadWaypointMessage.java index 0ee74dfcd..be18d8045 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/UploadWaypointMessage.java +++ b/common/src/main/java/whocraft/tardis_refined/common/network/messages/waypoints/UploadWaypointMessage.java @@ -28,7 +28,7 @@ public UploadWaypointMessage(TardisNavLocation tardisNavLocation, CoordInputType public UploadWaypointMessage(FriendlyByteBuf buf) { CompoundTag tardisNav = buf.readNbt(); - this.tardisNavLocation = TardisNavLocation.deserialise(tardisNav); + this.tardisNavLocation = TardisNavLocation.deserialize(tardisNav); this.coordInputType = CoordInputType.valueOf(buf.readUtf()); } diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisArchitectureHandler.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisArchitectureHandler.java index 7211f4e05..9018252e5 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisArchitectureHandler.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisArchitectureHandler.java @@ -83,17 +83,7 @@ public static void buildAirlockEntranceFromStructure(StructureTemplate template, } } } - - public static void generateEssentialCorridors(ServerLevel serverLevel) { - - Optional structureNBT = serverLevel.getLevel().getStructureManager().get(new ResourceLocation(TardisRefined.MODID, "rooms/eye_of_harmony")); - structureNBT.ifPresent(structure -> { - BlockPos offsetPosition = new BlockPos(EYE_OF_HARMONY_PLACEMENT); - structure.placeInWorld(serverLevel.getLevel(), offsetPosition, offsetPosition, new StructurePlaceSettings(), serverLevel.getLevel().random, Block.UPDATE_NONE); - }); - - } - + public static void generateArsTree(TardisLevelOperator tardisLevelOperator, ServerLevel level) { if (!currentArsStage.equals("one") && Objects.equals(tardisLevelOperator.getUpgradeHandler().getProgressLevel(), currentArsStage)) return; diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisNavLocation.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisNavLocation.java index b03353917..8517f3124 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisNavLocation.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisNavLocation.java @@ -1,6 +1,5 @@ package whocraft.tardis_refined.common.tardis; -import com.sun.jna.platform.win32.Guid; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries; @@ -11,8 +10,6 @@ import net.minecraft.world.level.Level; import whocraft.tardis_refined.common.util.Platform; -import java.util.UUID; - /** * TardisNavLocation * Co-ordinates that represent position, rotation, level and name. @@ -108,7 +105,7 @@ public void setName(String name) { this.name = name; } - public static TardisNavLocation deserialise(CompoundTag tag) { + public static TardisNavLocation deserialize(CompoundTag tag) { TardisNavLocation loc = new TardisNavLocation(BlockPos.of(tag.getLong("pos")), Direction.values()[tag.getInt("dir")], ResourceKey.create(Registries.DIMENSION, new ResourceLocation(tag.getString("dim")))); if (tag.contains("name")) diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisWaypoint.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisWaypoint.java index a246ca226..a07b65fd1 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisWaypoint.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/TardisWaypoint.java @@ -1,11 +1,6 @@ package whocraft.tardis_refined.common.tardis; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import java.util.UUID; @@ -37,7 +32,7 @@ public void setLocation(TardisNavLocation location) { } public static TardisWaypoint deserialise(CompoundTag tag) { - TardisNavLocation loc = TardisNavLocation.deserialise(tag.getCompound("location")); + TardisNavLocation loc = TardisNavLocation.deserialize(tag.getCompound("location")); UUID id = tag.getUUID("id"); TardisWaypoint waypoint = new TardisWaypoint(id, loc);