From 22319710e8c7618119b250c584fbb0aca21cb507 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 6 Aug 2022 23:53:54 -0400 Subject: [PATCH 01/85] Kill pre-1.19 legacy data handling, deprecate RoomSize enum --- .../machines/api/room/RoomSize.java | 4 + .../machine/CompactMachineBlockEntity.java | 34 +------- .../legacy/LegacyMachineConnections.java | 81 ------------------- .../legacy/LegacyMachineLocationsGraph.java | 69 ---------------- .../machines/tunnel/TunnelWallEntity.java | 47 ++--------- 5 files changed, 11 insertions(+), 224 deletions(-) delete mode 100644 src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineConnections.java delete mode 100644 src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineLocationsGraph.java diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomSize.java b/src/api/java/dev/compactmods/machines/api/room/RoomSize.java index 3d2366d0..efef73f0 100644 --- a/src/api/java/dev/compactmods/machines/api/room/RoomSize.java +++ b/src/api/java/dev/compactmods/machines/api/room/RoomSize.java @@ -5,6 +5,10 @@ import net.minecraft.world.phys.AABB; import net.minecraft.core.BlockPos; +/** + * Planning on removing in 1.20. Will be replaced by a registry to allow for custom room sizes. + */ +@Deprecated public enum RoomSize implements StringRepresentable { TINY ("tiny", 3), SMALL ("small", 5), diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java index 0353e947..66d69f87 100644 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java +++ b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java @@ -3,11 +3,10 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.machine.MachineNbt; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.dimension.MissingDimensionException; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.machine.graph.legacy.LegacyMachineConnections; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactMachineRoomNode; import dev.compactmods.machines.tunnel.TunnelWallEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; @@ -29,7 +28,6 @@ public class CompactMachineBlockEntity extends BlockEntity { private static final String ROOM_NBT = "room_pos"; - private static final String LEGACY_MACH_ID = "machine_id"; public long nextSpawnTick = 0; @@ -37,7 +35,6 @@ public class CompactMachineBlockEntity extends BlockEntity { protected String schema; protected boolean locked = false; private ChunkPos roomChunk; - private int legacyMachineId = -1; private WeakReference graphNode; private WeakReference roomNode; @@ -83,9 +80,6 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D @Override public void onLoad() { super.onLoad(); - if (this.legacyMachineId != -1) - this.updateLegacyData(); - this.syncConnectedRoom(); } @@ -93,17 +87,12 @@ public void onLoad() { public void load(@Nonnull CompoundTag nbt) { super.load(nbt); - // TODO customName = nbt.getString("CustomName"); if (nbt.contains(MachineNbt.OWNER)) { owner = nbt.getUUID(MachineNbt.OWNER); } else { owner = null; } - if (nbt.contains(LEGACY_MACH_ID)) { - this.legacyMachineId = nbt.getInt(LEGACY_MACH_ID); - } - nextSpawnTick = nbt.getLong("spawntick"); if (nbt.contains("schema")) { schema = nbt.getString("schema"); @@ -118,25 +107,6 @@ public void load(@Nonnull CompoundTag nbt) { } } - private void updateLegacyData() { - if (level instanceof ServerLevel sl) { - try { - final var legacy = LegacyMachineConnections.get(sl.getServer()); - - DimensionMachineGraph graph = DimensionMachineGraph.forDimension(sl); - graph.addMachine(worldPosition); - - final ChunkPos oldRoom = legacy.getConnectedRoom(this.legacyMachineId); - CompactMachines.LOGGER.info(CompactMachines.CONN_MARKER, "Rebinding machine {} ({}/{}) to room {}", legacyMachineId, worldPosition, level.dimension(), roomChunk); - - this.roomChunk = oldRoom; - graph.connectMachineToRoom(worldPosition, roomChunk); - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.fatal(CompactMachines.CONN_MARKER, "Could not load connection info from legacy data; machine at {} in dimension {} will be unmapped.", worldPosition, level.dimension()); - } - } - } - @Override protected void saveAdditional(CompoundTag nbt) { // nbt.putString("CustomName", customName.getString()); diff --git a/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineConnections.java b/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineConnections.java deleted file mode 100644 index bd97899e..00000000 --- a/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineConnections.java +++ /dev/null @@ -1,81 +0,0 @@ -package dev.compactmods.machines.machine.graph.legacy; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.codec.CodecExtensions; -import dev.compactmods.machines.dimension.MissingDimensionException; -import dev.compactmods.machines.dimension.Dimension; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.saveddata.SavedData; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class LegacyMachineConnections extends SavedData { - - private static final String DATA_KEY = "compactmachines_connections"; - - private final Map machineMapping; - - private LegacyMachineConnections() { - this.machineMapping = new HashMap<>(); - } - - public static LegacyMachineConnections get(MinecraftServer server) throws MissingDimensionException { - var compactDim = server.getLevel(Dimension.COMPACT_DIMENSION); - if(compactDim == null) - throw new MissingDimensionException(); - - return compactDim.getDataStorage().get(LegacyMachineConnections::load, DATA_KEY); - } - - private static LegacyMachineConnections load(CompoundTag tag) { - if(!tag.contains("graph")) - return null; - - var graphTag = tag.getCompound("graph"); - if(!graphTag.contains("connections")) - return null; - - LegacyMachineConnections tmp = new LegacyMachineConnections(); - final var connections = ConnectionInfoTag.CODEC.listOf() - .fieldOf("connections") - .codec() - .parse(NbtOps.INSTANCE, graphTag) - .getOrThrow(false, CompactMachines.LOGGER::error); - - // load all connections into result - connections.forEach(conn -> conn.machines.forEach(mid -> tmp.machineMapping.putIfAbsent(mid, conn.room))); - - return tmp; - } - - @Override - public CompoundTag save(CompoundTag tag) { - return tag; - } - - public ChunkPos getConnectedRoom(int legacyMachineId) { - if(!machineMapping.containsKey(legacyMachineId)) - return ChunkPos.ZERO; - - return machineMapping.get(legacyMachineId); - } - - private record ConnectionInfoTag(ChunkPos room, List machines) { - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.CHUNKPOS - .fieldOf("machine") - .forGetter(ConnectionInfoTag::room), - - Codec.INT.listOf() - .fieldOf("connections") - .forGetter(ConnectionInfoTag::machines) - ).apply(i, ConnectionInfoTag::new)); - } -} diff --git a/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineLocationsGraph.java b/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineLocationsGraph.java deleted file mode 100644 index 54ecd6f7..00000000 --- a/src/main/java/dev/compactmods/machines/machine/graph/legacy/LegacyMachineLocationsGraph.java +++ /dev/null @@ -1,69 +0,0 @@ -package dev.compactmods.machines.machine.graph.legacy; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.dimension.MissingDimensionException; -import dev.compactmods.machines.dimension.Dimension; -import dev.compactmods.machines.location.LevelBlockPosition; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.saveddata.SavedData; - -import java.util.HashMap; -import java.util.Map; - -public class LegacyMachineLocationsGraph extends SavedData { - - private static final String DATA_KEY = "compactmachines_machines"; - - private final Map machineMapping; - - private LegacyMachineLocationsGraph() { - this.machineMapping = new HashMap<>(); - } - - public static LegacyMachineLocationsGraph get(MinecraftServer server) throws MissingDimensionException { - var compactDim = server.getLevel(Dimension.COMPACT_DIMENSION); - if(compactDim == null) - throw new MissingDimensionException(); - - return compactDim.getDataStorage().get(LegacyMachineLocationsGraph::load, DATA_KEY); - } - - private static LegacyMachineLocationsGraph load(CompoundTag tag) { - LegacyMachineLocationsGraph tmp = new LegacyMachineLocationsGraph(); - - if(tag.contains("locations")) { - final var locations = MachineData.CODEC.listOf() - .fieldOf("locations") - .codec() - .parse(NbtOps.INSTANCE, tag) - .getOrThrow(false, CompactMachines.LOGGER::error); - - locations.forEach(md -> tmp.machineMapping.putIfAbsent(md.machine, md.location)); - } - - return tmp; - } - - @Override - public CompoundTag save(CompoundTag tag) { - return tag; - } - - public LevelBlockPosition getLocation(int legacyMachineId) { - if(!machineMapping.containsKey(legacyMachineId)) - return null; - - return this.machineMapping.get(legacyMachineId); - } - - private record MachineData(LevelBlockPosition location, int machine) { - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - LevelBlockPosition.CODEC.fieldOf("location").forGetter(MachineData::location), - Codec.INT.fieldOf("machine").forGetter(MachineData::machine) - ).apply(i, MachineData::new)); - } -} diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index c993ed80..307980e3 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -9,9 +9,7 @@ import dev.compactmods.machines.api.tunnels.lifecycle.InstancedTunnel; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; -import dev.compactmods.machines.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.machine.graph.legacy.LegacyMachineLocationsGraph; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; @@ -35,9 +33,6 @@ public class TunnelWallEntity extends BlockEntity { private static final String NBT_LEGACY_MACHINE_KEY = "machine"; - @Deprecated(forRemoval = true) - private int legacyMachineId = -1; - private LevelBlockPosition connectedMachine; private TunnelDefinition tunnelType; @@ -54,19 +49,11 @@ public void load(@Nonnull CompoundTag nbt) { super.load(nbt); try { - // TODO - Remove in 5.0 - if(nbt.contains(NBT_LEGACY_MACHINE_KEY)) { - // 4.2 and below - this.legacyMachineId = nbt.getInt(NBT_LEGACY_MACHINE_KEY); - this.tunnelType = Tunnels.getDefinition(new ResourceLocation(nbt.getString(BaseTunnelWallData.KEY_TUNNEL_TYPE))); - } else { - // 4.3 and above - final var baseData = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, nbt) - .getOrThrow(true, CompactMachines.LOGGER::fatal); - - this.connectedMachine = baseData.connection(); - this.tunnelType = baseData.tunnel(); - } + final var baseData = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, nbt) + .getOrThrow(true, CompactMachines.LOGGER::fatal); + + this.connectedMachine = baseData.connection(); + this.tunnelType = baseData.tunnel(); } catch (Exception e) { this.tunnelType = Tunnels.UNKNOWN.get(); this.connectedMachine = null; @@ -90,15 +77,6 @@ public void onLoad() { super.onLoad(); if (level instanceof ServerLevel sl) { - if(legacyMachineId > -1) { - try { - this.upgradeLegacyData(); - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.error(CompactMachines.CONN_MARKER, "Failed to load legacy location info for tunnel conversion at: {}; removing the tunnel instance.", worldPosition); - this.tunnelType = Tunnels.UNKNOWN.get(); - } - } - // If tunnel type is unknown, remove the tunnel entirely // Null tunnel types here mean it's being loaded into the world if (this.tunnelType != null && tunnelType.equals(Tunnels.UNKNOWN.get())) { @@ -108,21 +86,6 @@ public void onLoad() { } } - private void upgradeLegacyData() throws MissingDimensionException { - if(level != null && level.isClientSide) return; - if(this.legacyMachineId == -1) return; - - if(level instanceof ServerLevel sl) { - var leg = LegacyMachineLocationsGraph.get(sl.getServer()); - if(leg != null) - this.connectedMachine = leg.getLocation(this.legacyMachineId); - else { - CompactMachines.LOGGER.error(CompactMachines.CONN_MARKER, "Failed to load legacy location info for tunnel conversion at: {}; removing the tunnel instance.", worldPosition); - this.tunnelType = Tunnels.UNKNOWN.get(); - } - } - } - @Override public void saveAdditional(@Nonnull CompoundTag compound) { if (tunnelType != null) From fc88d474041127383540c3fe6f78471a3c164882 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 6 Aug 2022 23:55:33 -0400 Subject: [PATCH 02/85] [API Break] Move blockPos code from IDimPos > IDimBlockPos --- .../api/location/IDimensionalBlockPosition.java | 6 ++++++ .../api/location/IDimensionalPosition.java | 10 ++-------- .../location/PreciseDimensionalPosition.java | 16 ++-------------- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java b/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java index a8a94436..929fd7a0 100644 --- a/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java +++ b/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java @@ -1,8 +1,14 @@ package dev.compactmods.machines.api.location; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.server.MinecraftServer; import net.minecraft.world.level.block.state.BlockState; public interface IDimensionalBlockPosition extends IDimensionalPosition { + BlockPos getBlockPosition(); + BlockState state(MinecraftServer server); + + IDimensionalBlockPosition relative(Direction direction); } diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java index db7b4e3c..3bad7a48 100644 --- a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java +++ b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java @@ -1,25 +1,19 @@ package dev.compactmods.machines.api.location; -import java.util.Optional; - -import com.mojang.serialization.Codec; -import net.minecraft.core.Direction; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; -import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import java.util.Optional; + public interface IDimensionalPosition { - BlockPos getBlockPosition(); Vec3 getExactPosition(); ResourceKey dimensionKey(); ServerLevel level(MinecraftServer server); - IDimensionalPosition relative(Direction direction); - Optional getRotation(); } diff --git a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java index fb04c2a8..ea1eb4eb 100644 --- a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java +++ b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java @@ -4,9 +4,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.api.location.IDimensionalPosition; -import dev.compactmods.machines.util.MathUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; @@ -28,6 +25,8 @@ public final class PreciseDimensionalPosition implements IDimensionalPosition { private final ResourceKey dimension; private final Vec3 position; + + // TODO 1.20 - Change to vec2 private final Vec3 rotation; public PreciseDimensionalPosition(ResourceKey dimension, Vec3 position) { @@ -46,11 +45,6 @@ public static PreciseDimensionalPosition fromPlayer(Player player) { return new PreciseDimensionalPosition(player.level.dimension(), player.position(), player.getLookAngle()); } - @Override - public BlockPos getBlockPosition() { - return new BlockPos(position.x, position.y, position.z); - } - @Override public Vec3 getExactPosition() { return position; @@ -70,12 +64,6 @@ public ServerLevel level(MinecraftServer server) { return server.getLevel(dimension); } - @Override - public IDimensionalPosition relative(Direction direction) { - final var newPos = position.add(direction.getStepX(), direction.getStepY(), direction.getStepZ()); - return new PreciseDimensionalPosition(dimension, newPos); - } - @Override public Optional getRotation() { return Optional.empty(); From 86e5bfcdbddc576f1718dcce1c31d798b2dfef3c Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:07:34 -0400 Subject: [PATCH 03/85] [API Break] Add server to teardown hooks, changes to TunnelPos --- .../machines/api/tunnels/TunnelPosition.java | 5 +--- .../lifecycle/TunnelTeardownHandler.java | 27 ++++++++++++++++--- .../machines/tunnel/TunnelWallBlock.java | 5 ++-- .../machines/tunnel/TunnelWallEntity.java | 6 ++--- .../tunnel/definitions/ItemTunnel.java | 10 ++++--- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java b/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java index 55164c52..6b90d1aa 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java @@ -2,10 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.server.level.ServerLevel; -import javax.annotation.Nullable; - -public record TunnelPosition(@Nullable ServerLevel level, BlockPos pos, Direction side) { +public record TunnelPosition(BlockPos pos, Direction wallSide, Direction machineSide) { } diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java b/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java index 40d56f81..84e2c79b 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.api.tunnels.TunnelPosition; import net.minecraft.core.Direction; +import net.minecraft.server.MinecraftServer; /** * Indicates that a tunnel has teardown tasks that are performed whenever a tunnel @@ -9,14 +10,31 @@ */ public interface TunnelTeardownHandler extends InstancedTunnel { + /** + * @deprecated Swap to the version that takes the current MC server. + */ + @Deprecated(since = "5.2.0") + default void onRotated(TunnelPosition position, Instance instance, Direction oldSide, Direction newSide) { + } + /** * Handle tasks when a tunnel is being rotated on a machine room wall. * + * @param server Current server instance. + * @param position The position of the tunnel being rotated. * @param instance The tunnel instance being rotated. - * @param oldSide The previous side of the machine the tunnel was connected to. - * @param newSide The upcoming side of the machine the tunnel will connect to. + * @param oldSide The previous side of the machine the tunnel was connected to. + * @param newSide The upcoming side of the machine the tunnel will connect to. */ - default void onRotated(TunnelPosition position, Instance instance, Direction oldSide, Direction newSide) { + default void onRotated(MinecraftServer server, TunnelPosition position, Instance instance, Direction oldSide, Direction newSide) { + onRotated(position, instance, oldSide, newSide); + } + + /** + * @deprecated Switch to the version that takes the current Minecraft server. + */ + @Deprecated(since = "5.2.0") + default void onRemoved(TunnelPosition position, Instance instance) { } /** @@ -24,6 +42,7 @@ default void onRotated(TunnelPosition position, Instance instance, Direction old * * @param instance The tunnel instance being removed. */ - default void onRemoved(TunnelPosition position, Instance instance) { + default void onRemoved(MinecraftServer server, TunnelPosition position, Instance instance) { + onRemoved(position, instance); } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index c1ecce79..7bc6cbc2 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -104,6 +104,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player if(level.dimension().equals(CompactDimension.LEVEL_KEY) && level instanceof ServerLevel compactDim) { var def = tunnel.getTunnelType(); final Direction tunnelWallSide = hitResult.getDirection(); + var tunnelConnectedSide = tunnel.getConnectedSide(); if (player.isShiftKeyDown()) { BlockState solidWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); @@ -118,7 +119,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player level.addFreshEntity(ie); if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRemoved(new TunnelPosition(compactDim, pos, tunnelWallSide), tunnel.getTunnel()); + teardown.onRemoved(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel()); } final var tunnels = TunnelConnectionGraph.forRoom(compactDim, new ChunkPos(pos)); @@ -145,7 +146,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRotated(new TunnelPosition(compactDim, pos, tunnelWallSide), tunnel.getTunnel(), dir, newSide); + teardown.onRotated(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); } tunnelGraph.rotateTunnel(pos, newSide); diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index 307980e3..f300badf 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -189,14 +189,14 @@ public void setTunnelType(TunnelDefinition type) { return; } - final var p = new TunnelPosition(sl, worldPosition, getTunnelSide()); + final var p = new TunnelPosition(worldPosition, getTunnelSide(), getConnectedSide()); if (tunnelType instanceof TunnelTeardownHandler teardown) { - teardown.onRemoved(p, tunnel); + teardown.onRemoved(sl.getServer(), p, tunnel); } this.tunnelType = type; if (type instanceof InstancedTunnel it) - this.tunnel = it.newInstance(p.pos(), p.side()); + this.tunnel = it.newInstance(p.pos(), p.wallSide()); setChanged(); } diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java index bd9ffa61..2ac0eee7 100644 --- a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.tunnel.definitions; import com.google.common.collect.ImmutableSet; +import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; @@ -10,6 +11,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.FastColor; import net.minecraft.world.Containers; import net.minecraft.world.item.ItemStack; @@ -62,8 +64,8 @@ public LazyOptional getCapability(Capability capType * @param instance The tunnel instance being modified. */ @Override - public void onRemoved(TunnelPosition position, Instance instance) { - BlockPos dropAt = position.pos().relative(position.side(), 1); + public void onRemoved(MinecraftServer server, TunnelPosition position, Instance instance) { + BlockPos dropAt = position.pos().relative(position.wallSide(), 1); NonNullList stacks = NonNullList.create(); for (int i = 0; i < instance.handler.getSlots(); i++) { @@ -72,7 +74,9 @@ public void onRemoved(TunnelPosition position, Instance instance) { stacks.add(stack); } - Containers.dropContents(position.level(), dropAt, stacks); + final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); + if(compactDim != null) + Containers.dropContents(compactDim, dropAt, stacks); } public static class Instance implements TunnelInstance, INBTSerializable { From 86fb8cbbb560b123bbdc1b5c2b021b6e3fd5a501 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:08:04 -0400 Subject: [PATCH 04/85] [API Break] Initial changes for redstone in tunnels --- .../redstone/RedstoneReaderTunnel.java | 11 ++++ ...edstoneTunnel.java => RedstoneTunnel.java} | 2 +- .../machines/tunnel/TunnelItem.java | 6 +-- .../tunnel/graph/TunnelConnectionGraph.java | 21 ++++++++ .../redstone/RedstoneInTunnelDefinition.java | 37 ++++++++++++++ .../RedstoneInTunnelDefinition.java | 51 ------------------- 6 files changed, 73 insertions(+), 55 deletions(-) create mode 100644 src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java rename src/api/java/dev/compactmods/machines/api/tunnels/redstone/{IRedstoneTunnel.java => RedstoneTunnel.java} (62%) create mode 100644 src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java delete mode 100644 tunnels/definitions/RedstoneInTunnelDefinition.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java new file mode 100644 index 00000000..cc5533c2 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java @@ -0,0 +1,11 @@ +package dev.compactmods.machines.api.tunnels.redstone; + +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.tunnels.TunnelPosition; +import net.minecraft.server.MinecraftServer; + +public interface RedstoneReaderTunnel extends RedstoneTunnel { + + int powerLevel(MinecraftServer server, IDimensionalBlockPosition machine, TunnelPosition tunnel); + +} diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/IRedstoneTunnel.java b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java similarity index 62% rename from src/api/java/dev/compactmods/machines/api/tunnels/redstone/IRedstoneTunnel.java rename to src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java index bfd4a713..a48e337a 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/IRedstoneTunnel.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java @@ -1,4 +1,4 @@ package dev.compactmods.machines.api.tunnels.redstone; -public interface IRedstoneTunnel { +public interface RedstoneTunnel { } diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index 2d554e7d..26c6d198 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -7,8 +7,8 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.api.tunnels.redstone.IRedstoneTunnel; -import dev.compactmods.machines.core.*; +import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; +import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.RoomCapabilities; @@ -163,7 +163,7 @@ public static Optional getMachineBindingInfo(Player player) { } private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position, Direction innerFace, Player player, TunnelDefinition def) throws Exception, MissingDimensionException { - boolean redstone = def instanceof IRedstoneTunnel; + boolean redstone = def instanceof RedstoneTunnel; final var roomTunnels = TunnelConnectionGraph.forRoom(compactDim, player.chunkPosition()); diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java index f9c2dedd..253ca6d5 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java @@ -8,6 +8,7 @@ import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; +import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.graph.*; import dev.compactmods.machines.location.LevelBlockPosition; @@ -412,6 +413,26 @@ public boolean hasTunnel(BlockPos location) { return tunnels.containsKey(location); } + /** + * Fetches the locations of all redstone-enabled tunnels for a specific wallSide. + * @param machine + * @param side + * @return + */ + public Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction side) { + final var node = machines.get(machine); + if (node == null) return Stream.empty(); + + return getTunnelsForSide(machine, side) + .filter(sided -> graph.successors(sided).stream() + .filter(TunnelTypeNode.class::isInstance) + .map(TunnelTypeNode.class::cast) + .anyMatch(ttn -> { + var def = Tunnels.getDefinition(ttn.id()); + return def instanceof RedstoneTunnel; + })).map(TunnelNode::position); + } + public Stream getTunnelsSupporting(LevelBlockPosition machine, Direction side, Capability capability) { final var node = machines.get(machine); if (node == null) return Stream.empty(); diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java new file mode 100644 index 00000000..a9f677b0 --- /dev/null +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java @@ -0,0 +1,37 @@ +package dev.compactmods.machines.tunnel.definitions.redstone; + +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.api.tunnels.TunnelPosition; +import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.state.BlockState; + +import java.awt.*; + +public class RedstoneInTunnelDefinition implements RedstoneReaderTunnel, TunnelDefinition { + + @Override + public int ringColor() { + return new Color(167, 38, 38).getRGB(); + } + + @Override + public int indicatorColor() { + return Color.blue.getRGB(); + // return Color.ORANGE.darker().getRGB(); + } + + @Override + public int powerLevel(MinecraftServer server, IDimensionalBlockPosition machine, TunnelPosition tunnel) { + LevelReader connectedWorld = machine.level(server); + if (connectedWorld != null) { + BlockState state = machine.state(server); + return state.getSignal(connectedWorld, machine.getBlockPosition(), tunnel.machineSide()); + } + + return 0; + } +} + diff --git a/tunnels/definitions/RedstoneInTunnelDefinition.java b/tunnels/definitions/RedstoneInTunnelDefinition.java deleted file mode 100644 index f5e66e3c..00000000 --- a/tunnels/definitions/RedstoneInTunnelDefinition.java +++ /dev/null @@ -1,51 +0,0 @@ -package dev.compactmods.machines.tunnel.definitions; - -import dev.compactmods.machines.api.location.IDimensionalPosition; -import dev.compactmods.machines.api.tunnels.EnumTunnelSide; -import dev.compactmods.machines.api.tunnels.ITunnelConnectionInfo; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.teleportation.DimensionalPosition; -import dev.compactmods.machines.api.tunnels.redstone.IRedstoneReaderTunnel; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.LevelReader; -import net.minecraft.server.level.ServerLevel; - -import java.awt.*; -import java.util.Optional; - -public class RedstoneInTunnelDefinition extends TunnelDefinition implements IRedstoneReaderTunnel { - - @Override - public int getTunnelRingColor() { - return new Color(167, 38, 38).getRGB(); - } - - @Override - public int getTunnelIndicatorColor() { - return Color.blue.getRGB(); - // return Color.ORANGE.darker().getRGB(); - } - - @Override - public int getPowerLevel(ITunnelConnectionInfo connectionInfo) { - LevelReader connectedWorld = connectionInfo.getConnectedWorld(EnumTunnelSide.OUTSIDE).orElse(null); - if (connectedWorld instanceof ServerLevel) { - IDimensionalPosition pos = connectionInfo.getConnectedPosition(EnumTunnelSide.OUTSIDE).orElse(null); - if (pos == null) - return 0; - - Optional state = connectionInfo.getConnectedState(EnumTunnelSide.OUTSIDE); - if (!state.isPresent()) return 0; - - int weak = state.get().getSignal( - connectedWorld, - pos.getBlockPosition(), - connectionInfo.getConnectedSide(EnumTunnelSide.OUTSIDE)); - - return weak; - } - - return 0; - } -} - From afcb275a446a4dda6b3a8f229990fc637246a468 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:09:19 -0400 Subject: [PATCH 05/85] Move tunnel wall render type to datagen/model files --- .../machines/datagen/TunnelWallStateGenerator.java | 3 ++- .../compactmods/machines/client/ClientEventHandler.java | 7 +------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java index 5363a79f..fb241044 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java @@ -30,7 +30,8 @@ protected void registerStatesAndModels() { String typedTunnelDirectional = "tunnels/" + dir.getSerializedName(); models() .withExistingParent(typedTunnelDirectional, modLoc("tunnels/base")) - .texture("wall", modLoc("block/" + typedTunnelDirectional)); + .texture("wall", modLoc("block/" + typedTunnelDirectional)) + .renderType(mcLoc("cutout")); // NamedRenderTypeManager /* diff --git a/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java index 659077d2..4c8b2505 100644 --- a/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java @@ -1,14 +1,12 @@ package dev.compactmods.machines.client; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.core.UIRegistration; import dev.compactmods.machines.room.client.MachineRoomScreen; +import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.client.TunnelColors; import dev.compactmods.machines.tunnel.client.TunnelItemColor; import net.minecraft.client.gui.screens.MenuScreens; -import net.minecraft.client.renderer.ItemBlockRenderTypes; -import net.minecraft.client.renderer.RenderType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -30,9 +28,6 @@ public static void onBlockColors(final RegisterColorHandlersEvent.Block colors) @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent client) { - RenderType cutout = RenderType.cutoutMipped(); - ItemBlockRenderTypes.setRenderLayer(Tunnels.BLOCK_TUNNEL_WALL.get(), cutout); - MenuScreens.register(UIRegistration.MACHINE_MENU.get(), MachineRoomScreen::new); } } From 15ae404c108fa2f940b50faa420396c4d1a3e642 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:09:40 -0400 Subject: [PATCH 06/85] Fix network handler deprecations --- .../dev/compactmods/machines/core/CompactMachinesNet.java | 4 ++-- .../compactmods/machines/room/network/RoomNetworkHandler.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java index dcc09de9..fc1f32b6 100644 --- a/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java +++ b/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java @@ -37,13 +37,13 @@ public static void setupMessages() { CHANNEL.messageBuilder(TunnelAddedPacket.class, 1, NetworkDirection.PLAY_TO_CLIENT) .encoder(TunnelAddedPacket::encode) .decoder(TunnelAddedPacket::new) - .consumer(TunnelAddedPacket::handle) + .consumerMainThread(TunnelAddedPacket::handle) .add(); CHANNEL.messageBuilder(PlayerRequestedTeleportPacket.class, 2, NetworkDirection.PLAY_TO_SERVER) .encoder(PlayerRequestedTeleportPacket::encode) .decoder(PlayerRequestedTeleportPacket::new) - .consumer(PlayerRequestedTeleportPacket::handle) + .consumerMainThread(PlayerRequestedTeleportPacket::handle) .add(); } } diff --git a/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java b/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java index 8f5de386..31f087e5 100644 --- a/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java +++ b/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java @@ -24,13 +24,13 @@ public static void setupMessages() { CHANNEL.messageBuilder(PlayerStartedRoomTrackingPacket.class, 1, NetworkDirection.PLAY_TO_SERVER) .encoder(PlayerStartedRoomTrackingPacket::encode) .decoder(PlayerStartedRoomTrackingPacket::new) - .consumer(PlayerStartedRoomTrackingPacket::handle) + .consumerMainThread(PlayerStartedRoomTrackingPacket::handle) .add(); CHANNEL.messageBuilder(InitialRoomBlockDataPacket.class, 2, NetworkDirection.PLAY_TO_CLIENT) .encoder(InitialRoomBlockDataPacket::toNetwork) .decoder(InitialRoomBlockDataPacket::fromNetwork) - .consumer(InitialRoomBlockDataPacket::handle) + .consumerMainThread(InitialRoomBlockDataPacket::handle) .add(); } } From e50baa7a28eff8948e6657a693ce545a9e5d3f8b Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:09:53 -0400 Subject: [PATCH 07/85] Fix machine data file export --- .../data/CMMachineDataExportCommand.java | 98 +++++++++---------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index b37bb0c3..8df22e60 100644 --- a/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -2,15 +2,21 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.room.MachineRoomConnections; +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.util.CsvOutput; +import net.minecraft.world.level.ChunkPos; import javax.annotation.Nonnull; import java.io.BufferedWriter; import java.io.IOException; +import java.nio.file.Files; // TODO public class CMMachineDataExportCommand { @@ -25,35 +31,32 @@ private static int execAll(CommandContext ctx) { var src = ctx.getSource(); var serv = src.getServer(); -// final CompactMachineGraph machines; -// final MachineToRoomConnections connections; -// try { -// machines = CompactMachineGraph.forDimension(serv); -// connections = MachineToRoomConnections.get(serv); -// } catch (MissingDimensionException e) { -// CompactMachines.LOGGER.fatal(e); -// return -1; -// } -// -// var outdir = src.getServer().getFile(CompactMachines.MOD_ID); -// var out = outdir.toPath() -// .resolve("machines.csv") -// .toAbsolutePath(); -// -// try { -// Files.createDirectories(outdir.toPath()); -// -// var writer = Files.newBufferedWriter(out); -// CsvOutput builder = makeCsv(writer); -// -// machines.getMachines().forEach(node -> writeMachine(connections, node, builder)); -// -// writer.close(); -// } catch (IOException e) { -// CompactMachines.LOGGER.error(e); -// src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); -// return -1; -// } + var outdir = src.getServer().getFile(Constants.MOD_ID); + var out = outdir.toPath() + .resolve("machines.csv") + .toAbsolutePath(); + + try { + Files.createDirectories(outdir.toPath()); + + var writer = Files.newBufferedWriter(out); + CsvOutput builder = makeCsv(writer); + + for (final var dim : serv.getAllLevels()) { + final var graph = DimensionMachineGraph.forDimension(dim); + graph.getMachines().forEach(machNode -> { + final var m = machNode.dimpos(); + final var r = graph.getConnectedRoom(m.getBlockPosition()); + r.ifPresent(room -> writeMachine(m, room, builder)); + }); + } + + writer.close(); + } catch (IOException e) { + CompactMachines.LOGGER.error(e); + src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); + return -1; + } return 0; } @@ -61,7 +64,6 @@ private static int execAll(CommandContext ctx) { @Nonnull private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { return CsvOutput.builder() - .addColumn("id") .addColumn("dim") .addColumn("machine_x") .addColumn("machine_y") @@ -71,24 +73,20 @@ private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { .build(writer); } - private static void writeMachine(MachineRoomConnections connections, CsvOutput builder) { -// try { -// int id = mach.getMachineId(); -// var loc = mach.getLocation(); -// var placedAt = loc.getBlockPosition(); -// -// var room = connections.getConnectedRoom(id).orElse(new ChunkPos(-1, -1)); -// builder.writeRow( -// id, -// loc.getDimension().location().toString(), -// placedAt.getX(), -// placedAt.getY(), -// placedAt.getZ(), -// room.x, -// room.z -// ); -// } catch (IOException e) { -// CompactMachines.LOGGER.error(e); -// } + private static void writeMachine(IDimensionalBlockPosition machine, ChunkPos room, CsvOutput builder) { + try { + var placedAt = machine.getBlockPosition(); + + builder.writeRow( + machine.dimensionKey().location().toString(), + placedAt.getX(), + placedAt.getY(), + placedAt.getZ(), + room.x, + room.z + ); + } catch (IOException e) { + CompactMachines.LOGGER.error(e); + } } } From 2bba16ec8c7816f3020f6c5ebe91c10a81aaa903 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 7 Aug 2022 00:10:06 -0400 Subject: [PATCH 08/85] Fix tunnel-related registry deprecations --- .../java/dev/compactmods/machines/tunnel/TunnelItem.java | 3 ++- .../dev/compactmods/machines/tunnel/TunnelWallBlock.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index 26c6d198..6ae20354 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -164,6 +164,7 @@ public static Optional getMachineBindingInfo(Player player) { private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position, Direction innerFace, Player player, TunnelDefinition def) throws Exception, MissingDimensionException { boolean redstone = def instanceof RedstoneTunnel; + final var tunnelId = Tunnels.getRegistryId(def); final var roomTunnels = TunnelConnectionGraph.forRoom(compactDim, player.chunkPosition()); @@ -176,7 +177,7 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position var hist = lastEnteredMachine.get(); var placedSides = roomTunnels - .getTunnelSides(def) + .getTunnelSides(tunnelId) .collect(Collectors.toSet()); // all tunnels already placed for type diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index 7bc6cbc2..0ef1fa6f 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -106,6 +106,8 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final Direction tunnelWallSide = hitResult.getDirection(); var tunnelConnectedSide = tunnel.getConnectedSide(); + final var tunnelId = Tunnels.getRegistryId(def); + if (player.isShiftKeyDown()) { BlockState solidWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); @@ -113,7 +115,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player ItemStack stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); CompoundTag defTag = stack.getOrCreateTagElement("definition"); - defTag.putString("id", Tunnels.getRegistryId(def).toString()); + defTag.putString("id", tunnelId.toString()); ItemEntity ie = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), stack); level.addFreshEntity(ie); @@ -130,7 +132,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, new ChunkPos(pos)); final var existingDirs = tunnelGraph - .getTunnelSides(def) + .getTunnelSides(tunnelId) .collect(Collectors.toSet()); if (existingDirs.size() == 6) { From a12e3a43435d7ef4307efaf49deaa79967ad92d5 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 14 Aug 2022 03:36:09 -0400 Subject: [PATCH 09/85] Setup for loading and testing room templates --- build.gradle | 82 ++++++---- gradle.properties | 12 +- .../api/dimension/CompactDimension.java | 8 + .../api/location/IDimensionalPosition.java | 2 + .../machines/api/room/RoomSize.java | 7 +- .../machines/api/room/RoomTemplate.java | 30 ++++ .../compactmods/machines/api/room/Rooms.java | 18 +++ .../connection/RoomTunnelConnections.java | 18 +++ .../redstone/RedstoneWriterTunnel.java | 4 + .../datagen/AdvancementGenerator.java | 3 +- .../machines/datagen/DataGenUtil.java | 9 +- .../machines/datagen/DataGeneration.java | 7 +- .../machines/datagen/ItemModelGenerator.java | 4 +- .../machines/datagen/LevelBiomeGenerator.java | 17 +- .../machines/datagen/StateGenerator.java | 6 +- .../datagen/TunnelWallStateGenerator.java | 4 +- .../datagen/lang/BaseLangGenerator.java | 10 +- .../datagen/lang/EnglishLangGenerator.java | 12 +- .../datagen/lang/RussianLangGenerator.java | 10 +- .../machines/datagen/room/RoomTemplates.java | 43 +++++ .../datagen/tags/BlockTagGenerator.java | 7 +- .../datagen/tags/ItemTagGenerator.java | 4 +- .../compactmods/machines/CompactMachines.java | 5 +- .../theoneprobe/providers/TunnelProvider.java | 54 +++---- .../compactmods/machines/core/Registries.java | 4 + .../machines/location/LevelBlockPosition.java | 12 +- .../location/PreciseDimensionalPosition.java | 6 + .../machines/machine/CompactMachineBlock.java | 20 ++- .../machine/CompactMachineBlockEntity.java | 33 ++++ .../dev/compactmods/machines/room/Rooms.java | 25 ++- .../machines/tunnel/TunnelWallBlock.java | 37 +++-- .../machines/tunnel/TunnelWallEntity.java | 56 +++---- .../compactmods/machines/tunnel/Tunnels.java | 4 + .../tunnel/graph/TunnelConnectionGraph.java | 9 +- .../util/CompactStructureGenerator.java | 150 ++++++++++++------ .../machines/util/LocationUtil.java | 19 --- .../compactmods/machines/util/MathUtil.java | 5 - .../compactmods/machines/util/PlayerUtil.java | 4 +- .../compactmods/machines/test/MathTests.java | 7 +- .../machines/test/ServerEvents.java | 3 +- .../test/core/CompactMachinesTests.java | 3 +- .../machines/test/data/CodecTests.java | 4 +- .../test/worldgen/DimensionTests.java | 4 +- .../test/worldgen/RoomGenerationTests.java | 76 +++++++++ .../structures/template_max.nbt | Bin 0 -> 225 bytes 45 files changed, 586 insertions(+), 271 deletions(-) create mode 100644 src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/Rooms.java create mode 100644 src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java create mode 100644 src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java create mode 100644 src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java delete mode 100644 src/main/java/dev/compactmods/machines/util/LocationUtil.java create mode 100644 src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java create mode 100644 src/test/resources/data/compactmachines/structures/template_max.nbt diff --git a/build.gradle b/build.gradle index e5bc8cf4..625c0d9b 100644 --- a/build.gradle +++ b/build.gradle @@ -107,10 +107,15 @@ minecraft { property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" + // JetBrains Runtime Hotswap + jvmArg '-XX:+AllowEnhancedClassRedefinition' + jvmArg '-XX:HotswapAgent=fatjar' + args '--username', 'Nano' args '--width', 1920 args '--height', 1080 + mods { compactmachines { source sourceSets.tunnels @@ -134,6 +139,10 @@ minecraft { property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" + // JetBrains Runtime Hotswap + jvmArg '-XX:+AllowEnhancedClassRedefinition' + jvmArg '-XX:HotswapAgent=fatjar' + mods { compactmachines { source sourceSets.tunnels @@ -161,6 +170,12 @@ minecraft { args '--all' args '--output', file('src/generated/resources/') + if(!System.getenv().containsKey("CI")) { + // JetBrains Runtime Hotswap + jvmArg '-XX:+AllowEnhancedClassRedefinition' + jvmArg '-XX:HotswapAgent=fatjar' + } + forceExit false mods { @@ -193,6 +208,10 @@ minecraft { forceExit false + // JetBrains Runtime Hotswap + jvmArg '-XX:+AllowEnhancedClassRedefinition' + jvmArg '-XX:HotswapAgent=fatjar' + mods { compactmachines { source sourceSets.tunnels @@ -244,49 +263,48 @@ dependencies { runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}") // The One Probe - implementation(fg.deobf("curse.maven:theoneprobe-245211:3871444")) + implementation(fg.deobf("curse.maven:theoneprobe-245211:3927520")) if (!System.getenv().containsKey("CI") && include_test_mods.equals("true")) { // Nicephore - Screenshots and Stuff - runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3741832")) - - // // Testing Mods - Trash Cans, Pipez, Create, Refined Pipes, Pretty Pipes, Refined Storage - runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3649270")) - runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3597654")) - runtimeOnly(fg.deobf("curse.maven:pipez-443900:3760255")) - - runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3737402")) - runtimeOnly(fg.deobf("curse.maven:create-328085:3737418")) - - // runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151")) - // runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145")) - // runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324")) - // - // // Scalable Cat's Force, BdLib, Advanced Generators - // runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756")) - // runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149")) - // runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335")) - // - // // Immersive Eng - 7.1.0-145 (Dec 31) - // runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149")) + runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3879841")) + + // Testing Mods - Trash Cans, Pipez, Create, Refined Pipes, Pretty Pipes, Refined Storage + runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3910759")) + runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3871885")) + + // runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3871082")) + // runtimeOnly(fg.deobf("curse.maven:create-328085:3737418")) + + // runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151")) + // runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145")) + // runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324")) + + // Scalable Cat's Force, BdLib, Advanced Generators + // runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756")) + // runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149")) + // runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335")) + + // Immersive Eng - 7.1.0-145 (Dec 31) + // runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149")) // FTB Chunks - runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711")) - runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501")) - runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485")) - runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113")) + // runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711")) + // runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501")) + // runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485")) + // runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113")) // Mekanism + Mek Generators - Tunnel testing - runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3743835")) - runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3743837")) + runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3922056")) + runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3922058")) // Soul Shards (FTB) - runtimeOnly(fg.deobf("curse.maven:polylib-576589:3751528")) - runtimeOnly(fg.deobf("curse.maven:soulshards-551523:3757202")) + // runtimeOnly(fg.deobf("curse.maven:polylib-576589:3751528")) + // runtimeOnly(fg.deobf("curse.maven:soulshards-551523:3757202")) // Everlasting Abilities - runtimeOnly(fg.deobf("curse.maven:cyclopscore-232758:3809427")) - runtimeOnly(fg.deobf("curse.maven:everlastabilities-248353:3768481")) + // runtimeOnly(fg.deobf("curse.maven:cyclopscore-232758:3809427")) + // runtimeOnly(fg.deobf("curse.maven:everlastabilities-248353:3768481")) } } diff --git a/gradle.properties b/gradle.properties index 59e7ce0c..2439531c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -minecraft_version=1.19.1 -forge_version=42.0.1 -parchment_version=1.18.2-2022.07.17-1.19.1 +minecraft_version=1.19.2 +forge_version=43.0.8 +parchment_version=2022.08.10-1.19.2 mod_id=compactmachines # Dependencies and Libs -jei_mc_version=1.19.1 -jei_version=11.2.0.241 +jei_mc_version=1.19.2 +jei_version=11.2.0.247 #top_version=1.16-3.1.4-22 # Curseforge @@ -22,4 +22,4 @@ cf_release_type=release mixin_version = 0.8.5 mixingradle_version = 0.7-SNAPSHOT -include_test_mods = false \ No newline at end of file +include_test_mods = true \ No newline at end of file diff --git a/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java index a29f6eea..60a436f6 100644 --- a/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java +++ b/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java @@ -3,8 +3,11 @@ import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.dimension.DimensionType; +import org.jetbrains.annotations.Nullable; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -16,4 +19,9 @@ public abstract class CompactDimension { .create(Registry.DIMENSION_TYPE_REGISTRY, new ResourceLocation(MOD_ID, "compact_world")); private CompactDimension() {} + + @Nullable + public static ServerLevel forServer(MinecraftServer server) { + return server.getLevel(LEVEL_KEY); + } } diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java index 3bad7a48..c4ed1b17 100644 --- a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java +++ b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java @@ -16,4 +16,6 @@ public interface IDimensionalPosition { ServerLevel level(MinecraftServer server); Optional getRotation(); + + boolean isLoaded(MinecraftServer serv); } diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomSize.java b/src/api/java/dev/compactmods/machines/api/room/RoomSize.java index efef73f0..101857dc 100644 --- a/src/api/java/dev/compactmods/machines/api/room/RoomSize.java +++ b/src/api/java/dev/compactmods/machines/api/room/RoomSize.java @@ -1,12 +1,13 @@ package dev.compactmods.machines.api.room; import com.mojang.serialization.Codec; +import net.minecraft.core.Vec3i; import net.minecraft.util.StringRepresentable; import net.minecraft.world.phys.AABB; import net.minecraft.core.BlockPos; /** - * Planning on removing in 1.20. Will be replaced by a registry to allow for custom room sizes. + * Planning on removing in 1.20. Will be replaced by a registry to allow for custom room templates. */ @Deprecated public enum RoomSize implements StringRepresentable { @@ -61,4 +62,8 @@ public static RoomSize getFromSize(String size) { public String getSerializedName() { return this.name; } + + public Vec3i toVec3() { + return new Vec3i(internalSize, internalSize, internalSize); + } } diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java b/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java new file mode 100644 index 00000000..a85ceda2 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java @@ -0,0 +1,30 @@ +package dev.compactmods.machines.api.room; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.core.Vec3i; +import net.minecraft.resources.ResourceLocation; + +/** + * Template structure for creating a new Compact Machine room. These can be added and removed from the registry + * at any point, so persistent data must be stored outside these instances. + * + * @param dimensions The internal dimensions of the room when it is created. + * @param color The color of the machine blocks created for this template. + * @param prefillTemplate A template (structure) file reference, if specified this will fill the new room post-generation + */ +public record RoomTemplate(Vec3i dimensions, int color, ResourceLocation prefillTemplate) { + + public static final ResourceLocation NO_TEMPLATE = new ResourceLocation(Constants.MOD_ID, "empty"); + + public static Codec CODEC = RecordCodecBuilder.create(i -> i.group( + Vec3i.CODEC.fieldOf("dimensions").forGetter(RoomTemplate::dimensions), + Codec.INT.fieldOf("color").forGetter(RoomTemplate::color), + ResourceLocation.CODEC.optionalFieldOf("template", NO_TEMPLATE).forGetter(RoomTemplate::prefillTemplate) + ).apply(i, RoomTemplate::new)); + + public RoomTemplate(int cubicSize, int color) { + this(new Vec3i(cubicSize, cubicSize, cubicSize), color, NO_TEMPLATE); + } +} diff --git a/src/api/java/dev/compactmods/machines/api/room/Rooms.java b/src/api/java/dev/compactmods/machines/api/room/Rooms.java new file mode 100644 index 00000000..9266018d --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/Rooms.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.api.room; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; + +public class Rooms { + + public static ResourceKey> TEMPLATE_REG_KEY = + ResourceKey.createRegistryKey(new ResourceLocation(Constants.MOD_ID, "room_templates")); + + public static Registry getTemplates(MinecraftServer server) { + final var regAccess = server.registryAccess(); + return regAccess.registryOrThrow(TEMPLATE_REG_KEY); + } +} diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java b/src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java new file mode 100644 index 00000000..7728da04 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.api.tunnels.connection; + +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; + +import java.util.stream.Stream; + +public interface RoomTunnelConnections { + /** + * Fetches sided redstone tunnel locations inside a machine room, based on connected machine + * location and the side the tunnel is pointed to. + * @param machine The connected machine (non-compact level) + * @param facing The side the tunnels are queried for + * @return + */ + Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction facing); +} diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java new file mode 100644 index 00000000..d80bc440 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.api.tunnels.redstone; + +public interface RedstoneWriterTunnel extends RedstoneTunnel { +} diff --git a/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java index c4a2e13a..800b1e3e 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java @@ -7,6 +7,7 @@ import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; @@ -62,7 +63,7 @@ public void run(@Nonnull CachedOutput cache) { } private ResourceLocation modLoc(String i) { - return new ResourceLocation(CompactMachines.MOD_ID, i); + return new ResourceLocation(Constants.MOD_ID, i); } private void generateAdvancements(Consumer consumer) { diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java b/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java index c3dd4d76..8db1e7fd 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java @@ -6,6 +6,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.resources.ResourceLocation; @@ -17,8 +18,8 @@ import java.util.function.BiConsumer; import java.util.function.Function; -class DataGenUtil { - static BiConsumer makeWriter(Gson gson, @Nonnull CachedOutput cache, Path dataDir, ImmutableSet pathParts, Codec codec, HashMap set) { +public class DataGenUtil { + public static BiConsumer makeWriter(Gson gson, @Nonnull CachedOutput cache, Path dataDir, ImmutableSet pathParts, Codec codec, HashMap set) { return (T resource, ResourceLocation regName) -> { if (set.containsKey(regName)) { throw new IllegalStateException("Duplicate resource " + regName); @@ -26,7 +27,7 @@ static BiConsumer makeWriter(Gson gson, @Nonnull Cached String namespace = regName.getNamespace(); String path = regName.getPath(); - Path fileLocation = dataDir.resolve(Path.of("data", CompactMachines.MOD_ID)); + Path fileLocation = dataDir.resolve(Path.of("data", Constants.MOD_ID)); for (String p : pathParts) fileLocation = fileLocation.resolve(p); @@ -52,7 +53,7 @@ static BiConsumer makeCustomWriter(Gson gson, @Nonnull String namespace = regName.getNamespace(); String path = regName.getPath(); - Path fileLocation = dataDir.resolve(Path.of("data", CompactMachines.MOD_ID)); + Path fileLocation = dataDir.resolve(Path.of("data", Constants.MOD_ID)); for (String p : pathParts) fileLocation = fileLocation.resolve(p); diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java b/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java index 5b01302f..7c98b46c 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java @@ -1,15 +1,16 @@ package dev.compactmods.machines.datagen; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.datagen.lang.EnglishLangGenerator; import dev.compactmods.machines.datagen.lang.RussianLangGenerator; +import dev.compactmods.machines.datagen.room.RoomTemplates; import dev.compactmods.machines.datagen.tags.BlockTagGenerator; import dev.compactmods.machines.datagen.tags.ItemTagGenerator; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -@Mod.EventBusSubscriber(modid = CompactMachines.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class DataGeneration { @SubscribeEvent @@ -27,6 +28,8 @@ public static void gatherData(GatherDataEvent event) { generator.addProvider(event.includeServer(), blocks); generator.addProvider(event.includeServer(), new ItemTagGenerator(generator, blocks, helper)); + RoomTemplates.make(event); + // Client generator.addProvider(event.includeClient(), new StateGenerator(generator, helper)); generator.addProvider(event.includeClient(), new TunnelWallStateGenerator(generator, helper)); diff --git a/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java index 85b1caf5..f2665fef 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.datagen; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.data.DataGenerator; @@ -10,7 +10,7 @@ public class ItemModelGenerator extends ItemModelProvider { public ItemModelGenerator(DataGenerator generator, ExistingFileHelper existingFileHelper) { - super(generator, CompactMachines.MOD_ID, existingFileHelper); + super(generator, Constants.MOD_ID, existingFileHelper); } @Override diff --git a/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java index c8f454d0..87490f8a 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java @@ -8,6 +8,8 @@ import com.google.gson.JsonObject; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.dimension.Dimension; import net.minecraft.core.Holder; import net.minecraft.core.Registry; @@ -36,8 +38,7 @@ public class LevelBiomeGenerator implements DataProvider { private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final DataGenerator generator; - private final ResourceLocation COMPACT_BIOME = new ResourceLocation(CompactMachines.MOD_ID, "machine"); - private final ResourceLocation COMPACT_LEVEL = new ResourceLocation(CompactMachines.MOD_ID, "compact_world"); + private final ResourceLocation COMPACT_BIOME = new ResourceLocation(Constants.MOD_ID, "machine"); LevelBiomeGenerator(DataGenerator generator) { this.generator = generator; @@ -65,7 +66,7 @@ public void run(@Nonnull CachedOutput cache) { private JsonElement writeFlatDimension(LevelStem dimension) { JsonObject d = new JsonObject(); - d.addProperty("type", COMPACT_LEVEL.toString()); + d.addProperty("type", CompactDimension.LEVEL_KEY.toString()); var gen = ChunkGenerator.CODEC.encodeStart(JsonOps.INSTANCE, dimension.generator()) .getOrThrow(false, CompactMachines.LOGGER::error) @@ -93,11 +94,11 @@ private void writeDimensions(HashMap biomes, HashMap consumer) { @@ -110,7 +111,7 @@ private void writeDimensionTypes(BiConsumer con .heightBounds(0, 256) .build(); - consumer.accept(dim, COMPACT_LEVEL); + consumer.accept(dim, CompactDimension.LEVEL_KEY.location()); } private void writeBiomes(BiConsumer biomeWriter) { @@ -140,6 +141,6 @@ private void writeBiomes(BiConsumer biomeWriter) { @Override public String getName() { - return CompactMachines.MOD_ID + ":levelgen"; + return Constants.MOD_ID + ":levelgen"; } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java index 29f13e02..27d16036 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.datagen; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.machine.CompactMachineBlock; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.machine.CompactMachineBlock; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.BlockStateProvider; @@ -11,7 +11,7 @@ public class StateGenerator extends BlockStateProvider { public StateGenerator(DataGenerator gen, ExistingFileHelper exFileHelper) { - super(gen, CompactMachines.MOD_ID, exFileHelper); + super(gen, Constants.MOD_ID, exFileHelper); } @Override diff --git a/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java index fb241044..b2fb109f 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.datagen; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.tunnel.TunnelWallBlock; import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.Direction; @@ -16,7 +16,7 @@ public class TunnelWallStateGenerator extends BlockStateProvider { public TunnelWallStateGenerator(DataGenerator gen, ExistingFileHelper exFileHelper) { - super(gen, CompactMachines.MOD_ID, exFileHelper); + super(gen, Constants.MOD_ID, exFileHelper); } @Override diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java index 58548616..7a38eaeb 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java @@ -1,14 +1,14 @@ package dev.compactmods.machines.datagen.lang; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.datagen.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.CompactMachineBlock; -import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; @@ -23,7 +23,7 @@ public abstract class BaseLangGenerator extends LanguageProvider { private final String locale; public BaseLangGenerator(DataGenerator gen, String locale) { - super(gen, CompactMachines.MOD_ID, locale); + super(gen, Constants.MOD_ID, locale); this.locale = locale; } @@ -47,7 +47,7 @@ protected void addTranslations() { // Direction Names for (var dir : Direction.values()) { - add(CompactMachines.MOD_ID + ".direction." + dir.getSerializedName(), getDirectionTranslation(dir)); + add(Constants.MOD_ID + ".direction." + dir.getSerializedName(), getDirectionTranslation(dir)); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 518f7d4d..5bdba4ed 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -1,14 +1,14 @@ package dev.compactmods.machines.datagen.lang; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.dimension.VoidAirBlock; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; @@ -59,8 +59,8 @@ protected void addTranslations() { add(Shrinking.PERSONAL_SHRINKING_DEVICE.get(), "Personal Shrinking Device"); - add(CompactMachines.MOD_ID + ".direction.side", "Side: %s"); - add(CompactMachines.MOD_ID + ".connected_block", "Connected: %s"); + add(Constants.MOD_ID + ".direction.side", "Side: %s"); + add(Constants.MOD_ID + ".connected_block", "Connected: %s"); add(RoomUpgrade.UNNAMED_TRANS_KEY, "Unnamed Room Upgrade"); @@ -107,9 +107,9 @@ protected void addTranslations() { addMessage(Messages.UNKNOWN_ROOM_CHUNK, "Unknown room at %s; please verify it exists."); - add("itemGroup." + CompactMachines.MOD_ID, "Compact Machines"); + add("itemGroup." + Constants.MOD_ID, "Compact Machines"); - add("biome." + CompactMachines.MOD_ID + ".machine", "Compact Machine"); + add("biome." + Constants.MOD_ID + ".machine", "Compact Machine"); add("compactmachines.psd.pages.machines.title", "Compact Machines"); add("compactmachines.psd.pages.machines", "Compact Machines are the core mechanic of this mod. They allow you to build large " + diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java index 4f6239c6..328be67b 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java @@ -1,11 +1,11 @@ package dev.compactmods.machines.datagen.lang; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.wall.Walls; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; @@ -54,8 +54,8 @@ protected void addTranslations() { add(Tunnels.BLOCK_TUNNEL_WALL.get(), "Прочная стена компактного механизма (с Туннелем)"); // Basics - add(CompactMachines.MOD_ID + ".connected_block", "Подключено: %s"); - add(CompactMachines.MOD_ID + ".direction.side", "Сторона: %s"); + add(Constants.MOD_ID + ".connected_block", "Подключено: %s"); + add(Constants.MOD_ID + ".direction.side", "Сторона: %s"); // PSD add(Shrinking.PERSONAL_SHRINKING_DEVICE.get(), "Персональное сжимающее устройство"); @@ -64,7 +64,7 @@ protected void addTranslations() { add(Tunnels.ITEM_TUNNEL.get(), "Предметный туннель"); // Creative Tabs - add("itemGroup." + CompactMachines.MOD_ID, "Компактные механизмы"); + add("itemGroup." + Constants.MOD_ID, "Компактные механизмы"); // PSD Guide Pages add("compactmachines.psd.pages.machines.title", "Компактные механизмы"); diff --git a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java new file mode 100644 index 00000000..fe0df48d --- /dev/null +++ b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java @@ -0,0 +1,43 @@ +package dev.compactmods.machines.datagen.room; + +import com.mojang.serialization.JsonOps; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.RoomTemplate; +import net.minecraft.core.RegistryAccess; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.FastColor; +import net.minecraftforge.common.data.JsonCodecProvider; +import net.minecraftforge.data.event.GatherDataEvent; + +import java.util.HashMap; + +public class RoomTemplates { + + public static void make(GatherDataEvent event) { + final var tiny = new RoomTemplate(3, FastColor.ARGB32.color(255, 201, 91, 19)); + final var small = new RoomTemplate(5, FastColor.ARGB32.color(255, 212, 210, 210)); + final var normal = new RoomTemplate(7, FastColor.ARGB32.color(255, 251, 242, 54)); + final var large = new RoomTemplate(9, FastColor.ARGB32.color(255, 33, 27, 46)); + final var giant = new RoomTemplate(11, FastColor.ARGB32.color(255, 67, 214, 205)); + final var max = new RoomTemplate(13, FastColor.ARGB32.color(255, 66, 63, 66)); + + final var templates = new HashMap(); + templates.put(new ResourceLocation(Constants.MOD_ID, "tiny"), tiny); + templates.put(new ResourceLocation(Constants.MOD_ID, "small"), small); + templates.put(new ResourceLocation(Constants.MOD_ID, "normal"), normal); + templates.put(new ResourceLocation(Constants.MOD_ID, "large"), large); + templates.put(new ResourceLocation(Constants.MOD_ID, "giant"), giant); + templates.put(new ResourceLocation(Constants.MOD_ID, "maximum"), max); + + final var ops = RegistryOps.create(JsonOps.INSTANCE, RegistryAccess.builtinCopy()); + + final var gen = event.getGenerator(); + final var files = event.getExistingFileHelper(); + + final var provider = JsonCodecProvider.forDatapackRegistry(gen, files, + Constants.MOD_ID, ops, dev.compactmods.machines.api.room.Rooms.TEMPLATE_REG_KEY, templates); + + gen.addProvider(event.includeServer(), provider); + } +} diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java index e620783a..a5c2ee62 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java @@ -1,7 +1,6 @@ package dev.compactmods.machines.datagen.tags; -import java.util.Set; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; @@ -9,10 +8,12 @@ import net.minecraft.tags.BlockTags; import net.minecraftforge.common.data.ExistingFileHelper; +import java.util.Set; + public class BlockTagGenerator extends BlockTagsProvider { public BlockTagGenerator(DataGenerator generator, ExistingFileHelper files) { - super(generator, CompactMachines.MOD_ID, files); + super(generator, Constants.MOD_ID, files); } @Override diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java index d9ecdf37..3b629bff 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.datagen.tags; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; @@ -11,7 +11,7 @@ public class ItemTagGenerator extends ItemTagsProvider { public ItemTagGenerator(DataGenerator gen, BlockTagsProvider blockTags, @Nullable ExistingFileHelper files) { - super(gen, blockTags, CompactMachines.MOD_ID, files); + super(gen, blockTags, Constants.MOD_ID, files); } @Override diff --git a/src/main/java/dev/compactmods/machines/CompactMachines.java b/src/main/java/dev/compactmods/machines/CompactMachines.java index 7ff5f395..4ae1ff77 100644 --- a/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -10,6 +10,7 @@ import dev.compactmods.machines.dimension.Dimension; import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.data.LootFunctions; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; @@ -40,7 +41,7 @@ public class CompactMachines { public static final Logger LOGGER = LogManager.getLogger(); public static final Marker CONN_MARKER = MarkerManager.getMarker("cm_connections"); - public static final CreativeModeTab COMPACT_MACHINES_ITEMS = new CreativeModeTab(MOD_ID) { + public static final CreativeModeTab COMPACT_MACHINES_ITEMS = new CreativeModeTab(Constants.MOD_ID) { @Override public @Nonnull ItemStack makeIcon() { @@ -72,6 +73,7 @@ private static void doRegistration() { Registries.BLOCK_ENTITIES.register(bus); Registries.TUNNEL_DEFINITIONS.register(bus); Registries.CONTAINERS.register(bus); + Registries.ROOM_TEMPLATES.register(bus); Registries.UPGRADES.register(bus); Registries.NODE_TYPES.register(bus); Registries.EDGE_TYPES.register(bus); @@ -88,6 +90,7 @@ private static void preparePackages() { UIRegistration.prepare(); Dimension.prepare(); + Rooms.prepare(); MachineRoomUpgrades.prepare(); Graph.prepare(); Commands.prepare(); diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java b/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java index 602a094c..e05442de 100644 --- a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java +++ b/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java @@ -40,10 +40,6 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player playerEnti IProbeInfo v = info.vertical(info.defaultLayoutStyle().spacing(-1)); if (level.getBlockEntity(hitData.getPos()) instanceof TunnelWallEntity tile) { - - - - if (probeMode == ProbeMode.EXTENDED) { TunnelDefinition definition = tile.getTunnelType(); final var tunnelReg = Tunnels.TUNNEL_DEF_REGISTRY.get(); @@ -65,32 +61,32 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player playerEnti .item(new ItemStack(Items.COMPASS)) .text(Component.translatable(sideTranslated)); - final var connectedTo = tile.getConnectedPosition(); - if(connectedTo != null) { - ServerLevel connectedWorld = (ServerLevel) level; - BlockPos outPosBlock = connectedTo.getBlockPosition(); - - try { - final var state = connectedTo.state(level.getServer()); - - // If connected block isn't air, show a connected block line - if (!state.isAir()) { - String blockName = IProbeInfo.STARTLOC + state.getBlock().getDescriptionId() + IProbeInfo.ENDLOC; - HitResult trace = new BlockHitResult( - hitData.getHitVec(), hitData.getSideHit(), - outPosBlock, false); - - ItemStack pick = state - .getBlock() - .getCloneItemStack(state, trace, connectedWorld, outPosBlock, playerEntity); - - v.horizontal(center) - .item(pick) - .text(Component.translatable(Constants.MOD_ID.concat(".connected_block"), blockName)); - } - } catch (Exception ex) { - // no-op: we don't want to spam the log here + final var connectedMachinePos = tile.getConnectedPosition(); + final var connectedPos = connectedMachinePos.relative(tile.getConnectedSide()); + + ServerLevel connectedWorld = (ServerLevel) level; + BlockPos outPosBlock = connectedMachinePos.getBlockPosition(); + + try { + final var state = connectedPos.state(level.getServer()); + + // If connected block isn't air, show a connected block line + if (!state.isAir()) { + String blockName = IProbeInfo.STARTLOC + state.getBlock().getDescriptionId() + IProbeInfo.ENDLOC; + HitResult trace = new BlockHitResult( + hitData.getHitVec(), hitData.getSideHit(), + outPosBlock, false); + + ItemStack pick = state + .getBlock() + .getCloneItemStack(state, trace, connectedWorld, outPosBlock, playerEntity); + + v.horizontal(center) + .item(pick) + .text(Component.translatable(Constants.MOD_ID.concat(".connected_block"), blockName)); } + } catch (Exception ex) { + // no-op: we don't want to spam the log here } } } diff --git a/src/main/java/dev/compactmods/machines/core/Registries.java b/src/main/java/dev/compactmods/machines/core/Registries.java index bc5d3391..40dcfb06 100644 --- a/src/main/java/dev/compactmods/machines/core/Registries.java +++ b/src/main/java/dev/compactmods/machines/core/Registries.java @@ -1,5 +1,7 @@ package dev.compactmods.machines.core; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphEdgeType; @@ -51,6 +53,8 @@ public class Registries { // LootFunctions public static final DeferredRegister LOOT_FUNCS = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, MOD_ID); + public static DeferredRegister ROOM_TEMPLATES = DeferredRegister.create(dev.compactmods.machines.api.room.Rooms.TEMPLATE_REG_KEY, Constants.MOD_ID); + public static void setup() { } diff --git a/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java index 9f38c34e..ac2d0480 100644 --- a/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java +++ b/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java @@ -1,15 +1,11 @@ package dev.compactmods.machines.location; -import javax.annotation.Nonnull; -import java.util.Objects; -import java.util.Optional; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.codec.CodecExtensions; -import dev.compactmods.machines.util.LocationUtil; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; @@ -25,6 +21,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.INBTSerializable; +import javax.annotation.Nonnull; +import java.util.Objects; +import java.util.Optional; + public class LevelBlockPosition implements INBTSerializable, IDimensionalBlockPosition { private ResourceKey dimension; @@ -84,7 +84,7 @@ public IDimensionalBlockPosition relative(Direction direction) { public boolean isLoaded(MinecraftServer server) { final var level = level(server); - return level.isLoaded(LocationUtil.vectorToBlockPos(position)); + return level.isLoaded(new BlockPos(position)); } public static LevelBlockPosition fromNBT(CompoundTag nbt) { diff --git a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java index ea1eb4eb..155c4599 100644 --- a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java +++ b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java @@ -4,6 +4,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.api.location.IDimensionalPosition; +import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; @@ -69,6 +70,11 @@ public Optional getRotation() { return Optional.empty(); } + @Override + public boolean isLoaded(MinecraftServer serv) { + return level(serv).isLoaded(new BlockPos(position)); + } + public ResourceKey dimension() { return dimension; } diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java index a776364b..e9d6bb1c 100644 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java +++ b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java @@ -18,6 +18,7 @@ import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import dev.compactmods.machines.room.menu.MachineRoomMenu; import dev.compactmods.machines.shrinking.Shrinking; +import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.upgrade.RoomUpgradeItem; @@ -116,20 +117,27 @@ public int getSignal(BlockState blockState, BlockGetter blockAccess, BlockPos po @SuppressWarnings("deprecation") @ParametersAreNonnullByDefault public void neighborChanged(BlockState state, Level world, BlockPos pos, Block changedBlock, BlockPos changedPos, boolean isMoving) { - super.neighborChanged(state, world, pos, changedBlock, changedPos, isMoving); - if (world.isClientSide) return; ServerLevel serverWorld = (ServerLevel) world; - if (serverWorld.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { ServerLevel compactWorld = serverWorld.getServer().getLevel(CompactDimension.LEVEL_KEY); if (compactWorld == null) { CompactMachines.LOGGER.warn("Warning: Compact Dimension was null! Cannot fetch internal state for machine neighbor change listener."); + } else { + for (final var dir : Direction.Plane.HORIZONTAL) { + if (!pos.relative(dir).equals(changedPos)) continue; + + // Horizontal neighbor changed + machine.getTunnelGraph().ifPresent(graph -> { + // Update redstone tunnel signals + graph.getRedstoneTunnels(machine.getLevelPosition(), dir).forEach(tunnelPos -> { + compactWorld.updateNeighbourForOutputSignal(tunnelPos, Tunnels.BLOCK_TUNNEL_WALL.get()); + }); + }); + } } - - // TODO - Send notification to dimension tunnel listeners (API) } } @@ -255,7 +263,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player // Upgrade Item if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { final var reg = MachineRoomUpgrades.REGISTRY.get(); - if(mainItem.getItem() instanceof RoomUpgradeItem upItem) { + if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { tile.getConnectedRoom().ifPresent(room -> { Rooms.getOwner(server, room).ifPresent(prof -> { diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java index 66d69f87..a373ef46 100644 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java +++ b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java @@ -3,6 +3,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.graph.CompactMachineNode; @@ -10,6 +11,7 @@ import dev.compactmods.machines.room.graph.CompactMachineRoomNode; import dev.compactmods.machines.tunnel.TunnelWallEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -25,6 +27,7 @@ import java.lang.ref.WeakReference; import java.util.Optional; import java.util.UUID; +import java.util.stream.Stream; public class CompactMachineBlockEntity extends BlockEntity { private static final String ROOM_NBT = "room_pos"; @@ -226,4 +229,34 @@ public void disconnect() { setChanged(); } } + + public Stream getTunnels(Direction dir) { + if(level == null || roomChunk == null) return Stream.empty(); + + if(level instanceof ServerLevel sl) { + final var compactDim = CompactDimension.forServer(sl.getServer()); + if(compactDim == null) + return Stream.empty(); + + final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomChunk); + return tunnelGraph.getTunnelsForSide(getLevelPosition(), dir).map(TunnelNode::position); + } + + return Stream.empty(); + } + + public Optional getTunnelGraph() { + if(level == null || roomChunk == null) return Optional.empty(); + + if(level instanceof ServerLevel sl) { + final var compactDim = CompactDimension.forServer(sl.getServer()); + if (compactDim == null) + return Optional.empty(); + + final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomChunk); + return Optional.of(tunnelGraph); + } + + return Optional.empty(); + } } diff --git a/src/main/java/dev/compactmods/machines/room/Rooms.java b/src/main/java/dev/compactmods/machines/room/Rooms.java index dd5130af..e3e6cf07 100644 --- a/src/main/java/dev/compactmods/machines/room/Rooms.java +++ b/src/main/java/dev/compactmods/machines/room/Rooms.java @@ -6,7 +6,9 @@ import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.location.IDimensionalPosition; import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; @@ -20,6 +22,7 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.registries.RegistryBuilder; import javax.naming.OperationNotSupportedException; import java.util.Objects; @@ -28,6 +31,15 @@ import java.util.stream.Stream; public class Rooms { + + static { + Registries.ROOM_TEMPLATES.makeRegistry(() -> new RegistryBuilder() + .dataPackRegistry(RoomTemplate.CODEC, RoomTemplate.CODEC)); + } + + public static void prepare() { + } + public static ChunkPos createNew(MinecraftServer serv, RoomSize size, UUID owner) throws MissingDimensionException { final var compactWorld = serv.getLevel(CompactDimension.LEVEL_KEY); @@ -39,8 +51,7 @@ public static ChunkPos createNew(MinecraftServer serv, RoomSize size, UUID owner int nextPosition = rooms.getNextSpiralPosition(); Vec3i location = MathUtil.getRegionPositionByIndex(nextPosition); - int centerY = ServerConfig.MACHINE_FLOOR_Y.get() + (size.getInternalSize() / 2); - BlockPos newCenter = MathUtil.getCenterWithY(location, centerY); + BlockPos newCenter = MathUtil.getCenterWithY(location, ServerConfig.MACHINE_FLOOR_Y.get()); // Generate a new machine room CompactStructureGenerator.generateCompactStructure(compactWorld, size, newCenter); @@ -137,7 +148,7 @@ public static Stream getConnectedMachines(MinecraftSe .flatMap(sl -> { final var graph = DimensionMachineGraph.forDimension(sl); return graph.getMachinesFor(room).stream() - .map(bp -> new LevelBlockPosition(sl.dimension(), bp)); + .map(bp -> new LevelBlockPosition(sl.dimension(), bp)); }); } @@ -175,7 +186,7 @@ public static StructureTemplate getInternalBlocks(MinecraftServer server, ChunkP } public static void resetSpawn(MinecraftServer server, ChunkPos room) throws NonexistentRoomException { - if(!exists(server, room)) + if (!exists(server, room)) throw new NonexistentRoomException(room); final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); @@ -190,7 +201,7 @@ public static void resetSpawn(MinecraftServer server, ChunkPos room) throws None } public static Optional getRoomName(MinecraftServer server, ChunkPos room) throws NonexistentRoomException { - if(!exists(server, room)) + if (!exists(server, room)) throw new NonexistentRoomException(room); final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); @@ -201,7 +212,7 @@ public static Optional getRoomName(MinecraftServer server, ChunkPos room } public static Optional getOwner(MinecraftServer server, ChunkPos room) { - if(!exists(server, room)) + if (!exists(server, room)) return Optional.empty(); final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); @@ -218,7 +229,7 @@ public static Optional getOwner(MinecraftServer server, ChunkPos ro } public static void updateName(MinecraftServer server, ChunkPos room, String newName) throws NonexistentRoomException { - if(!exists(server, room)) + if (!exists(server, room)) throw new NonexistentRoomException(room); final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index 0ef1fa6f..f3e06d45 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -2,9 +2,9 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; +import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.wall.ProtectedWallBlock; @@ -32,7 +32,6 @@ import net.minecraft.world.phys.BlockHitResult; import javax.annotation.Nullable; -import java.util.Optional; import java.util.stream.Collectors; @SuppressWarnings("deprecation") @@ -51,14 +50,6 @@ public TunnelWallBlock(Properties props) { ); } - public static Optional getTunnelInfo(BlockGetter world, BlockPos position) { - TunnelWallEntity tile = (TunnelWallEntity) world.getBlockEntity(position); - if (tile == null) - return Optional.empty(); - - return Optional.ofNullable(tile.getTunnelType()); - } - @Override public boolean canConnectRedstone(BlockState state, BlockGetter world, BlockPos position, @Nullable Direction side) { return state.getValue(REDSTONE); @@ -76,9 +67,23 @@ public int getDirectSignal(BlockState state, BlockGetter world, BlockPos positio @Override public int getSignal(BlockState state, BlockGetter world, BlockPos position, Direction side) { - // TODO - Redstone tunnels - // Optional tunnelInfo = getTunnelInfo(world, position); - return 0; + if (!state.getValue(REDSTONE)) return 0; + if (world instanceof ServerLevel sl && world.getBlockEntity(position) instanceof TunnelWallEntity tunnelWall) { + final var serv = sl.getServer(); + final var def = tunnelWall.getTunnelType(); + final var machPos = tunnelWall.getConnectedPosition(); + final var tunnPos = tunnelWall.getTunnelPosition(); + + if(!machPos.isLoaded(serv)) return 0; + + if (def instanceof RedstoneReaderTunnel rrt) { + return rrt.powerLevel(serv, machPos, tunnPos); + } else { + return 0; + } + } else { + return 0; + } } @Override @@ -101,7 +106,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player if (!(level.getBlockEntity(pos) instanceof TunnelWallEntity tunnel)) return InteractionResult.FAIL; - if(level.dimension().equals(CompactDimension.LEVEL_KEY) && level instanceof ServerLevel compactDim) { + if (level.dimension().equals(CompactDimension.LEVEL_KEY) && level instanceof ServerLevel compactDim) { var def = tunnel.getTunnelType(); final Direction tunnelWallSide = hitResult.getDirection(); var tunnelConnectedSide = tunnel.getConnectedSide(); @@ -120,7 +125,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player ItemEntity ie = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), stack); level.addFreshEntity(ie); - if (def instanceof TunnelTeardownHandler teardown) { + if (def instanceof TunnelTeardownHandler teardown) { teardown.onRemoved(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel()); } @@ -147,7 +152,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player next.ifPresent(newSide -> { level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); - if (def instanceof TunnelTeardownHandler teardown) { + if (def instanceof TunnelTeardownHandler teardown) { teardown.onRotated(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); } diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index f300badf..e20074b3 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -1,7 +1,6 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; @@ -25,6 +24,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -48,16 +48,11 @@ public TunnelWallEntity(BlockPos pos, BlockState state) { public void load(@Nonnull CompoundTag nbt) { super.load(nbt); - try { - final var baseData = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, nbt) - .getOrThrow(true, CompactMachines.LOGGER::fatal); - - this.connectedMachine = baseData.connection(); - this.tunnelType = baseData.tunnel(); - } catch (Exception e) { - this.tunnelType = Tunnels.UNKNOWN.get(); - this.connectedMachine = null; - } + final var baseData = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, nbt) + .getOrThrow(true, CompactMachines.LOGGER::fatal); + + this.connectedMachine = baseData.connection(); + this.tunnelType = baseData.tunnel(); try { if (tunnelType instanceof InstancedTunnel it) @@ -88,13 +83,8 @@ public void onLoad() { @Override public void saveAdditional(@Nonnull CompoundTag compound) { - if (tunnelType != null) - compound.putString(BaseTunnelWallData.KEY_TUNNEL_TYPE, Tunnels.getRegistryId(tunnelType).toString()); - else - compound.putString(BaseTunnelWallData.KEY_TUNNEL_TYPE, Tunnels.UNKNOWN.getId().toString()); - - if (connectedMachine != null) - compound.put(BaseTunnelWallData.KEY_CONNECTION, connectedMachine.serializeNBT()); + compound.putString(BaseTunnelWallData.KEY_TUNNEL_TYPE, Tunnels.getRegistryId(tunnelType).toString()); + compound.put(BaseTunnelWallData.KEY_CONNECTION, connectedMachine.serializeNBT()); if (tunnel instanceof INBTSerializable persist) { var data = persist.serializeNBT(); @@ -157,11 +147,9 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D return super.getCapability(cap, side); } + @NotNull public IDimensionalBlockPosition getConnectedPosition() { - if (this.connectedMachine == null) - return null; - - return this.connectedMachine.relative(getConnectedSide()); + return this.connectedMachine; } /** @@ -221,8 +209,13 @@ public void setConnectedTo(IDimensionalBlockPosition machine, Direction side) { } @Nullable - public TunnelInstance getTunnel() { - return tunnel; + @SuppressWarnings("unchecked") + public U getTunnel() { + try { + return (U) tunnel; + } catch (ClassCastException ignored) { + return null; + } } public void setInstance(TunnelInstance newTunn) { @@ -230,18 +223,7 @@ public void setInstance(TunnelInstance newTunn) { setChanged(); } - public void disconnect() { - if (level == null || level.isClientSide) { - this.connectedMachine = null; - return; - } - - if (level instanceof ServerLevel compactDim && compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) { - final var tunnelData = TunnelConnectionGraph.forRoom(compactDim, new ChunkPos(worldPosition)); - tunnelData.unregister(worldPosition); - - this.connectedMachine = null; - compactDim.setBlock(worldPosition, Walls.BLOCK_SOLID_WALL.get().defaultBlockState(), Block.UPDATE_ALL); - } + public TunnelPosition getTunnelPosition() { + return new TunnelPosition(worldPosition, getTunnelSide(), getConnectedSide()); } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index b464efd2..c335898b 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -7,6 +7,7 @@ import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; import dev.compactmods.machines.tunnel.definitions.ItemTunnel; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; +import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -54,6 +55,9 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { public static final RegistryObject FORGE_ENERGY = Registries.TUNNEL_DEFINITIONS.register("energy", ForgeEnergyTunnel::new); + public static final RegistryObject REDSTONE_IN = Registries.TUNNEL_DEFINITIONS + .register("redstone_in", RedstoneInTunnelDefinition::new); + // ================================================================================================================ // TUNNEL BLOCKS / TILES // ================================================================================================================ diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java index 253ca6d5..60d0b7b5 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java @@ -8,6 +8,7 @@ import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; +import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.graph.*; @@ -36,7 +37,7 @@ * Represents a room's tunnel connections in a graph-style format. * This should be accessed through the saved data for specific machine room chunks. */ -public class TunnelConnectionGraph extends SavedData implements INBTSerializable { +public class TunnelConnectionGraph extends SavedData implements INBTSerializable, RoomTunnelConnections { /** * The full data graph. Contains tunnel nodes, machine ids, and tunnel type information. @@ -416,14 +417,14 @@ public boolean hasTunnel(BlockPos location) { /** * Fetches the locations of all redstone-enabled tunnels for a specific wallSide. * @param machine - * @param side + * @param facing * @return */ - public Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction side) { + public Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction facing) { final var node = machines.get(machine); if (node == null) return Stream.empty(); - return getTunnelsForSide(machine, side) + return getTunnelsForSide(machine, facing) .filter(sided -> graph.successors(sided).stream() .filter(TunnelTypeNode.class::isInstance) .map(TunnelTypeNode.class::cast) diff --git a/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java b/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java index 8e6c5d92..b9053661 100644 --- a/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java +++ b/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java @@ -4,95 +4,149 @@ import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.phys.AABB; - -import java.util.Arrays; +import net.minecraft.world.phys.Vec3; public class CompactStructureGenerator { - public static AABB getWallBounds(RoomSize size, BlockPos cubeCenter, Direction wall) { - int s = size.getInternalSize() / 2; - + public static AABB getWallBounds(Vec3i size, BlockPos cubeFloor, Direction wall) { BlockPos start; - AABB wallBounds; - - boolean horiz = wall.getAxis().getPlane() == Direction.Plane.HORIZONTAL; - if (horiz) { - start = cubeCenter - .below(s) - .relative(wall, s + 1); - - wallBounds = new AABB(start, start) - .expandTowards(0, (s * 2) + 1, 0); - } else { - start = cubeCenter.relative(wall, s + 1); - - wallBounds = new AABB(start, start) - .inflate(s + 1, 0, s + 1); - } switch (wall) { - case NORTH: - case SOUTH: - wallBounds = wallBounds.inflate(s + 1, 0, 0); - break; - - case WEST: - case EAST: - wallBounds = wallBounds.inflate(0, 0, s + 1); - break; + case NORTH, SOUTH -> { + int offsetNorthSouth = (int) Math.ceil(size.getZ() / 2f); + start = cubeFloor.relative(wall, offsetNorthSouth); + + return new AABB(start, start) + .expandTowards(0, size.getY(), 0) + .inflate(Math.ceil(size.getX() / 2f), 0, 0); + } + + case WEST, EAST -> { + final var offsetWestEast = (int) Math.ceil(size.getX() / 2f); + start = cubeFloor.relative(wall, offsetWestEast); + + return new AABB(start, start) + .expandTowards(0, size.getY(), 0) + .inflate(0, 0, Math.ceil(size.getZ() / 2f)); + } + + case UP, DOWN -> { + start = wall == Direction.DOWN ? cubeFloor : cubeFloor.relative(wall, size.getY()); + var aabb = new AABB(start, start) + .inflate(Math.ceil(size.getX() / 2f), 0, Math.ceil(size.getZ() / 2f)); + + if(wall == Direction.UP) + aabb = aabb.inflate(0, 1, 0); + + return aabb; + } } - return wallBounds; + // catch-all + return AABB.ofSize(Vec3.ZERO, 0, 0, 0); } + /** * Generates a wall or platform in a given direction. * * @param world - * @param size + * @param dimensions * @param cubeCenter * @param wallDirection */ - public static void generateCompactWall(LevelAccessor world, RoomSize size, BlockPos cubeCenter, Direction wallDirection) { + public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, BlockPos cubeCenter, Direction wallDirection) { final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); - final var wallBounds = getWallBounds(size, cubeCenter, wallDirection); + final var wallBounds = getWallBounds(dimensions, cubeCenter, wallDirection); BlockPos.betweenClosedStream(wallBounds) - .filter(world::isEmptyBlock) + // .filter(world::isEmptyBlock) .map(BlockPos::immutable) .forEach(p -> world.setBlock(p, unbreakableWall, 7)); } /** - * Generates a machine "internal" structure in a world via a machine size and a central point. + * Generates a wall or platform in a given direction. * * @param world * @param size - * @param center + * @param cubeFloor + * @param wallDirection */ - public static void generateCompactStructure(LevelAccessor world, RoomSize size, BlockPos center) { - int s = size.getInternalSize() / 2; + @Deprecated(forRemoval = true) + public static void generateCompactWall(LevelAccessor world, RoomSize size, BlockPos cubeFloor, Direction wallDirection) { + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + final var wallBounds = getWallBounds(size.toVec3(), cubeFloor, wallDirection); - BlockPos floorCenter = center.relative(Direction.DOWN, s); - BlockPos machineTopCenter = center.relative(Direction.UP, s); + BlockPos.betweenClosedStream(wallBounds) + .filter(world::isEmptyBlock) + .map(BlockPos::immutable) + .forEach(p -> world.setBlock(p, unbreakableWall, 7)); + } - AABB floorBlocks = new AABB(floorCenter, floorCenter) - .inflate(s, 0, s); - AABB machineInternal = new AABB(machineTopCenter, floorCenter) - .inflate(s, 0, s); + /** + * Generates a machine "internal" structure in a world via a machine size and a central point. + * + * @param world + * @param dimensions Internal dimensions of the room. + * @param cubeFloorCenter + */ + public static void generateCompactStructure(LevelAccessor world, Vec3i dimensions, BlockPos cubeFloorCenter) { + AABB floorBlocks = getWallBounds(dimensions, cubeFloorCenter, Direction.DOWN); + AABB machineInternal = floorBlocks + .move(1, 1, 1) + .contract(2, 0, 2) + .expandTowards(0, dimensions.getY() - 1, 0); boolean anyAir = BlockPos.betweenClosedStream(floorBlocks).anyMatch(world::isEmptyBlock); - if (anyAir) { // Generate the walls - Arrays.stream(Direction.values()) - .forEach(d -> generateCompactWall(world, size, center, d)); + if (anyAir) { + // Generate the walls + for(final var dir : Direction.values()) + generateCompactWall(world, dimensions, cubeFloorCenter, dir); + // Clear out the inside of the room BlockPos.betweenClosedStream(machineInternal) .forEach(p -> world.setBlock(p, Blocks.AIR.defaultBlockState(), 7)); } } + + public static BlockPos cornerFromSize(Vec3i dimensions, BlockPos cubeFloorCenter) { + Vec3i offset = new Vec3i( + -Math.floor(dimensions.getX() / 2f), + 1, + -Math.floor(dimensions.getZ() / 2f) + ); + + return cubeFloorCenter.offset(offset); + } + + /** + * Generates a machine "internal" structure in a world via a machine size and a central point. + * + * @param world + * @param size + * @param cubeFloorCenter + */ + @Deprecated(forRemoval = true) + public static void generateCompactStructure(LevelAccessor world, RoomSize size, BlockPos cubeFloorCenter) { + int s = size.getInternalSize(); + generateCompactStructure(world, new Vec3i(s, s, s), cubeFloorCenter); + } + + public static void fillRoomTemplate(ServerLevel level, ResourceLocation template, Vec3i dimensions, BlockPos cubeFloorCenter) { + level.getStructureManager().get(template).ifPresent(tem -> { + BlockPos placeAt = cornerFromSize(dimensions, cubeFloorCenter); + tem.placeInWorld(level, placeAt, placeAt, new StructurePlaceSettings(), level.random, Block.UPDATE_ALL); + }); + } } diff --git a/src/main/java/dev/compactmods/machines/util/LocationUtil.java b/src/main/java/dev/compactmods/machines/util/LocationUtil.java deleted file mode 100644 index ad7b66d9..00000000 --- a/src/main/java/dev/compactmods/machines/util/LocationUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.compactmods.machines.util; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.phys.Vec3; - -public class LocationUtil { - - public static Vec3 blockPosToVector(BlockPos pos) { - return new Vec3( - pos.getX() + 0.5f, - pos.getY(), - pos.getZ() + 0.5f - ); - } - - public static BlockPos vectorToBlockPos(Vec3 position) { - return new BlockPos(position.x, position.y, position.z); - } -} diff --git a/src/main/java/dev/compactmods/machines/util/MathUtil.java b/src/main/java/dev/compactmods/machines/util/MathUtil.java index f266d1ed..41af0dd6 100644 --- a/src/main/java/dev/compactmods/machines/util/MathUtil.java +++ b/src/main/java/dev/compactmods/machines/util/MathUtil.java @@ -62,9 +62,4 @@ public static BlockPos getCenterWithY(Vec3i regionIndex, int y) { return getCenterWithY(chunk, y); } - public static ChunkPos getChunkForRoomIndex(int roomIndex) { - Vec3i region = getRegionPositionByIndex(roomIndex); - BlockPos roomCenter = getCenterWithY(region, 0); - return new ChunkPos(roomCenter); - } } diff --git a/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index b8a30ab1..1aa3ea22 100644 --- a/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -145,10 +145,10 @@ public static void howDidYouGetThere(@Nonnull ServerPlayer serverPlayer) { public static void teleportPlayerToRespawnOrOverworld(MinecraftServer serv, @Nonnull ServerPlayer player) { ServerLevel level = Optional.ofNullable(serv.getLevel(player.getRespawnDimension())).orElse(serv.overworld()); - Vec3 worldPos = LocationUtil.blockPosToVector(level.getSharedSpawnPos()); + Vec3 worldPos = Vec3.atCenterOf(level.getSharedSpawnPos()); if (player.getRespawnPosition() != null) - worldPos = LocationUtil.blockPosToVector(player.getRespawnPosition()); + worldPos = Vec3.atCenterOf(player.getRespawnPosition()); player.changeDimension(level, SimpleTeleporter.to(worldPos)); } diff --git a/src/test/java/dev/compactmods/machines/test/MathTests.java b/src/test/java/dev/compactmods/machines/test/MathTests.java index 66cc6fb2..f031bc0f 100644 --- a/src/test/java/dev/compactmods/machines/test/MathTests.java +++ b/src/test/java/dev/compactmods/machines/test/MathTests.java @@ -1,7 +1,6 @@ package dev.compactmods.machines.test; -import java.util.HashMap; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.util.MathUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; @@ -11,8 +10,10 @@ import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; +import java.util.HashMap; + @PrefixGameTestTemplate(false) -@GameTestHolder(CompactMachines.MOD_ID) +@GameTestHolder(Constants.MOD_ID) public class MathTests { @GameTest(template = "empty_1x1", batch = TestBatches.MATH) diff --git a/src/test/java/dev/compactmods/machines/test/ServerEvents.java b/src/test/java/dev/compactmods/machines/test/ServerEvents.java index d30c7e8a..7abb243d 100644 --- a/src/test/java/dev/compactmods/machines/test/ServerEvents.java +++ b/src/test/java/dev/compactmods/machines/test/ServerEvents.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.test; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.util.DimensionUtil; import net.minecraft.server.MinecraftServer; @@ -8,7 +9,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -@Mod.EventBusSubscriber(modid = CompactMachines.MOD_ID) +@Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class ServerEvents { @SubscribeEvent diff --git a/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java b/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java index f7f8ac66..1b93f65a 100644 --- a/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java +++ b/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.test.core; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestHelper; @@ -8,7 +9,7 @@ import net.minecraftforge.gametest.PrefixGameTestTemplate; @PrefixGameTestTemplate(false) -@GameTestHolder(CompactMachines.MOD_ID) +@GameTestHolder(Constants.MOD_ID) public class CompactMachinesTests { @GameTest(template = "empty_1x1", batch = TestBatches.CODEC_TESTS) diff --git a/src/test/java/dev/compactmods/machines/test/data/CodecTests.java b/src/test/java/dev/compactmods/machines/test/data/CodecTests.java index aa7bbd7e..098710a4 100644 --- a/src/test/java/dev/compactmods/machines/test/data/CodecTests.java +++ b/src/test/java/dev/compactmods/machines/test/data/CodecTests.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.test.data; import com.mojang.serialization.DataResult; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.codec.CodecExtensions; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; @@ -16,7 +16,7 @@ import net.minecraftforge.gametest.PrefixGameTestTemplate; @PrefixGameTestTemplate(false) -@GameTestHolder(CompactMachines.MOD_ID) +@GameTestHolder(Constants.MOD_ID) public class CodecTests { @GameTest(template = "empty_1x1", batch = TestBatches.CODEC_TESTS) diff --git a/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java b/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java index 6a8ff237..570a2992 100644 --- a/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java +++ b/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.worldgen; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; @@ -9,7 +9,7 @@ import net.minecraftforge.gametest.PrefixGameTestTemplate; @PrefixGameTestTemplate(false) -@GameTestHolder(CompactMachines.MOD_ID) +@GameTestHolder(Constants.MOD_ID) public class DimensionTests { @GameTest(template = "empty_5x5", batch = TestBatches.DIMENSION) diff --git a/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java new file mode 100644 index 00000000..acb42ddd --- /dev/null +++ b/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java @@ -0,0 +1,76 @@ +package dev.compactmods.machines.test.worldgen; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.util.CompactStructureGenerator; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class RoomGenerationTests { + + @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) + public static void checkRoomGeneratorColossal(final GameTestHelper test) { + final var roomDims = new Vec3i(13, 13, 13); + final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + + CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + + test.setBlock(new BlockPos(7, 8, 7), Blocks.GOLD_BLOCK.defaultBlockState()); + CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + new ResourceLocation(Constants.MOD_ID, "template_max"), + roomDims, roomCenter); + + test.succeed(); + } + + @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) + public static void checkRoomGeneratorNormal(final GameTestHelper test) { + final var roomDims = new Vec3i(9, 9, 9); + final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + + CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + + test.setBlock(new BlockPos(7, 5, 7), Blocks.GOLD_BLOCK.defaultBlockState()); + CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + RoomTemplate.NO_TEMPLATE, + roomDims, roomCenter); + + test.succeed(); + } + + @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) + public static void checkRoomGeneratorSmall(final GameTestHelper test) { + final var roomDims = new Vec3i(5, 5, 5); + final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + + CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + + test.setBlock(new BlockPos(7, 4, 7), Blocks.GOLD_BLOCK.defaultBlockState()); + CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + RoomTemplate.NO_TEMPLATE, + roomDims, roomCenter); + + test.succeed(); + } + + @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) + public static void checkRoomGeneratorWeirdShape(final GameTestHelper test) { + final var roomDims = new Vec3i(11, 2, 7); + final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + + CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + + // test.setBlock(new BlockPos(7, 3, 7), Blocks.GOLD_BLOCK.defaultBlockState()); + + test.succeed(); + } +} diff --git a/src/test/resources/data/compactmachines/structures/template_max.nbt b/src/test/resources/data/compactmachines/structures/template_max.nbt new file mode 100644 index 0000000000000000000000000000000000000000..eca07ef720cbb5a7a33a0f06241f12db46b3a848 GIT binary patch literal 225 zcmV<703QDziwFP!00000|BchV4uUWc2k;XrmWq=m#)t3)oShwANvWr4ER@i)`1FE8 zAjFSrazm5fzqwvo0T2Uo`hg(;w6*Fh29AZ-UZaC{#Smr2s=E`-W*tLVTGxjnc&{jg zx%1LvmzbJ>VAvl6og16k!~_Jx2qx<9Mlb=vFoGHP6MQk8aE>6D27`Ct~MH0V9H`H%xU$sA#q>jG6Jul`WhRcSC)wonx|sh(^Hl9~Dg*bLxi%_V*P bkfxR8QF?jC%4u6PE$!h6E53$#X#)TNKDlO} literal 0 HcmV?d00001 From 4e22e6df9c19da0017d982c3e3292043da4c105d Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 7 Sep 2022 11:20:05 -0400 Subject: [PATCH 10/85] Create bug-report-cm5.yml --- .github/ISSUE_TEMPLATE/bug-report-cm5.yml | 77 +++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-report-cm5.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report-cm5.yml b/.github/ISSUE_TEMPLATE/bug-report-cm5.yml new file mode 100644 index 00000000..6f4b7a4e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report-cm5.yml @@ -0,0 +1,77 @@ +name: Bug Report - Compact Machines 5 (1.19) +description: Submit a report for Compact Machines 5 +labels: + - triage + - 1.19 + - bug + - unverified +assignees: [] +body: + - type: markdown + attributes: + value: "*Please do not create an issue if you have not tried fixing it by using the latest version of the mod!*" + + - type: checkboxes + attributes: + label: I am not using performance mods. + description: We request you remove performance mods and try to reproduce your issue before submitting this report. Examples include Optifine, Lithium, Sodium, and BetterFPS. + options: + - label: Confirm + required: true + + - type: textarea + attributes: + label: Description + description: Description of the problem, including expected versus actual behavior. + placeholder: I attempted to do X, but Y happened instead. + validations: + required: true + + - type: markdown + attributes: + value: "## Mod and Forge Versions" + + - type: markdown + attributes: + value: > + *Do not use 'latest' for versions. Be exact; it helps us track down the issue accurately.* + If you need help finding the mod version, check the mods menu, accessible from the Main Menu of the game. + + - type: input + attributes: + label: Mod Version + placeholder: 5.0.0 + validations: + required: true + + - type: input + attributes: + label: Forge Version + placeholder: 1.19.2 - 43.1.0 + validations: + required: true + + - type: markdown + attributes: + value: "## Crash Information" + + - type: input + attributes: + label: Link to Crashlog + placeholder: pastebin/gist/etc. + + - type: textarea + attributes: + label: Screenshot (if available) + description: If you have an image, you can attach it by dragging and dropping it from your file browser to the text area here. + + - type: textarea + attributes: + label: How to reproduce + description: "How do you trigger this bug?" + value: | + 1. + 2. + 3. + validations: + required: true From 3235e927e6ff1b1f83dabd8288a4c4eae60fe9e1 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 24 Sep 2022 20:57:47 -0400 Subject: [PATCH 11/85] Create stale.yml --- .github/stale.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000..77a155c6 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From 74c38571ba417da9591da801101d34002c3267af Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 9 Oct 2022 12:09:36 -0400 Subject: [PATCH 12/85] Update stale.yml --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 77a155c6..29daea6e 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,5 +1,5 @@ # Number of days of inactivity before an issue becomes stale -daysUntilStale: 30 +daysUntilStale: 45 # Number of days of inactivity before a stale issue is closed daysUntilClose: 14 # Issues with these labels will never be considered stale From 26018af307fc62c43155a7dcb768cdafb388e696 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 11:39:23 -0400 Subject: [PATCH 13/85] First build for 5.2.0; handles data migration and new room templates --- build.gradle | 82 ++-- gradle.properties | 3 +- raw-assets/personal_shrinking_device.aseprite | Bin 756 -> 615 bytes .../machines/api/CompactMachinesAddon.java | 7 + .../machines/api/ICompactMachinesAddon.java | 26 ++ .../api/ItemWithNbtRecipeBuilder.java | 84 ++++ .../machines/api/codec/CodecExtensions.java | 31 -- .../machines/api/core/CMRegistries.java | 22 + .../compactmods/machines/api/core/CMTags.java | 4 + .../machines/api/core/Tooltips.java | 1 + .../api/dimension/CompactDimension.java | 33 +- .../dimension/MissingDimensionException.java | 2 +- .../location/IDimensionalBlockPosition.java | 5 + .../api/location/IDimensionalPosition.java | 8 +- .../machines/api/machine/MachineTags.java | 15 + .../machine/ShapedWithNbtRecipeBuilder.java | 131 ++++++ .../recipe/ShapelessRecipeWithNbtResult.java | 84 ++++ .../machines/api/room/IRoomLookup.java | 26 ++ .../machines/api/room/IRoomOwnerLookup.java | 9 + .../machines/api/room/RoomTemplate.java | 16 + .../compactmods/machines/api/room/Rooms.java | 9 +- .../api/room/registration/IBasicRoomInfo.java | 7 + .../IMutableRoomRegistration.java | 9 + .../room/registration/IRoomRegistration.java | 34 ++ .../room/registration/IRoomSpawnLookup.java | 4 + .../upgrade/ILevelLoadedUpgradeListener.java | 6 +- .../api/room/upgrade/RoomUpgrade.java | 6 +- .../api/room/upgrade/RoomUpgradeInstance.java | 5 +- .../machines/api/shrinking/PSDTags.java | 11 + .../machines/api/tunnels/TunnelPosition.java | 7 + .../capability/CapabilityLookupTunnel.java | 15 + .../tunnels/capability/CapabilityTunnel.java | 5 + .../tunnels/recipe/TunnelRecipeBuilder.java | 152 +------ .../machines/datagen/BlockLootGenerator.java | 21 +- .../machines/datagen/DataGeneration.java | 24 +- .../machines/datagen/ItemModelGenerator.java | 4 + .../machines/datagen/RecipeGenerator.java | 48 ++- .../machines/datagen/StateGenerator.java | 51 ++- .../datagen/lang/BaseLangGenerator.java | 5 +- .../datagen/lang/EnglishLangGenerator.java | 19 +- .../machines/datagen/room/RoomTemplates.java | 27 +- .../datagen/tags/BlockTagGenerator.java | 16 +- .../datagen/tags/ItemTagGenerator.java | 29 ++ .../compactmods/machines/CompactMachines.java | 40 ++ .../compactmods/machines/ModDataUpgrader.java | 134 ++++++ .../machines/client/ClientEventHandler.java | 14 + .../machines/client/PlayerFaceRenderer.java | 18 + .../machines/codec/CodecExtensions.java | 51 +++ .../codec/DoubleStreamExtensions.java | 2 +- .../machines}/codec/NbtListCollector.java | 2 +- .../machines/command/Commands.java | 13 +- .../command/argument/RoomCoordinates.java | 21 - .../argument/RoomPositionArgument.java | 51 --- .../data/CMMachineDataExportCommand.java | 12 +- .../command/data/CMRoomDataExportCommand.java | 45 +-- .../data/CMTunnelDataExportCommand.java | 65 +-- .../subcommand/CMGiveMachineSubcommand.java | 40 +- .../subcommand/CMRebindSubcommand.java | 51 ++- .../command/subcommand/CMRoomsSubcommand.java | 54 +-- .../subcommand/CMSummarySubcommand.java | 45 +-- .../subcommand/CMUnbindSubcommand.java | 4 +- .../command/subcommand/SpawnSubcommand.java | 26 +- .../machines/compat/InterModCompat.java | 4 + .../compat/carryon/CarryOnCompat.java | 9 +- .../machines/compat/curios/CuriosCompat.java | 42 ++ .../compat/jei/CompactMachinesJeiPlugin.java | 26 +- .../compat/theoneprobe/TheOneProbeMain.java | 17 + .../elements/PlayerFaceElement.java | 47 +++ .../overrides/CompactMachineNameOverride.java | 18 +- .../providers/CompactMachineProvider.java | 134 +++--- .../machines/core/CompactMachinesNet.java | 1 - .../compactmods/machines/core/Registries.java | 23 +- .../machines/core/ServerEventHandler.java | 33 +- .../machines/core/UIRegistration.java | 2 +- .../migration/EarlyLevelDataFileReader.java | 79 ++++ .../migration/Pre520RoomDataMigrator.java | 168 ++++++++ .../machines/dimension/VoidAirBlock.java | 1 + .../machines/graph/DimensionGraphNode.java | 4 +- .../dev/compactmods/machines/graph/Graph.java | 29 +- .../machines/graph/GraphEdgeType.java | 2 +- .../machines/graph/GraphNodeBase.java | 4 - .../machines/graph/GraphNodeType.java | 30 -- .../machines/graph/IGraphEdge.java | 4 +- .../machines/graph/IGraphEdgeType.java | 4 +- .../machines/graph/IGraphNode.java | 4 +- .../machines/graph/IGraphNodeType.java | 4 +- .../machines/graph/SimpleGraphEdgeType.java | 22 + .../machines/graph/SimpleGraphNodeType.java | 23 ++ .../machines/location/LevelBlockPosition.java | 114 +----- .../location/PreciseDimensionalPosition.java | 56 +-- .../machines/location/SimpleTeleporter.java | 69 +++- .../machines/machine/BasicRoomInfo.java | 6 + .../machine/CompactMachineBlockEntity.java | 262 ------------ .../machines/machine/CompactMachineItem.java | 115 ------ .../machine/LegacySizedTemplates.java | 36 ++ .../machines/machine/Machines.java | 45 ++- .../machine/block/CompactMachineBlock.java | 99 +++++ .../block/CompactMachineBlockEntity.java | 382 ++++++++++++++++++ .../LegacySizedCompactMachineBlock.java} | 219 ++++------ .../machine/block/MachineBlockUtil.java | 150 +++++++ .../machine/client/MachineColors.java | 25 ++ .../machine/data/MachineDataTagBuilder.java | 89 ++++ .../machine/graph/DimensionMachineGraph.java | 81 ++-- .../machine/graph/MachineRoomEdge.java | 2 +- .../machine/item/BoundCompactMachineItem.java | 96 +++++ .../machine/item/CompactMachineItem.java | 29 ++ .../item/LegacyCompactMachineItem.java | 63 +++ .../item/UnboundCompactMachineItem.java | 117 ++++++ .../room/MutableRoomRegistration.java | 92 +++++ .../machines/room/RoomCodeGenerator.java | 16 + .../machines/room/RoomEventHandler.java | 21 +- .../dev/compactmods/machines/room/Rooms.java | 331 ++++++--------- .../room/capability/CMRoomHistory.java | 3 +- .../room/client/MachineRoomScreen.java | 143 ++++--- .../room/client/RoomClientHelper.java | 14 + .../machines/room/data/CompactRoomData.java | 306 -------------- .../room/data/CopyRoomBindingFunction.java | 19 +- .../machines/room/data/RoomPreview.java | 2 +- .../exceptions/NonexistentRoomException.java | 8 +- .../room/graph/CompactMachineRoomNode.java | 35 -- .../room/graph/CompactRoomProvider.java | 335 +++++++++++++++ .../machines/room/graph/NewRoomBuilder.java | 67 +++ .../machines/room/graph/RoomChunkNode.java | 19 + .../machines/room/graph/RoomMetadataNode.java | 93 +++++ .../machines/room/graph/RoomOwnerEdge.java | 16 + .../machines/room/graph/RoomOwnerNode.java | 27 ++ .../room/graph/RoomReferenceNode.java | 33 ++ .../machines/room/graph/RoomSpawnNode.java | 23 ++ .../machines/room/menu/MachineRoomMenu.java | 30 +- .../PlayerRequestedTeleportPacket.java | 27 +- .../PlayerStartedRoomTrackingPacket.java | 30 +- .../room/network/RoomNetworkHandler.java | 2 +- .../shrinking/PersonalShrinkingDevice.java | 16 +- .../machines/tunnel/TunnelItem.java | 11 +- .../machines/tunnel/TunnelWallBlock.java | 84 ++-- .../machines/tunnel/TunnelWallEntity.java | 30 +- .../compactmods/machines/tunnel/Tunnels.java | 33 +- .../tunnel/graph/TunnelConnectionGraph.java | 67 +-- .../tunnel/graph/TunnelMachineEdge.java | 2 +- .../tunnel/graph/TunnelMachineInfo.java | 4 +- .../machines/tunnel/graph/TunnelNode.java | 46 +-- .../machines/tunnel/graph/TunnelTypeEdge.java | 2 +- .../machines/tunnel/graph/TunnelTypeNode.java | 8 +- .../machines/upgrade/ChunkloadUpgrade.java | 29 +- .../machines/upgrade/RoomUpgradeManager.java | 31 +- .../upgrade/command/CMUpgradeRoomCommand.java | 75 ++-- .../upgrade/command/RoomUpgradeArgument.java | 4 +- .../upgrade/graph/RoomUpgradeConnection.java | 2 +- .../upgrade/graph/UpgradeConnectionEntry.java | 6 +- .../util/CompactStructureGenerator.java | 62 +-- .../machines/util/DimensionUtil.java | 32 ++ .../compactmods/machines/util/NbtUtil.java | 15 + .../compactmods/machines/util/PlayerUtil.java | 106 +++-- .../machines/util/SavedDataHelper.java | 22 + .../textures/block/machine/border.png | Bin 0 -> 140 bytes .../block/machine/e x/machine_giant.png | Bin 3389 -> 0 bytes .../block/machine/e x/machine_large.png | Bin 3321 -> 0 bytes .../block/machine/e x/machine_maximum.png | Bin 3295 -> 0 bytes .../block/machine/e x/machine_normal.png | Bin 3427 -> 0 bytes .../block/machine/e x/machine_small.png | Bin 3326 -> 0 bytes .../block/machine/e x/machine_tiny.png | Bin 3399 -> 0 bytes .../textures/block/machine/overlay.png | Bin 0 -> 451 bytes .../textures/block/machine/tint.png | Bin 0 -> 126 bytes .../textures/curios/empty_psd.png | Bin 0 -> 246 bytes .../textures/item/room_core.png | Bin 0 -> 421 bytes .../machines/test/GameTestEventHandler.java | 18 + .../machines/test/TestBatches.java | 1 + .../machines/test/crossmod/Mekanism.java | 18 + .../machines/test/data/CodecTests.java | 2 +- .../test/migrators/EarlyFileLoaderTests.java | 37 ++ .../RoomInfoPre520MigratorTests.java | 46 +++ .../machines/test/util/FileHelper.java | 24 +- .../test/worldgen/RoomGenerationTests.java | 23 +- .../structures/mekanism/empty_1x1.nbt | Bin 0 -> 125 bytes .../resources/migrate/pre520/connections.dat | Bin 0 -> 106 bytes src/test/resources/migrate/pre520/level.dat | Bin 0 -> 57825 bytes .../resources/migrate/pre520/level.dat_old | Bin 0 -> 57825 bytes .../resources/migrate/pre520/machines.dat | Bin 0 -> 150 bytes .../resources/migrate/pre520/room_data.dat | Bin 0 -> 179 bytes .../migrate/pre520/tunnels_0_-64.dat | Bin 0 -> 314 bytes .../machines/tunnel/BuiltinTunnels.java | 51 +++ ...temTunnel.java => BufferedItemTunnel.java} | 9 +- .../tunnel/definitions/FluidTunnel.java | 6 +- .../tunnel/definitions/ForgeEnergyTunnel.java | 6 +- .../tunnel/definitions/SmartItemTunnel.java | 40 ++ 185 files changed, 4820 insertions(+), 2420 deletions(-) create mode 100644 src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java create mode 100644 src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java create mode 100644 src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java delete mode 100644 src/api/java/dev/compactmods/machines/api/codec/CodecExtensions.java create mode 100644 src/api/java/dev/compactmods/machines/api/core/CMRegistries.java rename src/{main/java/dev/compactmods/machines => api/java/dev/compactmods/machines/api}/dimension/MissingDimensionException.java (85%) create mode 100644 src/api/java/dev/compactmods/machines/api/machine/MachineTags.java create mode 100644 src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java create mode 100644 src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java create mode 100644 src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java create mode 100644 src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java create mode 100644 src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java create mode 100644 src/main/java/dev/compactmods/machines/ModDataUpgrader.java create mode 100644 src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java create mode 100644 src/main/java/dev/compactmods/machines/codec/CodecExtensions.java rename src/{api/java/dev/compactmods/machines/api => main/java/dev/compactmods/machines}/codec/DoubleStreamExtensions.java (97%) rename src/{api/java/dev/compactmods/machines/api => main/java/dev/compactmods/machines}/codec/NbtListCollector.java (96%) delete mode 100644 src/main/java/dev/compactmods/machines/command/argument/RoomCoordinates.java delete mode 100644 src/main/java/dev/compactmods/machines/command/argument/RoomPositionArgument.java create mode 100644 src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java create mode 100644 src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java create mode 100644 src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java create mode 100644 src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java delete mode 100644 src/main/java/dev/compactmods/machines/graph/GraphNodeBase.java delete mode 100644 src/main/java/dev/compactmods/machines/graph/GraphNodeType.java create mode 100644 src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java create mode 100644 src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java create mode 100644 src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java delete mode 100644 src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java delete mode 100644 src/main/java/dev/compactmods/machines/machine/CompactMachineItem.java create mode 100644 src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java create mode 100644 src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java create mode 100644 src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java rename src/main/java/dev/compactmods/machines/machine/{CompactMachineBlock.java => block/LegacySizedCompactMachineBlock.java} (58%) create mode 100644 src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java create mode 100644 src/main/java/dev/compactmods/machines/machine/client/MachineColors.java create mode 100644 src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java create mode 100644 src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java create mode 100644 src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java create mode 100644 src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java create mode 100644 src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java create mode 100644 src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java create mode 100644 src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java create mode 100644 src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java delete mode 100644 src/main/java/dev/compactmods/machines/room/data/CompactRoomData.java delete mode 100644 src/main/java/dev/compactmods/machines/room/graph/CompactMachineRoomNode.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java create mode 100644 src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java create mode 100644 src/main/java/dev/compactmods/machines/util/NbtUtil.java create mode 100644 src/main/java/dev/compactmods/machines/util/SavedDataHelper.java create mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/border.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_giant.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_large.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_maximum.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_normal.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_small.png delete mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_tiny.png create mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/overlay.png create mode 100644 src/main/resources/assets/compactmachines/textures/block/machine/tint.png create mode 100644 src/main/resources/assets/compactmachines/textures/curios/empty_psd.png create mode 100644 src/main/resources/assets/compactmachines/textures/item/room_core.png create mode 100644 src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java create mode 100644 src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java create mode 100644 src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java create mode 100644 src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java create mode 100644 src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt create mode 100644 src/test/resources/migrate/pre520/connections.dat create mode 100644 src/test/resources/migrate/pre520/level.dat create mode 100644 src/test/resources/migrate/pre520/level.dat_old create mode 100644 src/test/resources/migrate/pre520/machines.dat create mode 100644 src/test/resources/migrate/pre520/room_data.dat create mode 100644 src/test/resources/migrate/pre520/tunnels_0_-64.dat create mode 100644 src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java rename src/tunnels/java/dev/compactmods/machines/tunnel/definitions/{ItemTunnel.java => BufferedItemTunnel.java} (91%) create mode 100644 src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java diff --git a/build.gradle b/build.gradle index 625c0d9b..4464ef9a 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle' def semver = System.getenv("CM_SEMVER_VERSION") def buildNumber = System.getenv("CM_BUILD_NUM") -def nightlyVersion = "${semver}.${buildNumber}" +def nightlyVersion = "nightly-${semver}.${buildNumber}" def isRelease = (System.getenv("CM_RELEASE") ?: "false").equalsIgnoreCase("true") task getBuildInfo() { @@ -46,14 +46,6 @@ sourceSets { compileClasspath += configurations.getByName("minecraft") } - datagen { - compileClasspath += configurations.getByName("minecraft") - compileClasspath += sourceSets.api.output - runtimeClasspath += sourceSets.api.output - compileClasspath += sourceSets.main.output - runtimeClasspath += sourceSets.main.output - } - tunnels { compileClasspath += configurations.getByName("minecraft") compileClasspath += sourceSets.api.output @@ -83,6 +75,16 @@ sourceSets { compileClasspath += sourceSets.api.output runtimeClasspath += sourceSets.api.output } + + datagen { + compileClasspath += configurations.getByName("minecraft") + compileClasspath += sourceSets.tunnels.output + runtimeClasspath += sourceSets.tunnels.output + compileClasspath += sourceSets.api.output + runtimeClasspath += sourceSets.api.output + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + } } println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) @@ -176,8 +178,6 @@ minecraft { jvmArg '-XX:HotswapAgent=fatjar' } - forceExit false - mods { compactmachines { source sourceSets.tunnels @@ -208,6 +208,8 @@ minecraft { forceExit false + environment("CM5_TEST_RESOURCES", file('src/test/resources')) + // JetBrains Runtime Hotswap jvmArg '-XX:+AllowEnhancedClassRedefinition' jvmArg '-XX:HotswapAgent=fatjar' @@ -249,8 +251,15 @@ repositories { name "tterrag maven" url "https://maven.tterrag.com/" } + + maven { + url = "https://maven.theillusivec4.top/" + } + + mavenCentral() } +jarJar.enable(); dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. @@ -258,13 +267,24 @@ dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" // JEI - compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}") - compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}") - runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}") + if(jei_version != null) { + compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}") + compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}") + runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}") + } // The One Probe implementation(fg.deobf("curse.maven:theoneprobe-245211:3927520")) + // Curios + if(curios_version != null) { + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") + compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") + } + + minecraftLibrary(group: 'com.aventrix.jnanoid', name: 'jnanoid', version: '2.0.0') + jarJar (group: 'com.aventrix.jnanoid', name: 'jnanoid', version: '[2.0.0]') + if (!System.getenv().containsKey("CI") && include_test_mods.equals("true")) { // Nicephore - Screenshots and Stuff runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3879841")) @@ -320,13 +340,26 @@ compileDatagenJava { options.encoding = 'UTF-8' } +// FIXME: Remove once https://github.com/MinecraftForge/ForgeGradle/issues/883 is closed +reobf { + jarJar { } +} + +tasks.withType(Jar) { + destinationDirectory = file("$rootDir/build-out") +} + +tasks.jarJar.configure { + classifier '' +} + jar { from sourceSets.tunnels.output from sourceSets.main.output from sourceSets.api.output - destinationDirectory = file("$rootDir/build-out") finalizedBy('reobfJar') + classifier 'slim' manifest { attributes([ @@ -344,8 +377,7 @@ jar { task apiJar(type: Jar) { from sourceSets.api.output // Sources included because of MinecraftForge/ForgeGradle#369 - archiveClassifier = 'api' - destinationDirectory = file("$rootDir/build-out") + classifier 'api' } artifacts { @@ -360,21 +392,7 @@ publishing { artifacts { artifact jar - artifact(apiJar) { - classifier = "api" - } - } - } - - nightly(MavenPublication) { - artifactId = mod_id - groupId = "dev.compactmods.nightly" - - artifacts { - artifact(jar) - artifact(apiJar) { - classifier = "api" - } + artifact(apiJar) } } } diff --git a/gradle.properties b/gradle.properties index 2439531c..4db64bb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false minecraft_version=1.19.2 -forge_version=43.0.8 +forge_version=43.1.15 parchment_version=2022.08.10-1.19.2 mod_id=compactmachines @@ -13,6 +13,7 @@ mod_id=compactmachines jei_mc_version=1.19.2 jei_version=11.2.0.247 #top_version=1.16-3.1.4-22 +curios_version=1.19.2-5.1.1.0 # Curseforge cf_project=224218 diff --git a/raw-assets/personal_shrinking_device.aseprite b/raw-assets/personal_shrinking_device.aseprite index 1c5752f9da9a92105d43250a026ee0e741de4e1f..bee07c4128c792e347dde3a5aaf5d5fe0387030f 100644 GIT binary patch delta 303 zcmeyu`kaM3or!_r!BR#B0S1AI+@-wF85tOUePm}yVPIfjpV+%Y5-1G^N+3Z7pTx@4 zA_c?A_Kb4%MkPQYRs{wICI&`^|8TWD4EzigbCMGh5;%By|N5)2t+uWEV-YB^jQ_~9 zj#US`-FH<59Tsj`d#1TFj6aC`@QGg&k9L^;KhVg`a+g1NbM5akgT0lX)0+O>-IU7R zb?eKQ61Iq0$}NdmjE8q`KUW5}lM!fV4n9lM92RvReDSLwsq;z|&)3Sz%7~8vf&N|f zjx|mak+vKSZ|?1@wPx09SR;3HuYv80q!X_kYi3yZ*!J)qe(}yR%=?6G3qzEZvRSSX J(7uae+yIqHW(EKN delta 451 zcmaFP@`aWA3ljswgQbiN4Gawvxl4IVfZSgnSs79o7#LV5_U@RR!YEO1IE@j=Q(#~a zVBlc*4^#mG2@Dks6?5KR-I&{Az|a!+vR!+BbV5TIE9OG$0MdsVRU__$YC$NznN zjJ@wmM8UC2!pNwf4UFV~7D@ssH~?d7L-yt-ZZ1x9;2DTuHE&^%v@2 z?v(-QtzYne&AQiVwj1k9{QtxQjh8a}cl}#@b^qe`<&FQIoSt8w`f>k;|Kii{t#bhY Dk1GeT diff --git a/src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java b/src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java new file mode 100644 index 00000000..4613a482 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java @@ -0,0 +1,7 @@ +package dev.compactmods.machines.api; + +/** + * Registers an instance of {@link ICompactMachinesAddon} for use in getting api interfaces. + */ +public @interface CompactMachinesAddon { +} diff --git a/src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java b/src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java new file mode 100644 index 00000000..0d6583c4 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java @@ -0,0 +1,26 @@ +package dev.compactmods.machines.api; + +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import net.minecraftforge.eventbus.api.IEventBus; + +import java.util.function.Supplier; + +public interface ICompactMachinesAddon { + + default void prepare() { + // no-op + } + + default void afterRegistration(IEventBus bus) { + // no-op + } + + default void acceptRoomOwnerLookup(Supplier ownerLookup) { + // Implement and store supplier for room owner lookups + } + + default void acceptRoomSpawnLookup(Supplier spawnLookup) { + // Implement and store supplier for spawn lookups + } +} diff --git a/src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java b/src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java new file mode 100644 index 00000000..195c0d6d --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java @@ -0,0 +1,84 @@ +package dev.compactmods.machines.api; + +import com.google.common.collect.Lists; +import com.google.gson.JsonObject; +import dev.compactmods.machines.api.recipe.ShapelessRecipeWithNbtResult; +import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeHelper; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.advancements.RequirementsStrategy; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; + +import java.util.List; +import java.util.function.Consumer; + +public abstract class ItemWithNbtRecipeBuilder { + protected ResourceLocation recipeId; + protected final List ingredients = Lists.newArrayList(); + protected final Advancement.Builder advancement = Advancement.Builder.advancement(); + protected String group; + protected int count; + + public T requires(ItemLike item) { + return this.requires(Ingredient.of(item)); + } + + public T requires(Ingredient ingredient) { + this.ingredients.add(ingredient); + return (T) this; + } + + public T unlockedBy(String criterionName, CriterionTriggerInstance crit) { + this.advancement.addCriterion(criterionName, crit); + return (T) this; + } + + public T group(String groupName) { + this.group = groupName; + return (T) this; + } + + protected abstract void addExtraData(JsonObject root); + + public void save(Consumer consumer) { + this.ensureValid(recipeId); + this.advancement + .parent(new ResourceLocation("recipes/root")) + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(TunnelRecipeHelper.getRecipeId(recipeId))) + .rewards(AdvancementRewards.Builder.recipe(recipeId)) + .requirements(RequirementsStrategy.OR); + + consumer.accept(new ShapelessRecipeWithNbtResult( + (T) this, + this.advancement, + new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath()), + this::addExtraData + )); + } + + private void ensureValid(ResourceLocation recipeId) { + if (this.advancement.getCriteria().isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + recipeId); + } + } + + public abstract ResourceLocation outputItemId(); + public abstract ResourceLocation outputRecipeId(); + + public int count() { + return this.count; + } + + public String group() { + return this.group; + } + + public List ingredients() { + return this.ingredients; + } +} diff --git a/src/api/java/dev/compactmods/machines/api/codec/CodecExtensions.java b/src/api/java/dev/compactmods/machines/api/codec/CodecExtensions.java deleted file mode 100644 index 10fea87f..00000000 --- a/src/api/java/dev/compactmods/machines/api/codec/CodecExtensions.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.compactmods.machines.api.codec; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import net.minecraft.Util; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.Vec3; - -import java.util.UUID; -import java.util.stream.DoubleStream; -import java.util.stream.IntStream; - -public abstract class CodecExtensions { - public static final Codec UUID_CODEC = Codec.STRING - .comapFlatMap((s) -> { - try { - return DataResult.success(UUID.fromString(s)); - } catch (Exception ex) { - return DataResult.error("Not a valid UUID: " + s + " (" + ex.getMessage() + ")"); - } - }, UUID::toString).stable(); - - public static final Codec VECTOR3D = DoubleStreamExtensions.CODEC - .comapFlatMap(i -> DoubleStreamExtensions.fixedDoubleSize(i, 3) - .map(out -> new Vec3(out[0], out[1], out[2])), vec -> DoubleStream.of(vec.x, vec.y, vec.z)); - - public static final Codec CHUNKPOS = Codec.INT_STREAM - .comapFlatMap(i -> Util.fixedSize(i, 2) - .map(arr -> new ChunkPos(arr[0], arr[1])), pos -> IntStream.of(pos.x, pos.z)); - -} diff --git a/src/api/java/dev/compactmods/machines/api/core/CMRegistries.java b/src/api/java/dev/compactmods/machines/api/core/CMRegistries.java new file mode 100644 index 00000000..6c56d742 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/core/CMRegistries.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.api.core; + +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; + +import static dev.compactmods.machines.api.core.Constants.MOD_ID; + +public class CMRegistries { + + public static final ResourceKey> TYPES_REG_KEY = ResourceKey + .createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); + + public static ResourceKey> TEMPLATE_REG_KEY = + ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); + + public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey + .createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); +} diff --git a/src/api/java/dev/compactmods/machines/api/core/CMTags.java b/src/api/java/dev/compactmods/machines/api/core/CMTags.java index 95800750..36784eec 100644 --- a/src/api/java/dev/compactmods/machines/api/core/CMTags.java +++ b/src/api/java/dev/compactmods/machines/api/core/CMTags.java @@ -1,11 +1,15 @@ package dev.compactmods.machines.api.core; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public abstract class CMTags { public static final TagKey ROOM_UPGRADE_ITEM = ItemTags.create(new ResourceLocation(Constants.MOD_ID, "room_upgrade")); + public static final TagKey MACHINE_ITEM = ItemTags.create(new ResourceLocation(Constants.MOD_ID, "machine")); + public static final TagKey MACHINE_BLOCK = BlockTags.create(new ResourceLocation(Constants.MOD_ID, "machine")); } diff --git a/src/api/java/dev/compactmods/machines/api/core/Tooltips.java b/src/api/java/dev/compactmods/machines/api/core/Tooltips.java index b18233c6..db8a3eed 100644 --- a/src/api/java/dev/compactmods/machines/api/core/Tooltips.java +++ b/src/api/java/dev/compactmods/machines/api/core/Tooltips.java @@ -10,6 +10,7 @@ public abstract class Tooltips { public static final ResourceLocation ROOM_NAME = new ResourceLocation(Constants.MOD_ID, "room_name"); public static final ResourceLocation ROOM_UPGRADE_TYPE = new ResourceLocation(Constants.MOD_ID, "room_upgrade_type"); public static final ResourceLocation TUTORIAL_APPLY_ROOM_UPGRADE = new ResourceLocation(Constants.MOD_ID, "tutorial_apply_room_upgrade"); + public static final ResourceLocation CRAFT_TO_UPGRADE = new ResourceLocation(Constants.MOD_ID, "craft_machine_to_upgrade"); public static abstract class Machines { public static final ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id"); diff --git a/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java index 60a436f6..b89ff8fe 100644 --- a/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java +++ b/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java @@ -5,9 +5,13 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.datafix.DataFixers; import net.minecraft.world.level.Level; import net.minecraft.world.level.dimension.DimensionType; -import org.jetbrains.annotations.Nullable; +import net.minecraft.world.level.storage.DimensionDataStorage; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraftforge.server.ServerLifecycleHooks; +import org.jetbrains.annotations.NotNull; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -20,8 +24,29 @@ public abstract class CompactDimension { private CompactDimension() {} - @Nullable - public static ServerLevel forServer(MinecraftServer server) { - return server.getLevel(LEVEL_KEY); + @NotNull + public static ServerLevel forCurrentServer() throws MissingDimensionException { + final var server = ServerLifecycleHooks.getCurrentServer(); + final var level = server.getLevel(LEVEL_KEY); + if(level == null) + throw new MissingDimensionException(); + + return level; + } + + @NotNull + public static ServerLevel forServer(MinecraftServer server) throws MissingDimensionException { + final var level = server.getLevel(LEVEL_KEY); + if(level == null) + throw new MissingDimensionException(); + + return level; + } + + @NotNull + public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.LevelDirectory levelDir) { + final var dimPath = DimensionType.getStorageFolder(CompactDimension.LEVEL_KEY, levelDir.path()); + final var fixer = DataFixers.getDataFixer(); + return new DimensionDataStorage(dimPath.resolve("data").toFile(), fixer); } } diff --git a/src/main/java/dev/compactmods/machines/dimension/MissingDimensionException.java b/src/api/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java similarity index 85% rename from src/main/java/dev/compactmods/machines/dimension/MissingDimensionException.java rename to src/api/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java index 606d2189..99e4f311 100644 --- a/src/main/java/dev/compactmods/machines/dimension/MissingDimensionException.java +++ b/src/api/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.dimension; +package dev.compactmods.machines.api.dimension; public class MissingDimensionException extends Throwable { public MissingDimensionException() { diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java b/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java index 929fd7a0..78c38b9e 100644 --- a/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java +++ b/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java @@ -3,11 +3,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import java.util.Optional; + public interface IDimensionalBlockPosition extends IDimensionalPosition { BlockPos getBlockPosition(); + Optional getBlockEntity(MinecraftServer server); + BlockState state(MinecraftServer server); IDimensionalBlockPosition relative(Direction direction); diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java index c4ed1b17..801ed3c5 100644 --- a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java +++ b/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java @@ -6,16 +6,12 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -import java.util.Optional; - public interface IDimensionalPosition { - Vec3 getExactPosition(); + Vec3 position(); - ResourceKey dimensionKey(); + ResourceKey dimension(); ServerLevel level(MinecraftServer server); - Optional getRotation(); - boolean isLoaded(MinecraftServer serv); } diff --git a/src/api/java/dev/compactmods/machines/api/machine/MachineTags.java b/src/api/java/dev/compactmods/machines/api/machine/MachineTags.java new file mode 100644 index 00000000..d1e07dcd --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/machine/MachineTags.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.api.machine; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public interface MachineTags { + + TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + +} diff --git a/src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java b/src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java new file mode 100644 index 00000000..f2138b4d --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java @@ -0,0 +1,131 @@ +package dev.compactmods.machines.api.machine; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.JsonObject; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.CriterionTriggerInstance; +import net.minecraft.advancements.RequirementsStrategy; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +public class ShapedWithNbtRecipeBuilder implements RecipeBuilder { + private final Item result; + private String group; + private final int count; + private final List rows = Lists.newArrayList(); + private final Map key = Maps.newLinkedHashMap(); + private Advancement.Builder advancement; + + private List> additionalNbtWriters = Lists.newArrayList(); + + public ShapedWithNbtRecipeBuilder(ItemLike pResult, int pCount) { + this.result = pResult.asItem(); + this.count = pCount; + this.advancement = Advancement.Builder.advancement(); + } + + public static ShapedWithNbtRecipeBuilder shaped(ItemLike out) { + return new ShapedWithNbtRecipeBuilder(out, 1); + } + + public ShapedWithNbtRecipeBuilder advancement(Advancement.Builder adv) { + this.advancement = adv; + return this; + } + + public ShapedWithNbtRecipeBuilder addWriter(Consumer writer) { + this.additionalNbtWriters.add(writer); + return this; + } + + protected void addResultNbt(JsonObject itemTag) { + additionalNbtWriters.forEach(c -> c.accept(itemTag)); + } + + @Override + public RecipeBuilder unlockedBy(String criterion, CriterionTriggerInstance trigger) { + return this; + } + + @Override + public RecipeBuilder group(@Nullable String newGroup) { + this.group = newGroup; + return this; + } + + public ShapedWithNbtRecipeBuilder define(Character pSymbol, TagKey pTag) { + return this.define(pSymbol, Ingredient.of(pTag)); + } + + public ShapedWithNbtRecipeBuilder define(Character pSymbol, ItemLike pItem) { + return this.define(pSymbol, Ingredient.of(pItem)); + } + + public ShapedWithNbtRecipeBuilder define(Character pSymbol, Ingredient pIngredient) { + if (this.key.containsKey(pSymbol)) { + throw new IllegalArgumentException("Symbol '" + pSymbol + "' is already defined!"); + } else if (pSymbol == ' ') { + throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); + } else { + this.key.put(pSymbol, pIngredient); + return this; + } + } + + public ShapedWithNbtRecipeBuilder pattern(String pPattern) { + if (!this.rows.isEmpty() && pPattern.length() != this.rows.get(0).length()) { + throw new IllegalArgumentException("Pattern must be the same width on every line!"); + } else { + this.rows.add(pPattern); + return this; + } + } + + @Override + public Item getResult() { + return this.result; + } + + @Override + public void save(Consumer pFinishedRecipeConsumer, ResourceLocation pRecipeId) { + this.advancement.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) + .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) + .requirements(RequirementsStrategy.OR); + + pFinishedRecipeConsumer.accept(new ShapedWithNbtRecipeBuilder.Result(this, pRecipeId, this.result, this.count, + this.group == null ? "" : this.group, + this.rows, this.key, + this.advancement, + new ResourceLocation(pRecipeId.getNamespace(), "recipes/" + this.result.getItemCategory().getRecipeFolderName() + "/" + pRecipeId.getPath()))); + } + + public static class Result extends ShapedRecipeBuilder.Result { + + private final ShapedWithNbtRecipeBuilder builder; + + public Result(ShapedWithNbtRecipeBuilder builder, ResourceLocation pId, Item pResult, int pCount, String pGroup, List pPattern, Map pKey, Advancement.Builder pAdvancement, ResourceLocation pAdvancementId) { + super(pId, pResult, pCount, pGroup, pPattern, pKey, pAdvancement, pAdvancementId); + this.builder = builder; + } + + @Override + public void serializeRecipeData(JsonObject pJson) { + super.serializeRecipeData(pJson); + this.builder.addResultNbt(pJson.getAsJsonObject("result")); + } + } +} diff --git a/src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java b/src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java new file mode 100644 index 00000000..192d0d40 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java @@ -0,0 +1,84 @@ +package dev.compactmods.machines.api.recipe; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import dev.compactmods.machines.api.ItemWithNbtRecipeBuilder; +import net.minecraft.advancements.Advancement; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.function.Consumer; + +public class ShapelessRecipeWithNbtResult implements FinishedRecipe { + private final int count; + private final String group; + private final List ingredients; + private final Advancement.Builder advancement; + private final ResourceLocation advancementId; + private final Consumer additionalNbtProvider; + private final T builder; + + public ShapelessRecipeWithNbtResult(T builder, Advancement.Builder adv, ResourceLocation advId, + Consumer additionalNbtProvider) { + this.builder = builder; + this.count = builder.count(); + this.group = builder.group() != null ? builder.group() : ""; + this.ingredients = builder.ingredients(); + this.advancement = adv; + this.advancementId = advId; + this.additionalNbtProvider = additionalNbtProvider; + } + + @Override + public void serializeRecipeData(JsonObject output) { + if (this.group != null && !this.group.isEmpty()) { + output.addProperty("group", this.group); + } + + JsonArray jsonarray = new JsonArray(); + + for (Ingredient ingredient : this.ingredients) { + jsonarray.add(ingredient.toJson()); + } + + output.add("ingredients", jsonarray); + + JsonObject result = new JsonObject(); + result.addProperty("item", builder.outputItemId().toString()); + if (this.count > 1) { + result.addProperty("count", this.count); + } + + JsonObject nbt = new JsonObject(); + additionalNbtProvider.accept(nbt); + result.add("nbt", nbt); + + output.add("result", result); + } + + @Override + public ResourceLocation getId() { + return builder.outputRecipeId(); + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.SHAPELESS_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return this.advancement.serializeToJson(); + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return this.advancementId; + } +} diff --git a/src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java b/src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java new file mode 100644 index 00000000..31d1c893 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java @@ -0,0 +1,26 @@ +package dev.compactmods.machines.api.room; + +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import net.minecraft.world.level.ChunkPos; + +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Stream; + +public interface IRoomLookup { + + Stream findByOwner(UUID owner); + + Optional findByMachine(IDimensionalBlockPosition machine); + + Optional forRoom(String room); + + Optional findByChunk(ChunkPos chunk); + + boolean isRoomChunk(ChunkPos chunk); + + long count(); + + Stream allRooms(); +} diff --git a/src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java b/src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java new file mode 100644 index 00000000..c8757e6e --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.api.room; + +import java.util.Optional; +import java.util.UUID; + +public interface IRoomOwnerLookup { + + Optional getRoomOwner(String roomCode); +} diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java b/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java index a85ceda2..92956886 100644 --- a/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java +++ b/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java @@ -6,6 +6,8 @@ import net.minecraft.core.Vec3i; import net.minecraft.resources.ResourceLocation; +import java.util.Objects; + /** * Template structure for creating a new Compact Machine room. These can be added and removed from the registry * at any point, so persistent data must be stored outside these instances. @@ -17,6 +19,7 @@ public record RoomTemplate(Vec3i dimensions, int color, ResourceLocation prefillTemplate) { public static final ResourceLocation NO_TEMPLATE = new ResourceLocation(Constants.MOD_ID, "empty"); + public static final RoomTemplate INVALID_TEMPLATE = new RoomTemplate(0, 0); public static Codec CODEC = RecordCodecBuilder.create(i -> i.group( Vec3i.CODEC.fieldOf("dimensions").forGetter(RoomTemplate::dimensions), @@ -27,4 +30,17 @@ public record RoomTemplate(Vec3i dimensions, int color, ResourceLocation prefill public RoomTemplate(int cubicSize, int color) { this(new Vec3i(cubicSize, cubicSize, cubicSize), color, NO_TEMPLATE); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RoomTemplate that = (RoomTemplate) o; + return color == that.color && Objects.equals(dimensions, that.dimensions); + } + + @Override + public int hashCode() { + return Objects.hash(dimensions, color); + } } diff --git a/src/api/java/dev/compactmods/machines/api/room/Rooms.java b/src/api/java/dev/compactmods/machines/api/room/Rooms.java index 9266018d..874cbf82 100644 --- a/src/api/java/dev/compactmods/machines/api/room/Rooms.java +++ b/src/api/java/dev/compactmods/machines/api/room/Rooms.java @@ -1,18 +1,13 @@ package dev.compactmods.machines.api.room; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.CMRegistries; import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; public class Rooms { - public static ResourceKey> TEMPLATE_REG_KEY = - ResourceKey.createRegistryKey(new ResourceLocation(Constants.MOD_ID, "room_templates")); - public static Registry getTemplates(MinecraftServer server) { final var regAccess = server.registryAccess(); - return regAccess.registryOrThrow(TEMPLATE_REG_KEY); + return regAccess.registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); } } diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java b/src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java new file mode 100644 index 00000000..82fee69d --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java @@ -0,0 +1,7 @@ +package dev.compactmods.machines.api.room.registration; + +public interface IBasicRoomInfo { + String code(); + + int color(); +} diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java b/src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java new file mode 100644 index 00000000..61687806 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.api.room.registration; + +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +public interface IMutableRoomRegistration extends IRoomRegistration { + IMutableRoomRegistration setSpawnPosition(Vec3 spawnPosition); + IMutableRoomRegistration setSpawnRotation(Vec2 spawnRotation); +} diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java b/src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java new file mode 100644 index 00000000..c3ab2029 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java @@ -0,0 +1,34 @@ +package dev.compactmods.machines.api.room.registration; + +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import net.minecraft.core.Vec3i; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Stream; + +public interface IRoomRegistration extends IBasicRoomInfo { + + Vec3i dimensions(); + + UUID owner(IRoomOwnerLookup lookup); + + Vec3 center(); + + AABB innerBounds(); + + AABB outerBounds(); + + Vec3 spawnPosition(IRoomSpawnLookup spawns); + + Vec2 spawnRotation(IRoomSpawnLookup spawns); + + Optional getTemplate(); + + Stream chunks(); +} diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java b/src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java new file mode 100644 index 00000000..3431bc59 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.api.room.registration; + +public interface IRoomSpawnLookup { +} diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java b/src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java index ded9f8b6..4b690cc8 100644 --- a/src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java +++ b/src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java @@ -1,18 +1,18 @@ package dev.compactmods.machines.api.room.upgrade; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; public interface ILevelLoadedUpgradeListener extends RoomUpgrade { /** * Called when a level is loaded, typically when the server first boots up. */ - default void onLevelLoaded(ServerLevel level, ChunkPos room) {} + default void onLevelLoaded(ServerLevel level, IRoomRegistration room) {} /** * Called when a level is unloaded. */ - default void onLevelUnloaded(ServerLevel level, ChunkPos room) {} + default void onLevelUnloaded(ServerLevel level, IRoomRegistration room) {} } diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java b/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java index 1180fa5e..9bb46183 100644 --- a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java +++ b/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java @@ -1,11 +1,11 @@ package dev.compactmods.machines.api.room.upgrade; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ChunkPos; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -26,10 +26,10 @@ default String getTranslationKey(ItemStack stack) { /** * Called when an upgrade is first applied to a room. */ - default void onAdded(ServerLevel level, ChunkPos room) {} + default void onAdded(ServerLevel level, IRoomRegistration room) {} /** * Called when an update is removed from a room. */ - default void onRemoved(ServerLevel level, ChunkPos room) {} + default void onRemoved(ServerLevel level, IRoomRegistration room) {} } diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java b/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java index cad3bcca..4f353089 100644 --- a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java +++ b/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java @@ -1,6 +1,3 @@ package dev.compactmods.machines.api.room.upgrade; -import net.minecraft.world.level.ChunkPos; - -public record RoomUpgradeInstance(T upgrade, ChunkPos room) { -} +public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file diff --git a/src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java b/src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java new file mode 100644 index 00000000..74a4c923 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java @@ -0,0 +1,11 @@ +package dev.compactmods.machines.api.shrinking; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; + +public interface PSDTags { + TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "shrinking_device")); +} diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java b/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java index 6b90d1aa..7d7dc435 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java @@ -3,6 +3,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +/** + * Tunnel position information, for the tunnel placed inside a machine room. + * + * @param pos Absolute position inside the Compact dimension. + * @param wallSide Side of the wall the tunnel is on. + * @param machineSide Side of the machine the tunnel connects to. + */ public record TunnelPosition(BlockPos pos, Direction wallSide, Direction machineSide) { } diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java b/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java new file mode 100644 index 00000000..eb9c01b5 --- /dev/null +++ b/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.api.tunnels.capability; + +import com.google.common.collect.ImmutableSet; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.tunnels.TunnelPosition; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; + +public interface CapabilityLookupTunnel { + + ImmutableSet> getSupportedCapabilities(); + + > LazyOptional findCapability(MinecraftServer server, TunnelPosition tunnelPosition, IDimensionalBlockPosition connectedPosition); +} diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java b/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java index c6803c31..da45985a 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java @@ -7,6 +7,11 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; +/** + * + * @param + * @deprecated Prefer new capability lookup tunnel instead + */ public interface CapabilityTunnel extends InstancedTunnel { ImmutableSet> getSupportedCapabilities(); diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java b/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java index 30939171..5ec35315 100644 --- a/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java +++ b/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java @@ -1,38 +1,28 @@ package dev.compactmods.machines.api.tunnels.recipe; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import dev.compactmods.machines.api.ItemWithNbtRecipeBuilder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; -import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; import net.minecraftforge.registries.RegistryObject; -import javax.annotation.Nullable; -import java.util.List; -import java.util.function.Consumer; - -public class TunnelRecipeBuilder { - - private final List ingredients = Lists.newArrayList(); - private final Advancement.Builder advancement = Advancement.Builder.advancement(); - private String group; - private int count; - private ResourceLocation tunnelType; +public class TunnelRecipeBuilder extends ItemWithNbtRecipeBuilder { private TunnelRecipeBuilder(RegistryObject definition, int count) { - this.tunnelType = definition.getId(); + this.recipeId = definition.getId(); this.count = count; } + @Override + public ResourceLocation outputItemId() { + return TunnelDefinition.TUNNEL_ID; + } + + @Override + public ResourceLocation outputRecipeId() { + return TunnelRecipeHelper.getRecipeId(this.recipeId); + } + public static TunnelRecipeBuilder tunnel(RegistryObject definition) { return new TunnelRecipeBuilder(definition, 1); } @@ -42,119 +32,15 @@ public static TunnelRecipeBuilder tunnel(RegistryObject defini } public TunnelRecipeBuilder setType(ResourceLocation id) { - this.tunnelType = id; - return this; - } - - public TunnelRecipeBuilder requires(ItemLike item) { - return this.requires(Ingredient.of(item)); - } - - public TunnelRecipeBuilder requires(Ingredient ingredient) { - this.ingredients.add(ingredient); - return this; - } - - public TunnelRecipeBuilder unlockedBy(String criterionName, CriterionTriggerInstance crit) { - this.advancement.addCriterion(criterionName, crit); - return this; - } - - public TunnelRecipeBuilder group(String groupName) { - this.group = groupName; + this.recipeId = id; return this; } - public void save(Consumer consumer) { - this.ensureValid(tunnelType); - this.advancement - .parent(new ResourceLocation("recipes/root")) - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(TunnelRecipeHelper.getRecipeId(tunnelType))) - .rewards(AdvancementRewards.Builder.recipe(tunnelType)) - .requirements(RequirementsStrategy.OR); - - consumer.accept(new TunnelRecipeBuilder.Result( - this.tunnelType, - this.count, - this.group == null ? "" : this.group, this.ingredients, - this.advancement, - new ResourceLocation(tunnelType.getNamespace(), "recipes/" + tunnelType.getPath()) - )); - } - - private void ensureValid(ResourceLocation recipeId) { - if (this.advancement.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + recipeId); - } + @Override + protected void addExtraData(JsonObject root) { + JsonObject definition = new JsonObject(); + definition.addProperty("id", this.recipeId.toString()); + root.add("definition", definition); } - public static class Result implements FinishedRecipe { - private final ResourceLocation tunnelType; - private final int count; - private final String group; - private final List ingredients; - private final Advancement.Builder advancement; - private final ResourceLocation advancementId; - - public Result(ResourceLocation tunnelType, int count, String group, List ingredients, Advancement.Builder adv, ResourceLocation advId) { - this.tunnelType = tunnelType; - this.count = count; - this.group = group; - this.ingredients = ingredients; - this.advancement = adv; - this.advancementId = advId; - } - - @Override - public void serializeRecipeData(JsonObject output) { - if (!this.group.isEmpty()) { - output.addProperty("group", this.group); - } - - JsonArray jsonarray = new JsonArray(); - - for(Ingredient ingredient : this.ingredients) { - jsonarray.add(ingredient.toJson()); - } - - output.add("ingredients", jsonarray); - - JsonObject result = new JsonObject(); - result.addProperty("item", TunnelDefinition.TUNNEL_ID.toString()); - if (this.count > 1) { - result.addProperty("count", this.count); - } - - JsonObject definition = new JsonObject(); - definition.addProperty("id", this.tunnelType.toString()); - JsonObject nbt = new JsonObject(); - nbt.add("definition", definition); - - result.add("nbt", nbt); - - output.add("result", result); - } - - @Override - public ResourceLocation getId() { - return TunnelRecipeHelper.getRecipeId(tunnelType); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.SHAPELESS_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return this.advancement.serializeToJson(); - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return this.advancementId; - } - } } \ No newline at end of file diff --git a/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java index 53118ec3..717ea908 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java @@ -9,7 +9,6 @@ import net.minecraft.data.loot.BlockLoot; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.LootTable; @@ -56,21 +55,24 @@ protected void addTables() { .add(LootItem.lootTableItem(Walls.ITEM_BREAKABLE_WALL.get())))); // Compact Machines - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_TINY, Machines.MACHINE_BLOCK_ITEM_TINY); - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_SMALL, Machines.MACHINE_BLOCK_ITEM_SMALL); - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_NORMAL, Machines.MACHINE_BLOCK_ITEM_NORMAL); - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_LARGE, Machines.MACHINE_BLOCK_ITEM_LARGE); - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_GIANT, Machines.MACHINE_BLOCK_ITEM_GIANT); - registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_MAXIMUM, Machines.MACHINE_BLOCK_ITEM_MAXIMUM); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK); + + // Legacy Machines + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_TINY); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_SMALL); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_NORMAL); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_LARGE); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_GIANT); + registerCompactMachineBlockDrops(Machines.MACHINE_BLOCK_MAXIMUM); } - private void registerCompactMachineBlockDrops(RegistryObject block, RegistryObject item) { + private void registerCompactMachineBlockDrops(RegistryObject block) { LootPool.Builder builder = LootPool.lootPool() .name(block.getId().toString()) .setRolls(ConstantValue.exactly(1)) .when(ExplosionCondition.survivesExplosion()) .apply(CopyRoomBindingFunction.binding()) - .add(LootItem.lootTableItem(item.get())); + .add(LootItem.lootTableItem(Machines.BOUND_MACHINE_BLOCK_ITEM.get())); this.add(block.get(), LootTable.lootTable().withPool(builder)); } @@ -82,6 +84,7 @@ protected Iterable getKnownBlocks() { Walls.BLOCK_BREAKABLE_WALL.get(), // Compact Machines + Machines.MACHINE_BLOCK.get(), Machines.MACHINE_BLOCK_TINY.get(), Machines.MACHINE_BLOCK_SMALL.get(), Machines.MACHINE_BLOCK_NORMAL.get(), diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java b/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java index 7c98b46c..3dbcd52e 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java @@ -19,23 +19,25 @@ public static void gatherData(GatherDataEvent event) { final var generator = event.getGenerator(); // Server - generator.addProvider(event.includeServer(), new LevelBiomeGenerator(generator)); - generator.addProvider(event.includeServer(), new BlockLootGenerator(generator)); - generator.addProvider(event.includeServer(), new RecipeGenerator(generator)); - generator.addProvider(event.includeServer(), new AdvancementGenerator(generator)); + boolean server = event.includeServer(); + generator.addProvider(server, new LevelBiomeGenerator(generator)); + generator.addProvider(server, new BlockLootGenerator(generator)); + generator.addProvider(server, new RecipeGenerator(generator)); + generator.addProvider(server, new AdvancementGenerator(generator)); final var blocks = new BlockTagGenerator(generator, helper); - generator.addProvider(event.includeServer(), blocks); - generator.addProvider(event.includeServer(), new ItemTagGenerator(generator, blocks, helper)); + generator.addProvider(server, blocks); + generator.addProvider(server, new ItemTagGenerator(generator, blocks, helper)); RoomTemplates.make(event); // Client - generator.addProvider(event.includeClient(), new StateGenerator(generator, helper)); - generator.addProvider(event.includeClient(), new TunnelWallStateGenerator(generator, helper)); - generator.addProvider(event.includeClient(), new ItemModelGenerator(generator, helper)); + boolean client = event.includeClient(); + generator.addProvider(client, new StateGenerator(generator, helper)); + generator.addProvider(client, new TunnelWallStateGenerator(generator, helper)); + generator.addProvider(client, new ItemModelGenerator(generator, helper)); - generator.addProvider(event.includeClient(), new EnglishLangGenerator(generator)); - generator.addProvider(event.includeClient(), new RussianLangGenerator(generator)); + generator.addProvider(client, new EnglishLangGenerator(generator)); + generator.addProvider(client, new RussianLangGenerator(generator)); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java index f2665fef..f9e37269 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.ItemModelProvider; @@ -18,6 +19,9 @@ protected void registerModels() { for (var size : RoomSize.values()) machine(size.getSerializedName()); + withExistingParent(Machines.BOUND_MACHINE_BLOCK_ITEM.getId().getPath(), modLoc("block/machine/machine")); + withExistingParent(Machines.UNBOUND_MACHINE_BLOCK_ITEM.getId().getPath(), modLoc("block/machine/machine")); + withExistingParent("solid_wall", modLoc("block/wall")); withExistingParent("wall", modLoc("block/wall")); diff --git a/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 1baa86c5..6844b499 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -1,26 +1,27 @@ package dev.compactmods.machines.datagen; +import com.google.gson.JsonObject; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.machine.ShapedWithNbtRecipeBuilder; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; -import dev.compactmods.machines.config.EnableVanillaRecipesConfigCondition; +import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.tunnel.BuiltinTunnels; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.Tags; -import net.minecraftforge.common.crafting.ConditionalRecipe; -import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.NotNull; -import java.util.Objects; import java.util.function.Consumer; public class RecipeGenerator extends RecipeProvider { @@ -49,7 +50,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("picked_up_ender_eye", RecipeProvider.has(Items.ENDER_EYE)) .save(consumer); - TunnelRecipeBuilder.tunnel(Tunnels.ITEM_TUNNEL_DEF, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.ITEM_TUNNEL_DEF, 2) .requires(Ingredient.of(Tags.Items.CHESTS)) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -57,7 +58,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", RecipeProvider.has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(Tunnels.FLUID_TUNNEL_DEF, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.FLUID_TUNNEL_DEF, 2) .requires(Items.BUCKET) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -65,7 +66,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", RecipeProvider.has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(Tunnels.FORGE_ENERGY, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.FORGE_ENERGY, 2) .requires(Items.GLOWSTONE_DUST) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -77,17 +78,17 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) } private void addMachineRecipes(Consumer consumer) { - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_TINY.get(), Tags.Items.STORAGE_BLOCKS_COPPER); - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_SMALL.get(), Tags.Items.STORAGE_BLOCKS_IRON); - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_NORMAL.get(), Tags.Items.STORAGE_BLOCKS_GOLD); - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_GIANT.get(), Tags.Items.STORAGE_BLOCKS_DIAMOND); - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_LARGE.get(), Tags.Items.OBSIDIAN); - registerMachineRecipe(consumer, Machines.MACHINE_BLOCK_ITEM_MAXIMUM.get(), Tags.Items.STORAGE_BLOCKS_NETHERITE); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_TINY, Tags.Items.STORAGE_BLOCKS_COPPER); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_SMALL, Tags.Items.STORAGE_BLOCKS_IRON); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_NORMAL, Tags.Items.STORAGE_BLOCKS_GOLD); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_LARGE, Tags.Items.STORAGE_BLOCKS_DIAMOND); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_GIANT, Tags.Items.OBSIDIAN); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_COLOSSAL, Tags.Items.STORAGE_BLOCKS_NETHERITE); } - protected void registerMachineRecipe(Consumer consumer, ItemLike out, TagKey center) { + protected void registerMachineRecipe(Consumer consumer, LegacySizedTemplates template, TagKey center) { Item wall = Walls.ITEM_BREAKABLE_WALL.get(); - ShapedRecipeBuilder recipe = ShapedRecipeBuilder.shaped(out) + ShapedWithNbtRecipeBuilder recipe = ShapedWithNbtRecipeBuilder.shaped(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get()) .pattern("WWW"); if (center != null) @@ -100,10 +101,15 @@ protected void registerMachineRecipe(Consumer consumer, ItemLike recipe.define('C', center); recipe.unlockedBy("has_recipe", RecipeProvider.has(wall)); + recipe.addWriter(r -> { + final var nbt = new JsonObject(); + MachineDataTagBuilder.forTemplate(template.id(), template.template()) + .writeToItemJson(nbt) + .writeToBlockDataJson(nbt); + r.add("nbt", nbt); + }); - ConditionalRecipe.builder() - .addCondition(new EnableVanillaRecipesConfigCondition()) - .addRecipe(recipe::save) - .build(consumer, Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(out.asItem()))); + final var recipeId = new ResourceLocation(Constants.MOD_ID, "new_machine_" + template.id().getPath()); + recipe.save(consumer, recipeId); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java index 27d16036..b9a3dc41 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java @@ -2,9 +2,11 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.machine.CompactMachineBlock; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; +import net.minecraftforge.client.model.generators.BlockModelProvider; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.common.data.ExistingFileHelper; @@ -17,19 +19,50 @@ public StateGenerator(DataGenerator gen, ExistingFileHelper exFileHelper) { @Override protected void registerStatesAndModels() { // Wall block model - var wall = models().cubeAll("block/wall", modLoc("block/wall")); + BlockModelProvider models = models(); + + var wall = models.cubeAll("block/wall", modLoc("block/wall")); simpleBlock(Walls.BLOCK_SOLID_WALL.get(), wall); simpleBlock(Walls.BLOCK_BREAKABLE_WALL.get(), wall); - // Machine models - for(RoomSize size : RoomSize.values()) { - String sizeName = size.getName(); + // New machine block + final var m = models + .withExistingParent("block/machine/machine", mcLoc("block/block")) + .texture("border", modLoc("block/machine/border")) + .texture("tint", modLoc("block/machine/tint")) + .texture("overlay", modLoc("block/machine/overlay")) + .renderType(mcLoc("cutout_mipped_all")) + .element() + .allFaces((dir, face) -> face.texture("#border") + .uvs(0, 0, 16, 16) + .cullface(dir) + .end()) + .end() + .element() + .allFaces((dir, face) -> face.texture("#tint") + .emissivity(2) + .uvs(0, 0, 16, 16) + .cullface(dir) + .tintindex(0) + .end()) + .end() + .element() + .allFaces((dir, face) -> face.texture("#overlay") + .uvs(0, 0, 16, 16) + .cullface(dir) + .tintindex(1) + .end()) + .end(); - var mod = models() - .cubeAll("block/machine/machine_" + sizeName, modLoc("block/machine/machine_" + sizeName)); + simpleBlock(Machines.MACHINE_BLOCK.get(), ConfiguredModel.builder() + .modelFile(m) + .build()); - simpleBlock(CompactMachineBlock.getBySize(size), ConfiguredModel.builder() - .modelFile(mod) + // Legacy-sized machines + for (RoomSize size : RoomSize.values()) { + String sizeName = size.getName(); + simpleBlock(LegacySizedCompactMachineBlock.getBySize(size), ConfiguredModel.builder() + .modelFile(models.cubeAll("block/machine/machine_" + sizeName, modLoc("block/machine/machine_" + sizeName))) .build()); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java index 7a38eaeb..f28584ca 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java @@ -7,7 +7,7 @@ import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.datagen.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineBlock; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; @@ -41,8 +41,9 @@ protected String getMachineTranslation() { @Override protected void addTranslations() { // Machine Block names + final var machineTranslation = getMachineTranslation(); for(var size : RoomSize.values()) { - add(CompactMachineBlock.getBySize(size), String.format("%s (%s)", getMachineTranslation(), getSizeTranslation(size))); + add(LegacySizedCompactMachineBlock.getBySize(size), "%s (%s)".formatted(machineTranslation, getSizeTranslation(size))); } // Direction Names diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 5bdba4ed..471b8e5c 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -8,6 +8,7 @@ import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.dimension.VoidAirBlock; import dev.compactmods.machines.shrinking.Shrinking; +import dev.compactmods.machines.tunnel.BuiltinTunnels; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.wall.Walls; @@ -24,6 +25,14 @@ public EnglishLangGenerator(DataGenerator gen) { protected void addTranslations() { super.addTranslations(); + final var machineTranslation = getMachineTranslation(); + add("machine.compactmachines.tiny", "%s (%s)".formatted(machineTranslation, "Tiny")); + add("machine.compactmachines.small", "%s (%s)".formatted(machineTranslation, "Small")); + add("machine.compactmachines.normal", "%s (%s)".formatted(machineTranslation, "Normal")); + add("machine.compactmachines.large", "%s (%s)".formatted(machineTranslation, "Large")); + add("machine.compactmachines.giant", "%s (%s)".formatted(machineTranslation, "Giant")); + add("machine.compactmachines.colossal", "%s (%s)".formatted(machineTranslation, "Colossal")); + addMessage(Messages.CANNOT_ENTER_MACHINE, "You fumble with the shrinking device, to no avail. It refuses to work."); addMessage(Messages.NO_MACHINE_DATA, "No machine data loaded; report this."); addMessage(Messages.ROOM_SPAWNPOINT_SET, "New spawn point set."); @@ -49,7 +58,7 @@ protected void addTranslations() { addCommand(CMCommands.LEVEL_REGISTERED, "Compact Machine dimension found."); addCommand(CMCommands.LEVEL_NOT_FOUND, "Compact Machine dimension could not be found."); addCommand(CMCommands.ROOM_NOT_FOUND, "Room [%s] could not be found."); - addCommand(CMCommands.SPAWN_CHANGED_SUCCESSFULLY, "Spawnpoint for room [%s] was changed successfully."); + addCommand(CMCommands.SPAWN_CHANGED_SUCCESSFULLY, "Spawn point for room [%s] was changed successfully."); addAdvancementTranslations(); @@ -64,9 +73,9 @@ protected void addTranslations() { add(RoomUpgrade.UNNAMED_TRANS_KEY, "Unnamed Room Upgrade"); - addTunnel(Tunnels.ITEM_TUNNEL_DEF, "Item Tunnel"); - addTunnel(Tunnels.FLUID_TUNNEL_DEF, "Fluid Tunnel"); - addTunnel(Tunnels.FORGE_ENERGY, "Energy Tunnel"); + addTunnel(BuiltinTunnels.ITEM_TUNNEL_DEF, "Item Tunnel"); + addTunnel(BuiltinTunnels.FLUID_TUNNEL_DEF, "Fluid Tunnel"); + addTunnel(BuiltinTunnels.FORGE_ENERGY, "Energy Tunnel"); // addTunnel(Tunnels.REDSTONE_IN_DEF.get(), "Redstone Tunnel (In)"); // addTunnel(Tunnels.REDSTONE_OUT_DEF.get(), "Redstone Tunnel (Out)"); @@ -121,6 +130,8 @@ protected void addTranslations() { add("jei.compactmachines.shrinking_device", "Use the Personal Shrinking Device (PSD) on a machine in order to enter a compact space. " + "You can also right click it in the overworld for more info."); add("death.attack." + VoidAirBlock.DAMAGE_SOURCE.msgId, "%1$s failed to enter the void"); + + add("curios.identifier.psd", "Personal Shrinking Device"); } @Override diff --git a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java index fe0df48d..61b41069 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java @@ -1,9 +1,12 @@ package dev.compactmods.machines.datagen.room; import com.mojang.serialization.JsonOps; +import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.machine.LegacySizedTemplates; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.Vec3i; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FastColor; @@ -15,20 +18,18 @@ public class RoomTemplates { public static void make(GatherDataEvent event) { - final var tiny = new RoomTemplate(3, FastColor.ARGB32.color(255, 201, 91, 19)); - final var small = new RoomTemplate(5, FastColor.ARGB32.color(255, 212, 210, 210)); - final var normal = new RoomTemplate(7, FastColor.ARGB32.color(255, 251, 242, 54)); - final var large = new RoomTemplate(9, FastColor.ARGB32.color(255, 33, 27, 46)); - final var giant = new RoomTemplate(11, FastColor.ARGB32.color(255, 67, 214, 205)); - final var max = new RoomTemplate(13, FastColor.ARGB32.color(255, 66, 63, 66)); final var templates = new HashMap(); - templates.put(new ResourceLocation(Constants.MOD_ID, "tiny"), tiny); - templates.put(new ResourceLocation(Constants.MOD_ID, "small"), small); - templates.put(new ResourceLocation(Constants.MOD_ID, "normal"), normal); - templates.put(new ResourceLocation(Constants.MOD_ID, "large"), large); - templates.put(new ResourceLocation(Constants.MOD_ID, "giant"), giant); - templates.put(new ResourceLocation(Constants.MOD_ID, "maximum"), max); + templates.put(new ResourceLocation(Constants.MOD_ID, "tiny"), LegacySizedTemplates.EMPTY_TINY.template()); + templates.put(new ResourceLocation(Constants.MOD_ID, "small"), LegacySizedTemplates.EMPTY_SMALL.template()); + templates.put(new ResourceLocation(Constants.MOD_ID, "normal"), LegacySizedTemplates.EMPTY_NORMAL.template()); + templates.put(new ResourceLocation(Constants.MOD_ID, "large"), LegacySizedTemplates.EMPTY_LARGE.template()); + templates.put(new ResourceLocation(Constants.MOD_ID, "giant"), LegacySizedTemplates.EMPTY_GIANT.template()); + templates.put(new ResourceLocation(Constants.MOD_ID, "colossal"), LegacySizedTemplates.EMPTY_COLOSSAL.template()); + + templates.put(new ResourceLocation(Constants.MOD_ID, "weird"), new RoomTemplate(new Vec3i(42, 69, 12), + FastColor.ARGB32.color(255, 0, 166, 88), + RoomTemplate.NO_TEMPLATE)); final var ops = RegistryOps.create(JsonOps.INSTANCE, RegistryAccess.builtinCopy()); @@ -36,7 +37,7 @@ public static void make(GatherDataEvent event) { final var files = event.getExistingFileHelper(); final var provider = JsonCodecProvider.forDatapackRegistry(gen, files, - Constants.MOD_ID, ops, dev.compactmods.machines.api.room.Rooms.TEMPLATE_REG_KEY, templates); + Constants.MOD_ID, ops, CMRegistries.TEMPLATE_REG_KEY, templates); gen.addProvider(event.includeServer(), provider); } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java index a5c2ee62..c4bf33e5 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java @@ -1,11 +1,14 @@ package dev.compactmods.machines.datagen.tags; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.block.Block; import net.minecraftforge.common.data.ExistingFileHelper; import java.util.Set; @@ -18,13 +21,15 @@ public BlockTagGenerator(DataGenerator generator, ExistingFileHelper files) { @Override public void addTags() { - var machines = Set.of(Machines.MACHINE_BLOCK_TINY.get(), + var legacySizedMachines = Set.of(Machines.MACHINE_BLOCK_TINY.get(), Machines.MACHINE_BLOCK_SMALL.get(), Machines.MACHINE_BLOCK_NORMAL.get(), Machines.MACHINE_BLOCK_LARGE.get(), Machines.MACHINE_BLOCK_GIANT.get(), Machines.MACHINE_BLOCK_MAXIMUM.get()); + var legacyMachines = tag(LegacySizedCompactMachineBlock.LEGACY_MACHINES_TAG); + var allMachines = tag(CMTags.MACHINE_BLOCK); var pickaxe = tag(BlockTags.MINEABLE_WITH_PICKAXE); var ironTool = tag(BlockTags.NEEDS_IRON_TOOL); @@ -32,9 +37,16 @@ public void addTags() { pickaxe.add(breakableWall); ironTool.add(breakableWall); - machines.forEach(mach -> { + legacySizedMachines.forEach(mach -> { + legacyMachines.add(mach); + allMachines.add(mach); pickaxe.add(mach); ironTool.add(mach); }); + + Block machine = Machines.MACHINE_BLOCK.get(); + allMachines.add(machine); + pickaxe.add(machine); + ironTool.add(machine); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java index 3b629bff..1eede3a8 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java @@ -2,13 +2,21 @@ import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.shrinking.PSDTags; +import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; import net.minecraftforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; +import java.util.Set; + public class ItemTagGenerator extends ItemTagsProvider { public ItemTagGenerator(DataGenerator gen, BlockTagsProvider blockTags, @Nullable ExistingFileHelper files) { super(gen, blockTags, Constants.MOD_ID, files); @@ -17,7 +25,28 @@ public ItemTagGenerator(DataGenerator gen, BlockTagsProvider blockTags, @Nullabl @Override protected void addTags() { var upgradeTag = tag(CMTags.ROOM_UPGRADE_ITEM); + var machinesTag = tag(CMTags.MACHINE_ITEM); + + var legacySizedMachines = Set.of(Machines.MACHINE_BLOCK_ITEM_TINY.get(), + Machines.MACHINE_BLOCK_ITEM_SMALL.get(), + Machines.MACHINE_BLOCK_ITEM_NORMAL.get(), + Machines.MACHINE_BLOCK_ITEM_LARGE.get(), + Machines.MACHINE_BLOCK_ITEM_GIANT.get(), + Machines.MACHINE_BLOCK_ITEM_MAXIMUM.get()); + + var boundMachineItem = Machines.BOUND_MACHINE_BLOCK_ITEM.get(); + var unboundMachineItem = Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(); + + legacySizedMachines.forEach(machinesTag::add); + machinesTag.add(boundMachineItem); + machinesTag.add(unboundMachineItem); upgradeTag.add(MachineRoomUpgrades.CHUNKLOADER.get()); + + final var psd = Shrinking.PERSONAL_SHRINKING_DEVICE.get(); + final var curiosPsdTag = tag(TagKey.create(Registries.ITEMS.getRegistryKey(), new ResourceLocation("curios", "psd"))); + final var cmShrinkTag = tag(PSDTags.ITEM); + curiosPsdTag.add(psd); + cmShrinkTag.add(psd); } } diff --git a/src/main/java/dev/compactmods/machines/CompactMachines.java b/src/main/java/dev/compactmods/machines/CompactMachines.java index 4ae1ff77..9da57d7e 100644 --- a/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -1,5 +1,7 @@ package dev.compactmods.machines; +import dev.compactmods.machines.api.CompactMachinesAddon; +import dev.compactmods.machines.api.ICompactMachinesAddon; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.config.CommonConfig; @@ -19,16 +21,22 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; +import org.objectweb.asm.Type; import javax.annotation.Nonnull; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; @Mod(Constants.MOD_ID) public class CompactMachines { @@ -40,6 +48,7 @@ public class CompactMachines { public static final Logger LOGGER = LogManager.getLogger(); public static final Marker CONN_MARKER = MarkerManager.getMarker("cm_connections"); + public static final Marker ADDON_LIFECYCLE = MarkerManager.getMarker("addons"); public static final CreativeModeTab COMPACT_MACHINES_ITEMS = new CreativeModeTab(Constants.MOD_ID) { @Override @@ -49,6 +58,8 @@ ItemStack makeIcon() { } }; + private static Set loadedAddons; + public CompactMachines() { Registries.setup(); preparePackages(); @@ -79,6 +90,31 @@ private static void doRegistration() { Registries.EDGE_TYPES.register(bus); Registries.COMMAND_ARGUMENT_TYPES.register(bus); Registries.LOOT_FUNCS.register(bus); + + + CompactMachines.loadedAddons = ModList.get() + .getAllScanData() + .stream() + .flatMap(scans -> scans.getAnnotations() + .stream() + .filter(ad -> ad.annotationType().equals(Type.getType(CompactMachinesAddon.class))) + .map(ModFileScanData.AnnotationData::memberName) + .map(cmAddonClass -> { + try { + final var cl = Class.forName(cmAddonClass); + final var cla = cl.asSubclass(ICompactMachinesAddon.class); + return cla.getDeclaredConstructor().newInstance(); + } catch (Exception e) { + return null; + } + }) + .filter(Objects::nonNull)) + .collect(Collectors.toSet()); + + CompactMachines.loadedAddons.forEach(addon -> { + LOGGER.debug(ADDON_LIFECYCLE, "Sending registration hook to addon: {}", addon.getClass().getName()); + addon.afterRegistration(bus); + }); } private static void preparePackages() { @@ -96,4 +132,8 @@ private static void preparePackages() { Commands.prepare(); LootFunctions.prepare(); } + + public static Set getAddons() { + return loadedAddons; + } } diff --git a/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/src/main/java/dev/compactmods/machines/ModDataUpgrader.java new file mode 100644 index 00000000..c22ca9b9 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/ModDataUpgrader.java @@ -0,0 +1,134 @@ +package dev.compactmods.machines; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; +import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraftforge.event.ModMismatchEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import org.apache.commons.io.file.PathUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.jetbrains.annotations.Nullable; + +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; +import java.time.format.SignStyle; +import java.time.temporal.ChronoField; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class ModDataUpgrader { + + private static final Logger UPDATER_LOGGER = LogManager.getLogger(Constants.MOD_ID); + private static final Marker UPDATER = MarkerManager.getMarker("pre520_data_updater"); + + static final DateTimeFormatter DATETIME_FORMAT = new DateTimeFormatterBuilder() + .appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD) + .appendLiteral('-') + .appendValue(ChronoField.MONTH_OF_YEAR, 2) + .appendLiteral('-') + .appendValue(ChronoField.DAY_OF_MONTH, 2) + .appendLiteral('_') + .appendValue(ChronoField.HOUR_OF_DAY, 2) + .appendLiteral('-') + .appendValue(ChronoField.MINUTE_OF_HOUR, 2) + .appendLiteral('-') + .appendValue(ChronoField.SECOND_OF_MINUTE, 2) + .toFormatter(); + + @SubscribeEvent + public static void onUpgrade(final ModMismatchEvent mismatch) { + mismatch.getVersionDifference(Constants.MOD_ID).ifPresent(versions -> { + // If we're migrating from a version pre-5.2.0 (1.19.2) + if (versions.oldVersion().compareTo(new DefaultArtifactVersion("5.2.0")) < 0) { + // do upgrade + try { + ModDataUpgrader.doUpgrade(mismatch.getLevelDirectory()); + } catch (IOException e) { + CompactMachines.LOGGER.fatal("Exception occurred while trying to upgrade world data.", e); + } + } + }); + } + + public static void doUpgrade(@Nullable LevelStorageSource.LevelDirectory levelDirectory) throws IOException { + if (levelDirectory != null) { + final var dataStore = CompactDimension.getDataStorage(levelDirectory); + final var backupDir = levelDirectory.path().resolve("cm5_backup"); + + final var earlyFileReader = new EarlyLevelDataFileReader(levelDirectory); + + Files.deleteIfExists(backupDir); + Files.createDirectories(backupDir); + + var oldData = Pre520RoomDataMigrator.loadOldRoomData(dataStore); + + if (oldData.oldRoomData().isEmpty()) { + UPDATER_LOGGER.info(UPDATER, "No room data found to update. Exiting early."); + return; + } + + Pre520RoomDataMigrator.makeRoomDataBackup(dataStore, backupDir); + if(!dataStore.getDataFile(Pre520RoomDataMigrator.ROOM_DATA_NAME).delete()) + UPDATER_LOGGER.warn(UPDATER, "Failed to remove original room data file after backup; things might get weird."); + + final var roomChunkLookup = oldData.roomChunkLookup(); + + Pre520RoomDataMigrator.addMissingRoomEntries(dataStore, CompactRoomProvider.empty(), oldData); + + UPDATER_LOGGER.debug(UPDATER, "Updating room data for {} rooms.", roomChunkLookup.size()); + + final var levels = earlyFileReader.dimensions(); + Pre520RoomDataMigrator.migrateConnectionInfo(levelDirectory, roomChunkLookup, levels, backupDir); + + Pre520RoomDataMigrator.migrateTunnelFiles(levelDirectory, roomChunkLookup, backupDir); + + makeBackupZip(levelDirectory.path().resolve("cm520-data-backup-%s.zip".formatted(LocalDateTime.now().format(DATETIME_FORMAT))), backupDir); + PathUtils.delete(backupDir); + } + } + + + private static void makeBackupZip(Path destinationFile, Path backupDir) throws IOException { + final ZipOutputStream zipoutputstream = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(destinationFile))); + + try { + Files.walkFileTree(backupDir, new SimpleFileVisitor<>() { + public FileVisitResult visitFile(Path filename, BasicFileAttributes attrs) throws IOException { + String shortFilename = backupDir.relativize(filename).toString().replace('\\', '/'); + zipoutputstream.putNextEntry(new ZipEntry(shortFilename)); + + com.google.common.io.Files.asByteSource(filename.toFile()).copyTo(zipoutputstream); + zipoutputstream.closeEntry(); + return FileVisitResult.CONTINUE; + } + }); + } catch (Throwable throwable1) { + try { + zipoutputstream.close(); + } catch (Throwable throwable) { + throwable1.addSuppressed(throwable); + } + + throw throwable1; + } + + zipoutputstream.close(); + } +} \ No newline at end of file diff --git a/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java index 4c8b2505..03a12d8b 100644 --- a/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java @@ -1,7 +1,10 @@ package dev.compactmods.machines.client; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.core.UIRegistration; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.client.MachineColors; import dev.compactmods.machines.room.client.MachineRoomScreen; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.client.TunnelColors; @@ -9,7 +12,9 @@ import net.minecraft.client.gui.screens.MenuScreens; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; +import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -19,15 +24,24 @@ public class ClientEventHandler { @SubscribeEvent public static void onItemColors(final RegisterColorHandlersEvent.Item colors) { colors.register(new TunnelItemColor(), Tunnels.ITEM_TUNNEL.get()); + colors.register(MachineColors.ITEM, Machines.BOUND_MACHINE_BLOCK_ITEM.get()); + colors.register(MachineColors.ITEM, Machines.UNBOUND_MACHINE_BLOCK_ITEM.get()); } @SubscribeEvent public static void onBlockColors(final RegisterColorHandlersEvent.Block colors) { colors.register(new TunnelColors(), Tunnels.BLOCK_TUNNEL_WALL.get()); + colors.register(MachineColors.BLOCK, Machines.MACHINE_BLOCK.get()); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent client) { MenuScreens.register(UIRegistration.MACHINE_MENU.get(), MachineRoomScreen::new); } + + @SubscribeEvent + public static void onTextureStitch(final TextureStitchEvent.Pre stitch) { + if(ModList.get().isLoaded("curios")) + CuriosCompat.addTextures(stitch); + } } diff --git a/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java b/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java new file mode 100644 index 00000000..20e39ef6 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.client; + +import com.mojang.authlib.GameProfile; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; + +public class PlayerFaceRenderer { + public static void render(GameProfile profile, PoseStack poseStack, int x, int y) { + final var skins = Minecraft.getInstance().getSkinManager(); + final var playerSkin = skins.getInsecureSkinLocation(profile); + + RenderSystem.setShaderTexture(0, playerSkin); + + // pose, x, y, ???, hatLayer, upsideDown + net.minecraft.client.gui.components.PlayerFaceRenderer.draw(poseStack, x, y, 12, false, false); + } +} diff --git a/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java b/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java new file mode 100644 index 00000000..1db6a135 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java @@ -0,0 +1,51 @@ +package dev.compactmods.machines.codec; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import dev.compactmods.machines.CompactMachines; +import net.minecraft.Util; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +import java.util.List; +import java.util.UUID; +import java.util.stream.DoubleStream; +import java.util.stream.IntStream; + +public abstract class CodecExtensions { + public static final Codec VECTOR3D = DoubleStreamExtensions.CODEC + .comapFlatMap(i -> DoubleStreamExtensions.fixedDoubleSize(i, 3) + .map(out -> new Vec3(out[0], out[1], out[2])), vec -> DoubleStream.of(vec.x, vec.y, vec.z)); + + public static final Codec VEC2 = Codec.FLOAT.listOf() + .comapFlatMap((vec) -> Util.fixedSize(vec, 2).map( + (res) -> new Vec2(res.get(0), res.get(1))), + (vec) -> List.of(vec.x, vec.y)); + + public static final Codec CHUNKPOS = Codec.INT_STREAM + .comapFlatMap(i -> Util.fixedSize(i, 2) + .map(arr -> new ChunkPos(arr[0], arr[1])), pos -> IntStream.of(pos.x, pos.z)); + + @Deprecated(forRemoval = true, since = "5.2.0") + public static final Codec UUID_STRING = Codec.STRING.comapFlatMap((s) -> { + try { + return DataResult.success(UUID.fromString(s)); + } catch (Exception ex) { + return DataResult.error("Not a valid UUID: " + s + " (" + ex.getMessage() + ")"); + } + }, UUID::toString).stable(); + + public static CompoundTag writeIntoTag(Codec codec, T instance, CompoundTag tag) { + final var encoded = codec + .encodeStart(NbtOps.INSTANCE, instance) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + + if (encoded instanceof CompoundTag ect) + tag.merge(ect); + + return tag; + } +} diff --git a/src/api/java/dev/compactmods/machines/api/codec/DoubleStreamExtensions.java b/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java similarity index 97% rename from src/api/java/dev/compactmods/machines/api/codec/DoubleStreamExtensions.java rename to src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java index c00465cb..04a0a8fc 100644 --- a/src/api/java/dev/compactmods/machines/api/codec/DoubleStreamExtensions.java +++ b/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.api.codec; +package dev.compactmods.machines.codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; diff --git a/src/api/java/dev/compactmods/machines/api/codec/NbtListCollector.java b/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java similarity index 96% rename from src/api/java/dev/compactmods/machines/api/codec/NbtListCollector.java rename to src/main/java/dev/compactmods/machines/codec/NbtListCollector.java index 078a40b6..44640c0f 100644 --- a/src/api/java/dev/compactmods/machines/api/codec/NbtListCollector.java +++ b/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.api.codec; +package dev.compactmods.machines.codec; import com.google.common.collect.ImmutableSet; import net.minecraft.nbt.Tag; diff --git a/src/main/java/dev/compactmods/machines/command/Commands.java b/src/main/java/dev/compactmods/machines/command/Commands.java index 32aa2f5f..15f1f04c 100644 --- a/src/main/java/dev/compactmods/machines/command/Commands.java +++ b/src/main/java/dev/compactmods/machines/command/Commands.java @@ -2,9 +2,15 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.command.argument.RoomPositionArgument; import dev.compactmods.machines.command.data.CMDataSubcommand; -import dev.compactmods.machines.command.subcommand.*; +import dev.compactmods.machines.command.subcommand.CMEjectSubcommand; +import dev.compactmods.machines.command.subcommand.CMGiveMachineSubcommand; +import dev.compactmods.machines.command.subcommand.CMReaddDimensionSubcommand; +import dev.compactmods.machines.command.subcommand.CMRebindSubcommand; +import dev.compactmods.machines.command.subcommand.CMRoomsSubcommand; +import dev.compactmods.machines.command.subcommand.CMSummarySubcommand; +import dev.compactmods.machines.command.subcommand.CMUnbindSubcommand; +import dev.compactmods.machines.command.subcommand.SpawnSubcommand; import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.upgrade.command.CMUpgradeRoomCommand; import dev.compactmods.machines.upgrade.command.RoomUpgradeArgument; @@ -22,9 +28,6 @@ public class Commands { // TODO: /cm spawn set static { - Registries.COMMAND_ARGUMENT_TYPES.register("room_pos", - () -> ArgumentTypeInfos.registerByClass(RoomPositionArgument.class, SingletonArgumentInfo.contextFree(RoomPositionArgument::room))); - Registries.COMMAND_ARGUMENT_TYPES.register("room_upgrade", () -> ArgumentTypeInfos.registerByClass(RoomUpgradeArgument.class, SingletonArgumentInfo.contextFree(RoomUpgradeArgument::upgrade))); } diff --git a/src/main/java/dev/compactmods/machines/command/argument/RoomCoordinates.java b/src/main/java/dev/compactmods/machines/command/argument/RoomCoordinates.java deleted file mode 100644 index edeee10d..00000000 --- a/src/main/java/dev/compactmods/machines/command/argument/RoomCoordinates.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.command.argument; - -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.arguments.coordinates.WorldCoordinate; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.Vec3; - -public class RoomCoordinates { - private final WorldCoordinate x; - private final WorldCoordinate z; - - public RoomCoordinates(WorldCoordinate x, WorldCoordinate z) { - this.x = x; - this.z = z; - } - - public ChunkPos get(CommandSourceStack stack) { - Vec3 vec3 = stack.getPosition(); - return new ChunkPos((int) this.x.get(vec3.x), (int) this.z.get(vec3.z)); - } -} diff --git a/src/main/java/dev/compactmods/machines/command/argument/RoomPositionArgument.java b/src/main/java/dev/compactmods/machines/command/argument/RoomPositionArgument.java deleted file mode 100644 index fc1c6510..00000000 --- a/src/main/java/dev/compactmods/machines/command/argument/RoomPositionArgument.java +++ /dev/null @@ -1,51 +0,0 @@ -package dev.compactmods.machines.command.argument; - -import com.mojang.brigadier.StringReader; -import com.mojang.brigadier.arguments.ArgumentType; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; -import com.mojang.brigadier.suggestion.Suggestions; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.arguments.coordinates.WorldCoordinate; -import net.minecraft.network.chat.Component; -import net.minecraft.world.level.ChunkPos; - -import java.util.concurrent.CompletableFuture; - -public class RoomPositionArgument implements ArgumentType { - public static final SimpleCommandExceptionType ERROR_NOT_COMPLETE = new SimpleCommandExceptionType(Component.translatable("argument.pos2d.incomplete")); - - public static RoomPositionArgument room() { - return new RoomPositionArgument(); - } - - public static ChunkPos get(CommandContext ctx, String room) { - var arg = ctx.getArgument(room, RoomCoordinates.class); - return arg.get(ctx.getSource()); - } - - @Override - public RoomCoordinates parse(StringReader reader) throws CommandSyntaxException { - int i = reader.getCursor(); - if (!reader.canRead()) { - throw ERROR_NOT_COMPLETE.createWithContext(reader); - } else { - WorldCoordinate chunkX = WorldCoordinate.parseInt(reader); - if (reader.canRead() && reader.peek() == ' ') { - reader.skip(); - WorldCoordinate chunkZ = WorldCoordinate.parseInt(reader); - return new RoomCoordinates(chunkX, chunkZ); - } else { - reader.setCursor(i); - throw ERROR_NOT_COMPLETE.createWithContext(reader); - } - } - } - - @Override - public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - return Suggestions.empty(); - } -} diff --git a/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index 8df22e60..700d0aa6 100644 --- a/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -11,14 +11,12 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.util.CsvOutput; -import net.minecraft.world.level.ChunkPos; import javax.annotation.Nonnull; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; -// TODO public class CMMachineDataExportCommand { public static ArgumentBuilder makeMachineCsv() { @@ -68,22 +66,20 @@ private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { .addColumn("machine_x") .addColumn("machine_y") .addColumn("machine_z") - .addColumn("room_x") - .addColumn("room_z") + .addColumn("room") .build(writer); } - private static void writeMachine(IDimensionalBlockPosition machine, ChunkPos room, CsvOutput builder) { + private static void writeMachine(IDimensionalBlockPosition machine, String room, CsvOutput builder) { try { var placedAt = machine.getBlockPosition(); builder.writeRow( - machine.dimensionKey().location().toString(), + machine.dimension().location().toString(), placedAt.getX(), placedAt.getY(), placedAt.getZ(), - room.x, - room.z + room ); } catch (IOException e) { CompactMachines.LOGGER.error(e); diff --git a/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java index 391afe2e..fa8512b4 100644 --- a/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java @@ -5,13 +5,15 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.core.Vec3i; import net.minecraft.util.CsvOutput; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.phys.Vec3; import javax.annotation.Nonnull; @@ -29,23 +31,19 @@ public class CMRoomDataExportCommand { private static int execAll(CommandContext ctx) { var src = ctx.getSource(); - var serv = src.getServer(); - var compact = serv.getLevel(CompactDimension.LEVEL_KEY); - - final CompactRoomData rooms = CompactRoomData.get(compact); - - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve("rooms.csv") - .toAbsolutePath(); - try { + var roomProvider = CompactRoomProvider.instance(src.getServer()); + + var outdir = src.getServer().getFile(Constants.MOD_ID); + var out = outdir.toPath() + .resolve("rooms.csv") + .toAbsolutePath(); Files.createDirectories(outdir.toPath()); var writer = Files.newBufferedWriter(out); CsvOutput builder = makeCsv(writer); - rooms.streamRooms().forEach(room -> writeRoom(room, builder)); + roomProvider.allRooms().forEach(room -> writeRoom(builder, room, roomProvider, roomProvider)); writer.close(); } catch (IOException e) { @@ -60,25 +58,26 @@ private static int execAll(CommandContext ctx) { @Nonnull private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { return CsvOutput.builder() - .addColumn("room_x") - .addColumn("room_z") - .addColumn("size") + .addColumn("room") .addColumn("owner_uuid") + .addColumn("size_x") + .addColumn("size_y") + .addColumn("size_z") .addColumn("spawn_x") .addColumn("spawn_y") .addColumn("spawn_z") .build(writer); } - private static void writeRoom(CompactRoomData.RoomData room, CsvOutput builder) { + private static void writeRoom(CsvOutput builder, IRoomRegistration room, IRoomOwnerLookup owners, IRoomSpawnLookup spawns) { try { - ChunkPos chunk = new ChunkPos(room.getCenter()); - final Vec3 spawn = room.getSpawn(); + final Vec3i roomDims = room.dimensions(); + final Vec3 spawn = room.spawnPosition(spawns); builder.writeRow( - chunk.x, chunk.z, - room.getSize().getSerializedName(), - room.getOwner().toString(), + room.code(), + room.owner(owners), + roomDims.getX(), roomDims.getY(), roomDims.getZ(), spawn.x, spawn.y, spawn.z ); } catch (IOException e) { diff --git a/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java index 2f4bb781..8782b75d 100644 --- a/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.command.data; +import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -7,17 +8,15 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.command.argument.RoomPositionArgument; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.CsvOutput; -import net.minecraft.world.level.ChunkPos; import javax.annotation.Nonnull; import java.io.BufferedWriter; @@ -28,7 +27,7 @@ public class CMTunnelDataExportCommand { public static ArgumentBuilder makeTunnelCsv() { var chunk = Commands - .argument("room", RoomPositionArgument.room()) + .argument("room", StringArgumentType.string()) .executes(CMTunnelDataExportCommand::exec); return Commands.literal("tunnels") @@ -40,34 +39,36 @@ public class CMTunnelDataExportCommand { private static int execAll(CommandContext ctx) { var src = ctx.getSource(); var serv = src.getServer(); - var compact = serv.getLevel(CompactDimension.LEVEL_KEY); + try (var compactDim = CompactDimension.forServer(serv)) { + final var roomProvider = CompactRoomProvider.instance(compactDim); - final CompactRoomData rooms = CompactRoomData.get(compact); + var outdir = src.getServer().getFile(Constants.MOD_ID); + var out = outdir.toPath() + .resolve("tunnels.csv") + .toAbsolutePath(); - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve("tunnels.csv") - .toAbsolutePath(); - - try { - Files.createDirectories(outdir.toPath()); + try { + Files.createDirectories(outdir.toPath()); - var writer = Files.newBufferedWriter(out); - CsvOutput builder = makeTunnelCsvOut(writer); + var writer = Files.newBufferedWriter(out); + CsvOutput builder = makeTunnelCsvOut(writer); - rooms.stream().forEach(roomChunk -> { - try { - writeRoomTunnels(compact, roomChunk, builder); - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.error(e); - } - }); + roomProvider.allRooms().forEach(room -> { + try { + writeRoomTunnels(compactDim, room.code(), builder); + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.error(e); + } + }); - writer.close(); - } catch (IOException e) { - CompactMachines.LOGGER.error(e); - src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); - return -1; + writer.close(); + } catch (IOException e) { + CompactMachines.LOGGER.error(e); + src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); + return -1; + } + } catch (IOException | MissingDimensionException e) { + throw new RuntimeException(e); } return 0; @@ -77,12 +78,12 @@ public static int exec(CommandContext ctx) throws CommandSyn var src = ctx.getSource(); ServerPlayer player = src.getPlayerOrException(); - final var room = RoomPositionArgument.get(ctx, "room"); + final var room = StringArgumentType.getString(ctx, "room"); final var compactDim = src.getServer().getLevel(CompactDimension.LEVEL_KEY); var outdir = src.getServer().getFile(Constants.MOD_ID); var out = outdir.toPath() - .resolve(String.format("tunnels_%s_%s.csv", room.x, room.z)) + .resolve(String.format("tunnels_%s.csv", room)) .toAbsolutePath(); try { @@ -114,8 +115,8 @@ private static CsvOutput makeTunnelCsvOut(BufferedWriter writer) throws IOExcept .build(writer); } - private static void writeRoomTunnels(ServerLevel compactDim, ChunkPos room, CsvOutput builder) throws MissingDimensionException { - final var graph = TunnelConnectionGraph.forRoom(compactDim, room); + private static void writeRoomTunnels(ServerLevel compactDim, String roomCode, CsvOutput builder) throws MissingDimensionException { + final var graph = TunnelConnectionGraph.forRoom(compactDim, roomCode); graph.tunnels().forEach(info -> { var pos = info.location(); try { diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java index 4e6cbe82..9b4dee00 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java @@ -1,18 +1,16 @@ package dev.compactmods.machines.command.subcommand; +import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.command.argument.RoomPositionArgument; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineItem; -import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.room.Rooms; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; @@ -25,39 +23,29 @@ public static LiteralArgumentBuilder make() { .requires(cs -> cs.hasPermission(ServerConfig.giveMachineLevel())); subRoot.then(Commands.argument("player", EntityArgument.player()) - .then(Commands.argument("room", RoomPositionArgument.room()) - .executes(CMGiveMachineSubcommand::giveMachine))); + .then(Commands.argument("room", StringArgumentType.string()) + .executes(CMGiveMachineSubcommand::giveMachine))); return subRoot; } private static int giveMachine(CommandContext ctx) throws CommandSyntaxException { final var src = ctx.getSource(); - final var server = src.getServer(); - final var player = EntityArgument.getPlayer(ctx, "player"); - final var roomPos = RoomPositionArgument.get(ctx, "room"); - - if(!Rooms.exists(server, roomPos)) { - CompactMachines.LOGGER.error("Error giving player a new machine block: room not found."); - src.sendFailure(TranslationUtil.message(Messages.UNKNOWN_ROOM_CHUNK, "%s, %s".formatted(roomPos.x, roomPos.z))); - return -1; - } + final var roomCode = StringArgumentType.getString(ctx, "room"); - try { - final RoomSize size = Rooms.sizeOf(server, roomPos); - - ItemStack newItem = new ItemStack(CompactMachineItem.getItemBySize(size)); - CompactMachineItem.setRoom(newItem, roomPos); - - if(!player.addItem(newItem)) { + var roomProvider = CompactRoomProvider.instance(src.getServer()); + roomProvider.forRoom(roomCode).ifPresentOrElse(room -> { + ItemStack newItem = BoundCompactMachineItem.createForRoom(room); + if (!player.addItem(newItem)) { src.sendFailure(TranslationUtil.command(CMCommands.CANNOT_GIVE_MACHINE)); } else { src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_GIVEN, player.getDisplayName()), true); } - } catch (NonexistentRoomException e) { - CompactMachines.LOGGER.fatal(e); - } + }, () -> { + CompactMachines.LOGGER.error("Error giving player a new machine block: room not found."); + src.sendFailure(TranslationUtil.message(Messages.UNKNOWN_ROOM_CHUNK, roomCode)); + }); return 0; } diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java index a65476c9..b2eeecb1 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java @@ -1,20 +1,23 @@ package dev.compactmods.machines.command.subcommand; +import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.command.argument.RoomPositionArgument; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; +import net.minecraft.server.level.ServerLevel; public class CMRebindSubcommand { @@ -23,7 +26,7 @@ public static LiteralArgumentBuilder make() { .requires(cs -> cs.hasPermission(ServerConfig.rebindLevel())); subRoot.then(Commands.argument("pos", BlockPosArgument.blockPos()) - .then(Commands.argument("bindTo", RoomPositionArgument.room()) + .then(Commands.argument("bindTo", StringArgumentType.string()) .executes(CMRebindSubcommand::doRebind))); return subRoot; @@ -32,31 +35,37 @@ public static LiteralArgumentBuilder make() { private static int doRebind(CommandContext ctx) throws CommandSyntaxException { final var server = ctx.getSource().getServer(); final var level = ctx.getSource().getLevel(); - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - if(compactDim == null) { + final ServerLevel compactDim; + try { + compactDim = CompactDimension.forServer(server); + } catch (MissingDimensionException e) { throw new CommandRuntimeException(TranslationUtil.command(CMCommands.LEVEL_NOT_FOUND)); } + final var roomProvider = CompactRoomProvider.instance(compactDim); final var rebindingMachine = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); - final var roomPos = RoomPositionArgument.get(ctx, "bindTo"); + final var roomCode = StringArgumentType.getString(ctx, "bindTo"); + roomProvider.forRoom(roomCode).ifPresentOrElse(targetRoom -> { + CompactMachines.LOGGER.debug("Binding machine at {} to room {}", rebindingMachine, targetRoom.code()); - CompactMachines.LOGGER.debug("Binding machine at {} to room chunk {}", rebindingMachine, roomPos); + if(!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { + CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); + throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); + } - if(!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { - CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); - throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); - } - - machine.getConnectedRoom().ifPresentOrElse(currentRoom -> { - final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); - final var firstTunnel = currentRoomTunnels.getConnections(machine.getLevelPosition()).findFirst(); - firstTunnel.ifPresent(ft -> { - throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); - }); + machine.connectedRoom().ifPresentOrElse(currentRoom -> { + final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); + final var firstTunnel = currentRoomTunnels.getConnections(machine.getLevelPosition()).findFirst(); + firstTunnel.ifPresent(ft -> { + throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); + }); - // No tunnels - clear to rebind - machine.setConnectedRoom(roomPos); - }, () -> machine.setConnectedRoom(roomPos)); + // No tunnels - clear to rebind + machine.setConnectedRoom(targetRoom); + }, () -> machine.setConnectedRoom(targetRoom)); + }, () -> { + CompactMachines.LOGGER.error("Cannot rebind to room {}; not registered.", roomCode); + }); return 0; } diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java index 425f386a..c39a42d1 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java @@ -3,24 +3,21 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.machine.MachineTags; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineBlock; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; -import dev.compactmods.machines.room.Rooms; -import dev.compactmods.machines.room.data.CompactRoomData; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import net.minecraft.ChatFormatting; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.coordinates.BlockPosArgument; import net.minecraft.network.chat.Component; -import net.minecraft.world.level.ChunkPos; + +import java.util.stream.Collectors; public class CMRoomsSubcommand { @@ -49,12 +46,12 @@ private static int fetchByMachineBlock(CommandContext ctx) t final var block = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); final var level = ctx.getSource().getLevel(); - if(!(level.getBlockState(block).getBlock() instanceof CompactMachineBlock b)) + if (!level.getBlockState(block).is(MachineTags.BLOCK)) throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); - if(level.getBlockEntity(block) instanceof CompactMachineBlockEntity be) { - be.getConnectedRoom().ifPresent(room -> { - final var m = TranslationUtil.message(Messages.MACHINE_ROOM_INFO, block, b.getSize(), room); + if (level.getBlockEntity(block) instanceof CompactMachineBlockEntity be) { + be.roomInfo().ifPresent(room -> { + final var m = TranslationUtil.message(Messages.MACHINE_ROOM_INFO, block, room.dimensions(), room.code()); ctx.getSource().sendSuccess(m, false); }); } @@ -73,32 +70,25 @@ private static int findByContainingPlayer(CommandContext ctx throw new CommandRuntimeException(TranslationUtil.command(CMCommands.WRONG_DIMENSION)); } - try { - final var roomSize = Rooms.sizeOf(server, playerChunk); - final var m = TranslationUtil.message(Messages.PLAYER_ROOM_INFO, player.getDisplayName(), playerChunk.toString(), roomSize); - ctx.getSource().sendSuccess(m, false); - } catch (NonexistentRoomException e) { - CompactMachines.LOGGER.error("Player is inside an unregistered chunk ({}) in the compact world.", playerChunk, e); - final var tc = Component.literal("%s, %s".formatted(playerChunk.x, playerChunk.z)) - .withStyle(ChatFormatting.RED); - - throw new CommandRuntimeException(TranslationUtil.message(Messages.UNKNOWN_ROOM_CHUNK, tc)); - } + final var m = TranslationUtil.message(Messages.PLAYER_ROOM_INFO, player.getDisplayName(), playerChunk.toString()); + ctx.getSource().sendSuccess(m, false); return 0; } public static int findByOwner(CommandContext ctx) throws CommandSyntaxException { final var owner = EntityArgument.getPlayer(ctx, "owner"); - final var server = ctx.getSource().getServer(); - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - - final var rooms = CompactRoomData.get(compactDim); - rooms.streamRooms() - .filter(r -> r.getOwner().equals(owner.getUUID())) - .forEach(data -> { - ctx.getSource().sendSuccess(Component.literal("Room: " + new ChunkPos(data.getCenter())), false); - }); + final var source = ctx.getSource(); + final var graph = CompactRoomProvider.instance(source.getServer()); + + // TODO Localization + final var owned = graph.findByOwner(owner.getUUID()).collect(Collectors.toSet()); + if(owned.isEmpty()) { + source.sendSuccess(Component.literal("No rooms found."), false); + } else { + owned.forEach(roomInfo -> source.sendSuccess(Component.literal("Room: " + roomInfo.code()), false)); + } + return 0; } diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java index 7bea8f7d..8b7baddf 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java @@ -4,16 +4,16 @@ import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; +import net.minecraft.server.level.ServerLevel; -import java.util.HashMap; +import java.util.stream.LongStream; public class CMSummarySubcommand { public static ArgumentBuilder make() { @@ -25,31 +25,30 @@ private static int exec(CommandContext ctx) { var src = ctx.getSource(); var serv = src.getServer(); - var compactLevel = serv.getLevel(CompactDimension.LEVEL_KEY); - if (compactLevel != null) { + try { + ServerLevel compactLevel = CompactDimension.forServer(serv); src.sendSuccess(TranslationUtil.command(CMCommands.LEVEL_REGISTERED).withStyle(ChatFormatting.DARK_GREEN), false); - } else { - src.sendSuccess(TranslationUtil.command(CMCommands.LEVEL_NOT_FOUND).withStyle(ChatFormatting.RED), false); - } - HashMap, Long> levelCounts = new HashMap<>(); - serv.getAllLevels().forEach(sl -> { - final var machineData = DimensionMachineGraph.forDimension(sl); - long numRegistered = machineData.getMachines().count(); + final var ls = LongStream.builder(); + serv.getAllLevels().forEach(sl -> { + final var machineData = DimensionMachineGraph.forDimension(sl); + long numRegistered = machineData.getMachines().count(); - if(numRegistered > 0) { - src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().toString(), numRegistered), false); - levelCounts.put(sl.dimension(), numRegistered); - } - }); + if(numRegistered > 0) { + src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().location().toString(), numRegistered), false); + ls.add(numRegistered); + } + }); - long grandTotal = levelCounts.values().stream().reduce(0L, Long::sum); - src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_TOTAL, grandTotal).withStyle(ChatFormatting.GOLD), false); + long grandTotal = ls.build().sum(); + src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_TOTAL, grandTotal).withStyle(ChatFormatting.GOLD), false); - final var roomData = CompactRoomData.get(compactLevel); + final var roomInfo = CompactRoomProvider.instance(compactLevel); + src.sendSuccess(TranslationUtil.command(CMCommands.ROOM_REG_COUNT, roomInfo.count()), false); + } catch (MissingDimensionException e) { + src.sendSuccess(TranslationUtil.command(CMCommands.LEVEL_NOT_FOUND).withStyle(ChatFormatting.RED), false); + } - long numRegistered = roomData.stream().count(); - src.sendSuccess(TranslationUtil.command(CMCommands.ROOM_REG_COUNT, numRegistered), false); return 0; } diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java index 033c91f8..7206cf51 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; @@ -42,7 +42,7 @@ private static int doUnbind(CommandContext ctx) throws Comma throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); } - machine.getConnectedRoom().ifPresentOrElse(currentRoom -> { + machine.connectedRoom().ifPresentOrElse(currentRoom -> { final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); final var firstTunnel = currentRoomTunnels.getConnections(machine.getLevelPosition()).findFirst(); firstTunnel.ifPresent(ft -> { diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java index 271d662b..f6be02f3 100644 --- a/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java @@ -1,13 +1,16 @@ package dev.compactmods.machines.command.subcommand; +import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.command.argument.RoomPositionArgument; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -18,8 +21,8 @@ public class SpawnSubcommand { final var resetSpawn = Commands.literal("reset") .requires(cs -> cs.hasPermission(ServerConfig.changeRoomSpawn())) - .then(Commands.argument("room", RoomPositionArgument.room()) - .executes(SpawnSubcommand::resetRoomSpawn)); + .then(Commands.argument("room", StringArgumentType.string()) + .executes(SpawnSubcommand::resetRoomSpawn)); spawnRoot.then(resetSpawn); @@ -29,16 +32,21 @@ public class SpawnSubcommand { private static int resetRoomSpawn(CommandContext ctx) { final var src = ctx.getSource(); final var serv = src.getServer(); - final var roomPos = RoomPositionArgument.get(ctx, "room"); + final var roomCode = StringArgumentType.getString(ctx, "room"); try { - Rooms.resetSpawn(serv, roomPos); - src.sendSuccess(TranslationUtil.command(CMCommands.SPAWN_CHANGED_SUCCESSFULLY, "%s, %s".formatted(roomPos.x, roomPos.z)), true); + final var compactDim = CompactDimension.forServer(serv); + final var roomProvider = CompactRoomProvider.instance(compactDim); + + roomProvider.resetSpawn(roomCode); + src.sendSuccess(TranslationUtil.command(CMCommands.SPAWN_CHANGED_SUCCESSFULLY, "%s".formatted(roomCode)), true); return 0; + } catch (MissingDimensionException e) { + src.sendFailure(TranslationUtil.command(Messages.UNREGISTERED_CM_DIM)); + return -1; } catch (NonexistentRoomException e) { - src.sendFailure(TranslationUtil.command(CMCommands.ROOM_NOT_FOUND, "%s, %s".formatted(roomPos.x, roomPos.z))); + src.sendFailure(TranslationUtil.command(CMCommands.ROOM_NOT_FOUND, roomCode)); return -1; } } - } diff --git a/src/main/java/dev/compactmods/machines/compat/InterModCompat.java b/src/main/java/dev/compactmods/machines/compat/InterModCompat.java index b7764014..1881fc08 100644 --- a/src/main/java/dev/compactmods/machines/compat/InterModCompat.java +++ b/src/main/java/dev/compactmods/machines/compat/InterModCompat.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.compat.carryon.CarryOnCompat; +import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.compat.theoneprobe.TheOneProbeCompat; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; @@ -18,5 +19,8 @@ public static void enqueueCompatMessages(final InterModEnqueueEvent evt) { if(ModList.get().isLoaded("carryon")) CarryOnCompat.sendIMC(); + + if(ModList.get().isLoaded("curios")) + CuriosCompat.sendIMC(); } } diff --git a/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java b/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java index 118abe62..feecbf8f 100644 --- a/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java +++ b/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java @@ -1,7 +1,8 @@ package dev.compactmods.machines.compat.carryon; -import dev.compactmods.machines.machine.CompactMachineBlock; import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.machine.Machines; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.registries.ForgeRegistries; @@ -14,9 +15,13 @@ public static void sendIMC() { // Prevents duplication of data on block movement. final var blockReg = ForgeRegistries.BLOCKS; for(var size : RoomSize.values()) { - final var regName = blockReg.getKey(CompactMachineBlock.getBySize(size)); + final var regName = blockReg.getKey(LegacySizedCompactMachineBlock.getBySize(size)); if(regName != null) InterModComms.sendTo(MOD_ID, "blacklistBlock", regName::toString); } + + final var machineBlockNew = blockReg.getKey(Machines.MACHINE_BLOCK.get()); + if(machineBlockNew != null) + InterModComms.sendTo(MOD_ID, "blacklistBlock", machineBlockNew::toString); } } diff --git a/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java b/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java new file mode 100644 index 00000000..d4d1dbe3 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java @@ -0,0 +1,42 @@ +package dev.compactmods.machines.compat.curios; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.shrinking.PSDTags; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.fml.InterModComms; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotTypeMessage; + +import javax.annotation.Nonnull; + +public class CuriosCompat { + + private static final ResourceLocation CURIO_TEXTURE = new ResourceLocation(Constants.MOD_ID, "curios/empty_psd"); + + + public static void sendIMC() { + InterModComms.sendTo(CuriosApi.MODID, SlotTypeMessage.REGISTER_TYPE, () -> new SlotTypeMessage.Builder("psd") + .size(1) + .icon(CURIO_TEXTURE) + .build()); + + + } + + private static boolean isPsd(ItemStack stack) { + return stack.is(PSDTags.ITEM); + } + + public static void addTextures(final TextureStitchEvent.Pre stitch) { + stitch.addSprite(CURIO_TEXTURE); + } + + public static boolean hasPsdCurio(@Nonnull LivingEntity ent) { + return CuriosApi.getCuriosHelper() + .findFirstCurio(ent, CuriosCompat::isPsd) + .isPresent(); + } +} diff --git a/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java b/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java index 8defeaa4..6f1af433 100644 --- a/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java +++ b/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java @@ -2,9 +2,10 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.JeiInfo; -import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineItem; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; import mezz.jei.api.IModPlugin; @@ -14,8 +15,7 @@ import mezz.jei.api.registration.ISubtypeRegistration; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; - -import java.util.Arrays; +import net.minecraftforge.server.ServerLifecycleHooks; @JeiPlugin public class CompactMachinesJeiPlugin implements IModPlugin { @@ -26,13 +26,17 @@ public ResourceLocation getPluginUid() { @Override public void registerRecipes(IRecipeRegistration registration) { - Arrays.stream(RoomSize.values()) - .map(CompactMachineItem::getItemBySize) - .forEach(i -> registration.addIngredientInfo( - new ItemStack(i), - VanillaTypes.ITEM_STACK, - TranslationUtil.jeiInfo(JeiInfo.MACHINE))); + registration.addIngredientInfo( + UnboundCompactMachineItem.unbound(), + VanillaTypes.ITEM_STACK, + TranslationUtil.jeiInfo(JeiInfo.MACHINE)); + // Add all known template JEI infos + Rooms.getTemplates(ServerLifecycleHooks.getCurrentServer()) + .entrySet() + .stream() + .map(t -> UnboundCompactMachineItem.forTemplate(t.getKey().location(), t.getValue())) + .forEach(t -> registration.addIngredientInfo(t, VanillaTypes.ITEM_STACK, TranslationUtil.jeiInfo(JeiInfo.MACHINE))); registration.addIngredientInfo( new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get()), @@ -43,5 +47,7 @@ public void registerRecipes(IRecipeRegistration registration) { @Override public void registerItemSubtypes(ISubtypeRegistration registration) { registration.useNbtForSubtypes(Tunnels.ITEM_TUNNEL.get()); + registration.registerSubtypeInterpreter(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(), + (ingredient, context) -> UnboundCompactMachineItem.getTemplateId(ingredient).toString()); } } diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java b/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java index 41e275b9..2b7507b2 100644 --- a/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java +++ b/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java @@ -1,9 +1,14 @@ package dev.compactmods.machines.compat.theoneprobe; +import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; import dev.compactmods.machines.compat.theoneprobe.overrides.CompactMachineNameOverride; import dev.compactmods.machines.compat.theoneprobe.providers.CompactMachineProvider; import dev.compactmods.machines.compat.theoneprobe.providers.TunnelProvider; +import mcjty.theoneprobe.api.IElement; +import mcjty.theoneprobe.api.IElementFactory; import mcjty.theoneprobe.api.ITheOneProbe; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; import java.util.function.Function; @@ -17,6 +22,18 @@ public Void apply(Object o) { PROBE.registerProvider(new CompactMachineProvider()); PROBE.registerProvider(new TunnelProvider()); + PROBE.registerElementFactory(new IElementFactory() { + @Override + public IElement createElement(FriendlyByteBuf buffer) { + return new PlayerFaceElement(buffer.readGameProfile()); + } + + @Override + public ResourceLocation getId() { + return PlayerFaceElement.ID; + } + }); + return null; } diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java b/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java new file mode 100644 index 00000000..5602a27d --- /dev/null +++ b/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java @@ -0,0 +1,47 @@ +package dev.compactmods.machines.compat.theoneprobe.elements; + +import com.mojang.authlib.GameProfile; +import com.mojang.blaze3d.vertex.PoseStack; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.client.PlayerFaceRenderer; +import mcjty.theoneprobe.api.IElement; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; + +public class PlayerFaceElement implements IElement { + public static final ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "player_face"); + private final GameProfile player; + + public PlayerFaceElement(GameProfile player) { + this.player = player; + } + + @Override + public void render(PoseStack poseStack, int x, int y) { + PlayerFaceRenderer.render(player, poseStack, x, y); + } + + @Override + public int getWidth() { + return 16; + } + + @Override + public int getHeight() { + return 16; + } + + @Override + public void toBytes(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeGameProfile(player); + } + + @Override + public ResourceLocation getID() { + return ID; + } + + public GameProfile player() { + return player; + } +} diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java index 39418d28..27c308be 100644 --- a/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,11 +1,17 @@ package dev.compactmods.machines.compat.theoneprobe.overrides; -import dev.compactmods.machines.machine.CompactMachineBlock; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import mcjty.theoneprobe.Tools; -import mcjty.theoneprobe.api.*; +import mcjty.theoneprobe.api.CompoundText; +import mcjty.theoneprobe.api.ElementAlignment; +import mcjty.theoneprobe.api.IBlockDisplayOverride; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.ProbeMode; +import mcjty.theoneprobe.api.TextStyleClass; import mcjty.theoneprobe.config.Config; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -16,9 +22,9 @@ public class CompactMachineNameOverride implements IBlockDisplayOverride { @Override public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level level, BlockState blockState, IProbeHitData hitData) { - if(blockState.getBlock() instanceof CompactMachineBlock) { + if(blockState.is(CMTags.MACHINE_BLOCK)) { if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity mach) { - final var cr = mach.getConnectedRoom(); + final var cr = mach.roomInfo(); if(cr.isEmpty()) return false; @@ -31,7 +37,7 @@ public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player Component roomName; try { - roomName = Rooms.getRoomName(level.getServer(), room) + roomName = Rooms.getRoomName(level.getServer(), room.code()) .map(Component::literal) .orElse((MutableComponent) pickBlock.getHoverName()); } catch (NonexistentRoomException e) { diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java index a870163c..c64f843c 100644 --- a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java @@ -1,21 +1,28 @@ package dev.compactmods.machines.compat.theoneprobe.providers; -import com.mojang.authlib.GameProfile; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.CompactMachineBlock; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.TunnelItem; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import mcjty.theoneprobe.api.*; +import dev.compactmods.machines.util.PlayerUtil; +import mcjty.theoneprobe.api.ElementAlignment; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; import mcjty.theoneprobe.apiimpl.styles.ItemStyle; import mcjty.theoneprobe.apiimpl.styles.LayoutStyle; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -32,7 +39,7 @@ public ResourceLocation getID() { @Override public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Level level, BlockState blockState, IProbeHitData hitData) { - if (!(blockState.getBlock() instanceof CompactMachineBlock mach)) + if (!blockState.is(CMTags.MACHINE_BLOCK)) return; final var server = level.getServer(); @@ -40,13 +47,31 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le return; final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); + if (compactDim == null) + return; - final var te = level.getBlockEntity(hitData.getPos()); - - if (te instanceof CompactMachineBlockEntity machine) { - machine.getConnectedRoom().ifPresentOrElse(room -> { - final var boundTo = TranslationUtil.tooltip(Tooltips.Machines.BOUND_TO, room); + if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity machine) { + machine.roomInfo().ifPresentOrElse(room -> { + final var boundTo = TranslationUtil.tooltip(Tooltips.Machines.BOUND_TO, room.code()); info.text(boundTo); + + final var roomGraph = CompactRoomProvider.instance(compactDim); + final var owner = room.owner(roomGraph); + if (owner != null) { + PlayerUtil.getProfileByUUID(server, owner).ifPresent(p -> { + MutableComponent ownerText = TranslationUtil + .tooltip(Tooltips.Machines.OWNER, p.getName()) + .withStyle(ChatFormatting.GRAY); + + info.horizontal(new LayoutStyle() + .alignment(ElementAlignment.ALIGN_CENTER) + .padding(0).spacing(0)) + .element(new PlayerFaceElement(p)) + .text(ownerText); + }); + } + + addTunnelInfo(probeMode, info, hitData, compactDim, machine, room); }, () -> { MutableComponent newMachine = TranslationUtil .message(new ResourceLocation(Constants.MOD_ID, "new_machine")) @@ -54,65 +79,44 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le info.text(newMachine); }); + } + } - machine.getOwnerUUID().ifPresent(ownerID -> { - // Owner Name - Player owner = level.getPlayerByUUID(ownerID); - if (owner != null) { - GameProfile ownerProfile = owner.getGameProfile(); - MutableComponent ownerText = TranslationUtil - .tooltip(Tooltips.Machines.OWNER, ownerProfile.getName()) - .withStyle(ChatFormatting.GRAY); + private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHitData hitData, ServerLevel compactDim, CompactMachineBlockEntity machine, IRoomRegistration room) { + if (compactDim == null) + return; - info.text(ownerText); - } - }); + final var graph = TunnelConnectionGraph.forRoom(compactDim, room.code()); - machine.getConnectedRoom().ifPresent(room -> { - if (compactDim == null) - return; - - final var roomData = CompactRoomData.get(compactDim); - final var graph = TunnelConnectionGraph.forRoom(compactDim, room); - - final var applied = graph.getTypesForSide(machine.getLevelPosition(), hitData.getSideHit()) - .collect(Collectors.toSet()); - - switch (probeMode) { - case NORMAL: - final var group = info.horizontal(new LayoutStyle() - .alignment(ElementAlignment.ALIGN_TOPLEFT) - .padding(0) - .spacing(0)); - - applied.forEach(tn -> { - ItemStack item = TunnelItem.createStack(tn); - group.item(item, new ItemStyle().bounds(8, 8)); - }); - break; - - case EXTENDED: - final var tgg = info.vertical(new LayoutStyle().alignment(ElementAlignment.ALIGN_TOPLEFT)); - applied.forEach(tn -> { - final var tg = tgg.horizontal(new LayoutStyle() - .alignment(ElementAlignment.ALIGN_CENTER) - .hPadding(2).vPadding(2) - .spacing(0)); - - ItemStack item = TunnelItem.createStack(tn); - tg.item(item, new ItemStyle().bounds(8, 8)); - tg.itemLabel(item); - }); - break; - } + final var applied = graph.getTypesForSide(machine.getLevelPosition(), hitData.getSideHit()) + .collect(Collectors.toSet()); + + switch (probeMode) { + case NORMAL: + final var group = info.horizontal(new LayoutStyle() + .alignment(ElementAlignment.ALIGN_TOPLEFT) + .padding(0) + .spacing(0)); - final var rd = roomData.forRoom(room); - rd.ifPresent(r -> { -// final var el = new RoomPreviewElement(new RoomPreview(room, r.getSize())); -// el.loadBlocks(server, r); -// info.element(el); + applied.forEach(tn -> { + ItemStack item = TunnelItem.createStack(tn); + group.item(item, new ItemStyle().bounds(8, 8)); }); - }); + break; + + case EXTENDED: + final var tgg = info.vertical(new LayoutStyle().alignment(ElementAlignment.ALIGN_TOPLEFT)); + applied.forEach(tn -> { + final var tg = tgg.horizontal(new LayoutStyle() + .alignment(ElementAlignment.ALIGN_CENTER) + .hPadding(2).vPadding(2) + .spacing(0)); + + ItemStack item = TunnelItem.createStack(tn); + tg.item(item, new ItemStyle().bounds(8, 8)); + tg.itemLabel(item); + }); + break; } } } diff --git a/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java index fc1f32b6..117b7386 100644 --- a/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java +++ b/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java @@ -16,7 +16,6 @@ public class CompactMachinesNet { private static final ArtifactVersion PROTOCOL_VERSION; - static { if(FMLEnvironment.production) { PROTOCOL_VERSION = new DefaultArtifactVersion(ModList.get().getModFileById(Constants.MOD_ID).versionString()); diff --git a/src/main/java/dev/compactmods/machines/core/Registries.java b/src/main/java/dev/compactmods/machines/core/Registries.java index 40dcfb06..57eb61e6 100644 --- a/src/main/java/dev/compactmods/machines/core/Registries.java +++ b/src/main/java/dev/compactmods/machines/core/Registries.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.core; +import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; @@ -17,6 +18,7 @@ import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import org.jetbrains.annotations.ApiStatus; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -28,24 +30,24 @@ public class Registries { public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID); // Tunnels - public static final ResourceLocation TYPES_REG_KEY = new ResourceLocation(MOD_ID, "tunnel_types"); - public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(TYPES_REG_KEY, MOD_ID); + public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(CMRegistries.TYPES_REG_KEY, MOD_ID); // UIRegistration public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); // MachineRoomUpgrades - public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey - .createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); - public static final DeferredRegister UPGRADES = DeferredRegister.create(ROOM_UPGRADES_REG_KEY, MOD_ID); + public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistries.ROOM_UPGRADES_REG_KEY, MOD_ID); // Graph - public static final ResourceKey> NODES_REG_KEY = ResourceKey + @ApiStatus.Internal + public static final ResourceKey>> NODES_REG_KEY = ResourceKey .createRegistryKey(new ResourceLocation(MOD_ID, "graph_nodes")); - public static final ResourceKey> EDGES_REG_KEY = ResourceKey + + @ApiStatus.Internal + public static final ResourceKey>> EDGES_REG_KEY = ResourceKey .createRegistryKey(new ResourceLocation(MOD_ID, "graph_edges")); - public static final DeferredRegister NODE_TYPES = DeferredRegister.create(NODES_REG_KEY, MOD_ID); - public static final DeferredRegister EDGE_TYPES = DeferredRegister.create(EDGES_REG_KEY, MOD_ID); + public static final DeferredRegister> NODE_TYPES = DeferredRegister.create(NODES_REG_KEY, MOD_ID); + public static final DeferredRegister> EDGE_TYPES = DeferredRegister.create(EDGES_REG_KEY, MOD_ID); // Commands public static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, MOD_ID); @@ -53,7 +55,8 @@ public class Registries { // LootFunctions public static final DeferredRegister LOOT_FUNCS = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, MOD_ID); - public static DeferredRegister ROOM_TEMPLATES = DeferredRegister.create(dev.compactmods.machines.api.room.Rooms.TEMPLATE_REG_KEY, Constants.MOD_ID); + public static DeferredRegister ROOM_TEMPLATES = DeferredRegister + .create(CMRegistries.TEMPLATE_REG_KEY, Constants.MOD_ID); public static void setup() { diff --git a/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java b/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java index d0b650fe..b3b53cca 100644 --- a/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java +++ b/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java @@ -1,8 +1,10 @@ package dev.compactmods.machines.core; +import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.upgrade.RoomUpgradeManager; import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; @@ -12,6 +14,7 @@ import net.minecraft.world.level.border.WorldBorder; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.level.LevelEvent; +import net.minecraftforge.event.server.ServerStartedEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.network.PacketDistributor; @@ -21,19 +24,21 @@ @Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class ServerEventHandler { + @SubscribeEvent + public static void onServerStarted(final ServerStartedEvent started) { + CompactMachines.getAddons().forEach(addon -> { + addon.acceptRoomSpawnLookup(CompactRoomProvider::instance); + addon.acceptRoomOwnerLookup(CompactRoomProvider::instance); + }); + } + @SubscribeEvent public static void onWorldLoaded(final LevelEvent.Load evt) { - if(evt.getLevel() instanceof ServerLevel sl && sl.dimension().equals(CompactDimension.LEVEL_KEY)) + if(evt.getLevel() instanceof ServerLevel compactDim && compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) { - final var serv = sl.getServer(); + final var serv = compactDim.getServer(); final var owBorder = serv.overworld().getWorldBorder(); - final var cwBorder = sl.getWorldBorder(); - - final var levelUpgrades = RoomUpgradeManager.get(sl); - levelUpgrades.implementing(ILevelLoadedUpgradeListener.class).forEach(inst -> { - final var upg = inst.upgrade(); - upg.onLevelLoaded(sl, inst.room()); - }); + final var cwBorder = compactDim.getWorldBorder(); // Filter border listeners down to the compact world, then remove them from the OW listener list final var listeners = owBorder.listeners.stream() @@ -51,6 +56,16 @@ public static void onWorldLoaded(final LevelEvent.Load evt) { PacketDistributor.DIMENSION.with(() -> CompactDimension.LEVEL_KEY) .send(new ClientboundSetBorderSizePacket(cwBorder)); + + // Room upgrade initialization + final var levelUpgrades = RoomUpgradeManager.get(compactDim); + final var roomInfo = CompactRoomProvider.instance(compactDim); + + levelUpgrades.implementing(ILevelLoadedUpgradeListener.class).forEach(inst -> { + final var upg = inst.upgrade(); + roomInfo.forRoom(inst.room()).ifPresent(ri -> upg.onLevelLoaded(compactDim, ri)); + }); + } } diff --git a/src/main/java/dev/compactmods/machines/core/UIRegistration.java b/src/main/java/dev/compactmods/machines/core/UIRegistration.java index 32269272..70216946 100644 --- a/src/main/java/dev/compactmods/machines/core/UIRegistration.java +++ b/src/main/java/dev/compactmods/machines/core/UIRegistration.java @@ -12,7 +12,7 @@ public class UIRegistration { ((windowId, inv, data) -> { data.readBlockPos(); final var mach = data.readWithCodec(LevelBlockPosition.CODEC); - final var room = data.readChunkPos(); + final var room = data.readUtf(); final boolean hasName = data.readBoolean(); final var roomName = hasName ? data.readUtf() : "Room Preview"; diff --git a/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java b/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java new file mode 100644 index 00000000..c806b75e --- /dev/null +++ b/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java @@ -0,0 +1,79 @@ +package dev.compactmods.machines.data.migration; + +import com.google.common.collect.ImmutableSet; +import com.mojang.serialization.Dynamic; +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.dimension.CompactDimension; +import net.minecraft.SharedConstants; +import net.minecraft.Util; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.util.datafix.DataFixTypes; +import net.minecraft.util.datafix.DataFixers; +import net.minecraft.util.datafix.fixes.References; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.levelgen.WorldGenSettings; +import net.minecraft.world.level.storage.LevelStorageSource; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Set; + +public class EarlyLevelDataFileReader { + + private final LevelStorageSource.LevelDirectory directory; + private static final ImmutableSet> DEFAULT_LEVELS = ImmutableSet.of(Level.OVERWORLD, Level.NETHER, Level.END, CompactDimension.LEVEL_KEY); + public EarlyLevelDataFileReader(LevelStorageSource.LevelDirectory directory) { + this.directory = directory; + } + + /** + * Clones a file to do work upon, keeping the original in a safe state + * @return + */ + private Path makeSafeFile(String backupName) throws IOException { + if(Files.exists(directory.dataFile())) { + final var copied = directory.path().resolve(backupName); + Files.copy(directory.dataFile(), copied, StandardCopyOption.REPLACE_EXISTING); + return copied; + } + + if(Files.exists(directory.oldDataFile())) { + final var copied = directory.path().resolve(backupName); + Files.copy(directory.oldDataFile(), copied, StandardCopyOption.REPLACE_EXISTING); + return copied; + } + + throw new IOException("No source file could be found."); + } + + public Set> dimensions() { + CompactMachines.LOGGER.info("Starting dimension read from level files."); + try { + final var tempFile = makeSafeFile("cm5_early_dimensions.dat"); + final var dataFixer = DataFixers.getDataFixer(); + final var rootTag = NbtIo.readCompressed(tempFile.toFile()).getCompound("Data"); + + int savedLevelVersion = rootTag.contains("DataVersion", 99) ? rootTag.getInt("DataVersion") : -1; + Dynamic dynamic = dataFixer.update(DataFixTypes.LEVEL.getType(), new Dynamic<>(NbtOps.INSTANCE, rootTag), savedLevelVersion, + SharedConstants.getCurrentVersion().getWorldVersion()); + + final var updatedData = dataFixer.update(References.WORLD_GEN_SETTINGS, dynamic, savedLevelVersion, SharedConstants.getCurrentVersion().getWorldVersion()); + final var levels = WorldGenSettings.CODEC.parse(updatedData) + .resultOrPartial(Util.prefix("CM5-EarlyLevelReader: ", CompactMachines.LOGGER::error)) + .map(WorldGenSettings::levels) + .orElse(DEFAULT_LEVELS); + + Files.deleteIfExists(tempFile); + CompactMachines.LOGGER.info("Completed dimension read from level files."); + return levels; + } catch (IOException e) { + CompactMachines.LOGGER.fatal("Failed to make a safe level file backup to read dimension info!"); + return DEFAULT_LEVELS; + } + } +} diff --git a/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java new file mode 100644 index 00000000..35b9fa24 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java @@ -0,0 +1,168 @@ +package dev.compactmods.machines.data.migration; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.RoomCodeGenerator; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.util.DimensionUtil; +import dev.compactmods.machines.util.SavedDataHelper; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.dimension.DimensionType; +import net.minecraft.world.level.storage.DimensionDataStorage; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Collections; +import java.util.HashMap; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; + +@SuppressWarnings({"removal", "deprecation"}) +public class Pre520RoomDataMigrator { + + public static final String ROOM_DATA_NAME = Constants.MOD_ID + "_rooms"; + private static final Logger UPDATER_LOGGER = LogManager.getLogger(Constants.MOD_ID); + private static final Marker UPDATER = MarkerManager.getMarker("room_data_updater"); + + public record RoomDataPre520(UUID owner, BlockPos center, Vec3 spawn, RoomSize size, Optional name) { + + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + CodecExtensions.UUID_STRING.fieldOf("owner").forGetter(RoomDataPre520::owner), + BlockPos.CODEC.fieldOf("center").forGetter(RoomDataPre520::center), + CodecExtensions.VECTOR3D.fieldOf("spawn").forGetter(RoomDataPre520::spawn), + RoomSize.CODEC.fieldOf("size").forGetter(RoomDataPre520::size), + Codec.STRING.optionalFieldOf("name").forGetter(RoomDataPre520::name) + ).apply(i, RoomDataPre520::new)); + } + + public record RoomDataLoadResult(HashMap oldRoomData, HashMap roomChunkLookup) { + } + + public static RoomDataLoadResult loadOldRoomData(DimensionDataStorage dataStore) throws IOException { + AtomicReference result = new AtomicReference<>(); + SavedDataHelper.processFile(dataStore, ROOM_DATA_NAME, nbt -> result.set(loadOldRoomData(nbt))); + return result.get(); + } + + public static RoomDataLoadResult loadOldRoomData(CompoundTag nbt) { + final HashMap oldRoomData = new HashMap<>(); + final HashMap roomChunkLookup = new HashMap<>(); + + final var data = RoomDataPre520.CODEC.listOf() + .parse(NbtOps.INSTANCE, nbt.getList("machines", Tag.TAG_COMPOUND)) + .resultOrPartial(UPDATER_LOGGER::error) + .orElse(Collections.emptyList()); + + data.forEach(d -> { + ChunkPos chunk = new ChunkPos(d.center()); + String newId = RoomCodeGenerator.generateRoomId(); + roomChunkLookup.put(chunk, newId); + oldRoomData.put(newId, d); + }); + + return new RoomDataLoadResult(oldRoomData, roomChunkLookup); + } + + public static void addMissingRoomEntries(DimensionDataStorage dataStore, CompactRoomProvider provider, RoomDataLoadResult oldData) { + oldData.oldRoomData().forEach((code, roomInfo) -> { + final var roomChunk = new ChunkPos(roomInfo.center); + if (!provider.isRoomChunk(roomChunk)) { + // Room hasn't been registered yet, map to migrated code + var legTemplate = LegacySizedCompactMachineBlock.getLegacyTemplate(roomInfo.size); + provider.registerNew(code, builder -> builder + .setColor(legTemplate.color()) + .setDimensions(roomInfo.size.toVec3()) + .setCenter(roomInfo.center) + .setSpawn(roomInfo.spawn, Vec2.ZERO) + .setOwner(roomInfo.owner)); + } + }); + + SavedDataHelper.saveFile(dataStore, CompactRoomProvider.DATA_NAME, provider); + } + + public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory levelDirectory, HashMap roomChunkLookup, + Set> levels, Path backupDir) throws IOException { + + for (var level : levels) { + final var dimDataStore = DimensionUtil.getDataStorage(levelDirectory, level); + final var connFile = dimDataStore.getDataFile(DimensionMachineGraph.DATA_KEY); + if (connFile.exists()) { + final var thisDimDir = DimensionUtil.getDataFolder(backupDir, level); + Files.createDirectories(thisDimDir); + + UPDATER_LOGGER.debug(UPDATER, "Updating connection info for dimension: {}", level.location()); + Files.copy(connFile.toPath(), thisDimDir.resolve(connFile.getName() + ".backup")); + + final var machineGraphNbt = DimensionUtil.readSavedFile(dimDataStore, DimensionMachineGraph.DATA_KEY); + machineGraphNbt.getCompound("graph") + .getList("connections", Tag.TAG_COMPOUND) + .forEach(machConnTag -> { + // Loop machine-room connection info, replace room pos with room code + if (machConnTag instanceof CompoundTag ct) { + final var oldChunk = ct.getIntArray("room"); + final var oldRoomPos = new ChunkPos(oldChunk[0], oldChunk[1]); + if (roomChunkLookup.containsKey(oldRoomPos)) { + final var newCode = roomChunkLookup.get(oldRoomPos); + ct.remove("room"); + ct.putString("room", newCode); + UPDATER_LOGGER.debug(UPDATER, "Assigning new code to room {}; code: {}", oldRoomPos.toString(), newCode); + } + } + }); + + final var dimPath = DimensionType.getStorageFolder(level, levelDirectory.path()); + NbtIo.writeCompressed(machineGraphNbt, dimPath.resolve("data").resolve(DimensionMachineGraph.DATA_KEY + ".dat").toFile()); + } + } + } + + public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDirectory, HashMap roomChunkLookup, Path backupDir) + throws IOException { + Files.createDirectories(backupDir.resolve("tunnels")); + + final var dataStore = CompactDimension.getDataStorage(levelDirectory); + for(final var room : roomChunkLookup.entrySet()) { + final var prevFilename = TunnelConnectionGraph.getOldTunnelFilename(room.getKey()); + final var oldFile = dataStore.getDataFile(prevFilename); + final var newFile = dataStore.getDataFile(TunnelConnectionGraph.getDataFilename(room.getValue())); + if(oldFile.exists()) { + final var oldFilePath = oldFile.toPath(); + Files.copy(oldFilePath, backupDir.resolve("tunnels").resolve(prevFilename + ".dat.backup")); + Files.copy(oldFilePath, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + Files.delete(oldFilePath); + } + } + } + + public static void makeRoomDataBackup(DimensionDataStorage dataStore, Path backupDir) throws IOException { + final var moveTo = DimensionUtil.getDataFolder(backupDir, CompactDimension.LEVEL_KEY); + Files.createDirectories(moveTo); + Files.copy(dataStore.getDataFile(ROOM_DATA_NAME).toPath(), moveTo.resolve(ROOM_DATA_NAME.concat(".dat"))); + } +} diff --git a/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java index 04fcac69..26cfc4b0 100644 --- a/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java @@ -32,6 +32,7 @@ public void entityInside(BlockState pState, Level pLevel, BlockPos pPos, Entity if (ServerConfig.isAllowedOutsideOfMachine()) return; if (pLevel.isClientSide) return; + // TODO: Configurable behavior if (pEntity instanceof ServerPlayer player) { if (player.isCreative()) return; diff --git a/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java b/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java index 0d222409..027786b7 100644 --- a/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java +++ b/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java @@ -6,7 +6,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; -public record DimensionGraphNode(ResourceKey dimension) implements IGraphNode { +public record DimensionGraphNode(ResourceKey dimension) implements IGraphNode { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(DimensionGraphNode::dimension) @@ -19,7 +19,7 @@ public String toString() { } @Override - public IGraphNodeType getType() { + public IGraphNodeType getType() { return Graph.DIM_NODE.get(); } } diff --git a/src/main/java/dev/compactmods/machines/graph/Graph.java b/src/main/java/dev/compactmods/machines/graph/Graph.java index 710d314b..3608ddb6 100644 --- a/src/main/java/dev/compactmods/machines/graph/Graph.java +++ b/src/main/java/dev/compactmods/machines/graph/Graph.java @@ -1,6 +1,9 @@ package dev.compactmods.machines.graph; import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.machine.graph.CompactMachineNode; +import dev.compactmods.machines.room.graph.RoomReferenceNode; +import dev.compactmods.machines.upgrade.graph.RoomUpgradeGraphNode; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryBuilder; import net.minecraftforge.registries.RegistryObject; @@ -9,24 +12,28 @@ public class Graph { - public static final Supplier> NODE_TYPE_REG = Registries.NODE_TYPES.makeRegistry(RegistryBuilder::new); - public static final Supplier> EDGE_TYPE_REG = Registries.EDGE_TYPES.makeRegistry(RegistryBuilder::new); + public static final Supplier>> NODE_TYPE_REG = Registries.NODE_TYPES.makeRegistry(RegistryBuilder::new); + public static final Supplier>> EDGE_TYPE_REG = Registries.EDGE_TYPES.makeRegistry(RegistryBuilder::new); - public static final RegistryObject MACH_NODE = Registries.NODE_TYPES.register("machine", () -> GraphNodeType.MACHINE); - public static final RegistryObject DIM_NODE = Registries.NODE_TYPES.register("dimension", () -> GraphNodeType.DIMENSION); - public static final RegistryObject ROOM_NODE = Registries.NODE_TYPES.register("room", () -> GraphNodeType.ROOM); + public static final RegistryObject> MACH_NODE = Registries.NODE_TYPES + .register("machine", SimpleGraphNodeType.instance(CompactMachineNode.CODEC)); + public static final RegistryObject> DIM_NODE = Registries.NODE_TYPES + .register("dimension", SimpleGraphNodeType.instance(DimensionGraphNode.CODEC)); + public static final RegistryObject> ROOM_REFERENCE_NODE = Registries.NODE_TYPES + .register("room", SimpleGraphNodeType.instance(RoomReferenceNode.CODEC)); - public static final RegistryObject TUNNEL_NODE = Registries.NODE_TYPES.register("tunnel", () -> GraphNodeType.TUNNEL); - public static final RegistryObject TUNNEL_TYPE_NODE = Registries.NODE_TYPES.register("tunnel_type", () -> GraphNodeType.TUNNEL_TYPE); + public static final RegistryObject> ROOM_UPGRADE_NODE = Registries.NODE_TYPES + .register("room_upgrade", SimpleGraphNodeType.instance(RoomUpgradeGraphNode.CODEC)); - public static final RegistryObject ROOM_UPGRADE_NODE = Registries.NODE_TYPES.register("room_upgrade", () -> GraphNodeType.ROOM_UPGRADE); - public static final RegistryObject MACHINE_LINK = Registries.EDGE_TYPES.register("machine_link", () -> GraphEdgeType.MACHINE_LINK); + + + public static final RegistryObject> MACHINE_LINK = Registries.EDGE_TYPES.register("machine_link", () -> GraphEdgeType.MACHINE_LINK); // Tunnel edges - public static final RegistryObject TUNNEL_TYPE = Registries.EDGE_TYPES.register("tunnel_type", () -> GraphEdgeType.TUNNEL_TYPE); - public static final RegistryObject TUNNEL_MACHINE_LINK = Registries.EDGE_TYPES.register("tunnel_machine", () -> GraphEdgeType.TUNNEL_MACHINE); + public static final RegistryObject> TUNNEL_TYPE = Registries.EDGE_TYPES.register("tunnel_type", () -> GraphEdgeType.TUNNEL_TYPE); + public static final RegistryObject> TUNNEL_MACHINE_LINK = Registries.EDGE_TYPES.register("tunnel_machine", () -> GraphEdgeType.TUNNEL_MACHINE); public static void prepare() { diff --git a/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java b/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java index 1f19c1b8..73209160 100644 --- a/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java +++ b/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java @@ -6,7 +6,7 @@ import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; import dev.compactmods.machines.upgrade.graph.RoomUpgradeConnection; -public enum GraphEdgeType implements IGraphEdgeType { +public enum GraphEdgeType implements IGraphEdgeType { TUNNEL_TYPE(TunnelTypeEdge.CODEC), MACHINE_LINK(MachineRoomEdge.CODEC), TUNNEL_MACHINE(TunnelMachineEdge.CODEC), diff --git a/src/main/java/dev/compactmods/machines/graph/GraphNodeBase.java b/src/main/java/dev/compactmods/machines/graph/GraphNodeBase.java deleted file mode 100644 index 391e29ba..00000000 --- a/src/main/java/dev/compactmods/machines/graph/GraphNodeBase.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.graph; - -public abstract class GraphNodeBase implements IGraphNode { -} diff --git a/src/main/java/dev/compactmods/machines/graph/GraphNodeType.java b/src/main/java/dev/compactmods/machines/graph/GraphNodeType.java deleted file mode 100644 index 34b780bc..00000000 --- a/src/main/java/dev/compactmods/machines/graph/GraphNodeType.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.room.graph.CompactMachineRoomNode; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; -import dev.compactmods.machines.upgrade.graph.RoomUpgradeGraphNode; - -public enum GraphNodeType implements IGraphNodeType { - MACHINE(CompactMachineNode.CODEC), - TUNNEL(TunnelNode.CODEC), - ROOM(CompactMachineRoomNode.CODEC), - TUNNEL_TYPE(TunnelTypeNode.CODEC), - DIMENSION(DimensionGraphNode.CODEC), - ROOM_UPGRADE(RoomUpgradeGraphNode.CODEC); - - private final Codec codec; - - @SuppressWarnings("unchecked") - GraphNodeType(Codec codec) { - this.codec = (Codec) codec; - } - - @Override - @SuppressWarnings("unchecked") - public Codec codec() { - return codec; - } -} diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java b/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java index 0ede60fb..b424dbf0 100644 --- a/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java +++ b/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java @@ -2,6 +2,6 @@ import org.jetbrains.annotations.NotNull; -public interface IGraphEdge { - @NotNull IGraphEdgeType getEdgeType(); +public interface IGraphEdge> { + @NotNull IGraphEdgeType getEdgeType(); } diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java b/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java index a89d1864..cd7e7cf1 100644 --- a/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java +++ b/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java @@ -2,6 +2,6 @@ import com.mojang.serialization.Codec; -public interface IGraphEdgeType { - Codec codec(); +public interface IGraphEdgeType { + Codec codec(); } diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphNode.java b/src/main/java/dev/compactmods/machines/graph/IGraphNode.java index 09c25cd2..ab134f30 100644 --- a/src/main/java/dev/compactmods/machines/graph/IGraphNode.java +++ b/src/main/java/dev/compactmods/machines/graph/IGraphNode.java @@ -1,5 +1,5 @@ package dev.compactmods.machines.graph; -public interface IGraphNode { - IGraphNodeType getType(); +public interface IGraphNode> { + IGraphNodeType getType(); } diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java b/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java index 65f137ba..e7e3d631 100644 --- a/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java +++ b/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; -public interface IGraphNodeType { +public interface IGraphNodeType { - Codec codec(); + Codec codec(); } diff --git a/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java b/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java new file mode 100644 index 00000000..0c2e542c --- /dev/null +++ b/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.graph; + +import com.mojang.serialization.Codec; + +import java.util.function.Supplier; + +public class SimpleGraphEdgeType implements IGraphEdgeType { + private final Codec codec; + + private SimpleGraphEdgeType(Codec codec) { + this.codec = codec; + } + + public static Supplier> instance(Codec codec) { + return () -> new SimpleGraphEdgeType(codec); + } + + @Override + public Codec codec() { + return codec; + } +} diff --git a/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java b/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java new file mode 100644 index 00000000..7f51c15a --- /dev/null +++ b/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java @@ -0,0 +1,23 @@ +package dev.compactmods.machines.graph; + +import com.mojang.serialization.Codec; + +import java.util.function.Supplier; + +public class SimpleGraphNodeType implements IGraphNodeType { + + private final Codec codec; + + private SimpleGraphNodeType(Codec codec) { + this.codec = codec; + } + + public static Supplier> instance(Codec codec) { + return () -> new SimpleGraphNodeType(codec); + } + + @Override + public Codec codec() { + return codec; + } +} diff --git a/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java index ac2d0480..87867bcd 100644 --- a/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java +++ b/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java @@ -1,71 +1,41 @@ package dev.compactmods.machines.location; import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.util.INBTSerializable; import javax.annotation.Nonnull; import java.util.Objects; import java.util.Optional; -public class LevelBlockPosition implements INBTSerializable, IDimensionalBlockPosition { - - private ResourceKey dimension; - private Vec3 position; - private Vec3 rotation; +public record LevelBlockPosition(ResourceKey dimension, BlockPos blockPos) + implements IDimensionalBlockPosition { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(LevelBlockPosition::getDimension), - CodecExtensions.VECTOR3D.fieldOf("pos").forGetter(LevelBlockPosition::getExactPosition), - CodecExtensions.VECTOR3D.optionalFieldOf("rot", Vec3.ZERO).forGetter(x -> x.rotation) + ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(LevelBlockPosition::dimension), + BlockPos.CODEC.fieldOf("pos").forGetter(LevelBlockPosition::blockPos) ).apply(i, LevelBlockPosition::new)); - private LevelBlockPosition() { - } - - public LevelBlockPosition(IDimensionalBlockPosition base) { - this.dimension = base.dimensionKey(); - this.position = base.getExactPosition(); - this.rotation = Vec3.ZERO; - } - - public LevelBlockPosition(ResourceKey world, BlockPos positionBlock) { - this(world, Vec3.ZERO, Vec3.ZERO); - this.position = new Vec3(positionBlock.getX(), positionBlock.getY(), positionBlock.getZ()); - this.rotation = Vec3.ZERO; - } - - public LevelBlockPosition(ResourceKey world, Vec3 positionBlock) { - this(world, positionBlock, Vec3.ZERO); - this.dimension = world; - this.rotation = Vec3.ZERO; + public LevelBlockPosition(IDimensionalBlockPosition machine) { + this(machine.dimension(), machine.getBlockPosition()); } - public LevelBlockPosition(ResourceKey dim, Vec3 pos, Vec3 rotation) { - this.dimension = dim; - this.position = pos; - this.rotation = rotation; - } - - public static LevelBlockPosition fromEntity(LivingEntity entity) { - return new LevelBlockPosition(entity.level.dimension(), entity.position()); + @Override + public Vec3 position() { + return Vec3.atCenterOf(blockPos); } public ServerLevel level(@Nonnull MinecraftServer server) { @@ -79,63 +49,28 @@ public BlockState state(MinecraftServer server) { @Override public IDimensionalBlockPosition relative(Direction direction) { - return new LevelBlockPosition(this.dimension, this.position.add(direction.getStepX(), direction.getStepY(), direction.getStepZ())); + return new LevelBlockPosition(this.dimension, this.blockPos.relative(direction, 1)); } public boolean isLoaded(MinecraftServer server) { final var level = level(server); - return level.isLoaded(new BlockPos(position)); + return level.isLoaded(blockPos); } public static LevelBlockPosition fromNBT(CompoundTag nbt) { - LevelBlockPosition dp = new LevelBlockPosition(); - dp.deserializeNBT(nbt); - - return dp; - } - - @Override - public CompoundTag serializeNBT() { - if(this.rotation == null) - this.rotation = Vec3.ZERO; - - DataResult nbt = CODEC.encodeStart(NbtOps.INSTANCE, this); - return (CompoundTag) nbt.result().orElse(null); - } - - @Override - public void deserializeNBT(CompoundTag nbt) { - Optional dimensionalPosition = CODEC - .parse(NbtOps.INSTANCE, nbt) - .resultOrPartial(CompactMachines.LOGGER::error); - - dimensionalPosition.ifPresent(dp -> { - this.dimension = dp.dimension; - this.position = dp.position; - this.rotation = dp.rotation; - }); - } - - public ResourceKey getDimension() { - return this.dimension; - } - - public Optional getRotation() { - return Optional.of(this.rotation); + return CODEC.parse(NbtOps.INSTANCE, nbt).getOrThrow(false, CompactMachines.LOGGER::error); } public BlockPos getBlockPosition() { - return new BlockPos(position.x, position.y, position.z); + return blockPos.immutable(); } @Override - public Vec3 getExactPosition() { - return this.position; - } + public Optional getBlockEntity(MinecraftServer server) { + if(!state(server).hasBlockEntity()) + return Optional.empty(); - @Override - public ResourceKey dimensionKey() { - return dimension; + return Optional.ofNullable(level(server).getBlockEntity(blockPos)); } @Override @@ -150,23 +85,16 @@ public boolean equals(Object o) { if (!dimension.equals(that.dimension)) return false; - if (!position.equals(that.position)) - return false; - - return rotation.equals(that.rotation); + return blockPos.equals(that.blockPos); } @Override public int hashCode() { - return Objects.hash(dimension, position, rotation); + return Objects.hash(dimension, blockPos); } @Override public String toString() { - return "DimensionalPosition{" + - "d=" + dimension + - ", p=" + position + - ", r=" + rotation + - '}'; + return "LevelBlockPosition{d=%s, p=%s}".formatted(dimension, blockPos); } } diff --git a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java index 155c4599..fc5b51a7 100644 --- a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java +++ b/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java @@ -2,8 +2,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.api.location.IDimensionalPosition; +import dev.compactmods.machines.codec.CodecExtensions; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; @@ -11,53 +11,22 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; import java.util.Objects; -import java.util.Optional; -public final class PreciseDimensionalPosition implements IDimensionalPosition { +public record PreciseDimensionalPosition(ResourceKey dimension, Vec3 position, Vec2 rotation) + implements IDimensionalPosition { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(PreciseDimensionalPosition::dimension), CodecExtensions.VECTOR3D.fieldOf("pos").forGetter(PreciseDimensionalPosition::position), - CodecExtensions.VECTOR3D.optionalFieldOf("rot", Vec3.ZERO).forGetter(x -> x.rotation) + CodecExtensions.VEC2.optionalFieldOf("rot", Vec2.ZERO).forGetter(x -> x.rotation) ).apply(i, PreciseDimensionalPosition::new)); - private final ResourceKey dimension; - private final Vec3 position; - - // TODO 1.20 - Change to vec2 - private final Vec3 rotation; - - public PreciseDimensionalPosition(ResourceKey dimension, Vec3 position) { - this.dimension = dimension; - this.position = position; - this.rotation = Vec3.ZERO; - } - - public PreciseDimensionalPosition(ResourceKey dimension, Vec3 position, Vec3 rotation) { - this.dimension = dimension; - this.position = position; - this.rotation = rotation; - } - public static PreciseDimensionalPosition fromPlayer(Player player) { - return new PreciseDimensionalPosition(player.level.dimension(), player.position(), player.getLookAngle()); - } - - @Override - public Vec3 getExactPosition() { - return position; - } - - public Optional rotation() { - return Optional.ofNullable(rotation); - } - - @Override - public ResourceKey dimensionKey() { - return dimension; + return new PreciseDimensionalPosition(player.level.dimension(), player.position(), new Vec2(player.xRotO, player.yRotO)); } @Override @@ -65,24 +34,11 @@ public ServerLevel level(MinecraftServer server) { return server.getLevel(dimension); } - @Override - public Optional getRotation() { - return Optional.empty(); - } - @Override public boolean isLoaded(MinecraftServer serv) { return level(serv).isLoaded(new BlockPos(position)); } - public ResourceKey dimension() { - return dimension; - } - - public Vec3 position() { - return position; - } - @Override public boolean equals(Object obj) { if (obj == this) return true; diff --git a/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java b/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java index 9b74d92b..5dc74a9f 100644 --- a/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java +++ b/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java @@ -1,22 +1,87 @@ package dev.compactmods.machines.location; +import net.minecraft.commands.arguments.EntityAnchorArgument; +import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.ITeleporter; +import java.util.Objects; import java.util.function.Function; -public record SimpleTeleporter(Vec3 pos) implements ITeleporter { +public final class SimpleTeleporter implements ITeleporter { + private final Vec3 pos; + private final Vec2 rotation; + + private final BlockPos postTeleLookAt; + + private SimpleTeleporter(Vec3 pos, Vec2 rotation) { + this.pos = pos; + this.rotation = rotation; + this.postTeleLookAt = null; + } + + private SimpleTeleporter(Vec3 pos, Vec2 rotation, BlockPos postTeleLookAt) { + this.pos = pos; + this.rotation = rotation; + this.postTeleLookAt = postTeleLookAt; + } public static SimpleTeleporter to(Vec3 pos) { - return new SimpleTeleporter(pos); + return new SimpleTeleporter(pos, Vec2.ZERO); + } + + public static SimpleTeleporter to(Vec3 pos, Vec2 rotation) { + return new SimpleTeleporter(pos, rotation); + } + + public static ITeleporter lookingAt(Vec3 position, BlockPos lookAt) { + return new SimpleTeleporter(position, Vec2.ZERO, lookAt); } @Override public Entity placeEntity(Entity entity, ServerLevel currentWorld, ServerLevel destWorld, float yaw, Function repositionEntity) { entity = repositionEntity.apply(false); entity.teleportTo(pos.x, pos.y, pos.z); + entity.setXRot(rotation.x); + entity.setYRot(rotation.y); + entity.setYHeadRot(rotation.y); + + if(postTeleLookAt != null) + entity.lookAt(EntityAnchorArgument.Anchor.EYES, Vec3.atCenterOf(postTeleLookAt)); + return entity; } + + public Vec3 pos() { + return pos; + } + + public Vec2 rotation() { + return rotation; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (SimpleTeleporter) obj; + return Objects.equals(this.pos, that.pos) && + Objects.equals(this.rotation, that.rotation); + } + + @Override + public int hashCode() { + return Objects.hash(pos, rotation); + } + + @Override + public String toString() { + return "SimpleTeleporter[" + + "pos=" + pos + ", " + + "rotation=" + rotation + ']'; + } + } diff --git a/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java b/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java new file mode 100644 index 00000000..7027b0ce --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java @@ -0,0 +1,6 @@ +package dev.compactmods.machines.machine; + +import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; + +public record BasicRoomInfo(String code, int color) implements IBasicRoomInfo { +} diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java b/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java deleted file mode 100644 index a373ef46..00000000 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlockEntity.java +++ /dev/null @@ -1,262 +0,0 @@ -package dev.compactmods.machines.machine; - -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.machine.MachineNbt; -import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; -import dev.compactmods.machines.dimension.MissingDimensionException; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.graph.CompactMachineRoomNode; -import dev.compactmods.machines.tunnel.TunnelWallEntity; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.LazyOptional; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -public class CompactMachineBlockEntity extends BlockEntity { - private static final String ROOM_NBT = "room_pos"; - - public long nextSpawnTick = 0; - - protected UUID owner; - protected String schema; - protected boolean locked = false; - private ChunkPos roomChunk; - - private WeakReference graphNode; - private WeakReference roomNode; - - public CompactMachineBlockEntity(BlockPos pos, BlockState state) { - super(Machines.MACHINE_TILE_ENTITY.get(), pos, state); - } - - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - if (level instanceof ServerLevel sl) { - return getConnectedRoom().map(roomId -> { - try { - final var serv = sl.getServer(); - final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); - - final var graph = TunnelConnectionGraph.forRoom(compactDim, roomId); - - final var supportingTunnels = graph.getTunnelsSupporting(getLevelPosition(), side, cap); - final var firstSupported = supportingTunnels.findFirst(); - if (firstSupported.isEmpty()) - return super.getCapability(cap, side); - - if (compactDim == null) - throw new MissingDimensionException(); - - if (compactDim.getBlockEntity(firstSupported.get()) instanceof TunnelWallEntity tunnel) { - return tunnel.getTunnelCapability(cap, side); - } else { - return super.getCapability(cap, side); - } - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.fatal(e); - return super.getCapability(cap, side); - } - }).orElse(super.getCapability(cap, side)); - } - - return super.getCapability(cap, side); - } - - @Override - public void onLoad() { - super.onLoad(); - this.syncConnectedRoom(); - } - - @Override - public void load(@Nonnull CompoundTag nbt) { - super.load(nbt); - - if (nbt.contains(MachineNbt.OWNER)) { - owner = nbt.getUUID(MachineNbt.OWNER); - } else { - owner = null; - } - - nextSpawnTick = nbt.getLong("spawntick"); - if (nbt.contains("schema")) { - schema = nbt.getString("schema"); - } else { - schema = null; - } - - if (nbt.contains("locked")) { - locked = nbt.getBoolean("locked"); - } else { - locked = false; - } - } - - @Override - protected void saveAdditional(CompoundTag nbt) { - // nbt.putString("CustomName", customName.getString()); - - if (owner != null) { - nbt.putUUID(MachineNbt.OWNER, this.owner); - } - - nbt.putLong("spawntick", nextSpawnTick); - if (schema != null) { - nbt.putString("schema", schema); - } - - nbt.putBoolean("locked", locked); - } - - @Override - public CompoundTag getUpdateTag() { - CompoundTag data = super.getUpdateTag(); - - getConnectedRoom().ifPresent(room -> { - data.putIntArray(ROOM_NBT, new int[]{room.x, room.z}); - }); - - if (level instanceof ServerLevel) { - // TODO - Internal player list - if (this.owner != null) - data.putUUID("owner", this.owner); - } - - return data; - } - - public Optional getConnectedRoom() { - if (level instanceof ServerLevel sl) { - if (roomChunk != null) - return Optional.of(roomChunk); - - final var graph = DimensionMachineGraph.forDimension(sl); - - var chunk = graph.getConnectedRoom(worldPosition); - chunk.ifPresent(c -> this.roomChunk = c); - return chunk; - } - - return Optional.ofNullable(roomChunk); - } - - @Override - public void handleUpdateTag(CompoundTag tag) { - super.handleUpdateTag(tag); - - if (tag.contains("players")) { - CompoundTag players = tag.getCompound("players"); - // playerData = CompactMachinePlayerData.fromNBT(players); - - } - - if (tag.contains(ROOM_NBT)) { - int[] room = tag.getIntArray(ROOM_NBT); - this.roomChunk = new ChunkPos(room[0], room[1]); - } - - if (tag.contains("owner")) - owner = tag.getUUID("owner"); - } - - public Optional getOwnerUUID() { - return Optional.ofNullable(this.owner); - } - - public void setOwner(UUID owner) { - this.owner = owner; - } - - public boolean hasPlayersInside() { - // TODO - return false; - } - - public LevelBlockPosition getLevelPosition() { - return new LevelBlockPosition(level.dimension(), worldPosition); - } - - public void syncConnectedRoom() { - if (this.level == null || this.level.isClientSide) return; - - if (level instanceof ServerLevel sl) { - final var graph = DimensionMachineGraph.forDimension(sl); - graph.getMachineNode(worldPosition).ifPresent(node -> { - this.graphNode = new WeakReference<>(node); - }); - - this.getConnectedRoom() - .flatMap(room -> graph.getRoomNode(this.roomChunk)) - .ifPresent(roomNode -> this.roomNode = new WeakReference<>(roomNode)); - - this.setChanged(); - } - } - - public void setConnectedRoom(ChunkPos room) { - if(level instanceof ServerLevel sl) { - final var dimMachines = DimensionMachineGraph.forDimension(sl); - dimMachines.connectMachineToRoom(worldPosition, room); - syncConnectedRoom(); - } - } - - public void disconnect() { - if(level instanceof ServerLevel sl) { - final var dimMachines = DimensionMachineGraph.forDimension(sl); - dimMachines.disconnect(worldPosition); - - this.roomChunk = null; - this.graphNode.clear(); - setChanged(); - } - } - - public Stream getTunnels(Direction dir) { - if(level == null || roomChunk == null) return Stream.empty(); - - if(level instanceof ServerLevel sl) { - final var compactDim = CompactDimension.forServer(sl.getServer()); - if(compactDim == null) - return Stream.empty(); - - final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomChunk); - return tunnelGraph.getTunnelsForSide(getLevelPosition(), dir).map(TunnelNode::position); - } - - return Stream.empty(); - } - - public Optional getTunnelGraph() { - if(level == null || roomChunk == null) return Optional.empty(); - - if(level instanceof ServerLevel sl) { - final var compactDim = CompactDimension.forServer(sl.getServer()); - if (compactDim == null) - return Optional.empty(); - - final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomChunk); - return Optional.of(tunnelGraph); - } - - return Optional.empty(); - } -} diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/CompactMachineItem.java deleted file mode 100644 index d0d068cb..00000000 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineItem.java +++ /dev/null @@ -1,115 +0,0 @@ -package dev.compactmods.machines.machine; - -import dev.compactmods.machines.api.core.Tooltips; -import dev.compactmods.machines.api.machine.MachineNbt; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.api.room.RoomSize; -import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; - -import javax.annotation.Nullable; -import java.util.List; -import java.util.Optional; - -public class CompactMachineItem extends BlockItem { - - private static final String ROOM_NBT = "room_pos"; - - public CompactMachineItem(Block blockIn, Properties builder) { - super(blockIn, builder); - } - - @Deprecated(forRemoval = true) - public static Optional getMachineId(ItemStack stack) { - if (!stack.hasTag()) - return Optional.empty(); - - CompoundTag machineData = stack.getOrCreateTag(); - if (machineData.contains(MachineNbt.ID)) { - int c = machineData.getInt(MachineNbt.ID); - return c > -1 ? Optional.of(c) : Optional.empty(); - } - - return Optional.empty(); - } - - public static Item getItemBySize(RoomSize size) { - return switch (size) { - case TINY -> Machines.MACHINE_BLOCK_ITEM_TINY.get(); - case SMALL -> Machines.MACHINE_BLOCK_ITEM_SMALL.get(); - case NORMAL -> Machines.MACHINE_BLOCK_ITEM_NORMAL.get(); - case LARGE -> Machines.MACHINE_BLOCK_ITEM_LARGE.get(); - case GIANT -> Machines.MACHINE_BLOCK_ITEM_GIANT.get(); - case MAXIMUM -> Machines.MACHINE_BLOCK_ITEM_MAXIMUM.get(); - }; - } - - public static Optional getRoom(ItemStack stack) { - if (!stack.hasTag()) - return Optional.empty(); - - var tag = stack.getTag(); - if(!tag.contains(ROOM_NBT)) { - return Optional.empty(); - } - - var roomNbt = tag.getIntArray(ROOM_NBT); - return Optional.of(new ChunkPos(roomNbt[0], roomNbt[1])); - } - - public static void setRoom(ItemStack stack, ChunkPos room) { - var tag = stack.getOrCreateTag(); - tag.putIntArray(ROOM_NBT, new int[] { room.x, room.z }); - } - - @Override - public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - super.appendHoverText(stack, worldIn, tooltip, flagIn); - - // We need NBT data for the rest of this - if (stack.hasTag()) { - CompoundTag nbt = stack.getTag(); - if(nbt == null) - return; - - // Try room binding; if failed, try old machine ID binding - getRoom(stack).ifPresentOrElse(room -> { - // TODO - Server-synced room name list - tooltip.add(TranslationUtil.tooltip(Tooltips.ROOM_NAME, room)); - }, () -> { - getMachineId(stack).ifPresent(id -> { - tooltip.add(TranslationUtil.tooltip(Tooltips.Machines.ID, id)); - }); - }); - } - - if (Screen.hasShiftDown()) { - Block b = Block.byItem(stack.getItem()); - if (b instanceof CompactMachineBlock cmb) { - RoomSize size = cmb.getSize(); - int internalSize = size.getInternalSize(); - - MutableComponent text = TranslationUtil.tooltip(Tooltips.Machines.SIZE, internalSize) - .withStyle(ChatFormatting.YELLOW); - - tooltip.add(text); - } - } else { - MutableComponent text = TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) - .withStyle(ChatFormatting.DARK_GRAY) - .withStyle(ChatFormatting.ITALIC); - - tooltip.add(text); - } - } -} diff --git a/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java new file mode 100644 index 00000000..ff32e038 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java @@ -0,0 +1,36 @@ +package dev.compactmods.machines.machine; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.RoomTemplate; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.FastColor; + +/** + * @deprecated These templates will be removed in 1.20, and the system will become fully data controlled. + * Do not assume these are valid at any point! + */ +@Deprecated(forRemoval = true, since = "5.2.0") +public enum LegacySizedTemplates { + EMPTY_TINY("tiny", 3, FastColor.ARGB32.color(255, 201, 91, 19)), + EMPTY_SMALL("small", 5, FastColor.ARGB32.color(255, 212, 210, 210)), + EMPTY_NORMAL("normal", 7, FastColor.ARGB32.color(255, 251, 242, 54)), + EMPTY_LARGE("large", 9, FastColor.ARGB32.color(255, 33, 27, 46)), + EMPTY_GIANT("giant", 11, FastColor.ARGB32.color(255, 67, 214, 205)), + EMPTY_COLOSSAL("colossal", 13, FastColor.ARGB32.color(255, 66, 63, 66)); + + private final ResourceLocation id; + private final RoomTemplate template; + + LegacySizedTemplates(String id, int size, int color) { + this.id = new ResourceLocation(Constants.MOD_ID, id); + this.template = new RoomTemplate(size, color); + } + + public RoomTemplate template() { + return template; + } + + public ResourceLocation id() { + return id; + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/Machines.java b/src/main/java/dev/compactmods/machines/machine/Machines.java index 76d25be8..1adf11e5 100644 --- a/src/main/java/dev/compactmods/machines/machine/Machines.java +++ b/src/main/java/dev/compactmods/machines/machine/Machines.java @@ -1,8 +1,14 @@ package dev.compactmods.machines.machine; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.machine.block.CompactMachineBlock; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; +import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -18,52 +24,57 @@ public class Machines { .strength(8.0F, 20.0F) .requiresCorrectToolForDrops(); - static final Supplier MACHINE_ITEM_PROPS = () -> new Item.Properties() - .tab(CompactMachines.COMPACT_MACHINES_ITEMS); + static final Supplier MACHINE_ITEM_PROPS = Item.Properties::new; public static final RegistryObject MACHINE_BLOCK_TINY = Registries.BLOCKS.register("machine_tiny", () -> - new CompactMachineBlock(RoomSize.TINY, MACHINE_BLOCK_PROPS)); + new LegacySizedCompactMachineBlock(RoomSize.TINY, MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_SMALL = Registries.BLOCKS.register("machine_small", () -> - new CompactMachineBlock(RoomSize.SMALL, MACHINE_BLOCK_PROPS)); + new LegacySizedCompactMachineBlock(RoomSize.SMALL, MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_NORMAL = Registries.BLOCKS.register("machine_normal", () -> - new CompactMachineBlock(RoomSize.NORMAL, MACHINE_BLOCK_PROPS)); + new LegacySizedCompactMachineBlock(RoomSize.NORMAL, MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_LARGE = Registries.BLOCKS.register("machine_large", () -> - new CompactMachineBlock(RoomSize.LARGE, MACHINE_BLOCK_PROPS)); + new LegacySizedCompactMachineBlock(RoomSize.LARGE, MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_GIANT = Registries.BLOCKS.register("machine_giant", () -> - new CompactMachineBlock(RoomSize.GIANT, MACHINE_BLOCK_PROPS)); + new LegacySizedCompactMachineBlock(RoomSize.GIANT, MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_MAXIMUM = Registries.BLOCKS.register("machine_maximum", () -> - new CompactMachineBlock(RoomSize.MAXIMUM, MACHINE_BLOCK_PROPS)); - - + new LegacySizedCompactMachineBlock(RoomSize.MAXIMUM, MACHINE_BLOCK_PROPS)); + public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("machine", () -> + new CompactMachineBlock(MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_ITEM_TINY = Registries.ITEMS.register("machine_tiny", - () -> new CompactMachineItem(MACHINE_BLOCK_TINY.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_TINY.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject MACHINE_BLOCK_ITEM_SMALL = Registries.ITEMS.register("machine_small", - () -> new CompactMachineItem(MACHINE_BLOCK_SMALL.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_SMALL.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject MACHINE_BLOCK_ITEM_NORMAL = Registries.ITEMS.register("machine_normal", - () -> new CompactMachineItem(MACHINE_BLOCK_NORMAL.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_NORMAL.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject MACHINE_BLOCK_ITEM_LARGE = Registries.ITEMS.register("machine_large", - () -> new CompactMachineItem(MACHINE_BLOCK_LARGE.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_LARGE.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject MACHINE_BLOCK_ITEM_GIANT = Registries.ITEMS.register("machine_giant", - () -> new CompactMachineItem(MACHINE_BLOCK_GIANT.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_GIANT.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject MACHINE_BLOCK_ITEM_MAXIMUM = Registries.ITEMS.register("machine_maximum", - () -> new CompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); + () -> new LegacyCompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); + + public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("machine", + () -> new BoundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); + public static final RegistryObject UNBOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("new_machine", + () -> new UnboundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); public static final RegistryObject> MACHINE_TILE_ENTITY = Registries.BLOCK_ENTITIES.register("compact_machine", () -> BlockEntityType.Builder.of(CompactMachineBlockEntity::new, + MACHINE_BLOCK.get(), MACHINE_BLOCK_TINY.get(), MACHINE_BLOCK_SMALL.get(), MACHINE_BLOCK_NORMAL.get(), MACHINE_BLOCK_LARGE.get(), MACHINE_BLOCK_GIANT.get(), MACHINE_BLOCK_MAXIMUM.get()) .build(null)); diff --git a/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java new file mode 100644 index 00000000..e739c922 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java @@ -0,0 +1,99 @@ +package dev.compactmods.machines.machine.block; + +import dev.compactmods.machines.api.shrinking.PSDTags; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.room.client.RoomClientHelper; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.stream.Collectors; + +/** + * Primary block. + * + * @since 5.2.0 + */ +public class CompactMachineBlock extends Block implements EntityBlock { + + public static final BooleanProperty IS_CONNECTED = BooleanProperty.create("connected"); + + public CompactMachineBlock(Properties props) { + super(props); + registerDefaultState(getStateDefinition().any() + .setValue(IS_CONNECTED, false) + ); + } + + // client-side + @Override + public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity be) { + return be.basicRoomInfo() + .map(BoundCompactMachineItem::createForRoom) + .orElse(UnboundCompactMachineItem.unbound()); + } + + return UnboundCompactMachineItem.unbound(); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(IS_CONNECTED); + super.createBlockStateDefinition(builder); + } + + @Override + public void fillItemCategory(@Nonnull CreativeModeTab tab, @Nonnull NonNullList tabItems) { + var reg = RoomClientHelper.getTemplates(); + tabItems.addAll(reg.entrySet() + .stream() + .map((template) -> UnboundCompactMachineItem.forTemplate(template.getKey().location(), template.getValue())) + .collect(Collectors.toSet())); + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + // force client redraw + super.setPlacedBy(level, pos, state, placer, stack); + } + + @Nullable + @Override + public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { + return new CompactMachineBlockEntity(pos, state); + } + + @Nonnull + @Override + @SuppressWarnings("deprecation") + public InteractionResult use(@Nonnull BlockState state, Level level, @Nonnull BlockPos pos, Player player, @Nonnull InteractionHand hand, @Nonnull BlockHitResult hitResult) { + MinecraftServer server = level.getServer(); + ItemStack mainItem = player.getMainHandItem(); + if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { + return MachineBlockUtil.tryRoomTeleport(level, pos, player, server, sp); + } + + return InteractionResult.sidedSuccess(level.isClientSide); + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java b/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java new file mode 100644 index 00000000..afeee784 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java @@ -0,0 +1,382 @@ +package dev.compactmods.machines.machine.block; + +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; +import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.machine.BasicRoomInfo; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.graph.CompactMachineNode; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.TunnelWallEntity; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.util.NbtUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.lang.ref.WeakReference; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Stream; + +public class CompactMachineBlockEntity extends BlockEntity { + + /** + * @deprecated Store a room code instead or use room lookup utils + */ + @Deprecated(forRemoval = true, since = "5.2.0") + public static final String NBT_ROOM_POS = "room_pos"; + public static final String NBT_ROOM_CODE = "room_code"; + public static final String NBT_CUSTOM_COLOR = "machine_color"; + public static final String NBT_TEMPLATE_ID = "template_id"; + private static final String NBT_ROOM_COLOR = "room_color"; + + @Nullable + private ResourceLocation roomTemplateId = null; + + protected UUID owner; + private String roomCode; + + private boolean hasCustomColor = false; + private int customColor; + private int roomColor; + + private WeakReference graphNode; + private WeakReference fullRoomInfo; + + @Nullable + private IBasicRoomInfo basicInfo; + + public CompactMachineBlockEntity(BlockPos pos, BlockState state) { + super(Machines.MACHINE_TILE_ENTITY.get(), pos, state); + this.roomTemplateId = RoomTemplate.NO_TEMPLATE; + } + + @NotNull + @Override + public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { + if (level instanceof ServerLevel sl) { + return getConnectedRoom().map(roomId -> { + try { + final var serv = sl.getServer(); + final var compactDim = CompactDimension.forServer(serv); + + final var graph = TunnelConnectionGraph.forRoom(compactDim, roomId); + + final var supportingTunnels = graph.getTunnelsSupporting(getLevelPosition(), side, cap); + final var firstSupported = supportingTunnels.findFirst(); + if (firstSupported.isEmpty()) + return super.getCapability(cap, side); + + if (compactDim.getBlockEntity(firstSupported.get()) instanceof TunnelWallEntity tunnel) { + return tunnel.getTunnelCapability(cap, side); + } else { + return super.getCapability(cap, side); + } + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.fatal(e); + return super.getCapability(cap, side); + } + }).orElse(super.getCapability(cap, side)); + } + + return super.getCapability(cap, side); + } + + @Override + public void onLoad() { + super.onLoad(); + this.syncConnectedRoom(); + } + + @Override + public void load(@NotNull CompoundTag nbt) { + super.load(nbt); + + if (nbt.contains(NBT_ROOM_POS)) { + final var originalRoomPos = NbtUtil.readChunkPos(nbt.get(NBT_ROOM_POS)); + CompactMachines.LOGGER.debug("Machine block has a chunk position specified, it will be rewritten to the new room code system." + + "The block at {} was originally connected to position {}", worldPosition, originalRoomPos); + } + + if (nbt.contains(NBT_ROOM_CODE)) { + this.hasCustomColor = true; + this.roomCode = nbt.getString(NBT_ROOM_CODE); + } + + if (nbt.contains(MachineNbt.OWNER)) { + owner = nbt.getUUID(MachineNbt.OWNER); + } else { + owner = null; + } + + if (nbt.contains(NBT_CUSTOM_COLOR)) { + customColor = nbt.getInt(NBT_CUSTOM_COLOR); + hasCustomColor = true; + } + + if (nbt.contains(NBT_TEMPLATE_ID)) { + roomTemplateId = new ResourceLocation(nbt.getString(NBT_TEMPLATE_ID)); + } + + if(level != null && !level.isClientSide ) + this.level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL); + } + + @Override + protected void saveAdditional(@NotNull CompoundTag nbt) { + if (owner != null) { + nbt.putUUID(MachineNbt.OWNER, this.owner); + } + + if (hasCustomColor) { + nbt.putInt(NBT_CUSTOM_COLOR, customColor); + } + + if (roomCode != null) + nbt.putString(NBT_ROOM_CODE, roomCode); + + if (roomTemplateId != null) + nbt.putString(NBT_TEMPLATE_ID, roomTemplateId.toString()); + } + + @Override + public CompoundTag getUpdateTag() { + CompoundTag data = super.getUpdateTag(); + + roomInfo().ifPresent(room -> { + // data.putString(ROOM_POS_NBT, room); + data.putString(NBT_ROOM_CODE, roomCode); + }); + + if (level instanceof ServerLevel) { + // TODO - Internal player list + if (this.owner != null) + data.putUUID("owner", this.owner); + } + + if (hasCustomColor) + data.putInt(NBT_CUSTOM_COLOR, customColor); + else + data.putInt(NBT_ROOM_COLOR, getColor()); + + if (!this.roomTemplateId.equals(RoomTemplate.NO_TEMPLATE)) + data.putString(NBT_TEMPLATE_ID, this.roomTemplateId.toString()); + + return data; + } + + private Optional getConnectedRoom() { + if (level instanceof ServerLevel sl) { + if (roomCode != null) + return Optional.of(roomCode); + + final var graph = DimensionMachineGraph.forDimension(sl); + + var chunk = graph.getConnectedRoom(worldPosition); + chunk.ifPresent(c -> this.roomCode = c); + return chunk; + } + + return Optional.ofNullable(roomCode); + } + + @Override + public void handleUpdateTag(CompoundTag tag) { + super.handleUpdateTag(tag); + + if (tag.contains("players")) { + CompoundTag players = tag.getCompound("players"); + // playerData = CompactMachinePlayerData.fromNBT(players); + + } + + if (tag.contains(NBT_ROOM_POS)) { + int[] room = tag.getIntArray(NBT_ROOM_POS); + final var oldChunk = new ChunkPos(room[0], room[1]); + } + + if (tag.contains(NBT_CUSTOM_COLOR)) { + hasCustomColor = true; + customColor = tag.getInt(NBT_CUSTOM_COLOR); + } else { + roomColor = tag.getInt(NBT_ROOM_COLOR); + } + + if (tag.contains("owner")) + owner = tag.getUUID("owner"); + + if (tag.contains(NBT_TEMPLATE_ID)) + roomTemplateId = new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); + + this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); + } + + public Optional getOwnerUUID() { + return Optional.ofNullable(this.owner); + } + + public void setOwner(UUID owner) { + this.owner = owner; + } + + public boolean hasPlayersInside() { + // TODO + return false; + } + + public LevelBlockPosition getLevelPosition() { + return new LevelBlockPosition(level.dimension(), worldPosition); + } + + public void syncConnectedRoom() { + if (this.level == null || this.level.isClientSide) return; + + if (level instanceof ServerLevel sl) { + final var graph = DimensionMachineGraph.forDimension(sl); + try { + final var compactDim = CompactDimension.forServer(sl.getServer()); + + graph.getMachineNode(worldPosition).ifPresent(node -> { + this.graphNode = new WeakReference<>(node); + }); + + if (this.roomCode != null) { + final var lookup = CompactRoomProvider.instance(compactDim); + lookup.forRoom(roomCode).ifPresent(roomInfo -> { + this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); + this.fullRoomInfo = new WeakReference<>(roomInfo); + this.roomColor = roomInfo.color(); + }); + } else { + graph.getConnectedRoom(worldPosition).ifPresentOrElse(room -> { + CompactMachines.LOGGER.debug("No room code found for {}/{}, but machine connection graph has value {}; connecting to that room...", + level.dimension().location(), worldPosition.toShortString(), room); + + this.roomCode = room; + final var lookup = CompactRoomProvider.instance(compactDim); + lookup.forRoom(roomCode).ifPresent(roomInfo -> { + this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); + this.fullRoomInfo = new WeakReference<>(roomInfo); + this.roomColor = roomInfo.color(); + }); + }, () -> { + this.basicInfo = null; + }); + } + + this.setChanged(); + } catch (MissingDimensionException e) { + throw new RuntimeException(e); + } + } + } + + public void setConnectedRoom(IRoomRegistration room) { + if (level instanceof ServerLevel sl) { + final var dimMachines = DimensionMachineGraph.forDimension(sl); + dimMachines.connectMachineToRoom(worldPosition, room.code()); + this.roomCode = room.code(); + syncConnectedRoom(); + } + } + + public void disconnect() { + if (level instanceof ServerLevel sl) { + final var dimMachines = DimensionMachineGraph.forDimension(sl); + dimMachines.disconnect(worldPosition); + + this.roomCode = null; + this.graphNode.clear(); + setChanged(); + } + } + + public Stream getTunnels(Direction dir) { + if (level == null || roomCode == null) return Stream.empty(); + + if (level instanceof ServerLevel sl) { + try { + final ServerLevel compactDim = CompactDimension.forServer(sl.getServer()); + final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomCode); + return tunnelGraph.getTunnelsForSide(getLevelPosition(), dir).map(TunnelNode::position); + } catch (MissingDimensionException e) { + return Stream.empty(); + } + } + + return Stream.empty(); + } + + public Optional getTunnelGraph() { + if (level == null || roomCode == null) return Optional.empty(); + + if (level instanceof ServerLevel sl) { + try { + final var compactDim = CompactDimension.forServer(sl.getServer()); + final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomCode); + return Optional.of(tunnelGraph); + } catch (MissingDimensionException e) { + return Optional.empty(); + } + } + + return Optional.empty(); + } + + public Optional roomInfo() { + if (level != null && level.isClientSide) { + if (roomCode == null) return Optional.empty(); + return Optional.empty(); + } else { + if (fullRoomInfo == null) + return Optional.empty(); + + return Optional.ofNullable(fullRoomInfo.get()); + } + } + + public int getColor() { + return hasCustomColor ? customColor : roomColor; + } + + public Optional getRoomTemplate() { + if (level != null) { + return level.registryAccess() + .registry(CMRegistries.TEMPLATE_REG_KEY) + .map(reg -> reg.get(roomTemplateId)); + } + + return Optional.empty(); + } + + public Optional connectedRoom() { + return Optional.ofNullable(roomCode); + } + + public Optional basicRoomInfo() { + if (this.roomCode != null) + return Optional.of(this.basicInfo); + + return Optional.empty(); + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java b/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java similarity index 58% rename from src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java rename to src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index e9d6bb1c..587ce096 100644 --- a/src/main/java/dev/compactmods/machines/machine/CompactMachineBlock.java +++ b/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -1,33 +1,33 @@ -package dev.compactmods.machines.machine; +package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.shrinking.PSDTags; +import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.location.PreciseDimensionalPosition; +import dev.compactmods.machines.machine.LegacySizedTemplates; +import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.menu.MachineRoomMenu; -import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.upgrade.RoomUpgradeItem; import dev.compactmods.machines.upgrade.RoomUpgradeManager; -import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -53,16 +53,16 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.Optional; -import java.util.UUID; -public class CompactMachineBlock extends Block implements EntityBlock { +@Deprecated(forRemoval = true, since = "5.2.0") +public class LegacySizedCompactMachineBlock extends Block implements EntityBlock { - public static final TagKey TAG = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + public static final TagKey LEGACY_MACHINES_TAG = TagKey.create(Registries.BLOCKS.getRegistryKey(), + new ResourceLocation(Constants.MOD_ID, "legacy_machines")); private final RoomSize size; - public CompactMachineBlock(RoomSize size, BlockBehaviour.Properties props) { + public LegacySizedCompactMachineBlock(RoomSize size, BlockBehaviour.Properties props) { super(props); this.size = size; } @@ -70,35 +70,7 @@ public CompactMachineBlock(RoomSize size, BlockBehaviour.Properties props) { @Override @SuppressWarnings("deprecation") public float getDestroyProgress(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { - CompactMachineBlockEntity tile = (CompactMachineBlockEntity) worldIn.getBlockEntity(pos); - float normalHardness = super.getDestroyProgress(state, player, worldIn, pos); - - if (tile == null) - return normalHardness; - - boolean hasPlayers = tile.hasPlayersInside(); - - - // If there are players inside, check config for break handling - if (hasPlayers) { - EnumMachinePlayersBreakHandling hand = ServerConfig.MACHINE_PLAYER_BREAK_HANDLING.get(); - switch (hand) { - case UNBREAKABLE: - return 0; - - case OWNER: - Optional ownerUUID = tile.getOwnerUUID(); - return ownerUUID - .map(uuid -> player.getUUID() == uuid ? normalHardness : 0) - .orElse(normalHardness); - - case ANYONE: - return normalHardness; - } - } - - // No players inside - let anyone break it - return normalHardness; + return MachineBlockUtil.destroyProgress(state, player, worldIn, pos); } @Override @@ -155,16 +127,7 @@ public static Block getBySize(RoomSize size) { @Override public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { - Block given = getBySize(this.size); - ItemStack stack = new ItemStack(given, 1); - - if (world.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.getConnectedRoom().ifPresent(room -> { - CompactMachineItem.setRoom(stack, room); - }); - } - - return stack; + return MachineBlockUtil.getCloneItemStack(world, state, pos); } @Override @@ -183,7 +146,7 @@ public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable return; // Machine was previously bound to a room - make a new binding post-place - CompactMachineItem.getRoom(stack).ifPresent(room -> { + BoundCompactMachineItem.getRoom(stack).ifPresent(room -> { final var g = DimensionMachineGraph.forDimension(sl); g.connectMachineToRoom(pos, room); tile.syncConnectedRoom(); @@ -199,86 +162,56 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); - - if (mainItem.isEmpty() && level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { - if (state.getBlock() instanceof CompactMachineBlock cmBlock) { - machine.getConnectedRoom().ifPresent(room -> { - var size = cmBlock.getSize(); - try { - final var roomName = Rooms.getRoomName(server, room); - NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, room, machine.getLevelPosition()), (buf) -> { - buf.writeBlockPos(pos); - buf.writeWithCodec(LevelBlockPosition.CODEC, machine.getLevelPosition()); - buf.writeChunkPos(room); - roomName.ifPresentOrElse(name -> { - buf.writeBoolean(true); - buf.writeUtf(name); - }, () -> { - buf.writeBoolean(false); - }); - }); - } catch (NonexistentRoomException e) { - e.printStackTrace(); - } - }); - } - } - - // TODO - Item tags instead of direct item reference here - if (mainItem.getItem() == Shrinking.PERSONAL_SHRINKING_DEVICE.get()) { - // Try teleport to compact machine dimension - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.getConnectedRoom().ifPresentOrElse(room -> { - try { - PlayerUtil.teleportPlayerIntoMachine(level, player, pos); - } catch (MissingDimensionException e) { - e.printStackTrace(); - } - }, () -> createAndEnterRoom(player, server, tile)); - } + if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { + return MachineBlockUtil.tryRoomTeleport(level, pos, player, server, sp); } // Try and pull the name off the nametag and apply it to the room - if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.getConnectedRoom().ifPresentOrElse(room -> { - Rooms.getOwner(server, room).ifPresent(profile -> { + try { + var compactDim = CompactDimension.forServer(server); + final var roomData = CompactRoomProvider.instance(compactDim); + + if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + tile.roomInfo().ifPresentOrElse(room -> { + final var ownerId = room.owner(roomData); try { - if (player.getUUID().equals(profile.getId())) { + if (player.getUUID().equals(ownerId)) { final var newName = mainItem.getHoverName().getString(120); - Rooms.updateName(server, room, newName); + Rooms.updateName(server, room.code(), newName); } else { - player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, profile.getName()), true); + player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, + server.getPlayerList().getPlayer(ownerId).getName()), true); } } catch (NonexistentRoomException e) { throw new RuntimeException(e); } + }, () -> { + CompactMachines.LOGGER.warn("Tried to apply upgrade to a 'claimed' machine, but there was no owner data attached."); }); - }, () -> { - CompactMachines.LOGGER.warn("Tried to apply upgrade to a 'claimed' machine, but there was no owner data attached."); - }); + } } - } - // Upgrade Item - if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { - final var reg = MachineRoomUpgrades.REGISTRY.get(); - if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.getConnectedRoom().ifPresent(room -> { - Rooms.getOwner(server, room).ifPresent(prof -> { - if (!player.getUUID().equals(prof.getId())) { - player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, prof.getName()), true); + // Upgrade Item + if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { + final var reg = MachineRoomUpgrades.REGISTRY.get(); + if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + tile.roomInfo().ifPresent(room -> { + final var ownerId = room.owner(roomData); + if (!player.getUUID().equals(ownerId)) { + final var ownerName = server.getPlayerList().getPlayer(ownerId).getName(); + player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, ownerName), true); return; } final var upg = upItem.getUpgradeType(); - final var manager = RoomUpgradeManager.get(server.getLevel(CompactDimension.LEVEL_KEY)); + final var manager = RoomUpgradeManager.get(compactDim); - if (manager.hasUpgrade(room, upg)) { + if (manager.hasUpgrade(room.code(), upg)) { player.displayClientMessage(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE), true); } else { - final var added = manager.addUpgrade(upg, room); + final var added = manager.addUpgrade(upg, room.code()); if (added) { player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_APPLIED) @@ -289,29 +222,53 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player } } }); + } + } + } + + // All other items, open preview screen + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { + if (state.getBlock() instanceof LegacySizedCompactMachineBlock cmBlock) { + machine.roomInfo().ifPresent(room -> { + var size = cmBlock.getSize(); + try { + final var roomName = Rooms.getRoomName(server, room.code()); + NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, room, machine.getLevelPosition()), (buf) -> { + buf.writeBlockPos(pos); + buf.writeWithCodec(LevelBlockPosition.CODEC, machine.getLevelPosition()); + buf.writeUtf(room.code()); + roomName.ifPresentOrElse(name -> { + buf.writeBoolean(true); + buf.writeUtf(name); + }, () -> { + buf.writeBoolean(false); + buf.writeUtf(""); + }); + }); + } catch (NonexistentRoomException e) { + e.printStackTrace(); + } }); } } + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.fatal(e); } - return InteractionResult.SUCCESS; + return InteractionResult.sidedSuccess(level.isClientSide); } - private void createAndEnterRoom(Player player, MinecraftServer server, CompactMachineBlockEntity tile) { - try { - final var newRoomPos = Rooms.createNew(server, size, player.getUUID()); - tile.setConnectedRoom(newRoomPos); - - PlayerUtil.teleportPlayerIntoRoom(server, player, newRoomPos, true); + public static RoomTemplate getLegacyTemplate(RoomSize size) { + final var temp = switch (size) { + case TINY -> LegacySizedTemplates.EMPTY_TINY; + case SMALL -> LegacySizedTemplates.EMPTY_SMALL; + case NORMAL -> LegacySizedTemplates.EMPTY_NORMAL; + case LARGE -> LegacySizedTemplates.EMPTY_LARGE; + case GIANT -> LegacySizedTemplates.EMPTY_GIANT; + case MAXIMUM -> LegacySizedTemplates.EMPTY_COLOSSAL; + }; - // Mark the player as inside the machine, set external spawn, and yeet - player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { - var entry = PreciseDimensionalPosition.fromPlayer(player); - hist.addHistory(new PlayerRoomHistoryItem(entry, tile.getLevelPosition())); - }); - } catch (MissingDimensionException | NonexistentRoomException e) { - CompactMachines.LOGGER.error("Error occurred while generating new room and machine info for first player entry.", e); - } + return temp.template(); } public RoomSize getSize() { @@ -338,14 +295,14 @@ public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity entity) { - entity.getConnectedRoom().ifPresent(room -> { + entity.roomInfo().ifPresent(room -> { final var dimGraph = DimensionMachineGraph.forDimension(sl); dimGraph.disconnect(pos); if (compactDim == null) return; - final var tunnels = TunnelConnectionGraph.forRoom(compactDim, room); + final var tunnels = TunnelConnectionGraph.forRoom(compactDim, room.code()); tunnels.unregister(pos); }); } diff --git a/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java new file mode 100644 index 00000000..837064ca --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -0,0 +1,150 @@ +package dev.compactmods.machines.machine.block; + +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.location.PreciseDimensionalPosition; +import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; +import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; +import dev.compactmods.machines.util.CompactStructureGenerator; +import dev.compactmods.machines.util.PlayerUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; + +import javax.annotation.Nonnull; +import java.util.Optional; +import java.util.UUID; + +public class MachineBlockUtil { + + @Nonnull + static InteractionResult tryRoomTeleport(Level level, BlockPos pos, Player player, MinecraftServer server, ServerPlayer sp) { + // Try teleport to compact machine dimension + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + tile.roomInfo().ifPresentOrElse(room -> { + try { + PlayerUtil.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), room); + } catch (MissingDimensionException e) { + e.printStackTrace(); + } + }, () -> { + final var state = level.getBlockState(pos); + RoomTemplate template = RoomTemplate.INVALID_TEMPLATE; + if(state.is(LegacySizedCompactMachineBlock.LEGACY_MACHINES_TAG)) { + if(state.getBlock() instanceof LegacySizedCompactMachineBlock b) + template = LegacySizedCompactMachineBlock.getLegacyTemplate(b.getSize()); + } else { + template = tile.getRoomTemplate().orElse(RoomTemplate.INVALID_TEMPLATE); + } + + createAndEnterRoom(player, server, template, tile); + // AdvancementTriggers.getTriggerForMachineClaim(size).trigger(sp); + }); + + return InteractionResult.SUCCESS; + } + + return InteractionResult.sidedSuccess(level.isClientSide); + } + + static void createAndEnterRoom(Player owner, MinecraftServer server, RoomTemplate template, CompactMachineBlockEntity machine) { + try { + final var compactDim = CompactDimension.forServer(server); + if(template.equals(RoomTemplate.INVALID_TEMPLATE)) { + CompactMachines.LOGGER.fatal("Tried to create and enter an invalidly-registered room. Something went very wrong!"); + return; + } + + final var roomInfo = CompactRoomProvider.instance(compactDim); + final var newRoom = roomInfo.registerNew(builder -> builder + .setColor(template.color()) + .setDimensions(template.dimensions()) + .setOwner(owner.getUUID())); + + // Generate a new machine room + CompactStructureGenerator.generateRoom(compactDim, template.dimensions(), newRoom.center()); + + // If template specified, prefill new room + if (!template.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { + CompactStructureGenerator.fillWithTemplate(compactDim, template.prefillTemplate(), template.dimensions(), newRoom.center()); + } + + machine.setConnectedRoom(newRoom); + + PlayerUtil.teleportPlayerIntoRoom(server, owner, newRoom); + + // Mark the player as inside the machine, set external spawn, and yeet + owner.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { + var entry = PreciseDimensionalPosition.fromPlayer(owner); + hist.addHistory(new PlayerRoomHistoryItem(entry, machine.getLevelPosition())); + }); + } catch (MissingDimensionException | NonexistentRoomException e) { + CompactMachines.LOGGER.error("Error occurred while generating new room and machine info for first player entry.", e); + } + } + + public static float destroyProgress(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { + CompactMachineBlockEntity tile = (CompactMachineBlockEntity) worldIn.getBlockEntity(pos); + float normalHardness = state.getDestroyProgress(player, worldIn, pos); + + if (tile == null) + return normalHardness; + + boolean hasPlayers = tile.hasPlayersInside(); + + + // If there are players inside, check config for break handling + if (hasPlayers) { + EnumMachinePlayersBreakHandling hand = ServerConfig.MACHINE_PLAYER_BREAK_HANDLING.get(); + switch (hand) { + case UNBREAKABLE: + return 0; + + case OWNER: + Optional ownerUUID = tile.getOwnerUUID(); + return ownerUUID + .map(uuid -> player.getUUID() == uuid ? normalHardness : 0) + .orElse(normalHardness); + + case ANYONE: + return normalHardness; + } + } + + // No players inside - let anyone break it + return normalHardness; + } + + public static ItemStack getCloneItemStack(BlockGetter world, BlockState state, BlockPos pos) { + if(state.is(LegacySizedCompactMachineBlock.LEGACY_MACHINES_TAG) && state.getBlock() instanceof LegacySizedCompactMachineBlock l) + { + final var item = LegacyCompactMachineItem.getItemBySize(l.getSize()); + return new ItemStack(item); + } + + // If not a machine or the block data is invalid... + if(!state.is(CMTags.MACHINE_BLOCK) || !(world.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile)) + return UnboundCompactMachineItem.unbound(); + + return tile.basicRoomInfo() + .map(BoundCompactMachineItem::createForRoom) + .orElse(UnboundCompactMachineItem.unbound()); + } + +} diff --git a/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java new file mode 100644 index 00000000..fd577fd9 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java @@ -0,0 +1,25 @@ +package dev.compactmods.machines.machine.client; + +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.machine.item.CompactMachineItem; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import net.minecraft.client.color.block.BlockColor; +import net.minecraft.client.color.item.ItemColor; + +public class MachineColors { + + public static final ItemColor ITEM = (stack, pTintIndex) -> { + if(!stack.is(CMTags.MACHINE_ITEM)) return 0xFFFFFFFF; + return pTintIndex == 0 ? CompactMachineItem.getMachineColor(stack) : 0xFFFFFFFF; + }; + + public static final BlockColor BLOCK = (state, level, pos, tintIndex) -> { + if(!state.is(CMTags.MACHINE_BLOCK) || level == null || pos == null) + return 0xFFFFFFFF; + + if(!(level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machineData)) + return 0xFFFFFFFF; + + return tintIndex == 0 ? machineData.getColor() : 0xFFFFFFFF; + }; +} diff --git a/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java b/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java new file mode 100644 index 00000000..52a2fe56 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java @@ -0,0 +1,89 @@ +package dev.compactmods.machines.machine.data; + +import com.google.gson.JsonObject; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; + +/** + * Used for setting up data that a Compact Machine block entity can + * read during its data loading process. + */ +public class MachineDataTagBuilder { + + private ResourceLocation templateId; + private int color; + + private MachineDataTagBuilder() { + this.templateId = RoomTemplate.NO_TEMPLATE; + this.color = RoomTemplate.INVALID_TEMPLATE.color(); + } + + public static MachineDataTagBuilder empty() { + return new MachineDataTagBuilder(); + } + + public static MachineDataTagBuilder forTemplate(ResourceLocation templateId, RoomTemplate template) { + return new MachineDataTagBuilder() + .template(templateId) + .color(template.color()); + } + + public MachineDataTagBuilder color(int color) { + this.color = color; + return this; + } + + public MachineDataTagBuilder template(ResourceLocation templateId) { + this.templateId = templateId; + return this; + } + + public MachineDataTagBuilder writeToItem(ItemStack stack) { + final var tag = stack.getOrCreateTag(); + tag.putInt(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); + tag.putString(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); + return this; + } + + public MachineDataTagBuilder writeToItemJson(JsonObject json) { + json.addProperty(UnboundCompactMachineItem.NBT_TEMPLATE_ID, templateId.toString()); + json.addProperty(UnboundCompactMachineItem.NBT_COLOR, color); + return this; + } + + public MachineDataTagBuilder writeToBlockData(ItemStack stack) { + BlockItem.setBlockEntityData(stack, Machines.MACHINE_TILE_ENTITY.get(), writeBlockDataTag()); + return this; + } + + public MachineDataTagBuilder writeToBlockDataJson(JsonObject json) { + if(json.has("BlockEntityTag")) + json.remove("BlockEntityTag"); + + json.add("BlockEntityTag", writeBlockDataJson()); + return this; + } + + private CompoundTag writeBlockDataTag() { + final var tag = new CompoundTag(); + tag.putString(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); + tag.putInt(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); + return tag; + } + + private JsonObject writeBlockDataJson() { + final var tag = new JsonObject(); + tag.addProperty("id", Machines.MACHINE_TILE_ENTITY.getId().toString()); + tag.addProperty(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); + tag.addProperty(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); + return tag; + } + + +} diff --git a/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java index f8e13cda..5cb51ed3 100644 --- a/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java +++ b/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java @@ -6,22 +6,25 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.room.graph.CompactMachineRoomNode; +import dev.compactmods.machines.room.graph.RoomReferenceNode; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.saveddata.SavedData; import javax.annotation.Nonnull; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -34,7 +37,7 @@ public class DimensionMachineGraph extends SavedData { private final ResourceKey level; private final MutableValueGraph graph; private final Map machines; - private final Map rooms; + private final Map rooms; public static final String DATA_KEY = "machine_connections"; private final Codec> CONN_CODEC = CompactMachineConnectionInfo.CODEC @@ -52,7 +55,7 @@ private DimensionMachineGraph(ResourceKey level) { rooms = new HashMap<>(); } - private DimensionMachineGraph(ResourceKey level, @Nonnull CompoundTag nbt) { + public DimensionMachineGraph(ResourceKey level, @Nonnull CompoundTag nbt) { this(level); if (nbt.contains("graph")) { @@ -68,10 +71,10 @@ private DimensionMachineGraph(ResourceKey level, @Nonnull CompoundTag nbt private void loadConnections(List connectionInfo) { for (CompactMachineConnectionInfo i : connectionInfo) { - addRoom(i.roomChunk); + addRoom(i.roomCode); for (var connectedMachine : i.machines()) { addMachine(connectedMachine); - connectMachineToRoom(connectedMachine, i.roomChunk); + connectMachineToRoom(connectedMachine, i.roomCode); } } } @@ -84,9 +87,9 @@ public static DimensionMachineGraph forDimension(ServerLevel dimension) { private List buildConnections() { List result = new ArrayList<>(); - this.rooms.forEach((chunk, node) -> { - Collection machines = this.getMachinesFor(chunk); - CompactMachineConnectionInfo roomInfo = new CompactMachineConnectionInfo(chunk, machines); + this.rooms.forEach((roomCode, node) -> { + final var machines = this.getMachinesFor(roomCode); + CompactMachineConnectionInfo roomInfo = new CompactMachineConnectionInfo(roomCode, ImmutableList.copyOf(machines)); result.add(roomInfo); }); @@ -101,36 +104,37 @@ public void addMachine(BlockPos machine) { graph.addNode(node); machines.put(machine, node); + this.setDirty(); } - public void addRoom(ChunkPos roomChunk) { - if (this.rooms.containsKey(roomChunk)) + public void addRoom(String roomCode) { + if (this.rooms.containsKey(roomCode)) return; - CompactMachineRoomNode node = new CompactMachineRoomNode(roomChunk); + var node = new RoomReferenceNode(roomCode); graph.addNode(node); - rooms.put(roomChunk, node); + rooms.put(roomCode, node); this.setDirty(); } - public void connectMachineToRoom(BlockPos machine, ChunkPos room) { + public void connectMachineToRoom(BlockPos machine, String room) { if (!machines.containsKey(machine)) addMachine(machine); if (!rooms.containsKey(room)) addRoom(room); - CompactMachineNode machineNode = machines.get(machine); - CompactMachineRoomNode roomNode = rooms.get(room); + var machineNode = machines.get(machine); + var roomNode = rooms.get(room); graph.putEdgeValue(machineNode, roomNode, new MachineRoomEdge()); this.setDirty(); } - public Collection getMachinesFor(ChunkPos room) { + public Set getMachinesFor(String room) { if(!rooms.containsKey(room)) return Collections.emptySet(); @@ -144,16 +148,16 @@ public Collection getMachinesFor(ChunkPos room) { .collect(Collectors.toSet()); } - public Optional getConnectedRoom(BlockPos machinePos) { + public Optional getConnectedRoom(BlockPos machinePos) { if (!this.machines.containsKey(machinePos)) return Optional.empty(); var node = this.machines.get(machinePos); var connected = this.graph.successors(node); return connected.stream() - .filter(n -> n instanceof CompactMachineRoomNode) - .map(n -> (CompactMachineRoomNode) n) - .map(CompactMachineRoomNode::pos) + .filter(n -> n instanceof RoomReferenceNode) + .map(n -> (RoomReferenceNode) n) + .map(RoomReferenceNode::code) .findFirst(); } @@ -170,7 +174,7 @@ public void disconnectAndUnregister(int machine) { machines.remove(machine); } - public void removeRoom(ChunkPos room) { + public void removeRoom(String room) { if (!this.rooms.containsKey(room)) return; @@ -184,7 +188,7 @@ public void disconnect(BlockPos machine) { final var node = machines.get(machine); graph.successors(node).stream() - .filter(cn -> cn instanceof CompactMachineRoomNode) + .filter(cn -> cn instanceof RoomReferenceNode) .forEach(room -> graph.removeEdge(node, room)); setDirty(); @@ -194,10 +198,6 @@ public Optional getMachineNode(BlockPos worldPosition) { return Optional.ofNullable(machines.get(worldPosition)); } - public Optional getRoomNode(ChunkPos room) { - return Optional.ofNullable(rooms.get(room)); - } - @Nonnull @Override public CompoundTag save(@Nonnull CompoundTag nbt) { @@ -213,31 +213,16 @@ public CompoundTag save(@Nonnull CompoundTag nbt) { /** * Data structure for serialization. Do not use directly. */ - private static class CompactMachineConnectionInfo { - private final ChunkPos roomChunk; - private final List connectedMachines; - + private record CompactMachineConnectionInfo(String roomCode, List machines) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.CHUNKPOS + Codec.STRING .fieldOf("room") - .forGetter(CompactMachineConnectionInfo::room), + .forGetter(CompactMachineConnectionInfo::roomCode), BlockPos.CODEC.listOf() .fieldOf("machines") .forGetter(CompactMachineConnectionInfo::machines) ).apply(i, CompactMachineConnectionInfo::new)); - public CompactMachineConnectionInfo(ChunkPos roomChunk, Collection connections) { - this.roomChunk = roomChunk; - this.connectedMachines = ImmutableList.copyOf(connections); - } - - public ChunkPos room() { - return this.roomChunk; - } - - public List machines() { - return this.connectedMachines; - } } } diff --git a/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java b/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java index 5e66dca9..dc87844a 100644 --- a/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java +++ b/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java @@ -26,7 +26,7 @@ public String toString() { } @Override - public @NotNull IGraphEdgeType getEdgeType() { + public @NotNull IGraphEdgeType getEdgeType() { return GraphEdgeType.MACHINE_LINK; } } diff --git a/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java new file mode 100644 index 00000000..dcc705b7 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java @@ -0,0 +1,96 @@ +package dev.compactmods.machines.machine.item; + +import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.Machines; +import net.minecraft.core.Vec3i; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.Optional; + +public class BoundCompactMachineItem extends CompactMachineItem { + public static final String ROOM_NBT = "room_pos"; + public static final String ROOM_DIMENSIONS_NBT = "room_dimensions"; + + public BoundCompactMachineItem(Block blockIn, Properties builder) { + super(blockIn, builder); + } + + @Deprecated(forRemoval = true) + public static Optional getMachineId(ItemStack stack) { + if (!stack.hasTag()) + return Optional.empty(); + + CompoundTag machineData = stack.getOrCreateTag(); + if (machineData.contains(MachineNbt.ID)) { + int c = machineData.getInt(MachineNbt.ID); + return c > -1 ? Optional.of(c) : Optional.empty(); + } + + return Optional.empty(); + } + + public static Optional getRoom(ItemStack stack) { + if (!stack.hasTag()) + return Optional.empty(); + + var tag = stack.getTag(); + if (tag == null || !tag.contains(ROOM_NBT)) + return Optional.empty(); + + return Optional.of(tag.getString(ROOM_NBT)); + } + + public static void setRoom(ItemStack stack, String room) { + var tag = stack.getOrCreateTag(); + tag.putString(ROOM_NBT, room); + } + + public static ItemStack createForRoom(IBasicRoomInfo room) { + ItemStack item = new ItemStack(Machines.BOUND_MACHINE_BLOCK_ITEM.get()); + setRoom(item, room.code()); + setColor(item, room.color()); + return item; + } + + public static Vec3i getRoomSize(ItemStack stack) { + if (!stack.hasTag()) return Vec3i.ZERO; + final var tag = stack.getTag(); + if (tag == null || tag.isEmpty() || !tag.contains(ROOM_DIMENSIONS_NBT)) return Vec3i.ZERO; + final var dimNbt = tag.getIntArray(ROOM_DIMENSIONS_NBT); + return new Vec3i(dimNbt[0], dimNbt[1], dimNbt[2]); + } + + public static ItemStack setRoomSize(ItemStack stack, Vec3i innerBounds) { + var tag = stack.getOrCreateTag(); + tag.putIntArray(ROOM_DIMENSIONS_NBT, new int[]{ + innerBounds.getX(), + innerBounds.getY(), + innerBounds.getZ() + }); + + return stack; + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { + // Try room binding; if failed, try old machine ID binding + getRoom(stack).ifPresentOrElse(room -> { + // TODO - Server-synced room name list + tooltip.add(TranslationUtil.tooltip(Tooltips.ROOM_NAME, room)); + }, () -> { + getMachineId(stack).ifPresent(id -> { + tooltip.add(TranslationUtil.tooltip(Tooltips.Machines.ID, id)); + }); + }); + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java new file mode 100644 index 00000000..4d01d6ea --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java @@ -0,0 +1,29 @@ +package dev.compactmods.machines.machine.item; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; + +public class CompactMachineItem extends BlockItem { + public static final String NBT_COLOR = "machine_color"; + + public CompactMachineItem(Block blockIn, Properties builder) { + super(blockIn, builder); + } + + public static ItemStack setColor(ItemStack stack, int color) { + var tag = stack.getOrCreateTag(); + tag.putInt(NBT_COLOR, color); + return stack; + } + + public static int getMachineColor(ItemStack stack) { + if (!stack.hasTag()) return 0xFFFFFFFF; + + final var tag = stack.getTag(); + if (tag == null || tag.isEmpty() || !tag.contains(NBT_COLOR)) + return 0xFFFFFFFF; + + return tag.getInt(NBT_COLOR); + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java new file mode 100644 index 00000000..e200d685 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -0,0 +1,63 @@ +package dev.compactmods.machines.machine.item; + +import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; + +import javax.annotation.Nullable; +import java.util.List; + +@Deprecated(forRemoval = true, since = "5.2.0") +public class LegacyCompactMachineItem extends CompactMachineItem { + public LegacyCompactMachineItem(Block blockIn, Properties builder) { + super(blockIn, builder); + } + + public static Item getItemBySize(RoomSize size) { + return switch (size) { + case TINY -> Machines.MACHINE_BLOCK_ITEM_TINY.get(); + case SMALL -> Machines.MACHINE_BLOCK_ITEM_SMALL.get(); + case NORMAL -> Machines.MACHINE_BLOCK_ITEM_NORMAL.get(); + case LARGE -> Machines.MACHINE_BLOCK_ITEM_LARGE.get(); + case GIANT -> Machines.MACHINE_BLOCK_ITEM_GIANT.get(); + case MAXIMUM -> Machines.MACHINE_BLOCK_ITEM_MAXIMUM.get(); + }; + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { + tooltip.add(TranslationUtil.tooltip(Tooltips.CRAFT_TO_UPGRADE).withStyle(ChatFormatting.YELLOW)); + + boolean sneaking = Screen.hasShiftDown(); + + if (sneaking) { + Block b = Block.byItem(stack.getItem()); + if (b instanceof LegacySizedCompactMachineBlock cmb) { + RoomSize size = cmb.getSize(); + int internalSize = size.getInternalSize(); + + MutableComponent text = TranslationUtil.tooltip(Tooltips.Machines.SIZE, internalSize) + .withStyle(ChatFormatting.YELLOW); + + tooltip.add(text); + } + } else { + MutableComponent text = TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) + .withStyle(ChatFormatting.DARK_GRAY) + .withStyle(ChatFormatting.ITALIC); + + tooltip.add(text); + } + } +} diff --git a/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java new file mode 100644 index 00000000..70d0b23d --- /dev/null +++ b/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java @@ -0,0 +1,117 @@ +package dev.compactmods.machines.machine.item; + +import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.machine.data.MachineDataTagBuilder; +import dev.compactmods.machines.room.client.RoomClientHelper; +import net.minecraft.ChatFormatting; +import net.minecraft.Util; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; +import java.util.Optional; + +/** + * Represents a machine item that has not been bound to a room yet, + * but has an assigned template to use. + */ +public class UnboundCompactMachineItem extends CompactMachineItem { + + public static final String NBT_TEMPLATE_ID = "template_id"; + + public UnboundCompactMachineItem(Block blockIn, Properties builder) { + super(blockIn, builder); + } + + @Nonnull + @Override + public String getDescriptionId(ItemStack stack) { + return Util.makeDescriptionId("machine", getTemplateId(stack)); + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { + // We need NBT data for the rest of this + boolean sneaking = Screen.hasShiftDown(); + + if (sneaking) { + UnboundCompactMachineItem.getTemplate(stack).ifPresent(actualTemplate -> { + final var roomDimensions = actualTemplate.dimensions(); + tooltip.add(Component.literal("Size: " + roomDimensions.toShortString()).withStyle(ChatFormatting.YELLOW)); + + final var templateId = getTemplateId(stack); + tooltip.add(Component.literal("Template: " + templateId).withStyle(ChatFormatting.DARK_GRAY)); + + if (!actualTemplate.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { + tooltip.add(Component.literal("Prefill: " + actualTemplate.prefillTemplate()).withStyle(ChatFormatting.DARK_GRAY)); + } + }); + } else { + MutableComponent text = TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) + .withStyle(ChatFormatting.DARK_GRAY) + .withStyle(ChatFormatting.ITALIC); + + tooltip.add(text); + } + } + + public static ItemStack unbound() { + final var stack = new ItemStack(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(), 1); + setTemplate(stack, RoomTemplate.NO_TEMPLATE); + setColor(stack, 0xFFFFFFFF); + return stack; + } + + public static ItemStack forTemplate(ResourceLocation templateId, RoomTemplate template) { + final var stack = new ItemStack(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(), 1); + setTemplate(stack, templateId); + setColor(stack, template.color()); + + MachineDataTagBuilder.empty() + .template(templateId) + .color(template.color()) + .writeToBlockData(stack); + + return stack; + } + + private static ItemStack setTemplate(ItemStack stack, ResourceLocation templateId) { + var tag = stack.getOrCreateTag(); + tag.putString(NBT_TEMPLATE_ID, templateId.toString()); + return stack; + } + + @NotNull + public static ResourceLocation getTemplateId(ItemStack stack) { + if (!stack.hasTag()) return RoomTemplate.NO_TEMPLATE; + + final var tag = stack.getTag(); + if (tag == null || tag.isEmpty() || !tag.contains(NBT_TEMPLATE_ID)) + return RoomTemplate.NO_TEMPLATE; + + return new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); + } + + @NotNull + public static Optional getTemplate(ItemStack stack) { + var template = getTemplateId(stack); + if (!template.equals(RoomTemplate.NO_TEMPLATE)) { + final var actualTemplate = RoomClientHelper.getTemplates().get(template); + return Optional.ofNullable(actualTemplate); + } + + return Optional.empty(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java b/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java new file mode 100644 index 00000000..8378efbc --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java @@ -0,0 +1,92 @@ +package dev.compactmods.machines.room; + +import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import net.minecraft.core.Vec3i; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Stream; + +public class MutableRoomRegistration implements IMutableRoomRegistration { + private final IRoomLookup lookup; + private final IRoomRegistration currentData; + + public MutableRoomRegistration(IRoomLookup lookup, IRoomRegistration currentRoomData) { + this.lookup = lookup; + this.currentData = currentRoomData; + } + + @Override + public IMutableRoomRegistration setSpawnPosition(Vec3 spawnPosition) { + return this; + } + + @Override + public IMutableRoomRegistration setSpawnRotation(Vec2 spawnRotation) { + return this; + } + + @Override + public String code() { + return currentData.code(); + } + + @Override + public Vec3i dimensions() { + return currentData.dimensions(); + } + + @Override + public UUID owner(IRoomOwnerLookup lookup) { + return lookup.getRoomOwner(currentData.code()).orElseThrow(); + } + + @Override + public Vec3 center() { + return currentData.center(); + } + + @Override + public AABB innerBounds() { + return currentData.innerBounds(); + } + + @Override + public AABB outerBounds() { + return currentData.outerBounds(); + } + + @Override + public Vec3 spawnPosition(IRoomSpawnLookup spawns) { + return currentData.spawnPosition(spawns); + } + + @Override + public Vec2 spawnRotation(IRoomSpawnLookup spawns) { + return currentData.spawnRotation(spawns); + } + + @Override + public Optional getTemplate() { + return currentData.getTemplate(); + } + + @Override + public Stream chunks() { + return null; + } + + @Override + public int color() { + return currentData.color(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java b/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java new file mode 100644 index 00000000..d5ab8b87 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java @@ -0,0 +1,16 @@ +package dev.compactmods.machines.room; + +import com.aventrix.jnanoid.jnanoid.NanoIdUtils; + +import java.util.Random; + +public class RoomCodeGenerator { + private static final String REPLACE_REGEX = "([A-Z0-9]{4})([A-Z0-9]{4})([A-Z0-9]{4})"; + private static final char[] ALPHABET = "0123456789ABDFGHJKLMNPQRSTVWXYZ".toCharArray(); + private static final Random RANDOM = new Random(); + + public static String generateRoomId() { + final var id = NanoIdUtils.randomNanoId(RANDOM, ALPHABET, 12); + return id.replaceAll(REPLACE_REGEX, "$1-$2-$3"); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java index 768f9840..604a0f2d 100644 --- a/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java @@ -3,9 +3,9 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.data.CompactRoomData; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -75,14 +75,15 @@ private static boolean positionInsideRoom(Entity entity, Vec3 target) { if (!level.dimension().equals(CompactDimension.LEVEL_KEY)) return false; if (level instanceof ServerLevel compactDim) { - ChunkPos machineChunk = new ChunkPos(entity.chunkPosition().x, entity.chunkPosition().z); - - try { - final CompactRoomData intern = CompactRoomData.get(compactDim); - return intern.getBounds(machineChunk).contains(target); - } catch (NonexistentRoomException e) { - return false; - } + ChunkPos playerChunk = entity.chunkPosition(); + + final var roomInfo = CompactRoomProvider.instance(compactDim); + return roomInfo.isRoomChunk(playerChunk) + ? roomInfo.findByChunk(playerChunk) + .map(IRoomRegistration::innerBounds) + .map(ib -> ib.contains(target)) + .orElse(false) + : false; } return false; diff --git a/src/main/java/dev/compactmods/machines/room/Rooms.java b/src/main/java/dev/compactmods/machines/room/Rooms.java index e3e6cf07..001d26a8 100644 --- a/src/main/java/dev/compactmods/machines/room/Rooms.java +++ b/src/main/java/dev/compactmods/machines/room/Rooms.java @@ -1,242 +1,171 @@ package dev.compactmods.machines.room; -import com.mojang.authlib.GameProfile; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.location.IDimensionalPosition; -import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.dimension.MissingDimensionException; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.util.CompactStructureGenerator; -import dev.compactmods.machines.util.MathUtil; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.room.graph.RoomMetadataNode; +import dev.compactmods.machines.room.graph.RoomOwnerEdge; +import dev.compactmods.machines.room.graph.RoomOwnerNode; +import dev.compactmods.machines.room.graph.RoomSpawnNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; -import net.minecraft.world.phys.Vec3; +import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryBuilder; +import net.minecraftforge.registries.RegistryObject; -import javax.naming.OperationNotSupportedException; -import java.util.Objects; import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; public class Rooms { - static { - Registries.ROOM_TEMPLATES.makeRegistry(() -> new RegistryBuilder() - .dataPackRegistry(RoomTemplate.CODEC, RoomTemplate.CODEC)); - } + public static Supplier> TEMPLATES = Registries.ROOM_TEMPLATES + .makeRegistry(() -> new RegistryBuilder() + .dataPackRegistry(RoomTemplate.CODEC, RoomTemplate.CODEC)); + + public static final RegistryObject> SPAWN_NODE = Registries.NODE_TYPES + .register("room_spawn", SimpleGraphNodeType.instance(RoomSpawnNode.CODEC)); + public static final RegistryObject> ROOM_OWNER_NODE = Registries.NODE_TYPES + .register("room_owner", SimpleGraphNodeType.instance(RoomOwnerNode.CODEC)); + + public static final RegistryObject> ROOM_META_NODE = Registries.NODE_TYPES + .register("room_meta", SimpleGraphNodeType.instance(RoomMetadataNode.CODEC)); + public static final RegistryObject> ROOM_OWNER_EDGE = Registries.EDGE_TYPES + .register("room_owner", SimpleGraphEdgeType.instance(RoomOwnerEdge.CODEC)); public static void prepare() { } - public static ChunkPos createNew(MinecraftServer serv, RoomSize size, UUID owner) throws MissingDimensionException { - final var compactWorld = serv.getLevel(CompactDimension.LEVEL_KEY); - - if (compactWorld == null) + /* + TODO - Revisit with furnace recipe + public static boolean destroy(MinecraftServer server, ChunkPos room) throws MissingDimensionException, NonexistentRoomException { + final var compactDim = server.getLevel(Registration.COMPACT_DIMENSION); + if (compactDim == null) throw new MissingDimensionException(); - CompactRoomData rooms = CompactRoomData.get(compactWorld); + var roomData = CompactRoomData.get(compactDim); + if (!roomData.isRegistered(room)) { + throw new NonexistentRoomException(room); + } - int nextPosition = rooms.getNextSpiralPosition(); - Vec3i location = MathUtil.getRegionPositionByIndex(nextPosition); + final var roomBounds = roomData.getBounds(room); + final var innerBounds = roomBounds.deflate(1); - BlockPos newCenter = MathUtil.getCenterWithY(location, ServerConfig.MACHINE_FLOOR_Y.get()); + final var states = compactDim.getBlockStates(innerBounds) + .collect(Collectors.toSet()); - // Generate a new machine room - CompactStructureGenerator.generateCompactStructure(compactWorld, size, newCenter); + final var nonAir = states.stream() + .filter(state -> !state.isAir()) + .findAny(); - ChunkPos machineChunk = new ChunkPos(newCenter); - try { - rooms.createNew() - .owner(owner) - .size(size) - .chunk(machineChunk) - .register(); - } catch (OperationNotSupportedException e) { - // room already registered somehow - CompactMachines.LOGGER.warn(e); + if (nonAir.isPresent()) { + CompactMachines.LOGGER.error("Refusing to delete room at {}; non-air blocks exist inside the room. First match: {}", room, nonAir.get()); + return false; } - return machineChunk; - } - - // TODO - Revisit with furnace recipe -// public static boolean destroy(MinecraftServer server, ChunkPos room) throws MissingDimensionException, NonexistentRoomException { -// final var compactDim = server.getLevel(Registration.COMPACT_DIMENSION); -// if (compactDim == null) -// throw new MissingDimensionException(); -// -// var roomData = CompactRoomData.get(compactDim); -// if (!roomData.isRegistered(room)) { -// throw new NonexistentRoomException(room); -// } -// -// final var roomBounds = roomData.getBounds(room); -// final var innerBounds = roomBounds.deflate(1); -// -// final var states = compactDim.getBlockStates(innerBounds) -// .collect(Collectors.toSet()); -// -// final var nonAir = states.stream() -// .filter(state -> !state.isAir()) -// .findAny(); -// -// if (nonAir.isPresent()) { -// CompactMachines.LOGGER.error("Refusing to delete room at {}; non-air blocks exist inside the room. First match: {}", room, nonAir.get()); -// return false; -// } -// -// // clear tunnel connection info -// final var tunnels = RoomTunnelData.getFile(server, room); -// final var filename = RoomTunnelData.getDataFilename(room); -// if (!tunnels.delete()) { -// CompactMachines.LOGGER.warn("Could not delete tunnel data for room {}; clearing the connection graph as an alternative.", room); -// CompactMachines.LOGGER.warn("Data file to delete: {}", filename); -// -// var td = RoomTunnelData.forRoom(server, room); -// td.getGraph().clear(); -// td.setDirty(); -// } else { -// // File deletion successful, delete cached data -// final var compactDataCache = compactDim.getDataStorage().cache; -// compactDataCache.remove(filename); -// } -// -// // reset everything for the room boundary -// BlockPos.betweenClosedStream(roomBounds.inflate(1)) -// .forEach(p -> compactDim.setBlock(p, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL)); -// -// // Remove room registration -// roomData.remove(room); -// -// // Disconnect all machines -// var conns = MachineToRoomConnections.forDimension(server); -// var d = CompactMachineData.get(server); -// -// var connected = conns.getMachinesFor(room); -// for (int mid : connected) { -// var location = d.getMachineLocation(mid); -// location.ifPresent(p -> { -// var pos = p.getBlockPosition(); -// var l = p.level(server); -// if (l.getBlockEntity(pos) instanceof TunnelWallEntity tunn) { -// tunn.disconnect(); -// } -// }); -// } -// -// conns.unregisterRoom(room); -// return true; -// } - - public static Stream getConnectedMachines(MinecraftServer server, ChunkPos room) { - return server.levelKeys().stream() - .map(server::getLevel) - .filter(Objects::nonNull) - .filter(sl -> sl.getDataStorage().cache.containsKey(DimensionMachineGraph.DATA_KEY)) - .flatMap(sl -> { - final var graph = DimensionMachineGraph.forDimension(sl); - return graph.getMachinesFor(room).stream() - .map(bp -> new LevelBlockPosition(sl.dimension(), bp)); - }); - } - - public static RoomSize sizeOf(MinecraftServer server, ChunkPos room) throws NonexistentRoomException { - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - return CompactRoomData.get(compactDim) - .getData(room) - .getSize(); - } + // clear tunnel connection info + final var tunnels = RoomTunnelData.getFile(server, room); + final var filename = RoomTunnelData.getDataFilename(room); + if (!tunnels.delete()) { + CompactMachines.LOGGER.warn("Could not delete tunnel data for room {}; clearing the connection graph as an alternative.", room); + CompactMachines.LOGGER.warn("Data file to delete: {}", filename); + + var td = RoomTunnelData.forRoom(server, room); + td.getGraph().clear(); + td.setDirty(); + } else { + // File deletion successful, delete cached data + final var compactDataCache = compactDim.getDataStorage().cache; + compactDataCache.remove(filename); + } - public static IDimensionalPosition getSpawn(MinecraftServer server, ChunkPos room) { - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - return CompactRoomData.get(compactDim).getSpawn(room); - } + // reset everything for the room boundary + BlockPos.betweenClosedStream(roomBounds.inflate(1)) + .forEach(p -> compactDim.setBlock(p, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL)); + + // Remove room registration + roomData.remove(room); + + // Disconnect all machines + var conns = MachineToRoomConnections.forDimension(server); + var d = CompactMachineData.get(server); + + var connected = conns.getMachinesFor(room); + for (int mid : connected) { + var location = d.getMachineLocation(mid); + location.ifPresent(p -> { + var pos = p.getBlockPosition(); + var l = p.level(server); + if (l.getBlockEntity(pos) instanceof TunnelWallEntity tunn) { + tunn.disconnect(); + } + }); + } - public static boolean exists(MinecraftServer server, ChunkPos room) { - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - return CompactRoomData.get(compactDim).isRegistered(room); + conns.unregisterRoom(room); + return true; } +*/ - public static StructureTemplate getInternalBlocks(MinecraftServer server, ChunkPos room) throws MissingDimensionException, NonexistentRoomException { + public static CompletableFuture getInternalBlocks(MinecraftServer server, String room) throws MissingDimensionException, NonexistentRoomException { final var tem = new StructureTemplate(); final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - - final var data = CompactRoomData.get(compactDim); - final var roomInfo = data.getData(room); - - final var bounds = roomInfo.getRoomBounds(); - final int inside = roomInfo.getSize().getInternalSize(); - tem.fillFromWorld(compactDim, new BlockPos(bounds.minX, bounds.minY - 1, bounds.minZ), - new Vec3i(inside, inside + 1, inside), false, null); - - return tem; - } - - public static void resetSpawn(MinecraftServer server, ChunkPos room) throws NonexistentRoomException { - if (!exists(server, room)) - throw new NonexistentRoomException(room); - - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - - final var data = CompactRoomData.get(compactDim); - final var roomInfo = data.getData(room); - - final var centerPoint = Vec3.atCenterOf(roomInfo.getCenter()); - final var newSpawn = centerPoint.subtract(0, (roomInfo.getSize().getInternalSize() / 2f), 0); - - data.setSpawn(room, newSpawn); - } - - public static Optional getRoomName(MinecraftServer server, ChunkPos room) throws NonexistentRoomException { - if (!exists(server, room)) - throw new NonexistentRoomException(room); - - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - - final var data = CompactRoomData.get(compactDim); - final var roomInfo = data.getData(room); - return roomInfo.getName(); + final var provider = CompactRoomProvider.instance(compactDim); + + final var chunkSource = compactDim.getChunkSource(); + return provider.forRoom(room).map(reg -> { + final var chunkLoading = reg.chunks() + .map(cp -> chunkSource.getChunkFuture(cp.x, cp.z, ChunkStatus.FULL, true)) + .toList(); + + final var awaitAllChunks = CompletableFuture.allOf(chunkLoading.toArray(new CompletableFuture[chunkLoading.size()])); + + return awaitAllChunks.thenApply(ignored -> { + final var bounds = reg.outerBounds(); + tem.fillFromWorld(compactDim, + new BlockPos(bounds.minX, bounds.minY - 1, bounds.minZ), + new Vec3i(bounds.getXsize(), bounds.getYsize() + 1, bounds.getZsize()), + false, Blocks.AIR + ); + + return tem; + }); + }).orElse(CompletableFuture.completedFuture(tem)); } - public static Optional getOwner(MinecraftServer server, ChunkPos room) { - if (!exists(server, room)) - return Optional.empty(); - - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - final var data = CompactRoomData.get(compactDim); - - try { - final CompactRoomData.RoomData roomInfo = data.getData(room); - final var ownerUUID = roomInfo.getOwner(); - - return server.getProfileCache().get(ownerUUID); - } catch (NonexistentRoomException e) { - return Optional.empty(); - } + public static Optional getRoomName(MinecraftServer server, String room) throws NonexistentRoomException { +// if (!exists(server, room)) +// throw new NonexistentRoomException(room); +// +// final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); +// +// final var data = RoomData.get(compactDim); +// final var roomInfo = data.getData(room); +// return roomInfo.getName(); + return Optional.empty(); } - public static void updateName(MinecraftServer server, ChunkPos room, String newName) throws NonexistentRoomException { - if (!exists(server, room)) - throw new NonexistentRoomException(room); - - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - - final var data = CompactRoomData.get(compactDim); - final var roomInfo = data.getData(room); - roomInfo.setName(newName); - data.setDirty(); + public static void updateName(MinecraftServer server, String room, String newName) throws NonexistentRoomException { +// if (!exists(server, room)) +// throw new NonexistentRoomException(room); +// +// final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); +// +// final var data = RoomData.get(compactDim); +// final var roomInfo = data.getData(room); +// roomInfo.setName(newName); +// data.setDirty(); } } diff --git a/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java b/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java index 50f6371a..e5ae7067 100644 --- a/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java +++ b/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java @@ -5,8 +5,7 @@ import java.util.Optional; import com.mojang.serialization.DataResult; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.api.codec.NbtListCollector; -import dev.compactmods.machines.api.room.history.IRoomHistoryItem; +import dev.compactmods.machines.codec.NbtListCollector; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; diff --git a/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java b/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java index 52feacf7..164611e1 100644 --- a/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java +++ b/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java @@ -10,6 +10,7 @@ import dev.compactmods.machines.client.render.RenderTypes; import dev.compactmods.machines.client.render.SuperRenderTypeBuffer; import dev.compactmods.machines.client.util.TransformingVertexBuilder; +import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.room.menu.MachineRoomMenu; import dev.compactmods.machines.room.network.PlayerStartedRoomTrackingPacket; @@ -28,6 +29,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraftforge.client.model.data.ModelData; +import net.minecraftforge.fml.ModList; public class MachineRoomScreen extends AbstractContainerScreen { @@ -64,7 +66,11 @@ public void updateBlockRender() { } private boolean hasPsdItem() { - return inv.contains(new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get())); + final var inInv = inv.contains(new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get())); + if (ModList.get().isLoaded("curios") && CuriosCompat.hasPsdCurio(inv.player)) + return true; + + return inInv; } @Override @@ -95,9 +101,9 @@ protected void renderLabels(PoseStack pose, int mouseX, int mouseY) { Screen.drawCenteredString(pose, font, p, 0, this.titleLabelY, 0xFFFFFFFF); var room = menu.getRoom(); - var rt = Component.literal("(%s, %s)".formatted(room.x, room.z)); - pose.scale(0.8f, 0.8f, 0.8f); - Screen.drawCenteredString(pose, font, rt, 0,this.titleLabelY + font.lineHeight + 2, 0xFFCCCCCC); + var rt = Component.literal(room); + pose.scale(0.7f, 0.7f, 0.7f); + Screen.drawCenteredString(pose, font, rt, 0, this.titleLabelY + font.lineHeight + 2, 0xFFCCCCCC); pose.popPose(); } @@ -121,93 +127,98 @@ public void render(PoseStack pose, int mouseX, int mouseY, float partial) { var cam = minecraft.cameraEntity; - - try { + if (this.menu.loadingBlocks) { pose.pushPose(); - pose.translate(0, 0, -800); + Screen.drawCenteredString(pose, font, "Loading preview...", 0, this.titleLabelY + font.lineHeight + 2, 0xFFCCCCCC); + pose.popPose(); + } else { + try { + pose.pushPose(); + pose.translate(0, 0, -800); - final var blockRenderer = Minecraft.getInstance().getBlockRenderer(); - final var beRenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher(); + final var blockRenderer = Minecraft.getInstance().getBlockRenderer(); + final var beRenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher(); - var struct = menu.getBlocks(); + var struct = menu.getBlocks(); - pose.pushPose(); - { - // pose.translate(s, s, s); + pose.pushPose(); + { + // pose.translate(s, s, s); - pose.translate(getGuiLeft() + (getXSize() / 2d), getGuiTop() + 135, 150); + pose.translate(getGuiLeft() + (getXSize() / 2d), getGuiTop() + 135, 150); - float zoom = switch (struct.getSize().getX()) { - case 3 -> 23.5f; - case 5 -> 19.5f; - case 7 -> 15.5f; - case 9 -> 14.5f; - case 11 -> 11.5f; - case 13 -> 10.5f; - default -> 10.5f; - }; + float zoom = switch (struct.getSize().getX()) { + case 3 -> 23.5f; + case 5 -> 19.5f; + case 7 -> 15.5f; + case 9 -> 14.5f; + case 11 -> 11.5f; + case 13 -> 10.5f; + default -> 10.5f; + }; - pose.scale(zoom, -zoom, zoom); + pose.scale(zoom, -zoom, zoom); - pose.mulPose(Vector3f.XP.rotationDegrees((float) rotateY)); - pose.mulPose(Vector3f.YP.rotationDegrees((float) rotateX)); + pose.mulPose(Vector3f.XP.rotationDegrees((float) rotateY)); + pose.mulPose(Vector3f.YP.rotationDegrees((float) rotateX)); - final var tSize = struct.getSize(); - final float s = tSize.getX() / 2f; - pose.translate(-s, -s + 1, -s); + final var tSize = struct.getSize(); + final float s = tSize.getX() / 2f; + pose.translate(-s, -s + 1, -s); - final var transformer = new TransformingVertexBuilder(buffer, RenderTypes.WALLS); + final var transformer = new TransformingVertexBuilder(buffer, RenderTypes.WALLS); - var bb = struct.getBoundingBox(new StructurePlaceSettings(), BlockPos.ZERO); + var bb = struct.getBoundingBox(new StructurePlaceSettings(), BlockPos.ZERO); - var as = new ArmorStand(renderer, 0, 0, 0); - minecraft.cameraEntity = as; + var as = new ArmorStand(renderer, 0, 0, 0); + minecraft.cameraEntity = as; - BlockPos.betweenClosedStream(bb).forEach(pos -> { - pose.pushPose(); - { - pose.translate(pos.getX(), pos.getY(), pos.getZ()); + BlockPos.betweenClosedStream(bb).forEach(pos -> { + pose.pushPose(); + { + pose.translate(pos.getX(), pos.getY(), pos.getZ()); - final var state = renderer.getBlockState(pos); - transformer.setOverlay(OverlayTexture.RED_OVERLAY_V); + final var state = renderer.getBlockState(pos); + transformer.setOverlay(OverlayTexture.RED_OVERLAY_V); - ModelData modelData = ModelData.EMPTY; - if (state.hasBlockEntity()) { - final var be = renderer.getBlockEntity(pos); - if (be != null) { - modelData = be.getModelData(); - final var ber = beRenderer.getRenderer(be); - if (ber != null) { - ber.render(be, 1f, pose, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY); + ModelData modelData = ModelData.EMPTY; + if (state.hasBlockEntity()) { + final var be = renderer.getBlockEntity(pos); + if (be != null) { + modelData = be.getModelData(); + final var ber = beRenderer.getRenderer(be); + if (ber != null) { + ber.render(be, 1f, pose, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY); + } } } - } - try { - pose.pushPose(); + try { + pose.pushPose(); - for(var type : blockRenderer.getBlockModel(state).getRenderTypes(state, minecraft.level.random, modelData)) { - blockRenderer.renderBatched(state, pos, renderer, pose, buffer.getBuffer(type), true, renderer.random, modelData, type); - } + for (var type : blockRenderer.getBlockModel(state).getRenderTypes(state, minecraft.level.random, modelData)) { + blockRenderer.renderBatched(state, pos, renderer, pose, buffer.getBuffer(type), true, renderer.random, modelData, type); + } - pose.popPose(); - } catch (Exception e) { + pose.popPose(); + } catch (Exception e) { + } } - } + pose.popPose(); + }); + } + pose.popPose(); + pose.popPose(); + } catch (Exception e) { + while (lastEntryBeforeTry != pose.last()) pose.popPose(); - }); } - pose.popPose(); - pose.popPose(); - } catch (Exception e) { - while (lastEntryBeforeTry != pose.last()) - pose.popPose(); - } - minecraft.cameraEntity = cam; + minecraft.cameraEntity = cam; - buffer.draw(); - RenderSystem.restoreProjectionMatrix(); + buffer.draw(); + RenderSystem.restoreProjectionMatrix(); + } } @Override diff --git a/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java new file mode 100644 index 00000000..d45a5b83 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.room.client; + +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.room.RoomTemplate; +import net.minecraft.client.Minecraft; +import net.minecraft.core.Registry; + +public class RoomClientHelper { + + public static Registry getTemplates() { + return Minecraft.getInstance().level.registryAccess() + .registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/data/CompactRoomData.java b/src/main/java/dev/compactmods/machines/room/data/CompactRoomData.java deleted file mode 100644 index 656d0bb7..00000000 --- a/src/main/java/dev/compactmods/machines/room/data/CompactRoomData.java +++ /dev/null @@ -1,306 +0,0 @@ -package dev.compactmods.machines.room.data; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.codec.CodecExtensions; -import dev.compactmods.machines.api.codec.NbtListCollector; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.util.MathUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.saveddata.SavedData; -import net.minecraft.world.level.storage.DimensionDataStorage; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.naming.OperationNotSupportedException; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -public class CompactRoomData extends SavedData { - public static final String DATA_NAME = Constants.MOD_ID + "_rooms"; - - private final Map roomData; - - public CompactRoomData() { - roomData = new HashMap<>(); - } - - @Nonnull - public static CompactRoomData get(ServerLevel compactDim) { - DimensionDataStorage sd = compactDim.getDataStorage(); - return sd.computeIfAbsent(CompactRoomData::fromNbt, CompactRoomData::new, DATA_NAME); - } - - public static CompactRoomData fromNbt(CompoundTag nbt) { - CompactRoomData data = new CompactRoomData(); - if (nbt.contains("machines")) { - ListTag machines = nbt.getList("machines", Tag.TAG_COMPOUND); - machines.forEach(machNbt -> { - DataResult result = - RoomData.CODEC.parse(NbtOps.INSTANCE, machNbt); - - result - .resultOrPartial((err) -> CompactMachines.LOGGER.error("Error loading machine data from file: {}", err)) - .ifPresent(imd -> { - ChunkPos chunk = new ChunkPos(imd.getCenter()); - data.roomData.put(chunk, imd); - }); - }); - } - - return data; - } - - @Override - @Nonnull - public CompoundTag save(@Nonnull CompoundTag nbt) { - if (!roomData.isEmpty()) { - ListTag collect = roomData.values() - .stream() - .map(data -> { - DataResult n = RoomData.CODEC.encodeStart(NbtOps.INSTANCE, data); - return n.result(); - }) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(NbtListCollector.toNbtList()); - - nbt.put("machines", collect); - } - - return nbt; - } - - public Stream stream() { - return roomData.keySet().stream(); - } - - public boolean isRegistered(ChunkPos chunkPos) { - return roomData.containsKey(chunkPos); - } - - private void register(ChunkPos pos, RoomData data) throws OperationNotSupportedException { - if (isRegistered(pos)) - throw new OperationNotSupportedException("Machine already registered."); - - roomData.put(pos, data); - setDirty(); - } - - public Optional forRoom(ChunkPos room) { - if (roomData.containsKey(room)) - return Optional.ofNullable(roomData.get(room)); - - return Optional.empty(); - } - - public Stream streamRooms() { - return roomData.values().stream(); - } - - @Nullable - public LevelBlockPosition getSpawn(ChunkPos roomChunk) { - RoomData roomData = this.roomData.get(roomChunk); - if (roomData == null) - return null; - - return new LevelBlockPosition( - CompactDimension.LEVEL_KEY, - roomData.getSpawn() - ); - } - - public int getNextSpiralPosition() { - return this.roomData.size() + 1; - } - - public void setSpawn(ChunkPos roomChunk, Vec3 position) { - if (!roomData.containsKey(roomChunk)) - return; - - RoomData roomData = this.roomData.get(roomChunk); - roomData.setSpawn(position); - - setDirty(); - } - - public AABB getBounds(ChunkPos roomChunk) throws NonexistentRoomException { - if (!roomData.containsKey(roomChunk)) - throw new NonexistentRoomException(roomChunk); - - return roomData.get(roomChunk).getRoomBounds(); - } - - public NewRoomRegistration createNew() { - return new NewRoomRegistration(this); - } - - public boolean isMachineRoomChunk(ChunkPos pos) { - return roomData.containsKey(pos); - } - - public void remove(ChunkPos room) { - roomData.remove(room); - setDirty(); - } - - public RoomData getData(ChunkPos room) throws NonexistentRoomException { - if (!roomData.containsKey(room)) - throw new NonexistentRoomException(room); - - return roomData.get(room); - } - - public static class NewRoomRegistration { - - private final CompactRoomData storage; - private Vec3 spawn; - private ChunkPos chunk = new ChunkPos(0, 0); - private RoomSize size = RoomSize.TINY; - private BlockPos center = BlockPos.ZERO; - private UUID owner; - - public NewRoomRegistration(CompactRoomData storage) { - this.storage = storage; - } - - private void recalculateSize() { - BlockPos centerAtFloor = MathUtil.getCenterWithY(chunk, ServerConfig.MACHINE_FLOOR_Y.get()); - BlockPos centerSized = centerAtFloor.above(size.getInternalSize() / 2); - - this.spawn = new Vec3(centerAtFloor.getX(), centerAtFloor.getY(), centerAtFloor.getZ()); - this.center = centerSized; - } - - public NewRoomRegistration owner(UUID owner) { - this.owner = owner; - return this; - } - - public NewRoomRegistration size(RoomSize size) { - this.size = size; - recalculateSize(); - return this; - } - - public NewRoomRegistration spawn(BlockPos spawn) { - Vec3 spawnTest = new Vec3(spawn.getX(), spawn.getY(), spawn.getZ()); - - // Make sure the spawn is inside the new room bounds - if (size.getBounds(this.center).contains(spawnTest)) - this.spawn = spawnTest; - - return this; - } - - public NewRoomRegistration chunk(ChunkPos chunk) { - this.chunk = chunk; - recalculateSize(); - return this; - } - - public void register() throws OperationNotSupportedException { - RoomData data = new RoomData(owner, center, spawn, size, Optional.empty()); - storage.register(chunk, data); - } - } - - public static class RoomData { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.UUID_CODEC.fieldOf("owner").forGetter(RoomData::getOwner), - BlockPos.CODEC.fieldOf("center").forGetter(RoomData::getCenter), - CodecExtensions.VECTOR3D.fieldOf("spawn").forGetter(RoomData::getSpawn), - RoomSize.CODEC.fieldOf("size").forGetter(RoomData::getSize), - Codec.STRING.optionalFieldOf("name").forGetter(RoomData::getName) - ).apply(i, RoomData::new)); - - private final UUID owner; - private final BlockPos center; - private Vec3 spawn; - private final RoomSize size; - private boolean hasCustomName; - private String name; - - public RoomData(UUID owner, BlockPos center, Vec3 spawn, RoomSize size, Optional name) { - this.owner = owner; - this.center = center; - this.spawn = spawn; - this.size = size; - - name.ifPresentOrElse(n -> { - this.name = n; - this.hasCustomName = true; - }, () -> { - this.hasCustomName = false; - }); - } - - public RoomSize getSize() { - return this.size; - } - - public UUID getOwner() { - return this.owner; - } - - public Vec3 getSpawn() { - if (this.spawn != null) - return this.spawn; - - Vec3 newSpawn = new Vec3( - center.getX(), - center.getY(), - center.getZ() - ); - - double offset = size.getInternalSize() / 2.0d; - - this.spawn = newSpawn.subtract(0, offset, 0); - return this.spawn; - } - - public BlockPos getCenter() { - return this.center; - } - - public void setSpawn(Vec3 newSpawn) { - this.spawn = newSpawn; - } - - public AABB getRoomBounds() { - return size.getBounds(this.center); - } - - public boolean hasName() { - return this.hasCustomName; - } - - public void setName(String newName) { - this.hasCustomName = true; - this.name = newName; - } - - public Optional getName() { - return hasCustomName ? Optional.ofNullable(name) : Optional.empty(); - } - } -} diff --git a/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java b/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java index 97527bc6..ef2ed4e1 100644 --- a/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java +++ b/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java @@ -3,8 +3,9 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; -import dev.compactmods.machines.machine.CompactMachineItem; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction; @@ -24,11 +25,15 @@ public static Builder binding() { @Override protected ItemStack run(ItemStack stack, LootContext ctx) { - var data = ctx.getParam(LootContextParams.BLOCK_ENTITY); - if(data instanceof CompactMachineBlockEntity machine) { - machine.getConnectedRoom().ifPresent(room -> { - CompactMachineItem.setRoom(stack, room); - }); + var state = ctx.getParam(LootContextParams.BLOCK_STATE); + if(state.is(CMTags.MACHINE_BLOCK)) { + var data = ctx.getParam(LootContextParams.BLOCK_ENTITY); + if (data instanceof CompactMachineBlockEntity machine) { + machine.basicRoomInfo().ifPresent(room -> { + BoundCompactMachineItem.setColor(stack, room.color()); + BoundCompactMachineItem.setRoom(stack, room.code()); + }); + } } return stack; diff --git a/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java b/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java index 28b10d47..f2949a0c 100644 --- a/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java +++ b/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.codec.CodecExtensions; +import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.api.room.RoomSize; import net.minecraft.world.level.ChunkPos; diff --git a/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java b/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java index 29165334..8a2ec787 100644 --- a/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java +++ b/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java @@ -1,16 +1,14 @@ package dev.compactmods.machines.room.exceptions; -import net.minecraft.world.level.ChunkPos; - public class NonexistentRoomException extends Throwable { - private final ChunkPos room; + private final String room; - public NonexistentRoomException(ChunkPos room) { + public NonexistentRoomException(String room) { super("The requested room could not be found."); this.room = room; } - public ChunkPos getRoom() { + public String getRoom() { return room; } } diff --git a/src/main/java/dev/compactmods/machines/room/graph/CompactMachineRoomNode.java b/src/main/java/dev/compactmods/machines/room/graph/CompactMachineRoomNode.java deleted file mode 100644 index ed42f446..00000000 --- a/src/main/java/dev/compactmods/machines/room/graph/CompactMachineRoomNode.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.codec.CodecExtensions; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.Graph; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ChunkPos; - -/** - * Represents the inside of a Compact Machine. - */ -public record CompactMachineRoomNode(ChunkPos pos) implements IGraphNode { - - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "room"); - - public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( - CodecExtensions.CHUNKPOS.fieldOf("chunk").forGetter(CompactMachineRoomNode::pos), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (pos, type) -> new CompactMachineRoomNode(pos))); - - @Override - public String toString() { - return "CompactMachineRoomNode[" + - "pos=" + pos + ']'; - } - - @Override - public IGraphNodeType getType() { - return Graph.ROOM_NODE.get(); - } -} diff --git a/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java new file mode 100644 index 00000000..76023636 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -0,0 +1,335 @@ +package dev.compactmods.machines.room.graph; + +import com.google.common.graph.MutableValueGraph; +import com.google.common.graph.ValueGraphBuilder; +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.codec.NbtListCollector; +import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.graph.IGraphEdge; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.room.MutableRoomRegistration; +import dev.compactmods.machines.room.RoomCodeGenerator; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.util.MathUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.saveddata.SavedData; +import net.minecraft.world.phys.Vec2; +import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nonnull; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Stream; + +public class CompactRoomProvider extends SavedData implements IRoomLookup, IRoomOwnerLookup, IRoomSpawnLookup { + + public static final String DATA_NAME = Constants.MOD_ID + "_rooms"; + public static final String NBT_NODE_ID_KEY = "node_id"; + + private final Map metadata; + + private final Map roomSpawns; + + private final Map chunks; + private final Map owners; + + private final MutableValueGraph, IGraphEdge> graph; + + private CompactRoomProvider() { + this.metadata = new HashMap<>(); + this.roomSpawns = new HashMap<>(); + this.chunks = new HashMap<>(); + this.owners = new HashMap<>(); + this.graph = ValueGraphBuilder + .directed() + .build(); + } + + public static CompactRoomProvider empty() { + return new CompactRoomProvider(); + } + + @Nullable + public static CompactRoomProvider instance() { + try { + final ServerLevel level = CompactDimension.forCurrentServer(); + return level.getDataStorage() + .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.fatal(e); + return null; + } + } + + @Nullable + public static CompactRoomProvider instance(MinecraftServer server) { + try { + final ServerLevel level = CompactDimension.forServer(server); + return level.getDataStorage() + .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.fatal(e); + return null; + } + } + + public static CompactRoomProvider instance(ServerLevel compactDim) { + return compactDim.getDataStorage() + .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); + } + + private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { + final var graph = new CompactRoomProvider(); + + final HashMap metaNodeIdMap = new HashMap<>(); + if (compoundTag.contains("rooms")) { + compoundTag.getList("rooms", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(roomNode -> { + UUID id = roomNode.getUUID(NBT_NODE_ID_KEY); + final var node = RoomMetadataNode.CODEC.parse(NbtOps.INSTANCE, roomNode) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + + metaNodeIdMap.put(id, node); + graph.metadata.put(node.code(), node); + }); + } + + final HashMap roomOwnerNodeMap = new HashMap<>(); + if (compoundTag.contains("owners")) { + compoundTag.getList("owners", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(ownerNode -> { + UUID id = ownerNode.getUUID(NBT_NODE_ID_KEY); + final var node = RoomOwnerNode.CODEC.parse(NbtOps.INSTANCE, ownerNode) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + + roomOwnerNodeMap.put(id, node); + graph.owners.put(node.owner(), node); + }); + } + + if (compoundTag.contains("roomOwners")) { + compoundTag.getList("roomOwners", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(roomOwnerConn -> { + RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("room")); + RoomOwnerNode owner = roomOwnerNodeMap.get(roomOwnerConn.getUUID("owner")); + graph.graph.putEdgeValue(meta, owner, new RoomOwnerEdge()); + }); + } + + CompactMachines.LOGGER.debug("Number of rooms loaded from disk: {}", metaNodeIdMap.size()); + return graph; + } + + + + @Nonnull + @Override + public CompoundTag save(@Nonnull CompoundTag tag) { + //region Room Metadata Nodes + final HashMap metaNodeIdMap = new HashMap<>(); + metadata.values().forEach(metaNode -> metaNodeIdMap.put(metaNode.code(), UUID.randomUUID())); + ListTag meta = (ListTag) RoomMetadataNode.CODEC.listOf() + .encodeStart(NbtOps.INSTANCE, List.copyOf(metadata.values())) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + + meta.stream() + .filter(CompoundTag.class::isInstance) + .map(CompoundTag.class::cast) + .forEach(mct -> mct.putUUID(NBT_NODE_ID_KEY, metaNodeIdMap.get(mct.getString("code")))); + + tag.put("rooms", meta); + //endregion + + //region Room Owner nodes + final HashMap ownerByUuidMap = new HashMap<>(); + owners.values().forEach(ownerNode -> ownerByUuidMap.put(ownerNode.owner(), UUID.randomUUID())); + ListTag ownerList = (ListTag) RoomOwnerNode.CODEC.listOf() + .encodeStart(NbtOps.INSTANCE, List.copyOf(owners.values())) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + + ownerList.stream().map(CompoundTag.class::cast) + .forEach(oct -> oct.putUUID(NBT_NODE_ID_KEY, ownerByUuidMap.get(oct.getUUID("owner")))); + + tag.put("owners", ownerList); + //endregion + + //region Room-Owner connections + if (!metadata.isEmpty() && !owners.isEmpty()) { + final ListTag roomOwnerConnections = metadata.values() + .stream() + .map(roomNode -> graph.adjacentNodes(roomNode) + .stream() + .filter(RoomOwnerNode.class::isInstance) + .map(RoomOwnerNode.class::cast) + .findFirst() + .map(roomOwner -> { + UUID roomId = metaNodeIdMap.get(roomNode.code()); + UUID ownerId = ownerByUuidMap.get(roomOwner.owner()); + CompoundTag connection = new CompoundTag(); + connection.putUUID("room", roomId); + connection.putUUID("owner", ownerId); + return connection; + })) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(NbtListCollector.toNbtList()); + + tag.put("roomOwners", roomOwnerConnections); + } + //endregion + + return tag; + } + + @Override + public Stream allRooms() { + return metadata.values().stream() + .map(mn -> mn); + } + + @Override + public Stream findByOwner(UUID owner) { + if (!owners.containsKey(owner)) + return Stream.empty(); + + return graph.adjacentNodes(owners.get(owner)).stream() + .filter(RoomMetadataNode.class::isInstance) + .map(RoomMetadataNode.class::cast); + } + + @Override + public Optional findByMachine(IDimensionalBlockPosition machine) { + return Optional.empty(); + } + + @Override + public Optional forRoom(String room) { + return Optional.ofNullable(metadata.get(room)); + } + + @Override + public Optional findByChunk(ChunkPos chunk) { + if (!isRoomChunk(chunk)) return Optional.empty(); + final var chunkNode = chunks.get(chunk); + + // TODO - Implement with graph + return Optional.ofNullable(chunkNode.room(this)); + } + + @Override + public boolean isRoomChunk(ChunkPos chunk) { + return chunks.containsKey(chunk); + } + + @Override + public long count() { + return metadata.size(); + } + + /** + * Registers a new room with a specified room code and data from the builder. + * This assumes that data is coming from a previous source such as a migrator, and + * will take all values from the returned builder. + * + * @param code + * @param newRoom + * @return + */ + public IRoomRegistration registerNew(String code, Function newRoom) { + final var builder = newRoom.apply(new NewRoomBuilder(code)); + + final var roomNode = builder.build(); + this.metadata.put(code, roomNode); + this.owners.computeIfAbsent(builder.owner, RoomOwnerNode::new); + final var ownerNode = owners.get(builder.owner); + + graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); + setDirty(); + + return roomNode; + } + + public IRoomRegistration registerNew(Function newRoom) { + final var newRoomCode = RoomCodeGenerator.generateRoomId(); + + Vec3i location = MathUtil.getRegionPositionByIndex(metadata.size()); + + final var builder = newRoom.apply(new NewRoomBuilder(newRoomCode)); + BlockPos newCenter = MathUtil.getCenterWithY(location, ServerConfig.MACHINE_FLOOR_Y.get()) + .above(builder.yOffset()); + + builder.setCenter(newCenter); + + final var roomNode = builder.build(); + this.metadata.put(newRoomCode, roomNode); + this.owners.computeIfAbsent(builder.owner, RoomOwnerNode::new); + final var ownerNode = owners.get(builder.owner); + + graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); + setDirty(); + + return roomNode; + } + + public IMutableRoomRegistration edit(String room) { + return new MutableRoomRegistration(this, this.metadata.get(room)); + } + + public void resetSpawn(String room) throws NonexistentRoomException { + if (!metadata.containsKey(room)) + throw new NonexistentRoomException(room); + + final var meta = metadata.get(room); + final var newSpawn = meta.center().subtract(0, (meta.dimensions().getY() / 2f), 0); + final var newSpawnNode = new RoomSpawnNode(newSpawn, Vec2.ZERO); + + // TODO - Graph data + if (!roomSpawns.containsKey(room)) { + // make new spawn data + roomSpawns.put(room, newSpawnNode); + } else { + // reset spawn data + roomSpawns.put(room, newSpawnNode); + } + } + + @Override + public Optional getRoomOwner(String roomCode) { + // TODO - Graph data + if (!metadata.containsKey(roomCode)) + return Optional.empty(); + + final var roomNode = metadata.get(roomCode); + return graph.adjacentNodes(roomNode).stream() + .filter(RoomOwnerNode.class::isInstance) + .map(RoomOwnerNode.class::cast) + .map(RoomOwnerNode::owner) + .findFirst(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java b/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java new file mode 100644 index 00000000..c609d743 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java @@ -0,0 +1,67 @@ +package dev.compactmods.machines.room.graph; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +import java.util.UUID; + +public class NewRoomBuilder { + private final String code; + private int color = 0; + private Vec3i dimensions = Vec3i.ZERO; + private Vec3 center = Vec3.ZERO; + private Vec3 centerOffset = Vec3.ZERO; + private Vec3 spawn = Vec3.ZERO; + private Vec2 spawnRotation = Vec2.ZERO; + UUID owner; + + NewRoomBuilder(String newRoomCode) { + this.code = newRoomCode; + } + + public NewRoomBuilder setDimensions(Vec3i dimensions) { + this.dimensions = dimensions; + return this; + } + + public NewRoomBuilder offsetCenter(Vec3 offset) { + this.centerOffset = offset; + return this; + } + + public NewRoomBuilder setOwner(UUID owner) { + this.owner = owner; + return this; + } + + public NewRoomBuilder setColor(int color) { + this.color = color; + return this; + } + + int yOffset() { + return Math.floorDiv(dimensions.getY(), 2); + } + + public NewRoomBuilder setCenter(BlockPos newCenter) { + this.center = Vec3.atCenterOf(newCenter); + this.spawn = Vec3.atCenterOf(newCenter); + this.spawnRotation = Vec2.ZERO; + return this; + } + + public NewRoomBuilder setSpawn(Vec3 spawn, Vec2 spawnRotation) { + this.spawn = spawn; + this.spawnRotation = spawnRotation; + return this; + } + + RoomMetadataNode build() { + return new RoomMetadataNode(code, color, dimensions, + center.add(centerOffset), + spawn, + spawnRotation); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java b/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java new file mode 100644 index 00000000..7d8c64e5 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java @@ -0,0 +1,19 @@ +package dev.compactmods.machines.room.graph; + +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; +import net.minecraft.world.level.ChunkPos; + +public record RoomChunkNode(ChunkPos chunk) implements IGraphNode { + + @Override + public IGraphNodeType getType() { + return null; + } + + public IRoomRegistration room(IRoomLookup lookup) { + return lookup.findByChunk(chunk).orElseThrow(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java b/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java new file mode 100644 index 00000000..2596946d --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java @@ -0,0 +1,93 @@ +package dev.compactmods.machines.room.graph; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.room.Rooms; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Stream; + +/** + * Hosts core information about a machine room, such as how large it is and its code. + * @param code + * @param dimensions + */ +public record RoomMetadataNode(String code, int color, Vec3i dimensions, Vec3 center, Vec3 spawnPosition, Vec2 spawnRotation) + implements IGraphNode, IRoomRegistration { + + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + Codec.STRING.fieldOf("code").forGetter(RoomMetadataNode::code), + Codec.INT.fieldOf("color").forGetter(RoomMetadataNode::color), + Vec3i.CODEC.fieldOf("dimensions").forGetter(RoomMetadataNode::dimensions), + Vec3.CODEC.fieldOf("center").forGetter(RoomMetadataNode::center), + Vec3.CODEC.fieldOf("spawnPos").forGetter(RoomMetadataNode::spawnPosition), + CodecExtensions.VEC2.fieldOf("spawnRot").forGetter(RoomMetadataNode::spawnRotation) + ).apply(i, RoomMetadataNode::new)); + + @Override + public String toString() { + return "Room Meta [id=%s]".formatted(code); + } + + @Override + public IGraphNodeType getType() { + return Rooms.ROOM_META_NODE.get(); + } + + @Override + public UUID owner(IRoomOwnerLookup lookup) { + return lookup.getRoomOwner(code).orElseThrow(); + } + + @Override + public AABB innerBounds() { + return AABB.ofSize(center, dimensions.getX() - 2, dimensions.getY() - 2, dimensions.getZ() - 2); + } + + @Override + public AABB outerBounds() { + return AABB.ofSize(center, dimensions.getX(), dimensions.getY(), dimensions.getZ()); + } + + @Override + public Vec3 spawnPosition(IRoomSpawnLookup spawns) { + return spawnPosition; + } + + @Override + public Vec2 spawnRotation(IRoomSpawnLookup spawns) { + return spawnRotation; + } + + @Override + public Optional getTemplate() { + return Optional.empty(); + } + + @Override + public Stream chunks() { + AABB outerBounds = outerBounds(); + BlockPos min = new BlockPos(outerBounds.minX, outerBounds.minY, outerBounds.minZ); + BlockPos max = new BlockPos(outerBounds.maxX, outerBounds.maxY, outerBounds.maxZ); + + return ChunkPos.rangeClosed(new ChunkPos(min), new ChunkPos(max)); + } + + public Codec codec() { + return CODEC; + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java b/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java new file mode 100644 index 00000000..92d03295 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java @@ -0,0 +1,16 @@ +package dev.compactmods.machines.room.graph; + +import com.mojang.serialization.Codec; +import dev.compactmods.machines.graph.IGraphEdge; +import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.room.Rooms; +import org.jetbrains.annotations.NotNull; + +public record RoomOwnerEdge() implements IGraphEdge { + public static final Codec CODEC = Codec.unit(new RoomOwnerEdge()); + + @Override + public @NotNull IGraphEdgeType getEdgeType() { + return Rooms.ROOM_OWNER_EDGE.get(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java new file mode 100644 index 00000000..6fe10508 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java @@ -0,0 +1,27 @@ +package dev.compactmods.machines.room.graph; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.room.Rooms; +import net.minecraft.core.UUIDUtil; +import net.minecraft.resources.ResourceLocation; + +import java.util.UUID; + +public record RoomOwnerNode(UUID owner) implements IGraphNode { + + private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "room"); + + public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( + UUIDUtil.CODEC.fieldOf("owner").forGetter(RoomOwnerNode::owner), + ResourceLocation.CODEC.fieldOf("type").forGetter(x -> RoomOwnerNode.TYPE) + ).apply(i, (owner, type) -> new RoomOwnerNode(owner))); + + @Override + public IGraphNodeType getType() { + return Rooms.ROOM_OWNER_NODE.get(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java b/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java new file mode 100644 index 00000000..4c28c58a --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java @@ -0,0 +1,33 @@ +package dev.compactmods.machines.room.graph; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.graph.Graph; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; + +/** + * Represents the inside of a Compact Machine. + */ +public record RoomReferenceNode(String code) implements IGraphNode { + + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + Codec.STRING.fieldOf("code").forGetter(RoomReferenceNode::code) + ).apply(i, RoomReferenceNode::new)); + + public IRoomRegistration getFullInfo(IRoomLookup lookup) { + return lookup.forRoom(code).orElseThrow(); + } + + @Override + public String toString() { + return "RoomReference[id=%s]".formatted(code); + } + + @Override + public IGraphNodeType getType() { + return Graph.ROOM_REFERENCE_NODE.get(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java b/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java new file mode 100644 index 00000000..dd38fbfb --- /dev/null +++ b/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java @@ -0,0 +1,23 @@ +package dev.compactmods.machines.room.graph; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.room.Rooms; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; + +public record RoomSpawnNode(Vec3 position, Vec2 rotation) implements IGraphNode { + + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + Vec3.CODEC.fieldOf("position").forGetter(RoomSpawnNode::position), + CodecExtensions.VEC2.fieldOf("rotation").forGetter(RoomSpawnNode::rotation) + ).apply(i, RoomSpawnNode::new)); + + @Override + public IGraphNodeType getType() { + return Rooms.SPAWN_NODE.get(); + } +} diff --git a/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java b/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java index 67b53776..6cf8cc04 100644 --- a/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java +++ b/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java @@ -1,8 +1,10 @@ package dev.compactmods.machines.room.menu; +import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.core.UIRegistration; -import dev.compactmods.machines.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; @@ -13,27 +15,31 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; public class MachineRoomMenu extends AbstractContainerMenu { - private final ChunkPos room; + private final String room; private String roomName; private final LevelBlockPosition machine; private StructureTemplate roomBlocks; + public boolean loadingBlocks; - public MachineRoomMenu(int win, ChunkPos room, LevelBlockPosition machine, String roomName) { + public MachineRoomMenu(int win, String room, LevelBlockPosition machine, String roomName) { super(UIRegistration.MACHINE_MENU.get(), win); this.room = room; this.roomName = roomName; this.roomBlocks = new StructureTemplate(); this.machine = machine; + this.loadingBlocks = true; } - public ChunkPos getRoom() { + public String getRoom() { return room; } @@ -41,7 +47,7 @@ public LevelBlockPosition getMachine() { return machine; } - public static MenuProvider makeProvider(MinecraftServer server, ChunkPos roomId, LevelBlockPosition machinePos) { + public static MenuProvider makeProvider(MinecraftServer server, IRoomRegistration roomInfo, LevelBlockPosition machinePos) { return new MenuProvider() { @Override public Component getDisplayName() { @@ -52,14 +58,17 @@ public Component getDisplayName() { @Override public AbstractContainerMenu createMenu(int winId, Inventory inv, Player player2) { try { - final var title = Rooms.getRoomName(server, roomId); + final var title = Rooms.getRoomName(server, roomInfo.code()); - var menu = new MachineRoomMenu(winId, roomId, machinePos, title.orElse("Room Preview")); - menu.roomBlocks = Rooms.getInternalBlocks(server, roomId); + var menu = new MachineRoomMenu(winId, roomInfo.code(), machinePos, title.orElse("Room Preview")); + menu.roomBlocks = Rooms.getInternalBlocks(server, roomInfo.code()).get(5, TimeUnit.SECONDS); return menu; - } catch (MissingDimensionException | NonexistentRoomException e) { + } catch (NonexistentRoomException | MissingDimensionException e) { + CompactMachines.LOGGER.fatal("Error creating machine preview for {}.", machinePos, e); return null; + } catch (ExecutionException | InterruptedException | TimeoutException e) { + throw new RuntimeException(e); } } }; @@ -83,6 +92,7 @@ public StructureTemplate getBlocks() { public void setBlocks(StructureTemplate blocks) { this.roomBlocks = blocks; + this.loadingBlocks = false; } public String getRoomName() { diff --git a/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java b/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java index 45ebf790..8876b961 100644 --- a/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java +++ b/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java @@ -1,33 +1,42 @@ package dev.compactmods.machines.room.network; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.level.ChunkPos; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; -public record PlayerRequestedTeleportPacket(LevelBlockPosition machine, ChunkPos room) { +public record PlayerRequestedTeleportPacket(LevelBlockPosition machine, String room) { public PlayerRequestedTeleportPacket(FriendlyByteBuf buf) { - this(buf.readWithCodec(LevelBlockPosition.CODEC), buf.readChunkPos()); + this(buf.readWithCodec(LevelBlockPosition.CODEC), buf.readUtf()); } public void encode(FriendlyByteBuf buf) { buf.writeWithCodec(LevelBlockPosition.CODEC, machine); - buf.writeChunkPos(room); + buf.writeUtf(room); } public boolean handle(Supplier ctx) { ctx.get().enqueueWork(() -> { final var player = ctx.get().getSender(); - try { - PlayerUtil.teleportPlayerIntoMachine(player.level, player, machine.getBlockPosition()); - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.error("Failed to teleport player into machine.", e); + if (player != null) { + try { + final var provider = CompactRoomProvider.instance(CompactDimension.forServer(player.server)); + provider.forRoom(room).ifPresent(info -> { + try { + PlayerUtil.teleportPlayerIntoMachine(player.level, player, machine, info); + } catch (MissingDimensionException ignored) { + } + }); + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.error("Failed to teleport player into machine.", e); + } } }); diff --git a/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java b/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java index c06e2b71..d85d8673 100644 --- a/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java +++ b/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java @@ -1,34 +1,46 @@ package dev.compactmods.machines.room.network; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.PacketDistributor; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Supplier; -public record PlayerStartedRoomTrackingPacket(ChunkPos room) { +public record PlayerStartedRoomTrackingPacket(String room) { public PlayerStartedRoomTrackingPacket(FriendlyByteBuf buf) { - this(buf.readChunkPos()); + this(buf.readUtf()); } public void encode(FriendlyByteBuf buf) { - buf.writeChunkPos(room); + buf.writeUtf(room); } public boolean handle(Supplier ctx) { var sender = ctx.get().getSender(); ctx.get().enqueueWork(() -> { + StructureTemplate blocks = null; try { - var blocks = Rooms.getInternalBlocks(sender.server, room); - RoomNetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> sender), new InitialRoomBlockDataPacket(blocks)); - } catch (MissingDimensionException | NonexistentRoomException e) { - e.printStackTrace(); + blocks = Rooms.getInternalBlocks(sender.server, room).get(5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } catch (TimeoutException e) { + throw new RuntimeException(e); + } catch (MissingDimensionException e) { + throw new RuntimeException(e); + } catch (NonexistentRoomException e) { + throw new RuntimeException(e); } + RoomNetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> sender), new InitialRoomBlockDataPacket(blocks)); }); return true; diff --git a/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java b/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java index 31f087e5..298e75bd 100644 --- a/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java +++ b/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java @@ -11,7 +11,7 @@ public class RoomNetworkHandler { - private static final ArtifactVersion ROOM_TRACK_VERSION = new DefaultArtifactVersion("1.0.0"); + private static final ArtifactVersion ROOM_TRACK_VERSION = new DefaultArtifactVersion("2.0.0"); public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(Constants.MOD_ID, "room_tracking"), diff --git a/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index 2047cc7a..f7687702 100644 --- a/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -3,9 +3,10 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; import dev.compactmods.machines.client.gui.PersonalShrinkingDeviceScreen; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.data.CompactRoomData; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; @@ -19,7 +20,6 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import javax.annotation.Nullable; @@ -64,12 +64,14 @@ public InteractionResultHolder use(Level world, Player player, Intera ServerLevel playerDim = serverPlayer.getLevel(); if (playerDim.dimension().equals(CompactDimension.LEVEL_KEY)) { if (player.isShiftKeyDown()) { - ChunkPos machineChunk = new ChunkPos(player.blockPosition()); - final CompactRoomData intern = CompactRoomData.get(playerDim); - - // Use internal data to set new spawn point - intern.setSpawn(machineChunk, player.position()); + final var roomInfo = CompactRoomProvider.instance(playerDim); + roomInfo.findByChunk(player.chunkPosition()).ifPresent(room -> { + if(room instanceof IMutableRoomRegistration mutableRoom) { + mutableRoom.setSpawnPosition(player.position()); + mutableRoom.setSpawnRotation(PlayerUtil.getLookDirection(player)); + } + }); MutableComponent tc = TranslationUtil.message(Messages.ROOM_SPAWNPOINT_SET) .withStyle(ChatFormatting.GREEN); diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index 6ae20354..2db5fcd3 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -9,9 +9,10 @@ import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; import dev.compactmods.machines.core.CompactMachinesNet; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; import dev.compactmods.machines.util.PlayerUtil; @@ -166,7 +167,13 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position boolean redstone = def instanceof RedstoneTunnel; final var tunnelId = Tunnels.getRegistryId(def); - final var roomTunnels = TunnelConnectionGraph.forRoom(compactDim, player.chunkPosition()); + final var provider = CompactRoomProvider.instance(compactDim); + final var roomInfo = provider.findByChunk(player.chunkPosition()); + if(roomInfo.isEmpty()) + return false; + + final var roomInstance = roomInfo.get(); + final var roomTunnels = TunnelConnectionGraph.forRoom(compactDim, roomInstance.code()); var lastEnteredMachine = getMachineBindingInfo(player); if (lastEnteredMachine.isEmpty()) { diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index f3e06d45..84752ebe 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -1,11 +1,13 @@ package dev.compactmods.machines.tunnel; +import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.wall.ProtectedWallBlock; import dev.compactmods.machines.wall.Walls; @@ -74,7 +76,7 @@ public int getSignal(BlockState state, BlockGetter world, BlockPos position, Dir final var machPos = tunnelWall.getConnectedPosition(); final var tunnPos = tunnelWall.getTunnelPosition(); - if(!machPos.isLoaded(serv)) return 0; + if (!machPos.isLoaded(serv)) return 0; if (def instanceof RedstoneReaderTunnel rrt) { return rrt.powerLevel(serv, machPos, tunnPos); @@ -113,57 +115,63 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var tunnelId = Tunnels.getRegistryId(def); - if (player.isShiftKeyDown()) { - BlockState solidWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + final var roomProvider = CompactRoomProvider.instance(compactDim); + return roomProvider.findByChunk(new ChunkPos(pos)).map(roomInfo -> { + final var tunnels = TunnelConnectionGraph.forRoom(compactDim, roomInfo.code()); + if (player.isShiftKeyDown()) { + BlockState solidWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); - level.setBlockAndUpdate(pos, solidWall); + level.setBlockAndUpdate(pos, solidWall); - ItemStack stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); - CompoundTag defTag = stack.getOrCreateTagElement("definition"); - defTag.putString("id", tunnelId.toString()); + ItemStack stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); + CompoundTag defTag = stack.getOrCreateTagElement("definition"); + defTag.putString("id", tunnelId.toString()); - ItemEntity ie = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), stack); - level.addFreshEntity(ie); + ItemEntity ie = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), stack); + level.addFreshEntity(ie); - if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRemoved(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel()); - } + if (def instanceof TunnelTeardownHandler teardown) { + teardown.onRemoved(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel()); + } - final var tunnels = TunnelConnectionGraph.forRoom(compactDim, new ChunkPos(pos)); - tunnels.unregister(pos); - } else { - // Rotate tunnel - Direction dir = state.getValue(CONNECTED_SIDE); + tunnels.unregister(pos); + } else { + // Rotate tunnel + Direction dir = state.getValue(CONNECTED_SIDE); - final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, new ChunkPos(pos)); - final var existingDirs = tunnelGraph - .getTunnelSides(tunnelId) - .collect(Collectors.toSet()); + final var existingDirs = tunnels + .getTunnelSides(tunnelId) + .collect(Collectors.toSet()); - if (existingDirs.size() == 6) { - // WARN PLAYER - NO OTHER SIDES REMAIN - player.displayClientMessage( - TranslationUtil.message(Messages.NO_TUNNEL_SIDE).withStyle(ChatFormatting.DARK_RED), true); + if (existingDirs.size() == 6) { + // WARN PLAYER - NO OTHER SIDES REMAIN + player.displayClientMessage( + TranslationUtil.message(Messages.NO_TUNNEL_SIDE).withStyle(ChatFormatting.DARK_RED), true); - return InteractionResult.FAIL; - } + return InteractionResult.FAIL; + } - final var next = TunnelHelper.getNextDirection(dir, existingDirs); - next.ifPresent(newSide -> { - level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); + final var next = TunnelHelper.getNextDirection(dir, existingDirs); + next.ifPresent(newSide -> { + level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); - if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRotated(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); - } + if (def instanceof TunnelTeardownHandler teardown) { + teardown.onRotated(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); + } - tunnelGraph.rotateTunnel(pos, newSide); - tunnelGraph.setDirty(); - }); - } + tunnels.rotateTunnel(pos, newSide); + tunnels.setDirty(); + }); + } + + return InteractionResult.SUCCESS; + }).orElseGet(() -> { + CompactMachines.LOGGER.fatal("Failed to interact with tunnel: not assigned to a room"); + return InteractionResult.FAIL; + }); } return InteractionResult.SUCCESS; } - // todo - breaking block unregisters tunnel info } diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index e20074b3..c93551ae 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -8,8 +8,11 @@ import dev.compactmods.machines.api.tunnels.lifecycle.InstancedTunnel; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; +import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelNode; import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -28,6 +31,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.lang.ref.WeakReference; public class TunnelWallEntity extends BlockEntity { @@ -39,6 +43,8 @@ public class TunnelWallEntity extends BlockEntity { @Nullable private TunnelInstance tunnel; + private WeakReference node; + public TunnelWallEntity(BlockPos pos, BlockState state) { super(Tunnels.TUNNEL_BLOCK_ENTITY.get(), pos, state); } @@ -77,14 +83,18 @@ public void onLoad() { if (this.tunnelType != null && tunnelType.equals(Tunnels.UNKNOWN.get())) { CompactMachines.LOGGER.warn("Removing unknown tunnel type at {}", worldPosition.toShortString()); sl.setBlock(worldPosition, Walls.BLOCK_SOLID_WALL.get().defaultBlockState(), Block.UPDATE_ALL); + } else { + // todo Load tunnel data + node = new WeakReference<>(null); } } } @Override public void saveAdditional(@Nonnull CompoundTag compound) { - compound.putString(BaseTunnelWallData.KEY_TUNNEL_TYPE, Tunnels.getRegistryId(tunnelType).toString()); - compound.put(BaseTunnelWallData.KEY_CONNECTION, connectedMachine.serializeNBT()); + CodecExtensions.writeIntoTag(BaseTunnelWallData.CODEC, + new BaseTunnelWallData(connectedMachine, Tunnels.getRegistryId(tunnelType)), + compound); if (tunnel instanceof INBTSerializable persist) { var data = persist.serializeNBT(); @@ -96,9 +106,9 @@ public void saveAdditional(@Nonnull CompoundTag compound) { @Nonnull public CompoundTag getUpdateTag() { CompoundTag nbt = super.getUpdateTag(); - nbt.putString(BaseTunnelWallData.KEY_TUNNEL_TYPE, Tunnels.getRegistryId(tunnelType).toString()); - nbt.put(BaseTunnelWallData.KEY_CONNECTION, connectedMachine.serializeNBT()); - return nbt; + return CodecExtensions.writeIntoTag(BaseTunnelWallData.CODEC, + new BaseTunnelWallData(connectedMachine, Tunnels.getRegistryId(tunnelType)), + nbt); } @Override @@ -201,10 +211,14 @@ public TunnelDefinition getTunnelType() { public void setConnectedTo(IDimensionalBlockPosition machine, Direction side) { if (level == null || level.isClientSide) return; this.connectedMachine = new LevelBlockPosition(machine); - if (level instanceof ServerLevel sl) { - final var graph = TunnelConnectionGraph.forRoom(sl, new ChunkPos(worldPosition)); - graph.rebind(worldPosition, machine, side); + + // TODO - Weak references to room data so we don't have to do this + final var roomProvider = CompactRoomProvider.instance(sl); + roomProvider.findByChunk(new ChunkPos(this.worldPosition)).ifPresent(room -> { + final var graph = TunnelConnectionGraph.forRoom(sl, room.code()); + graph.rebind(worldPosition, machine, side); + }); } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index c335898b..ee0ed186 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -3,11 +3,11 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.tunnel.definitions.FluidTunnel; -import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; -import dev.compactmods.machines.tunnel.definitions.ItemTunnel; +import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; -import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; +import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -26,7 +26,12 @@ public class Tunnels { - public static final Supplier> TUNNEL_DEF_REGISTRY = Registries.TUNNEL_DEFINITIONS.makeRegistry(RegistryBuilder::new); + public static final Supplier> TUNNEL_DEF_REGISTRY = Registries.TUNNEL_DEFINITIONS + .makeRegistry(RegistryBuilder::new); + public static final RegistryObject> TUNNEL_NODE = Registries.NODE_TYPES + .register("tunnel", SimpleGraphNodeType.instance(TunnelNode.CODEC)); + public static final RegistryObject> TUNNEL_TYPE_NODE = Registries.NODE_TYPES + .register("tunnel_type", SimpleGraphNodeType.instance(TunnelTypeNode.CODEC)); public static boolean isRegistered(ResourceLocation id) { return TUNNEL_DEF_REGISTRY.get().containsKey(id); @@ -41,23 +46,12 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { // ================================================================================================================ // TUNNELS // ================================================================================================================ - public static final RegistryObject UNKNOWN = Registries.TUNNEL_DEFINITIONS.register("unknown", UnknownTunnel::new); + public static final RegistryObject UNKNOWN = Registries.TUNNEL_DEFINITIONS + .register("unknown", UnknownTunnel::new); public static final RegistryObject ITEM_TUNNEL = Registries.ITEMS.register("tunnel", () -> new TunnelItem(new Item.Properties().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); - // ================================================================================================================ - // TUNNEL TYPE DEFINITIONS - // ================================================================================================================ - public static final RegistryObject ITEM_TUNNEL_DEF = Registries.TUNNEL_DEFINITIONS.register("item", ItemTunnel::new); - - public static final RegistryObject FLUID_TUNNEL_DEF = Registries.TUNNEL_DEFINITIONS.register("fluid", FluidTunnel::new); - - public static final RegistryObject FORGE_ENERGY = Registries.TUNNEL_DEFINITIONS.register("energy", ForgeEnergyTunnel::new); - - public static final RegistryObject REDSTONE_IN = Registries.TUNNEL_DEFINITIONS - .register("redstone_in", RedstoneInTunnelDefinition::new); - // ================================================================================================================ // TUNNEL BLOCKS / TILES // ================================================================================================================ @@ -68,7 +62,8 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { .lightLevel((state) -> 15))); public static final RegistryObject> TUNNEL_BLOCK_ENTITY = Registries.BLOCK_ENTITIES - .register("tunnel_wall", () -> BlockEntityType.Builder.of(TunnelWallEntity::new, BLOCK_TUNNEL_WALL.get()).build(null)); + .register("tunnel_wall", () -> BlockEntityType.Builder.of(TunnelWallEntity::new, BLOCK_TUNNEL_WALL.get()) + .build(null)); public static ResourceLocation getRegistryId(TunnelDefinition definition) { final var reg = TUNNEL_DEF_REGISTRY.get(); diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java index 60d0b7b5..b6703719 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java @@ -3,18 +3,23 @@ import com.google.common.graph.EndpointPair; import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; +import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.codec.NbtListCollector; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.graph.*; +import dev.compactmods.machines.codec.NbtListCollector; +import dev.compactmods.machines.graph.Graph; +import dev.compactmods.machines.graph.IGraphEdge; +import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.MachineRoomEdge; +import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -29,7 +34,13 @@ import net.minecraftforge.common.util.INBTSerializable; import javax.annotation.Nonnull; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -42,7 +53,7 @@ public class TunnelConnectionGraph extends SavedData implements INBTSerializable /** * The full data graph. Contains tunnel nodes, machine ids, and tunnel type information. */ - private final MutableValueGraph graph; + private final MutableValueGraph, IGraphEdge> graph; /** * Quick access to tunnel information for specific locations. @@ -74,7 +85,7 @@ private TunnelConnectionGraph(CompoundTag nbt) { this.deserializeNBT(nbt); } - public static TunnelConnectionGraph forRoom(ServerLevel compactDim, ChunkPos room) { + public static TunnelConnectionGraph forRoom(ServerLevel compactDim, String room) { final var key = getDataFilename(room); return compactDim.getDataStorage().computeIfAbsent( TunnelConnectionGraph::new, @@ -91,8 +102,13 @@ public CompoundTag save(CompoundTag tag) { return tag; } - public static String getDataFilename(ChunkPos room) { - return "tunnels_" + room.x + "_" + room.z; + @Deprecated(forRemoval = true, since = "5.2.0") + public static String getOldTunnelFilename(ChunkPos oldRoom) { + return "tunnels_%s_%s".formatted(oldRoom.x, oldRoom.z); + } + + public static String getDataFilename(String room) { + return "tunnels_" + room; } /** @@ -168,7 +184,7 @@ public CompactMachineNode getOrCreateMachineNode(IDimensionalBlockPosition machi var machineRegistered = machines.containsKey(machine); CompactMachineNode node; if (!machineRegistered) { - node = new CompactMachineNode(machine.dimensionKey(), machine.getBlockPosition()); + node = new CompactMachineNode(machine.dimension(), machine.getBlockPosition()); machines.put(machine, node); graph.addNode(node); setDirty(); @@ -224,17 +240,6 @@ public Set getTunnelsByType(TunnelDefinition type) { .collect(Collectors.toSet()); } - public Optional getTunnelSide(TunnelNode node) { - return graph.adjacentNodes(node).stream() - .filter(CompactMachineNode.class::isInstance) - .map(mn -> graph.edgeValue(node, mn)) - .filter(Optional::isPresent) - .map(Optional::get) - .map(TunnelMachineEdge.class::cast) - .map(TunnelMachineEdge::side) - .findFirst(); - } - public Optional getTunnelSide(BlockPos pos) { if (!tunnels.containsKey(pos)) return Optional.empty(); @@ -265,7 +270,7 @@ public Optional getTunnelInfo(BlockPos tunnel) { var side = getTunnelSide(tunnel).orElseThrow(); var type = typeNode.id(); - return Optional.of(new TunnelMachineInfo(tunnel, type, new LevelBlockPosition(mach), side)); + return Optional.of(new TunnelMachineInfo(tunnel, type, mach, side)); } public Stream tunnels() { @@ -275,7 +280,7 @@ public Stream tunnels() { .map(Optional::get); } - public Stream nodes() { + public Stream> nodes() { return graph.nodes().stream(); } @@ -288,10 +293,14 @@ public CompoundTag serializeNBT() { HashMap nodeIds = new HashMap<>(); final var nodeReg = Graph.NODE_TYPE_REG.get(); - final var nodeRegCodec = nodeReg.getCodec() + final Codec nodeRegCodec = nodeReg.getCodec() .dispatchStable(IGraphNode::getType, IGraphNodeType::codec); - var nodeList = nodes().map(node -> { + final Codec edgeRegCodec = Graph.EDGE_TYPE_REG.get() + .getCodec() + .dispatchStable(IGraphEdge::getEdgeType, IGraphEdgeType::codec); + + final var nodeList = nodes().map(node -> { CompoundTag nodeInfo = new CompoundTag(); var encoded = nodeRegCodec.encodeStart(NbtOps.INSTANCE, node); @@ -312,9 +321,8 @@ public CompoundTag serializeNBT() { //noinspection OptionalGetWithoutIsPresent var realEdge = graph.edgeValue(edge).get(); - var codec = realEdge.getEdgeType().codec(); - var encoded = codec.encodeStart(NbtOps.INSTANCE, realEdge); + var encoded = edgeRegCodec.encodeStart(NbtOps.INSTANCE, realEdge); var edgeEnc = encoded.getOrThrow(false, CompactMachines.LOGGER::error); edgeInfo.putUUID("from", nodeIds.get(edge.nodeU())); @@ -416,6 +424,7 @@ public boolean hasTunnel(BlockPos location) { /** * Fetches the locations of all redstone-enabled tunnels for a specific wallSide. + * * @param machine * @param facing * @return @@ -488,7 +497,7 @@ public Stream getTunnelSides(ResourceLocation type) { return Stream.empty(); return getTunnelNodesByType(type) - .map(this::getTunnelSide) + .map(node -> node.getTunnelSide(this)) .filter(Optional::isPresent) .map(Optional::get); } @@ -640,4 +649,8 @@ public void rebind(BlockPos tunnel, IDimensionalBlockPosition newMachine, Direct graph.putEdgeValue(tunnelNode, newMachineNode, new TunnelMachineEdge(side)); setDirty(); } + + public MutableValueGraph, IGraphEdge> getGraph() { + return graph; + } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java index b3767c22..df858583 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java @@ -27,7 +27,7 @@ public String toString() { } @Override - public IGraphEdgeType getEdgeType() { + public IGraphEdgeType getEdgeType() { return GraphEdgeType.TUNNEL_MACHINE; } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java index 636d111c..a7334c2a 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.tunnel.graph; -import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; -public record TunnelMachineInfo(BlockPos location, ResourceLocation type, LevelBlockPosition machine, Direction side) { +public record TunnelMachineInfo(BlockPos location, ResourceLocation type, IDimensionalBlockPosition machine, Direction side) { } diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java index 5320e0c4..b301ec01 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java @@ -3,39 +3,24 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.Graph; -import dev.compactmods.machines.graph.GraphNodeBase; +import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.machine.graph.CompactMachineNode; +import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import java.util.Objects; +import java.util.Optional; -public final class TunnelNode extends GraphNodeBase implements IGraphNodeType { +public record TunnelNode(BlockPos position) implements IGraphNode { private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel"); public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( BlockPos.CODEC.fieldOf("pos").forGetter(TunnelNode::position), ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (bpos, type) -> new TunnelNode(bpos))); - private final BlockPos position; - - public TunnelNode() { - this.position = BlockPos.ZERO; - } - - public TunnelNode(BlockPos position) { - this.position = position; - } - - @Override - public Codec codec() { - return CODEC; - } - - public BlockPos position() { - return position; - } @Override public boolean equals(Object obj) { @@ -52,12 +37,23 @@ public int hashCode() { @Override public String toString() { - return "TunnelNode[" + - "position=" + position + ']'; + return "TunnelNode[position=%s]".formatted(position); } @Override - public IGraphNodeType getType() { - return Graph.TUNNEL_NODE.get(); + public IGraphNodeType getType() { + return Tunnels.TUNNEL_NODE.get(); + } + + public Optional getTunnelSide(TunnelConnectionGraph graph) { + final var g = graph.getGraph(); + return g.adjacentNodes(this).stream() + .filter(CompactMachineNode.class::isInstance) + .map(mn -> g.edgeValue(this, mn)) + .filter(Optional::isPresent) + .map(Optional::get) + .map(TunnelMachineEdge.class::cast) + .map(TunnelMachineEdge::side) + .findFirst(); } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java index 27504be8..7a857752 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java @@ -35,7 +35,7 @@ public String toString() { } @Override - public @NotNull IGraphEdgeType getEdgeType() { + public @NotNull IGraphEdgeType getEdgeType() { return GraphEdgeType.TUNNEL_TYPE; } } diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java index 7ad9c24a..7d3ba372 100644 --- a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java +++ b/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java @@ -3,14 +3,14 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.Graph; -import dev.compactmods.machines.graph.GraphNodeBase; +import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.resources.ResourceLocation; import java.util.Objects; -public final class TunnelTypeNode extends GraphNodeBase implements IGraphNodeType { +public final class TunnelTypeNode implements IGraphNodeType, IGraphNode { private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( @@ -57,6 +57,6 @@ public String toString() { @Override public IGraphNodeType getType() { - return Graph.TUNNEL_TYPE_NODE.get(); + return Tunnels.TUNNEL_TYPE_NODE.get(); } } diff --git a/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java b/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java index def3e304..c4c6afe3 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java +++ b/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java @@ -3,6 +3,9 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import net.minecraft.resources.ResourceLocation; @@ -27,36 +30,42 @@ public String getTranslationKey() { } @Override - public void onAdded(ServerLevel level, ChunkPos room) { + public void onAdded(ServerLevel level, IRoomRegistration room) { forceLoad(level, room); } @Override - public void onRemoved(ServerLevel level, ChunkPos room) { + public void onRemoved(ServerLevel level, IRoomRegistration room) { normalLoad(level, room); } @Override - public void onLevelLoaded(ServerLevel level, ChunkPos room) { + public void onLevelLoaded(ServerLevel level, IRoomRegistration room) { forceLoad(level, room); } @Override - public void onLevelUnloaded(ServerLevel level, ChunkPos room) { + public void onLevelUnloaded(ServerLevel level, IRoomRegistration room) { normalLoad(level, room); } - private void forceLoad(ServerLevel level, ChunkPos room) { + private void forceLoad(ServerLevel level, IRoomRegistration room) { final var chunks = level.getChunkSource(); - level.setChunkForced(room.x, room.z, true); - chunks.addRegionTicket(CM4_LOAD_TYPE, room, 2, room); + room.chunks().forEach(chunk -> { + level.setChunkForced(chunk.x, chunk.z, true); + chunks.addRegionTicket(CM4_LOAD_TYPE, chunk, 2, chunk); + }); + chunks.save(false); } - private void normalLoad(ServerLevel level, ChunkPos room) { + private void normalLoad(ServerLevel level, IRoomRegistration room) { final var chunks = level.getChunkSource(); - level.setChunkForced(room.x, room.z, false); - chunks.removeRegionTicket(CM4_LOAD_TYPE, room, 2, room); + room.chunks().forEach(chunk -> { + level.setChunkForced(chunk.x, chunk.z, false); + chunks.removeRegionTicket(CM4_LOAD_TYPE, chunk, 2, chunk); + }); + chunks.save(false); } } diff --git a/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java b/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java index 3674d390..46a829bd 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java +++ b/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.api.room.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.room.graph.CompactMachineRoomNode; +import dev.compactmods.machines.room.graph.RoomReferenceNode; import dev.compactmods.machines.upgrade.graph.RoomUpgradeConnection; import dev.compactmods.machines.upgrade.graph.RoomUpgradeGraphNode; import dev.compactmods.machines.upgrade.graph.UpgradeConnectionEntry; @@ -19,12 +19,14 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.saveddata.SavedData; import net.minecraft.world.level.storage.DimensionDataStorage; import javax.annotation.Nonnull; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -33,8 +35,7 @@ public class RoomUpgradeManager extends SavedData { public static final String DATA_NAME = Constants.MOD_ID + "_upgrades"; private final HashMap upgradeNodes; - private final HashMap roomNodes; - + private final HashMap roomNodes; private final MutableValueGraph graph; private static final Codec> UPGRADE_CONNECTIONS_CODEC = UpgradeConnectionEntry.CODEC.listOf(); @@ -102,7 +103,7 @@ public CompoundTag save(CompoundTag tag) { return tag; } - public boolean addUpgrade(T upgrade, ChunkPos room) { + public boolean addUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); final var upgradeNode = upgradeNodes.computeIfAbsent(upgRegistry.getKey(upgrade), rl -> { @@ -111,7 +112,7 @@ public boolean addUpgrade(T upgrade, ChunkPos room) { }); final var roomNode = roomNodes.computeIfAbsent(room, p -> { - final var nn = new CompactMachineRoomNode(p); + final var nn = new RoomReferenceNode(p); return graph.addNode(nn) ? nn : null; }); @@ -124,7 +125,7 @@ public boolean addUpgrade(T upgrade, ChunkPos room) { return true; } - public boolean removeUpgrade(T upgrade, ChunkPos room) { + public boolean removeUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; @@ -142,16 +143,16 @@ public boolean removeUpgrade(T upgrade, ChunkPos room) { return true; } - public Stream roomsWith(ResourceKey upgradeKey) { + public Stream roomsWith(ResourceKey upgradeKey) { if (!upgradeNodes.containsKey(upgradeKey.location())) return Stream.empty(); return upgradeNodes.values().stream() .filter(upg -> upg.key().equals(upgradeKey.location())) .flatMap(upg -> graph.adjacentNodes(upg).stream()) - .filter(CompactMachineRoomNode.class::isInstance) - .map(CompactMachineRoomNode.class::cast) - .map(CompactMachineRoomNode::pos); + .filter(RoomReferenceNode.class::isInstance) + .map(RoomReferenceNode.class::cast) + .map(RoomReferenceNode::code); } public Stream> implementing(Class inter) { @@ -174,10 +175,10 @@ public Stream> implementing(Class final var roomNodes = new HashSet<>(); for (RoomUpgradeGraphNode upgNode : matchedUpgradeNodes) { for (IGraphNode adjNode : graph.adjacentNodes(upgNode)) { - if (adjNode instanceof CompactMachineRoomNode roomNode) { + if (adjNode instanceof RoomReferenceNode roomNode) { graph.edgeValue(roomNode, upgNode).ifPresent(edv -> { if (edv instanceof RoomUpgradeConnection conn && inter.isInstance(conn.instance())) - instances.add(new RoomUpgradeInstance<>(inter.cast(conn.instance()), roomNode.pos())); + instances.add(new RoomUpgradeInstance<>(inter.cast(conn.instance()), roomNode.code())); }); } } @@ -187,7 +188,7 @@ public Stream> implementing(Class return instances.stream(); } - public boolean hasUpgrade(ChunkPos room, RoomUpgrade upgrade) { + public boolean hasUpgrade(String room, RoomUpgrade upgrade) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; diff --git a/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java b/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java index 1964a789..48ebfdaa 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java +++ b/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java @@ -3,11 +3,12 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.upgrade.RoomUpgradeManager; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -44,10 +45,10 @@ public class CMUpgradeRoomCommand { private static int addToCurrentRoom(CommandContext ctx) throws CommandSyntaxException { final var src = ctx.getSource(); - final var level = ctx.getSource().getLevel(); + final var compactDim = ctx.getSource().getLevel(); final var serv = ctx.getSource().getServer(); - if (!level.dimension().equals(CompactDimension.LEVEL_KEY)) + if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); @@ -60,22 +61,29 @@ private static int addToCurrentRoom(CommandContext ctx) thro final var execdAt = src.getPosition(); final var currChunk = new ChunkPos(new BlockPos((int) execdAt.x, (int) execdAt.y, (int) execdAt.z)); - if (!Rooms.exists(serv, currChunk)) - return -1; + final var roomProvider = CompactRoomProvider.instance(compactDim); + final var manager = RoomUpgradeManager.get(compactDim); - final var manager = RoomUpgradeManager.get(level); - if(manager.hasUpgrade(currChunk, upgrade)) { - src.sendFailure(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE)); - } else { - final var added = manager.addUpgrade(upgrade, currChunk); + if (!roomProvider.isRoomChunk(currChunk)) { + src.sendFailure(TranslationUtil.command(CMCommands.NOT_IN_COMPACT_DIMENSION)); + return -1; + } - if (added) { - upgrade.onAdded(level, currChunk); - src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_APPLIED), true); + roomProvider.findByChunk(currChunk).ifPresentOrElse(room -> { + if (manager.hasUpgrade(room.code(), upgrade)) { + src.sendFailure(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE)); } else { - src.sendFailure(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED)); + final var added = manager.addUpgrade(upgrade, room.code()); + + if (added) { + upgrade.onAdded(compactDim, room); + src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_APPLIED), true); + } else { + src.sendFailure(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED)); + } } - } + }, () -> src.sendFailure(TranslationUtil.command(CMCommands.NOT_IN_COMPACT_DIMENSION))); + return 0; } @@ -86,10 +94,9 @@ private static int addToSpecificRoom(CommandContext ctx) { private static int removeFromCurrentRoom(CommandContext ctx) throws CommandSyntaxException { final var src = ctx.getSource(); - final var level = ctx.getSource().getLevel(); - final var serv = ctx.getSource().getServer(); + final var compactDim = ctx.getSource().getLevel(); - if (!level.dimension().equals(CompactDimension.LEVEL_KEY)) + if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); @@ -102,22 +109,28 @@ private static int removeFromCurrentRoom(CommandContext ctx) final var execdAt = src.getPosition(); final var currChunk = new ChunkPos(new BlockPos((int) execdAt.x, (int) execdAt.y, (int) execdAt.z)); - if (!Rooms.exists(serv, currChunk)) - return -1; + final var roomProvider = CompactRoomProvider.instance(compactDim); + final var manager = RoomUpgradeManager.get(compactDim); - final var manager = RoomUpgradeManager.get(level); - if(!manager.hasUpgrade(currChunk, upgrade)) { - src.sendFailure(TranslationUtil.message(Messages.UPGRADE_NOT_PRESENT)); - } else { - final var removed = manager.removeUpgrade(upgrade, currChunk); + if (!roomProvider.isRoomChunk(currChunk)) { + src.sendFailure(TranslationUtil.command(CMCommands.NOT_IN_COMPACT_DIMENSION)); + return -1; + } - if (removed) { - upgrade.onRemoved(level, currChunk); - src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_REMOVED), true); + roomProvider.findByChunk(currChunk).ifPresentOrElse(room -> { + if (!manager.hasUpgrade(room.code(), upgrade)) { + src.sendFailure(TranslationUtil.message(Messages.UPGRADE_NOT_PRESENT)); } else { - src.sendFailure(TranslationUtil.message(Messages.UPGRADE_REM_FAILED)); + final var removed = manager.removeUpgrade(upgrade, room.code()); + + if (removed) { + upgrade.onRemoved(compactDim, room); + src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_REMOVED), true); + } else { + src.sendFailure(TranslationUtil.message(Messages.UPGRADE_REM_FAILED)); + } } - } + }, () -> src.sendFailure(TranslationUtil.command(CMCommands.NOT_IN_COMPACT_DIMENSION))); return 0; } @@ -125,6 +138,4 @@ private static int removeFromCurrentRoom(CommandContext ctx) private static int removeFromSpecificRoom(CommandContext ctx) { return 0; } - - } diff --git a/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java b/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java index c3ddfff1..f45924c0 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java +++ b/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java @@ -5,8 +5,8 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.commands.CommandSourceStack; @@ -30,7 +30,7 @@ private RoomUpgradeArgument() { public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { final var UPGRADES = MachineRoomUpgrades.REGISTRY.get(); - ResourceKey resourcekey = getRegistryType(stack, argName, Registries.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); + ResourceKey resourcekey = getRegistryType(stack, argName, CMRegistries.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); return Optional.ofNullable(UPGRADES.getValue(resourcekey.location())); } diff --git a/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java index 8f8e3b4d..dbf6ebee 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java +++ b/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java @@ -25,7 +25,7 @@ public T instance() { } @Override - public @NotNull IGraphEdgeType getEdgeType() { + public @NotNull IGraphEdgeType getEdgeType() { return GraphEdgeType.ROOM_UPGRADE; } } diff --git a/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java index bf402b1f..f2d19467 100644 --- a/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java @@ -2,16 +2,14 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.codec.CodecExtensions; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.ChunkPos; -public record UpgradeConnectionEntry(ChunkPos room, ResourceKey upgradeKey, T instance) { +public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.CHUNKPOS + Codec.STRING .fieldOf("room") .forGetter(UpgradeConnectionEntry::room), diff --git a/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java b/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java index b9053661..895f56af 100644 --- a/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java +++ b/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java @@ -1,6 +1,5 @@ package dev.compactmods.machines.util; -import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -16,7 +15,8 @@ public class CompactStructureGenerator { - public static AABB getWallBounds(Vec3i size, BlockPos cubeFloor, Direction wall) { + public static AABB getWallBounds(Vec3i size, Vec3 roomCenter, Direction wall) { + BlockPos cubeFloor = new BlockPos(roomCenter).below(Math.floorDiv(size.getY(), 2)); BlockPos start; switch (wall) { @@ -62,7 +62,7 @@ public static AABB getWallBounds(Vec3i size, BlockPos cubeFloor, Direction wall) * @param cubeCenter * @param wallDirection */ - public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, BlockPos cubeCenter, Direction wallDirection) { + public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Vec3 cubeCenter, Direction wallDirection) { final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); final var wallBounds = getWallBounds(dimensions, cubeCenter, wallDirection); @@ -72,34 +72,15 @@ public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Bl .forEach(p -> world.setBlock(p, unbreakableWall, 7)); } - /** - * Generates a wall or platform in a given direction. - * - * @param world - * @param size - * @param cubeFloor - * @param wallDirection - */ - @Deprecated(forRemoval = true) - public static void generateCompactWall(LevelAccessor world, RoomSize size, BlockPos cubeFloor, Direction wallDirection) { - final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); - final var wallBounds = getWallBounds(size.toVec3(), cubeFloor, wallDirection); - - BlockPos.betweenClosedStream(wallBounds) - .filter(world::isEmptyBlock) - .map(BlockPos::immutable) - .forEach(p -> world.setBlock(p, unbreakableWall, 7)); - } - /** * Generates a machine "internal" structure in a world via a machine size and a central point. * * @param world * @param dimensions Internal dimensions of the room. - * @param cubeFloorCenter + * @param roomCenter */ - public static void generateCompactStructure(LevelAccessor world, Vec3i dimensions, BlockPos cubeFloorCenter) { - AABB floorBlocks = getWallBounds(dimensions, cubeFloorCenter, Direction.DOWN); + public static void generateRoom(LevelAccessor world, Vec3i dimensions, Vec3 roomCenter) { + AABB floorBlocks = getWallBounds(dimensions, roomCenter, Direction.DOWN); AABB machineInternal = floorBlocks .move(1, 1, 1) .contract(2, 0, 2) @@ -111,7 +92,7 @@ public static void generateCompactStructure(LevelAccessor world, Vec3i dimension if (anyAir) { // Generate the walls for(final var dir : Direction.values()) - generateCompactWall(world, dimensions, cubeFloorCenter, dir); + generateCompactWall(world, dimensions, roomCenter, dir); // Clear out the inside of the room BlockPos.betweenClosedStream(machineInternal) @@ -120,32 +101,19 @@ public static void generateCompactStructure(LevelAccessor world, Vec3i dimension } } - public static BlockPos cornerFromSize(Vec3i dimensions, BlockPos cubeFloorCenter) { - Vec3i offset = new Vec3i( - -Math.floor(dimensions.getX() / 2f), - 1, - -Math.floor(dimensions.getZ() / 2f) + public static BlockPos cornerFromSize(Vec3i dimensions, Vec3 center) { + Vec3 offset = new Vec3( + Math.floor(dimensions.getX() / 2f), + Math.floor(dimensions.getY() / 2f), + Math.floor(dimensions.getZ() / 2f) ); - return cubeFloorCenter.offset(offset); - } - - /** - * Generates a machine "internal" structure in a world via a machine size and a central point. - * - * @param world - * @param size - * @param cubeFloorCenter - */ - @Deprecated(forRemoval = true) - public static void generateCompactStructure(LevelAccessor world, RoomSize size, BlockPos cubeFloorCenter) { - int s = size.getInternalSize(); - generateCompactStructure(world, new Vec3i(s, s, s), cubeFloorCenter); + return new BlockPos(center.subtract(offset)); } - public static void fillRoomTemplate(ServerLevel level, ResourceLocation template, Vec3i dimensions, BlockPos cubeFloorCenter) { + public static void fillWithTemplate(ServerLevel level, ResourceLocation template, Vec3i dimensions, Vec3 center) { level.getStructureManager().get(template).ifPresent(tem -> { - BlockPos placeAt = cornerFromSize(dimensions, cubeFloorCenter); + BlockPos placeAt = cornerFromSize(dimensions, center); tem.placeInWorld(level, placeAt, placeAt, new StructurePlaceSettings(), level.random, Block.UPDATE_ALL); }); } diff --git a/src/main/java/dev/compactmods/machines/util/DimensionUtil.java b/src/main/java/dev/compactmods/machines/util/DimensionUtil.java index 2ed5942a..c25d4c6c 100644 --- a/src/main/java/dev/compactmods/machines/util/DimensionUtil.java +++ b/src/main/java/dev/compactmods/machines/util/DimensionUtil.java @@ -3,19 +3,27 @@ import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; +import net.minecraft.SharedConstants; import net.minecraft.core.Registry; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.RegistryOps; import net.minecraft.resources.RegistryResourceAccess; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.datafix.DataFixers; import net.minecraft.world.level.Level; +import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.dimension.LevelStem; +import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelResource; +import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraftforge.fml.loading.FMLEnvironment; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -125,4 +133,28 @@ public static boolean doLevelFileBackup(MinecraftServer server) { return true; } + @NotNull + public static Path getDataFolder(@NotNull Path rootDir, ResourceKey key) { + final var dimPath = DimensionType.getStorageFolder(key, rootDir); + return dimPath.resolve("data"); + } + + @NotNull + public static Path getDataFolder(@NotNull LevelStorageSource.LevelDirectory levelDir, ResourceKey key) { + final var dimPath = DimensionType.getStorageFolder(key, levelDir.path()); + return dimPath.resolve("data"); + } + + @NotNull + public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.LevelDirectory levelDir, ResourceKey key) { + final var folder = getDataFolder(levelDir, key).toFile(); + final var fixer = DataFixers.getDataFixer(); + return new DimensionDataStorage(folder, fixer); + } + + public static CompoundTag readSavedFile(@NotNull DimensionDataStorage storage, String dataKey) throws IOException { + final var currVersion = SharedConstants.getCurrentVersion().getWorldVersion(); + final var nbt = storage.readTagFromDisk(dataKey, currVersion); + return nbt.getCompound("data"); + } } diff --git a/src/main/java/dev/compactmods/machines/util/NbtUtil.java b/src/main/java/dev/compactmods/machines/util/NbtUtil.java new file mode 100644 index 00000000..7308bf61 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/util/NbtUtil.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.util; + +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.codec.CodecExtensions; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.world.level.ChunkPos; + +public class NbtUtil { + + public static ChunkPos readChunkPos(Tag tag) { + return CodecExtensions.CHUNKPOS.parse(NbtOps.INSTANCE, tag) + .getOrThrow(false, CompactMachines.LOGGER::fatal); + } +} diff --git a/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index 1aa3ea22..fad315c0 100644 --- a/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -5,25 +5,25 @@ import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; -import dev.compactmods.machines.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.location.PreciseDimensionalPosition; import dev.compactmods.machines.location.SimpleTeleporter; -import dev.compactmods.machines.machine.CompactMachineBlockEntity; import dev.compactmods.machines.room.RoomCapabilities; -import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; -import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.LazyOptional; @@ -32,8 +32,20 @@ import java.util.UUID; public abstract class PlayerUtil { + public static Optional getProfileByUUID(MinecraftServer server, UUID uuid) { + final var player = server.getPlayerList().getPlayer(uuid); + if (player == null) { + var profile = new GameProfile(uuid, "Unknown"); + var p2 = server.getSessionService().fillProfileProperties(profile, false); + return Optional.ofNullable(p2); + } + + GameProfile profile = player.getGameProfile(); + return Optional.of(profile); + } + public static Optional getProfileByUUID(LevelAccessor world, UUID uuid) { - Player player = world.getPlayerByUUID(uuid); + final var player = world.getPlayerByUUID(uuid); if (player == null) return Optional.empty(); @@ -41,69 +53,53 @@ public static Optional getProfileByUUID(LevelAccessor world, UUID u return Optional.of(profile); } - public static void teleportPlayerIntoMachine(Level machineLevel, Player player, BlockPos machinePos) throws MissingDimensionException { + public static void teleportPlayerIntoMachine(Level machineLevel, Player player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { MinecraftServer serv = machineLevel.getServer(); - ServerLevel compactWorld = serv.getLevel(CompactDimension.LEVEL_KEY); - if (compactWorld == null) { - throw new MissingDimensionException("Compact dimension not found; player attempted to enter machine."); - } - - if (machineLevel.getBlockEntity(machinePos) instanceof CompactMachineBlockEntity tile) { - final var targetRoom = tile.getConnectedRoom(); - boolean grantAdvancement = targetRoom.isEmpty(); + // Recursion check. Player tried to enter the room they're already in. + if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { + final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { + if (player instanceof ServerPlayer sp && room.chunks().anyMatch(chunk -> sp.chunkPosition().equals(chunk))) { + AdvancementTriggers.RECURSIVE_ROOMS.trigger(sp); + return true; + } - targetRoom.ifPresent(room -> { - if (player.level.dimension().equals(CompactDimension.LEVEL_KEY) && player.chunkPosition().equals(room)) { - if (player instanceof ServerPlayer sp) { - AdvancementTriggers.RECURSIVE_ROOMS.trigger(sp); - } + return false; + }).orElse(false); - return; - } + if (recursion) return; + } - try { - final var entry = PreciseDimensionalPosition.fromPlayer(player); + try { + final var entry = PreciseDimensionalPosition.fromPlayer(player); - teleportPlayerIntoRoom(serv, player, room, grantAdvancement); + teleportPlayerIntoRoom(serv, player, room); - // Mark the player as inside the machine, set external spawn, and yeet - player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { - hist.addHistory(new PlayerRoomHistoryItem(entry, tile.getLevelPosition())); - }); - } catch (MissingDimensionException | NonexistentRoomException e) { - CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); - } + // Mark the player as inside the machine, set external spawn, and yeet + player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { + hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); }); + } catch (MissingDimensionException | NonexistentRoomException e) { + CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); } } - public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, ChunkPos room, boolean grantAdvancement) throws MissingDimensionException, NonexistentRoomException { - final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); - final var spawn = Rooms.getSpawn(serv, room); - final var roomSize = Rooms.sizeOf(serv, room); - - if (spawn == null) { - CompactMachines.LOGGER.error("Room %s could not load spawn info.".formatted(room)); - return; - } + public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room) + throws MissingDimensionException, NonexistentRoomException { + final var compactDim = CompactDimension.forServer(serv); + final var spawnLookup = CompactRoomProvider.instance(compactDim); serv.submitAsync(() -> { - Vec3 sp = spawn.getExactPosition(); - Vec3 sr = spawn.getRotation().orElse(new Vec3(player.xRotO, player.yRotO, 0)); if (player instanceof ServerPlayer servPlayer) { - servPlayer.changeDimension(compactDim, SimpleTeleporter.to(sp)); - - if (grantAdvancement) - AdvancementTriggers.getTriggerForMachineClaim(roomSize).trigger(servPlayer); + servPlayer.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(spawnLookup), room.spawnRotation(spawnLookup))); } }); } - public static void teleportPlayerOutOfMachine(ServerLevel world, @Nonnull ServerPlayer serverPlayer) { + public static void teleportPlayerOutOfMachine(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { - MinecraftServer serv = world.getServer(); + MinecraftServer serv = compactDim.getServer(); final LazyOptional history = serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY); @@ -117,14 +113,10 @@ public static void teleportPlayerOutOfMachine(ServerLevel world, @Nonnull Server final IRoomHistoryItem prevArea = hist.pop(); var spawnPoint = prevArea.getEntryLocation(); + final var enteredMachine = prevArea.getMachine().getBlockPosition(); final var level = spawnPoint.level(serv); - - Vec3 worldPos, entryRot; - worldPos = spawnPoint.getExactPosition(); - entryRot = spawnPoint.getRotation().orElse(Vec3.ZERO); - - serverPlayer.changeDimension(level, SimpleTeleporter.to(worldPos)); + serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); } else { howDidYouGetThere(serverPlayer); @@ -152,4 +144,8 @@ public static void teleportPlayerToRespawnOrOverworld(MinecraftServer serv, @Non player.changeDimension(level, SimpleTeleporter.to(worldPos)); } + + public static Vec2 getLookDirection(Player player) { + return new Vec2(player.xRotO, player.yRotO); + } } diff --git a/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java b/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java new file mode 100644 index 00000000..0d5d0852 --- /dev/null +++ b/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.util; + +import net.minecraft.SharedConstants; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.saveddata.SavedData; +import net.minecraft.world.level.storage.DimensionDataStorage; + +import java.io.IOException; +import java.util.function.Consumer; + +public class SavedDataHelper { + + public static void processFile(DimensionDataStorage storage, String dataName, Consumer parser) throws IOException { + CompoundTag compoundtag = storage.readTagFromDisk(dataName, SharedConstants.getCurrentVersion().getWorldVersion()); + parser.accept(compoundtag.getCompound("data")); + } + + public static void saveFile(DimensionDataStorage storage, String dataName, T instance) { + storage.set(dataName, instance); + storage.save(); + } +} diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/border.png b/src/main/resources/assets/compactmachines/textures/block/machine/border.png new file mode 100644 index 0000000000000000000000000000000000000000..aa3cda37e8f731237533ac633bd171b357b0816b GIT binary patch literal 140 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Zk{fVArY-_ zuWu9ts&Wo|Z0YuGevj>vRHo#QFIRlh3pw#E_TbHvAM_d0^+K15FZ}%GBgiNOaIjgP Z>A-B(%l7KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_L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#zG9h4sxW*0l-1YI=w@@?8V8Cy#f%6?5e8NM zE=KHc5H0w{YalTZK}C_%6*fKQ(fyufYb>ji!wn*Wo3Sp!*`()kGDDVgJQ`X$OyvLt zciw4@`B2%sy5P-kui@sF1oC9Y>iiQ{Uww(Ha20`jfPj%gM59E|DV%!n=GWi(>)Rjs zuRi!5-hKQTyRIM)KvO^wAu>7bdLok?M{>7=0^1kD_Ju%!-0g^Q#8f%$dPIZ-6cT_` zfk?ug|5GMpB%(rk9sp`$nSj8iR^HEm$pq$ea9DhI2*-i>31vFLBiQ)JqlbT3l0-O> z$)JVn&NzGgDf|GryFIkek6E67#HJ{N=)>m2b`t?2(PI2#9XU-_Prl&2&(CSYJpj^m zZ2OMuqa!Y@pg<{wF%pA>gt*=i`x~xib5w*~@7T!<5g5ji*7sbh61Q7?yTi<=4Gch3 zxc%v8a7PylF3X{1QH&H=j{_2*UBR!`>|ee@PnHOR2?7Woc1P&NA58k5(i!1Ft(6vy zw-L+=opk`T<0Z8=pvR;XZ%owP1yAnxjt-8h;*ki3Ahf33jg=%33TD$(h<^tFy^cC& TmKFl@00000NkvXXu0mjfOZ89* diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_large.png b/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_large.png deleted file mode 100644 index d80b50f0fff250e876d0c8fe606015e2bb8460f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3321 zcmVKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb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9M3zjXuWZ6C$1K2Oaox7EABUcvl_3NvSBysP?1E{rT-D) zG|l@?!8v!}#K7_V1SH3{Awo!nkPtyth@Q#q?XM`rVq8#brDvzLMxQ#8D77%u0f4Db zoX!mpRi=O59s*mofgKSLQRq1Vn!onTor?l&$o~caz!^DMI*O%r00000NkvXXu0mjf DGH@oD diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_maximum.png b/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_maximum.png deleted file mode 100644 index d4103bc0b587deb5af2287ad3101afd3e9448a14..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3295 zcmV<53?TD~P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$I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S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0006hNkltO42B=u-(*rI$@CDYY+1EZD^Nt~2C?r2I0a|v3EDmC0wk18 zufe9Q$qy5fnX$W=WCV-)Tl&*uzprgM{`jSiaP@Ez5h5T01TZs16mK05Cje7HRWKz~ z)l)>+`(h}n0)VO#5x6_yK|~;81P~FJDrSnB$!1Z$7Aw5C#A$_G@_{+RF$MVKtzyIV!d8-b92Mp-5ty25`eNSIX^$= z^74{A&);~I2*KTPcSMB6V!`e0Eq}iMe&a*@3Z~O3S(eeZEfGN=C?dEA0PfDq%S%_; zU~wfZt^^F`^EuDY&%Gxif&fZ4puW;q9`cK5?Yx2*yUQ7OePG6 zLqxiL2?7yF0k}us+IT$X?CcDF^2Wrk-@a0oWe?~eLK30d-Cg^6o^x?=!O6)9>-8El z#wScx~@qnF&qvV3*7$Vm6y`czD<(DJ8O$0noG! z+ilIfsv{}VK2;kH59ubdMio?z)*EF1%_k^lez diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_tiny.png b/src/main/resources/assets/compactmachines/textures/block/machine/e x/machine_tiny.png deleted file mode 100644 index ba22215b32bc451e87cdad7634f55f5ce80a857d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3399 zcmV-N4Y=}&P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYo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QIm1tu&J0IkNN%ChB6e)L^cVT z;l){8ZW+Ae*Rv(RoW0tblbjXy=j?@E7qG160E-7laGFY#pRas#g-CK zN+4-}*4qu)jDv9|<)EoE|3^;7;Utq&FlzD*C&+s#(3Zl*dPiL+%zy$%-`}tcq$D<1 z9m`eAuI)LP1_*KhUYto&F`peWKW_N=y%Xwh6T5bxM9@^3uO7a|y*FMV=SxicVj+=r zn?c)izSs~^c>nD=r}s}7NiF^T9~>Vx$P5c`;$OLdN3dM)SZ{lh2}1iOdN>ar ze2S7$S2a0jJe%9N~002ovPDHLkV1jd)OYQ&w diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png b/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..4ba359634eabd2c1a55a0321311c86ef6c46c526 GIT binary patch literal 451 zcmV;!0X+VRP)Px$eMv+?R9J=WS37P4ArO6_l@qyf6T4ioSII>pODS@S6h1|YNLDVAI=5KK?qWA? ztjGnVFj#(Om2&~3MnPvPvPf4Ot#lO_CD`99HAuaB3}V`2-x=k-T-{XZkQ4R zL*9oM^n2-oSPxvtXKOrlEj%poq1V15BAHV{5ORC&x?}+k4oi1DTj%XF`Z4?$kevg$ zF~3E?zVNyv0UMmp^-7=fuA2}z--b~ST1pNW5q(Iyic@nSMnuw6?h7FQaJLW;a5zRk zhLnIg5?-?e)Nntij)1G8p|A*QuL%%NLi2ka;#=;360jipMGF%fObD^%oF9qOY)~-9 tlv5j;TFt`X#VMdeAf=oVHfpXoegP{5N%W=95lr&pdm z7t>0A?_*||=BK0V+P?XlQH0F4?UxU2OmW literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/compactmachines/textures/item/room_core.png b/src/main/resources/assets/compactmachines/textures/item/room_core.png new file mode 100644 index 0000000000000000000000000000000000000000..237639cd66f217031ca8726d0029b9beb30b2d05 GIT binary patch literal 421 zcmV;W0b2fvP)Px$Ur9tkR9J=8SFviuFbsVO9`hR+x)wYXI(6vWy~}+^J#@PN$R~8ZAy6n3YUp~y z{YJ+OoeZj~*p}@OPH_0-;OITc(!1-k{^V08m!LG&{-XD**Vz z0y`S-FN@_X1Y8L10|4Yc_;ANYh--)F1VimhFjS$f{FynF4^W~ P00000NkvXXu0mjfd1<}O literal 0 HcmV?d00001 diff --git a/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java b/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java new file mode 100644 index 00000000..c5fdb3df --- /dev/null +++ b/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.test; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraftforge.event.RegisterGameTestsEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class GameTestEventHandler { + + @SubscribeEvent + public static void registerCrossmodGametests(final RegisterGameTestsEvent gametests) { + final var mods = ModList.get(); + + // if(mods.isLoaded("mekanism")) gametests.register(Mekanism.class); + } +} diff --git a/src/test/java/dev/compactmods/machines/test/TestBatches.java b/src/test/java/dev/compactmods/machines/test/TestBatches.java index db6923de..acb23aaa 100644 --- a/src/test/java/dev/compactmods/machines/test/TestBatches.java +++ b/src/test/java/dev/compactmods/machines/test/TestBatches.java @@ -12,4 +12,5 @@ public final class TestBatches { public static final String MATH = "math"; public static final String MACHINE_DATA = "machine_data"; public static final String DIMENSION = "dimension"; + public static final String MIGRATION = "migration"; } diff --git a/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java b/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java new file mode 100644 index 00000000..80c8345d --- /dev/null +++ b/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.test.crossmod; + +import dev.compactmods.machines.CompactMachines; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +@PrefixGameTestTemplate(false) +public class Mekanism { + + public static final String MEKANISM_BATCH = "mekanism"; + + @GameTest(templateNamespace = "compactmachines", template = "empty_1x1", batch = MEKANISM_BATCH) + public static void testMekanism(final GameTestHelper test) { + CompactMachines.LOGGER.debug("Testing mekanism interactions!"); + test.succeed(); + } +} diff --git a/src/test/java/dev/compactmods/machines/test/data/CodecTests.java b/src/test/java/dev/compactmods/machines/test/data/CodecTests.java index 098710a4..60b69e96 100644 --- a/src/test/java/dev/compactmods/machines/test/data/CodecTests.java +++ b/src/test/java/dev/compactmods/machines/test/data/CodecTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.data; import com.mojang.serialization.DataResult; -import dev.compactmods.machines.api.codec.CodecExtensions; +import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.test.TestBatches; diff --git a/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java b/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java new file mode 100644 index 00000000..f8fff669 --- /dev/null +++ b/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java @@ -0,0 +1,37 @@ +package dev.compactmods.machines.test.migrators; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; +import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.test.util.FileHelper; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class EarlyFileLoaderTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.MIGRATION) + public static void canGetDimensions(final GameTestHelper test) { + final var resRoot = FileHelper.resourcesDir(); + if(resRoot == null) { + test.fail("No resource path defined; cannot complete test."); + return; + } + + final var resLoc = resRoot.resolve("migrate").resolve("pre520"); + final var save = new LevelStorageSource.LevelDirectory(resLoc); + final var loader = new EarlyLevelDataFileReader(save); + + final var dims = loader.dimensions(); + if(dims.isEmpty()) { + test.fail("Did not read any dimension info from level files; this should be impossible."); + return; + } + + test.succeed(); + } +} diff --git a/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java b/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java new file mode 100644 index 00000000..e49fe83c --- /dev/null +++ b/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java @@ -0,0 +1,46 @@ +package dev.compactmods.machines.test.migrators; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; +import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.test.util.FileHelper; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.world.level.ChunkPos; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +import java.io.IOException; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class RoomInfoPre520MigratorTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.MIGRATION) + public static void canReadPre520RoomFiles(final GameTestHelper test) { + + try { + final var oldRoomData = FileHelper.getNbtFromSavedDataFile("migrate/pre520/room_data.dat"); + final var oldData = Pre520RoomDataMigrator.loadOldRoomData(oldRoomData); + + if(oldData.oldRoomData().isEmpty()) { + test.fail("No data loaded."); + return; + } + + if(oldData.oldRoomData().size() != 2) { + test.fail("Expected 2 entries from old data; got %s".formatted(oldData.oldRoomData().size())); + return; + } + + if(!oldData.roomChunkLookup().containsKey(new ChunkPos(0, -64))) { + test.fail("Expected chunk [0,-64] in chunk lookup, but it was not found."); + return; + } + + test.succeed(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/test/java/dev/compactmods/machines/test/util/FileHelper.java b/src/test/java/dev/compactmods/machines/test/util/FileHelper.java index ddcdec78..bde7f20c 100644 --- a/src/test/java/dev/compactmods/machines/test/util/FileHelper.java +++ b/src/test/java/dev/compactmods/machines/test/util/FileHelper.java @@ -1,23 +1,29 @@ package dev.compactmods.machines.test.util; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; +import org.jetbrains.annotations.Nullable; + import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.nio.file.Path; -import java.nio.file.Paths; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtIo; public final class FileHelper { public static final FileHelper INSTANCE = new FileHelper(); - public static Path RESOURCES_DIR = Paths.get("src","test","resources"); private FileHelper() { } + @Nullable + public static Path resourcesDir() { + final var rd = System.getenv("CM5_TEST_RESOURCES"); + return rd == null ? null : Path.of(rd); + } + public InputStream getFileStream(String filename) { return getClass().getClassLoader().getResourceAsStream(filename); } @@ -44,4 +50,10 @@ public static CompoundTag getNbtFromFile(String filename) throws IOException { InputStream isr = INSTANCE.getFileStream(filename); return NbtIo.readCompressed(isr); } + + public static CompoundTag getNbtFromSavedDataFile(String filename) throws IOException { + InputStream isr = INSTANCE.getFileStream(filename); + final var nbtRoot = NbtIo.readCompressed(isr); + return nbtRoot.getCompound("data"); + } } diff --git a/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java index acb42ddd..ec58a3db 100644 --- a/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java +++ b/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java @@ -10,6 +10,7 @@ import net.minecraft.gametest.framework.GameTestHelper; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.Vec3; import net.minecraftforge.gametest.GameTestHolder; import net.minecraftforge.gametest.PrefixGameTestTemplate; @@ -20,12 +21,12 @@ public class RoomGenerationTests { @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) public static void checkRoomGeneratorColossal(final GameTestHelper test) { final var roomDims = new Vec3i(13, 13, 13); - final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); test.setBlock(new BlockPos(7, 8, 7), Blocks.GOLD_BLOCK.defaultBlockState()); - CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + CompactStructureGenerator.fillWithTemplate(test.getLevel(), new ResourceLocation(Constants.MOD_ID, "template_max"), roomDims, roomCenter); @@ -35,12 +36,12 @@ public static void checkRoomGeneratorColossal(final GameTestHelper test) { @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) public static void checkRoomGeneratorNormal(final GameTestHelper test) { final var roomDims = new Vec3i(9, 9, 9); - final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); test.setBlock(new BlockPos(7, 5, 7), Blocks.GOLD_BLOCK.defaultBlockState()); - CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + CompactStructureGenerator.fillWithTemplate(test.getLevel(), RoomTemplate.NO_TEMPLATE, roomDims, roomCenter); @@ -50,12 +51,12 @@ public static void checkRoomGeneratorNormal(final GameTestHelper test) { @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) public static void checkRoomGeneratorSmall(final GameTestHelper test) { final var roomDims = new Vec3i(5, 5, 5); - final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); test.setBlock(new BlockPos(7, 4, 7), Blocks.GOLD_BLOCK.defaultBlockState()); - CompactStructureGenerator.fillRoomTemplate(test.getLevel(), + CompactStructureGenerator.fillWithTemplate(test.getLevel(), RoomTemplate.NO_TEMPLATE, roomDims, roomCenter); @@ -65,9 +66,9 @@ public static void checkRoomGeneratorSmall(final GameTestHelper test) { @GameTest(template = "empty_15x15", batch = TestBatches.ROOM_GENERATION) public static void checkRoomGeneratorWeirdShape(final GameTestHelper test) { final var roomDims = new Vec3i(11, 2, 7); - final var roomCenter = test.absolutePos(new BlockPos(7, 1, 7)); + final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateCompactStructure(test.getLevel(), roomDims, roomCenter); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); // test.setBlock(new BlockPos(7, 3, 7), Blocks.GOLD_BLOCK.defaultBlockState()); diff --git a/src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt b/src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt new file mode 100644 index 0000000000000000000000000000000000000000..10ba26a42a21fe82c34168c801bc5c1c927cbe84 GIT binary patch literal 125 zcmV-@0D}J?iwFR8YZYPu|2>Pb4uU`sM28$Aobde@ct`Av1BE fHE}5N_FlBC%H=LDPZrahfOx|fcW-0DmH+?%fXz6K literal 0 HcmV?d00001 diff --git a/src/test/resources/migrate/pre520/connections.dat b/src/test/resources/migrate/pre520/connections.dat new file mode 100644 index 0000000000000000000000000000000000000000..81a30fe7c652c2eb636f5ece52d13d810fda9b3b GIT binary patch literal 106 zcmb2|=3oGW|BsUr9wa4rdg^#SNlNh5_tH7>AmxGIx$~#Jef3VBIj{XJDIp=@QCh-z zU!QX)&UmwaY?$%z|NsB&0is6Cu962YNvx7BSe?d}oF~5EZ{kYVqYj#EZ0~;ZFzhNS JiJAtq0sx_YE-3&2 literal 0 HcmV?d00001 diff --git a/src/test/resources/migrate/pre520/level.dat b/src/test/resources/migrate/pre520/level.dat new file mode 100644 index 0000000000000000000000000000000000000000..f0a8d3f64544619f766ef6445bc450afaf85afcd GIT binary patch literal 57825 zcmV)XK&`(YiwFP!00000|J;3byd=dD|LS{p2OJ!59PTa;?yx{S#DydzA)aM+ci!&Y zo84JvcHg^q5#sKiKnPLd?k>bVA?{Ax-F_`I-Bs0HvvZ%{@2_9-3E^(P)l*$v*44JD zR@+o-E|21kwas@ z>@^*R$vB*(NjI!fM$VESFwiZda3vT=*(m7uqp3j9_V-qt?>b}q(%FD)<2dStlVOt1 zYk&Wu{XsYm(_osU^aC3&SUO+!_=0l{QFCV)Iqgc!jSS?VY&HqgQIJlfo#XS)+0hfM z#8KBvWgFf&O@nOM3!Gk3wl@@P6WroCqP?XZ7T8`+(g78M9+R_{&I2R9VL4u38-`&_ zu_X z^z6bcnT`9Ma5WrHH`W$|I0`bMO!7Z_)fT&P(pw4p@=qIU&8RO(Ywc~#TK&>mt@YOp zwfdcE`|B@V*o}kTVP`ZO_l7kMXg3vLuN=@z23hgTLF$*y=9lqul#YrYx2PWvvp5Z94kDb; z!hX@*Kaf>tyKk{7{pETq32iD+mX{@zHx2s934Z0M+vQndXq+~1ybh@I6So*5=v z$l8P3+JYN288cc>R@NgDUFVIaNcBo2C}of?wcS{h1T(r}cl8b}@aO9b)iXxrPQ z9AM)sex!$@$Qmvj%%Y`!G>E1`le=MPT*f!`rwuNehNC6nGDhKam?mpsx}=82wEGS1 zVoLB)--NK%4;1Q~DC|eGBAmCrSJGk@ zCu;@ny9#$2!KJ~fke0M`A+k}@pT*kjX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0P zZEdU?$r3PYcIo2SZF%p{Z62 zd6BBcNKiG&*r@E(?F}v+OxPVY0dRH~iD5PSBlqothjX(LgcLIfOg|D7)FP;X!lEKKTM0 au`fB+>>w;G%0f=^pyOZQ_q^|dKLh~XF(KOk literal 0 HcmV?d00001 diff --git a/src/test/resources/migrate/pre520/level.dat_old b/src/test/resources/migrate/pre520/level.dat_old new file mode 100644 index 0000000000000000000000000000000000000000..ae8f90ab858d99dc8b06d92b0165475520df8d5e GIT binary patch literal 57825 zcmV)XK&`(YiwFP!00000|J;3byd=dD|LS{p2OJ!59PTa;?yx{S#DydzA)aM+ci!&Y zo84JvcHg^q5#sKiKnPLd?k>bVA?{Ax-F_`I-Bs0HvvZ%{@2_9-3E^(P)l*$v*44JD zR@+o-E|21kwas@ z>@^*R$vB*(NjI!fM$VESFwiZda3vT=*(m7uqp3j9_V-qt?>b}q(%FD)<2dStlVOt1 zYk&Wu{XsYm(_osU^aC3&SUO+!_=0l{QFCV)Iqgc!jSS?VY&HqgQIJlfo#XS)+0hfM z#8KBvWgFf&O@nOM3!Gk3wl@@P6WroCqP?XZ7T8`+(g78M9+R_{&I2R9VL4u38-`&_ zu_X z^z6bcnT`9Ma5WrHH`W$|I0`bMO!7Z_)fT&P(pw4p@=qIU&8RO(Ywc~#TK&>mt@YOp zwfdcE`|B@V*o}kTVP`ZO_l7kMXg3vLuN=@z23hgTLF$*y=9lqul#YrYx2PWvvp5Z94kDb; z!hX@*Kaf>tyKk{7{pETq32iD+mX{@zHx2s934Z0M+vQndXq+~1ybh@I6So*5=v z$l8P3+JYN288cc>R@NgDUFVIaNcBo2C}of?wcS{h1T(r}cl8b}@aO9b)iXxrPQ z9AM)sex!$@$Qmvj%%Y`!G>E1`le=MPT*f!`rwuNehNC6nGDhKam?mpsx}=82wEGS1 zVoLB)--NK%4;1Q~DC|eGBAmCrSJGk@ zCu;@ny9#$2!KJ~fke0M`A+k}@pT*kjXJcbxt?y{(hbf2a{WK6J+bdAt)*%|Bc7{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ek*t!3xgR+}`*nXv9+qs70kHMRxP7EC9 zd0ZVCG}ch+y}-`%Hh~=<%pdJ<8_wQdXsz!C=o|K*Z-9PsI%NOX-gxcU5NYovy&=1^ zQ{qh-795kGV3*W4&P&o!U-@R2tj%OfhE?9Ozuc0Snzo0gSs4x>HN?KiFW9gF4ouby zO@E>3{|`-{hQ2BdZ|m@@N!viJH)PnRJ=kX{?Q8R~c?=ka#wnWK<)($jrACCoIiE`G zfxE9XtB4;@fBWLkILsG;6msHFFSO>L3^!;;aj=6(qL1R*#9UAPsc8o);Eiqg(M2CK zgJ{OJH%(85?rEe)l5@MPFp}fT$H+&?Je6`V8oWr%OG_G5&4q093aSBDP*RLaZP0)Y6lWr zrT5|BI-$6c!lMh<^1Ju$^D=p8!K`Jf>-3vc27l>_A2P!W_T)#mo*nvi;r&O<=%ejQ zZSk#Vt+bef@omxeyh^VKaGOU7JnjCT5$P+Y$qYli8N3LmA5Em=ZtSiN9AK!Pk4e6MR&ND z4k{e_p6RTG4OrABJ=3)y@AZBb(`tm*6ZMYk$yAtgc|RL6vdunT$IyY3>V%h!8mV`a ze&38)Mb}sV(g$lB(j@Ax`I1S-ROi3 zH4Rl*$ z#m0L6+pL(>&{V61 zyhzt#6sVeHY*dzYd!0)M6LtsJaC__y7)2Qu?Hg}!eL5?0?W$B9<6*x@^bK@H3)v<`>YZ3!*KL9D4U1f&`wnmyQX zvq3jY9jS*S(V`j?tZWWK9i`XrP$r973G|l-+39@Sr(npL~Ih a*q0o~>>w;GszOfkpyOW=7EQ5&KLh~q12-A~ literal 0 HcmV?d00001 diff --git a/src/test/resources/migrate/pre520/machines.dat b/src/test/resources/migrate/pre520/machines.dat new file mode 100644 index 0000000000000000000000000000000000000000..f07b56af4a97d9208fe67b0e92bc45b786ccbf7e GIT binary patch literal 150 zcmV;H0BQdpiwFP!00000|Knm{;9_7&Ni0d^WZ=xnPfje!%+D+4VqjokVrF2^O-#usS1JvLE!Uh9P=5_&kB`me57-$>=1NVFe0BD~8lHmXV E0J*X~F8}}l literal 0 HcmV?d00001 diff --git a/src/test/resources/migrate/pre520/room_data.dat b/src/test/resources/migrate/pre520/room_data.dat new file mode 100644 index 0000000000000000000000000000000000000000..afab082587bd5415f36af51019a04d5dd4f32053 GIT binary patch literal 179 zcmV;k08IZMiwFP!00000|D}+z4uUWkgf9xDz)LW=b^sB}#=tYU|CUBOSPX4K;!Efo z_$oY@2{t%58*jN>E|)L41V|8c za1`VhXO?8<=Yd3lcqtIO|NsB5hJ%5nq_QBDK|DD>w;(aOBsVcRBQr0x*b2(vVBk#2 z%uUTJ2I&>f1&SmWC8m{F<(H)vmFE}bq%d$ZFlD9yjbm{$_dfK`(4lQ_)UDkUm5gsQ zz-?y++77jt1Bf;M|Np}Wvset>;*!$5ywn_ov3nBkbS-1??OCxMfthdyaTkmBp+Y!5#vvyEWq#_C`PzlfL4U17J=iJfqOm! M0Ch>D2~q+801B&+egFUf literal 0 HcmV?d00001 diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java new file mode 100644 index 00000000..e4e5a463 --- /dev/null +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java @@ -0,0 +1,51 @@ +package dev.compactmods.machines.tunnel; + +import dev.compactmods.machines.api.CompactMachinesAddon; +import dev.compactmods.machines.api.ICompactMachinesAddon; +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.tunnel.definitions.FluidTunnel; +import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; +import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; +import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +import java.util.function.Supplier; + +@CompactMachinesAddon +public class BuiltinTunnels implements ICompactMachinesAddon { + public static Supplier roomOwnerLookup; + public static Supplier roomSpawnLookup; + + public static DeferredRegister DR = DeferredRegister.create(CMRegistries.TYPES_REG_KEY, Constants.MOD_ID); + + // ================================================================================================================ + // TUNNEL TYPE DEFINITIONS + // ================================================================================================================ + public static final RegistryObject ITEM_TUNNEL_DEF = DR.register("item", BufferedItemTunnel::new); + + public static final RegistryObject FLUID_TUNNEL_DEF = DR.register("fluid", FluidTunnel::new); + + public static final RegistryObject FORGE_ENERGY = DR.register("energy", ForgeEnergyTunnel::new); + + public static final RegistryObject REDSTONE_IN = DR.register("redstone_in", RedstoneInTunnelDefinition::new); + + @Override + public void afterRegistration(IEventBus bus) { + DR.register(bus); + } + + public void acceptRoomOwnerLookup(Supplier ownerLookup) { + roomOwnerLookup = ownerLookup; + } + + @Override + public void acceptRoomSpawnLookup(Supplier spawnLookup) { + roomSpawnLookup = spawnLookup; + } +} diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java similarity index 91% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java rename to src/tunnels/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java index 2ac0eee7..941755f6 100644 --- a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ItemTunnel.java +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java @@ -16,15 +16,16 @@ import net.minecraft.world.Containers; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; import javax.annotation.Nonnull; -public class ItemTunnel implements TunnelDefinition, CapabilityTunnel, TunnelTeardownHandler { +public class BufferedItemTunnel implements TunnelDefinition, CapabilityTunnel, + TunnelTeardownHandler { @Override public int ringColor() { @@ -40,7 +41,7 @@ public Instance newInstance(BlockPos pos, Direction side) { @Override public ImmutableSet> getSupportedCapabilities() { - return ImmutableSet.of(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); + return ImmutableSet.of(ForgeCapabilities.ITEM_HANDLER); } /** @@ -51,7 +52,7 @@ public ImmutableSet> getSupportedCapabilities() { */ @Override public LazyOptional getCapability(Capability capType, Instance instance) { - if (capType == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (capType == ForgeCapabilities.ITEM_HANDLER) { return instance.lazy(); } diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java index 0c17e47b..05cfb0e2 100644 --- a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java @@ -9,9 +9,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.util.FastColor; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.templates.FluidTank; @@ -25,12 +25,12 @@ public int ringColor() { @Override public ImmutableSet> getSupportedCapabilities() { - return ImmutableSet.of(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + return ImmutableSet.of(ForgeCapabilities.FLUID_HANDLER); } @Override public LazyOptional getCapability(Capability type, FluidTunnel.Instance instance) { - if(type == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + if(type == ForgeCapabilities.FLUID_HANDLER) return instance.lazy().cast(); return LazyOptional.empty(); diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java index 000c906a..ace1ef37 100644 --- a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java @@ -9,9 +9,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.util.FastColor; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.energy.IEnergyStorage; @@ -25,12 +25,12 @@ public int ringColor() { @Override public ImmutableSet> getSupportedCapabilities() { - return ImmutableSet.of(CapabilityEnergy.ENERGY); + return ImmutableSet.of(ForgeCapabilities.ENERGY); } @Override public LazyOptional getCapability(Capability type, Instance instance) { - if (type == CapabilityEnergy.ENERGY) { + if (type == ForgeCapabilities.ENERGY) { return instance.lazy().cast(); } diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java new file mode 100644 index 00000000..28d4d905 --- /dev/null +++ b/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java @@ -0,0 +1,40 @@ +package dev.compactmods.machines.tunnel.definitions; + +import com.google.common.collect.ImmutableSet; +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.api.tunnels.TunnelPosition; +import dev.compactmods.machines.api.tunnels.capability.CapabilityLookupTunnel; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.FastColor; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; +import net.minecraftforge.common.util.LazyOptional; + +// WIP do not register yet +public class SmartItemTunnel implements TunnelDefinition, CapabilityLookupTunnel { + @Override + public int ringColor() { + return FastColor.ARGB32.color(255, 205, 143, 36); + } + + @Override + public ImmutableSet> getSupportedCapabilities() { + return ImmutableSet.of(ForgeCapabilities.ITEM_HANDLER); + } + + public > LazyOptional findCapability( + MinecraftServer server, TunnelPosition tunnelPosition, + IDimensionalBlockPosition targetPosition) { + final var lev = targetPosition.level(server); + if(!lev.isLoaded(targetPosition.getBlockPosition())) { + return LazyOptional.empty(); + } + + return targetPosition.getBlockEntity(server) + .map(be -> be.getCapability(ForgeCapabilities.ITEM_HANDLER, tunnelPosition.machineSide().getOpposite())) + .orElse(LazyOptional.empty()) + .cast(); + } + +} From a5f0d03a85e038a4f6aa2a45978a61f401ab3ce8 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 12:01:54 -0400 Subject: [PATCH 14/85] Fix CI JVM args, MME not marking v5.2 resolved --- build.gradle | 8 +++++--- .../java/dev/compactmods/machines/ModDataUpgrader.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 4464ef9a..2b11d3e4 100644 --- a/build.gradle +++ b/build.gradle @@ -210,9 +210,11 @@ minecraft { environment("CM5_TEST_RESOURCES", file('src/test/resources')) - // JetBrains Runtime Hotswap - jvmArg '-XX:+AllowEnhancedClassRedefinition' - jvmArg '-XX:HotswapAgent=fatjar' + if(!System.getenv().containsKey("CI")) { + // JetBrains Runtime Hotswap + jvmArg '-XX:+AllowEnhancedClassRedefinition' + jvmArg '-XX:HotswapAgent=fatjar' + } mods { compactmachines { diff --git a/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/src/main/java/dev/compactmods/machines/ModDataUpgrader.java index c22ca9b9..5a67ecdf 100644 --- a/src/main/java/dev/compactmods/machines/ModDataUpgrader.java +++ b/src/main/java/dev/compactmods/machines/ModDataUpgrader.java @@ -60,6 +60,7 @@ public static void onUpgrade(final ModMismatchEvent mismatch) { // do upgrade try { ModDataUpgrader.doUpgrade(mismatch.getLevelDirectory()); + mismatch.markResolved(Constants.MOD_ID); } catch (IOException e) { CompactMachines.LOGGER.fatal("Exception occurred while trying to upgrade world data.", e); } From 01eccbbf5b863e74f41fb5864280b958e4cb3ac3 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 12:29:18 -0400 Subject: [PATCH 15/85] More CI/workflow stuff for nightly build changes --- .github/workflows/ci-tests-nightly.yml | 32 ++++++++++++++++++++++++-- .github/workflows/tagged-release.yml | 15 +++++++++--- build.gradle | 2 ++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 8a66b571..2230d934 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -18,6 +18,9 @@ jobs: runs-on: ubuntu-20.04 outputs: release_type: ${{steps.cf_release_type.outputs.value }} + version: ${{steps.version.outputs.version }} + build: ${{steps.build.outputs.buildver}} + steps: - name: Checkout uses: actions/checkout@v2.4.0 @@ -29,6 +32,18 @@ jobs: path: './gradle.properties' property: 'cf_release_type' + - name: Semver Version + id: version + run: | + version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) + echo "::set-output name=version::$version" + + - name: Build Version + id: build + run: | + buildver=$(git describe --tags --match v* | cut -d- -f2) + echo "build = $buildver" + echo "::set-output name=buildver::$buildver" tests: name: Gradle Tests runs-on: ubuntu-20.04 @@ -61,10 +76,17 @@ jobs: - name: Create datagen assets continue-on-error: true run: ./gradlew runData - + env: + CM_RELEASE: false + CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} + - name: Test JAR with GameTest Server run: ./gradlew runGameTestServer env: + CM_RELEASE: false + CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -106,10 +128,16 @@ jobs: - name: Generate Resources run: ./gradlew runData + env: + CM_RELEASE: false + CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - name: Publish gradle nightly jar - run: ./gradlew publishNightlyPublicationToGitHubPackagesRepository + run: ./gradlew publishReleasePublicationToGitHubPackagesRepository env: CM_RELEASE: false + CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 2a73612b..676fd76d 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -13,6 +13,7 @@ jobs: cf_project: ${{steps.cf_project.outputs.value }} mod_id: ${{steps.mod_id.outputs.value }} version: ${{steps.version.outputs.version }} + build: ${{steps.build.outputs.buildver}} steps: - name: Checkout @@ -57,6 +58,13 @@ jobs: version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) echo "::set-output name=version::$version" + - name: Build Version + id: build + run: | + buildver=$(git describe --tags --match v* | cut -d- -f2) + echo "build = $buildver" + echo "::set-output name=buildver::$buildver" + changelog: name: Generate Changelog (tags) runs-on: ubuntu-20.04 @@ -135,14 +143,15 @@ jobs: env: CM_RELEASE: true CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: "0" + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - name: Test JAR with GameTest Server run: ./gradlew runGameTestServer timeout-minutes: 20 env: + CM_RELEASE: true CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: "0" + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -159,7 +168,7 @@ jobs: env: CM_RELEASE: true CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: "0" + CM_BUILD_NUM: ${{ needs.vars.outputs.build }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 2b11d3e4..95829679 100644 --- a/build.gradle +++ b/build.gradle @@ -176,6 +176,8 @@ minecraft { // JetBrains Runtime Hotswap jvmArg '-XX:+AllowEnhancedClassRedefinition' jvmArg '-XX:HotswapAgent=fatjar' + } else { + forceExit false } mods { From f9471812d6cc0957192a0e70c73e14cb7cd35951 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 12:32:07 -0400 Subject: [PATCH 16/85] CI is fun --- .github/workflows/ci-tests-nightly.yml | 13 ++++++++----- .github/workflows/tagged-release.yml | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 2230d934..8a7d6c71 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -23,8 +23,11 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2.4.0 - + uses: actions/checkout@v3 + + - name: Unshallow + run: git fetch --prune --unshallow + - name: Release Type id: cf_release_type uses: christian-draeger/read-properties@1.0.1 @@ -50,7 +53,7 @@ jobs: needs: [ vars ] steps: - name: Checkout - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3 - name: Unshallow and Get Tags run: git fetch --prune --unshallow --tags @@ -80,7 +83,7 @@ jobs: CM_RELEASE: false CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - + - name: Test JAR with GameTest Server run: ./gradlew runGameTestServer env: @@ -103,7 +106,7 @@ jobs: needs: [ vars, tests ] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Unshallow and Get Tags run: git fetch --prune --unshallow --tags diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 676fd76d..64720af3 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Unshallow run: git fetch --prune --unshallow @@ -70,7 +70,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Unshallow run: git fetch --prune --unshallow @@ -126,7 +126,7 @@ jobs: path: changelog - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up JDK uses: actions/setup-java@v2 @@ -266,7 +266,7 @@ jobs: needs: [changelog, vars, jar] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up JDK uses: actions/setup-java@v2 From 346a17382e899e9fec72a5071a5dd6ca4c906446 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 12:36:14 -0400 Subject: [PATCH 17/85] [ci] Another one, missed tag fetch --- .github/workflows/ci-tests-nightly.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 8a7d6c71..78b0aee6 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -28,6 +28,15 @@ jobs: - name: Unshallow run: git fetch --prune --unshallow + - name: Find Current Tag + id: current + uses: jimschubert/query-tag-action@v1 + with: + include: 'v*' + exclude: '*-rc*' + commit-ish: '@' + skip-unshallow: 'true' + - name: Release Type id: cf_release_type uses: christian-draeger/read-properties@1.0.1 From 7996f954fd5e95319b11693bdc843cba1e2596ba Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 12:50:14 -0400 Subject: [PATCH 18/85] Make absurd room template for testing, remove WIP craft to update text --- .github/workflows/ci-tests-nightly.yml | 2 +- .../machines/datagen/RecipeGenerator.java | 16 +++++++++++++--- .../datagen/lang/EnglishLangGenerator.java | 1 + .../machines/datagen/room/RoomTemplates.java | 2 +- .../machine/item/LegacyCompactMachineItem.java | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 78b0aee6..2007cd99 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -36,7 +36,7 @@ jobs: exclude: '*-rc*' commit-ish: '@' skip-unshallow: 'true' - + - name: Release Type id: cf_release_type uses: christian-draeger/read-properties@1.0.1 diff --git a/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 6844b499..8128063b 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -3,6 +3,7 @@ import com.google.gson.JsonObject; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.machine.ShapedWithNbtRecipeBuilder; +import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.machine.Machines; @@ -16,6 +17,7 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.util.FastColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -83,10 +85,18 @@ private void addMachineRecipes(Consumer consumer) { registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_NORMAL, Tags.Items.STORAGE_BLOCKS_GOLD); registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_LARGE, Tags.Items.STORAGE_BLOCKS_DIAMOND); registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_GIANT, Tags.Items.OBSIDIAN); - registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_COLOSSAL, Tags.Items.STORAGE_BLOCKS_NETHERITE); + registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_COLOSSAL, Tags.Items.INGOTS_NETHERITE); + + registerMachineRecipe(consumer, new ResourceLocation(Constants.MOD_ID, "absurd"), + new RoomTemplate(25, FastColor.ARGB32.color(255, 0, 166, 88)), + Tags.Items.NETHER_STARS); } protected void registerMachineRecipe(Consumer consumer, LegacySizedTemplates template, TagKey center) { + registerMachineRecipe(consumer, template.id(), template.template(), center); + } + + protected void registerMachineRecipe(Consumer consumer, ResourceLocation temId, RoomTemplate tem, TagKey center) { Item wall = Walls.ITEM_BREAKABLE_WALL.get(); ShapedWithNbtRecipeBuilder recipe = ShapedWithNbtRecipeBuilder.shaped(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get()) .pattern("WWW"); @@ -103,13 +113,13 @@ protected void registerMachineRecipe(Consumer consumer, LegacySi recipe.unlockedBy("has_recipe", RecipeProvider.has(wall)); recipe.addWriter(r -> { final var nbt = new JsonObject(); - MachineDataTagBuilder.forTemplate(template.id(), template.template()) + MachineDataTagBuilder.forTemplate(temId, tem) .writeToItemJson(nbt) .writeToBlockDataJson(nbt); r.add("nbt", nbt); }); - final var recipeId = new ResourceLocation(Constants.MOD_ID, "new_machine_" + template.id().getPath()); + final var recipeId = new ResourceLocation(Constants.MOD_ID, "new_machine_" + temId.getPath()); recipe.save(consumer, recipeId); } } diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 471b8e5c..68a3ee57 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -32,6 +32,7 @@ protected void addTranslations() { add("machine.compactmachines.large", "%s (%s)".formatted(machineTranslation, "Large")); add("machine.compactmachines.giant", "%s (%s)".formatted(machineTranslation, "Giant")); add("machine.compactmachines.colossal", "%s (%s)".formatted(machineTranslation, "Colossal")); + add("machine.compactmachines.absurd", "%s (%s)".formatted(machineTranslation, "Absurd")); addMessage(Messages.CANNOT_ENTER_MACHINE, "You fumble with the shrinking device, to no avail. It refuses to work."); addMessage(Messages.NO_MACHINE_DATA, "No machine data loaded; report this."); diff --git a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java index 61b41069..aaf039d8 100644 --- a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java +++ b/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java @@ -27,7 +27,7 @@ public static void make(GatherDataEvent event) { templates.put(new ResourceLocation(Constants.MOD_ID, "giant"), LegacySizedTemplates.EMPTY_GIANT.template()); templates.put(new ResourceLocation(Constants.MOD_ID, "colossal"), LegacySizedTemplates.EMPTY_COLOSSAL.template()); - templates.put(new ResourceLocation(Constants.MOD_ID, "weird"), new RoomTemplate(new Vec3i(42, 69, 12), + templates.put(new ResourceLocation(Constants.MOD_ID, "absurd"), new RoomTemplate(new Vec3i(25, 25, 25), FastColor.ARGB32.color(255, 0, 166, 88), RoomTemplate.NO_TEMPLATE)); diff --git a/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java index e200d685..71b13690 100644 --- a/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -37,7 +37,7 @@ public static Item getItemBySize(RoomSize size) { @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - tooltip.add(TranslationUtil.tooltip(Tooltips.CRAFT_TO_UPGRADE).withStyle(ChatFormatting.YELLOW)); + // tooltip.add(TranslationUtil.tooltip(Tooltips.CRAFT_TO_UPGRADE).withStyle(ChatFormatting.YELLOW)); boolean sneaking = Screen.hasShiftDown(); From 6e308dc292559187504eb7392191ba2024de2693 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 13:45:43 -0400 Subject: [PATCH 19/85] Break more things, because JarJar is the real dark lord --- build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 95829679..04b138ee 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle' def semver = System.getenv("CM_SEMVER_VERSION") def buildNumber = System.getenv("CM_BUILD_NUM") -def nightlyVersion = "nightly-${semver}.${buildNumber}" +def nightlyVersion = "${semver}+nightly-b${buildNumber}" def isRelease = (System.getenv("CM_RELEASE") ?: "false").equalsIgnoreCase("true") task getBuildInfo() { @@ -353,8 +353,9 @@ tasks.withType(Jar) { destinationDirectory = file("$rootDir/build-out") } -tasks.jarJar.configure { +tasks.jarJar { classifier '' + destinationDirectory = file("$rootDir/build-out") } jar { @@ -396,7 +397,8 @@ publishing { artifacts { artifact jar - artifact(apiJar) + artifact apiJar + artifact tasks.jarJar } } } From 49feedac1e706165f0dca405d61f9aec02b6ab65 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 10 Oct 2022 14:00:56 -0400 Subject: [PATCH 20/85] Here we GOOOOO --- .github/workflows/tagged-release.yml | 8 ++++---- build.gradle | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 64720af3..41722bc2 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -177,8 +177,8 @@ jobs: with: name: libs path: | - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar + build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar + build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar view: name: View Changelog Output @@ -221,8 +221,8 @@ jobs: prerelease: false files: | changelog/CHANGELOG.md - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar + build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar + build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar release-cf: name: Make Curseforge Release diff --git a/build.gradle b/build.gradle index 04b138ee..f47f5899 100644 --- a/build.gradle +++ b/build.gradle @@ -349,13 +349,11 @@ reobf { jarJar { } } -tasks.withType(Jar) { - destinationDirectory = file("$rootDir/build-out") -} - tasks.jarJar { classifier '' - destinationDirectory = file("$rootDir/build-out") + from sourceSets.tunnels.output + from sourceSets.main.output + from sourceSets.api.output } jar { From 18ccc98aa76a68f28fe9bfbfc90800942cff2996 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 11 Oct 2022 16:24:56 -0400 Subject: [PATCH 21/85] Kotlin multiproject go brrrrr --- .gitignore | 2 +- assets/machine.aseprite | Bin 0 -> 1899 bytes .../personal_shrinking_device.aseprite | Bin .../personal_shrinking_device.png | Bin build.gradle | 415 ------------------ build.gradle.kts | 119 +++++ forge-api/build.gradle.kts | 22 + .../machines/api/CompactMachinesAddon.java | 0 .../machines/api/ICompactMachinesAddon.java | 0 .../api/ItemWithNbtRecipeBuilder.java | 0 .../machines/api/core/Advancements.java | 0 .../machines/api/core/CMCommands.java | 0 .../machines/api/core/CMRegistries.java | 0 .../compactmods/machines/api/core/CMTags.java | 0 .../machines/api/core/Constants.java | 0 .../machines/api/core/JeiInfo.java | 0 .../machines/api/core/Messages.java | 0 .../machines/api/core/Tooltips.java | 0 .../api/dimension/CompactDimension.java | 0 .../dimension/MissingDimensionException.java | 0 .../location/IDimensionalBlockPosition.java | 0 .../api/location/IDimensionalPosition.java | 0 .../machines/api/machine/MachineNbt.java | 0 .../machines/api/machine/MachineTags.java | 0 .../machine/ShapedWithNbtRecipeBuilder.java | 0 .../recipe/ShapelessRecipeWithNbtResult.java | 0 .../machines/api/room/IRoomHistory.java | 0 .../machines/api/room/IRoomLookup.java | 0 .../machines/api/room/IRoomOwnerLookup.java | 0 .../machines/api/room/RoomSize.java | 0 .../machines/api/room/RoomTemplate.java | 0 .../compactmods/machines/api/room/Rooms.java | 0 .../api/room/history/IRoomHistoryItem.java | 0 .../api/room/registration/IBasicRoomInfo.java | 0 .../IMutableRoomRegistration.java | 0 .../room/registration/IRoomRegistration.java | 0 .../room/registration/IRoomSpawnLookup.java | 0 .../upgrade/ILevelLoadedUpgradeListener.java | 0 .../api/room/upgrade/RoomUpgrade.java | 0 .../api/room/upgrade/RoomUpgradeInstance.java | 0 .../machines/api/shrinking/PSDTags.java | 0 .../api/tunnels/TunnelDefinition.java | 0 .../machines/api/tunnels/TunnelPosition.java | 0 .../capability/CapabilityLookupTunnel.java | 0 .../tunnels/capability/CapabilityTunnel.java | 0 .../connection/RoomTunnelConnections.java | 0 .../tunnels/lifecycle/InstancedTunnel.java | 0 .../api/tunnels/lifecycle/TunnelInstance.java | 0 .../lifecycle/TunnelTeardownHandler.java | 0 .../tunnels/recipe/TunnelRecipeBuilder.java | 0 .../tunnels/recipe/TunnelRecipeHelper.java | 0 .../redstone/RedstoneReaderTunnel.java | 0 .../api/tunnels/redstone/RedstoneTunnel.java | 0 .../redstone/RedstoneWriterTunnel.java | 0 .../api/upgrade/RoomUpgradeHelper.java | 0 forge-main/build.gradle.kts | 244 ++++++++++ forge-main/gradle.properties | 5 + .../datagen/AdvancementGenerator.java | 0 .../datagen/AdvancementLangBuilder.java | 0 .../machines/datagen/BlockLootGenerator.java | 0 .../machines/datagen/DataGenUtil.java | 0 .../machines/datagen/DataGeneration.java | 0 .../datagen/DimensionTypeBuilder.java | 0 .../machines/datagen/ItemModelGenerator.java | 0 .../machines/datagen/LevelBiomeGenerator.java | 0 .../machines/datagen/RecipeGenerator.java | 0 .../machines/datagen/StateGenerator.java | 0 .../datagen/TunnelWallStateGenerator.java | 0 .../datagen/lang/BaseLangGenerator.java | 0 .../datagen/lang/EnglishLangGenerator.java | 0 .../datagen/lang/RussianLangGenerator.java | 0 .../machines/datagen/room/RoomTemplates.java | 0 .../datagen/tags/BlockTagGenerator.java | 0 .../datagen/tags/ItemTagGenerator.java | 0 .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 5 + .../07c329cab0b84ebb758f69c1df0c195805d0452c | 4 + .../12ec2377279d0d674d2996377e6aadd07db02702 | 8 + .../41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 | 14 + .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 9 + .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 5 + .../7614da1b3e3c7e6a5801139b6d50d862727ab0e1 | 12 + .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 25 ++ .../ad1d2f850013c48c78ac9faccdcfe00a5a273d1f | 18 + .../c622617f6fabf890a00b9275cd5f643584a8a2c8 | 2 + .../cc4a2989348227984ebea88deca578b68e58344e | 2 + .../compactmachines/blockstates/machine.json | 7 + .../blockstates/machine_giant.json | 7 + .../blockstates/machine_large.json | 7 + .../blockstates/machine_maximum.json | 7 + .../blockstates/machine_normal.json | 7 + .../blockstates/machine_small.json | 7 + .../blockstates/machine_tiny.json | 7 + .../blockstates/solid_wall.json | 7 + .../blockstates/tunnel_wall.json | 22 + .../compactmachines/blockstates/wall.json | 7 + .../assets/compactmachines/lang/en_us.json | 105 +++++ .../assets/compactmachines/lang/ru_ru.json | 36 ++ .../models/block/machine/machine.json | 143 ++++++ .../models/block/machine/machine_giant.json | 6 + .../models/block/machine/machine_large.json | 6 + .../models/block/machine/machine_maximum.json | 6 + .../models/block/machine/machine_normal.json | 6 + .../models/block/machine/machine_small.json | 6 + .../models/block/machine/machine_tiny.json | 6 + .../compactmachines/models/block/wall.json | 6 + .../models/item/chunkloader_upgrade.json | 6 + .../compactmachines/models/item/machine.json | 3 + .../models/item/machine_giant.json | 3 + .../models/item/machine_large.json | 3 + .../models/item/machine_maximum.json | 3 + .../models/item/machine_normal.json | 3 + .../models/item/machine_small.json | 3 + .../models/item/machine_tiny.json | 3 + .../models/item/new_machine.json | 3 + .../item/personal_shrinking_device.json | 6 + .../models/item/solid_wall.json | 3 + .../compactmachines/models/item/tunnel.json | 6 + .../compactmachines/models/item/wall.json | 3 + .../compactmachines/models/tunnels/base.json | 135 ++++++ .../compactmachines/models/tunnels/down.json | 7 + .../compactmachines/models/tunnels/east.json | 7 + .../compactmachines/models/tunnels/north.json | 7 + .../compactmachines/models/tunnels/south.json | 7 + .../compactmachines/models/tunnels/up.json | 7 + .../compactmachines/models/tunnels/west.json | 7 + .../advancements/claimed_machine_giant.json | 29 ++ .../advancements/claimed_machine_large.json | 29 ++ .../advancements/claimed_machine_max.json | 29 ++ .../advancements/claimed_machine_normal.json | 29 ++ .../advancements/claimed_machine_small.json | 29 ++ .../advancements/claimed_machine_tiny.json | 29 ++ .../advancements/foundations.json | 37 ++ .../advancements/got_shrinking_device.json | 37 ++ .../advancements/how_did_you_get_here.json | 29 ++ .../compactmachines/new_machine_absurd.json | 20 + .../compactmachines/new_machine_colossal.json | 20 + .../compactmachines/new_machine_giant.json | 20 + .../compactmachines/new_machine_large.json | 20 + .../compactmachines/new_machine_normal.json | 20 + .../compactmachines/new_machine_small.json | 20 + .../compactmachines/new_machine_tiny.json | 20 + .../personal_shrinking_device.json | 34 ++ .../recipes/compactmachines/wall.json | 32 ++ .../advancements/recipes/energy.json | 34 ++ .../advancements/recipes/fluid.json | 34 ++ .../advancements/recipes/item.json | 34 ++ .../advancements/recursion.json | 29 ++ .../compactmachines/advancements/root.json | 28 ++ .../room_templates/absurd.json | 4 + .../room_templates/colossal.json | 8 + .../compactmachines/room_templates/giant.json | 8 + .../compactmachines/room_templates/large.json | 8 + .../room_templates/normal.json | 8 + .../compactmachines/room_templates/small.json | 8 + .../compactmachines/room_templates/tiny.json | 8 + .../dimension/compact_world.json | 17 + .../dimension_type/compact_world.json | 26 ++ .../loot_tables/blocks/machine.json | 26 ++ .../loot_tables/blocks/machine_giant.json | 26 ++ .../loot_tables/blocks/machine_large.json | 26 ++ .../loot_tables/blocks/machine_maximum.json | 26 ++ .../loot_tables/blocks/machine_normal.json | 26 ++ .../loot_tables/blocks/machine_small.json | 26 ++ .../loot_tables/blocks/machine_tiny.json | 26 ++ .../loot_tables/blocks/wall.json | 21 + .../recipes/new_machine_absurd.json | 28 ++ .../recipes/new_machine_colossal.json | 28 ++ .../recipes/new_machine_giant.json | 28 ++ .../recipes/new_machine_large.json | 28 ++ .../recipes/new_machine_normal.json | 28 ++ .../recipes/new_machine_small.json | 28 ++ .../recipes/new_machine_tiny.json | 28 ++ .../recipes/personal_shrinking_device.json | 25 ++ .../recipes/tunnels/energy.json | 26 ++ .../recipes/tunnels/fluid.json | 26 ++ .../compactmachines/recipes/tunnels/item.json | 26 ++ .../data/compactmachines/recipes/wall.json | 17 + .../tags/blocks/legacy_machines.json | 10 + .../compactmachines/tags/blocks/machine.json | 11 + .../compactmachines/tags/items/machine.json | 12 + .../tags/items/room_upgrade.json | 5 + .../tags/items/shrinking_device.json | 5 + .../worldgen/biome/machine.json | 124 ++++++ .../resources/data/curios/tags/items/psd.json | 5 + .../tags/blocks/mineable/pickaxe.json | 12 + .../tags/blocks/needs_iron_tool.json | 12 + .../compactmods/machines/CompactMachines.java | 0 .../compactmods/machines/ModDataUpgrader.java | 0 .../advancement/AdvancementTriggers.java | 0 .../GenericAdvancementTriggerListener.java | 0 ...GenericAdvancementTriggerListenerList.java | 0 .../trigger/BaseAdvancementTrigger.java | 0 .../trigger/BasicPlayerAdvTrigger.java | 0 .../trigger/HowDidYouGetHereTrigger.java | 0 .../machines/client/ClientEventHandler.java | 0 .../machines/client/PlayerFaceRenderer.java | 0 .../machines/client/Resources.java | 0 .../machines/client/gui/GuiIds.java | 0 .../gui/PersonalShrinkingDeviceScreen.java | 0 .../machines/client/gui/guide/GuidePage.java | 0 .../client/gui/guide/GuideSection.java | 0 .../gui/widget/AbstractCMGuiWidget.java | 0 .../client/gui/widget/PSDIconButton.java | 0 .../widget/ScrollableWrappedTextWidget.java | 0 .../client/level/EmptyLevelEntityGetter.java | 0 .../machines/client/level/FakeSpawnInfo.java | 0 .../machines/client/level/RenderingLevel.java | 0 .../machines/client/level/TemplateChunk.java | 0 .../client/level/TemplateChunkProvider.java | 0 .../machines/client/render/RenderTypes.java | 0 .../client/render/SuperRenderTypeBuffer.java | 0 .../machines/client/shader/CM4Shaders.java | 0 .../util/TransformingVertexBuilder.java | 0 .../machines/codec/CodecExtensions.java | 0 .../codec/DoubleStreamExtensions.java | 0 .../machines/codec/NbtListCollector.java | 0 .../machines/command/Commands.java | 0 .../command/data/CMDataSubcommand.java | 0 .../data/CMMachineDataExportCommand.java | 0 .../command/data/CMRoomDataExportCommand.java | 0 .../data/CMTunnelDataExportCommand.java | 0 .../command/subcommand/CMEjectSubcommand.java | 0 .../subcommand/CMGiveMachineSubcommand.java | 0 .../CMReaddDimensionSubcommand.java | 0 .../subcommand/CMRebindSubcommand.java | 0 .../command/subcommand/CMRoomsSubcommand.java | 0 .../subcommand/CMSummarySubcommand.java | 0 .../subcommand/CMUnbindSubcommand.java | 0 .../command/subcommand/SpawnSubcommand.java | 0 .../machines/compat/InterModCompat.java | 0 .../compat/carryon/CarryOnCompat.java | 0 .../machines/compat/curios/CuriosCompat.java | 0 .../compat/jei/CompactMachinesJeiPlugin.java | 0 .../compat/theoneprobe/TheOneProbeCompat.java | 0 .../compat/theoneprobe/TheOneProbeMain.java | 0 .../elements/MachineTunnelElement.java | 0 .../elements/PlayerFaceElement.java | 0 .../overrides/CompactMachineNameOverride.java | 0 .../providers/CompactMachineProvider.java | 0 .../theoneprobe/providers/TunnelProvider.java | 0 .../machines/config/CommonConfig.java | 0 .../EnableVanillaRecipesConfigCondition.java | 0 .../machines/config/ServerConfig.java | 0 .../machines/core/CommonEventHandler.java | 0 .../machines/core/CompactMachinesNet.java | 0 .../machines/core/ModBusEvents.java | 0 .../compactmods/machines/core/Registries.java | 0 .../machines/core/ServerEventHandler.java | 0 .../machines/core/UIRegistration.java | 0 .../migration/EarlyLevelDataFileReader.java | 0 .../migration/Pre520RoomDataMigrator.java | 0 .../machines/dimension/Dimension.java | 0 .../machines/dimension/VoidAirBlock.java | 0 .../machines/graph/DimensionGraphNode.java | 0 .../dev/compactmods/machines/graph/Graph.java | 0 .../machines/graph/GraphEdgeType.java | 0 .../machines/graph/IGraphEdge.java | 0 .../machines/graph/IGraphEdgeType.java | 0 .../machines/graph/IGraphNode.java | 0 .../machines/graph/IGraphNodeType.java | 0 .../machines/graph/SimpleGraphEdgeType.java | 0 .../machines/graph/SimpleGraphNodeType.java | 0 .../machines/i18n/TranslationUtil.java | 0 .../machines/location/LevelBlockPosition.java | 0 .../location/PreciseDimensionalPosition.java | 0 .../machines/location/SimpleTeleporter.java | 0 .../machines/machine/BasicRoomInfo.java | 0 .../EnumMachinePlayersBreakHandling.java | 0 .../machine/LegacySizedTemplates.java | 0 .../machines/machine/Machines.java | 0 .../machine/block/CompactMachineBlock.java | 0 .../block/CompactMachineBlockEntity.java | 0 .../block/LegacySizedCompactMachineBlock.java | 0 .../machine/block/MachineBlockUtil.java | 0 .../machine/client/MachineColors.java | 0 .../machine/data/MachineDataTagBuilder.java | 0 .../InvalidMachineStateException.java | 0 .../NonexistentMachineException.java | 0 .../machine/graph/CompactMachineNode.java | 0 .../machine/graph/DimensionMachineGraph.java | 0 .../machine/graph/MachineRoomEdge.java | 0 .../machine/item/BoundCompactMachineItem.java | 0 .../machine/item/CompactMachineItem.java | 0 .../item/LegacyCompactMachineItem.java | 0 .../item/UnboundCompactMachineItem.java | 0 .../room/MutableRoomRegistration.java | 0 .../machines/room/RoomCapabilities.java | 0 .../machines/room/RoomCodeGenerator.java | 0 .../machines/room/RoomEventHandler.java | 0 .../dev/compactmods/machines/room/Rooms.java | 0 .../room/capability/CMRoomHistory.java | 0 .../PlayerRoomHistoryCapProvider.java | 0 .../room/capability/RoomCapEventHandler.java | 0 .../room/client/MachineRoomScreen.java | 0 .../room/client/RoomClientHelper.java | 0 .../room/data/CopyRoomBindingFunction.java | 0 .../machines/room/data/LootFunctions.java | 0 .../machines/room/data/RoomPreview.java | 0 .../exceptions/NonexistentRoomException.java | 0 .../room/graph/CompactRoomProvider.java | 0 .../machines/room/graph/NewRoomBuilder.java | 0 .../machines/room/graph/RoomChunkNode.java | 0 .../machines/room/graph/RoomMetadataNode.java | 0 .../machines/room/graph/RoomOwnerEdge.java | 0 .../machines/room/graph/RoomOwnerNode.java | 0 .../room/graph/RoomReferenceNode.java | 0 .../machines/room/graph/RoomSpawnNode.java | 0 .../room/history/PlayerRoomHistoryItem.java | 0 .../machines/room/menu/MachineRoomMenu.java | 0 .../network/ClientRoomNetworkHandler.java | 0 .../network/InitialRoomBlockDataPacket.java | 0 .../PlayerRequestedTeleportPacket.java | 0 .../PlayerStartedRoomTrackingPacket.java | 0 .../room/network/RoomNetworkHandler.java | 0 .../shrinking/PersonalShrinkingDevice.java | 0 .../machines/shrinking/Shrinking.java | 0 .../machines/tunnel/BaseTunnelWallData.java | 0 .../machines/tunnel/SidedPosition.java | 0 .../machines/tunnel/TunnelHelper.java | 0 .../machines/tunnel/TunnelItem.java | 0 .../machines/tunnel/TunnelWallBlock.java | 0 .../machines/tunnel/TunnelWallEntity.java | 0 .../compactmods/machines/tunnel/Tunnels.java | 0 .../tunnel/client/ClientTunnelHandler.java | 0 .../machines/tunnel/client/TunnelColors.java | 0 .../tunnel/client/TunnelItemColor.java | 0 .../tunnel/definitions/UnknownTunnel.java | 0 .../tunnel/graph/TunnelConnectionGraph.java | 0 .../tunnel/graph/TunnelMachineEdge.java | 0 .../tunnel/graph/TunnelMachineInfo.java | 0 .../machines/tunnel/graph/TunnelNode.java | 0 .../machines/tunnel/graph/TunnelTypeEdge.java | 0 .../machines/tunnel/graph/TunnelTypeNode.java | 0 .../machines/tunnel/graph/readme.md | 0 .../tunnel/network/TunnelAddedPacket.java | 0 .../machines/upgrade/ChunkloadUpgrade.java | 0 .../upgrade/ChunkloadUpgradeItem.java | 0 .../machines/upgrade/MachineRoomUpgrades.java | 0 .../machines/upgrade/RoomUpgradeItem.java | 0 .../machines/upgrade/RoomUpgradeManager.java | 0 .../upgrade/command/CMUpgradeRoomCommand.java | 0 .../upgrade/command/RoomUpgradeArgument.java | 0 .../upgrade/graph/RoomUpgradeConnection.java | 0 .../upgrade/graph/RoomUpgradeGraphNode.java | 0 .../upgrade/graph/UpgradeConnectionEntry.java | 0 .../util/CompactStructureGenerator.java | 0 .../machines/util/DimensionUtil.java | 0 .../compactmods/machines/util/MathUtil.java | 0 .../compactmods/machines/util/NbtUtil.java | 0 .../compactmods/machines/util/PlayerUtil.java | 0 .../machines/util/SavedDataHelper.java | 0 .../machines/util/VersionUtil.java | 0 .../machines/wall/BreakableWallBlock.java | 0 .../machines/wall/ItemBlockWall.java | 0 .../machines/wall/ProtectedWallBlock.java | 0 .../machines/wall/SolidWallBlock.java | 0 .../dev/compactmods/machines/wall/Walls.java | 0 .../resources/META-INF/accesstransformer.cfg | 0 .../src}/main/resources/META-INF/mods.toml | 0 .../shaders/core/block_fullbright.fsh | 0 .../shaders/core/block_fullbright.json | 0 .../shaders/core/block_fullbright.vsh | 0 .../compactmachines/shaders/core/wall.fsh | 0 .../compactmachines/shaders/core/wall.json | 0 .../textures/block/machine/border.png | Bin .../textures/block/machine/machine_giant.png | Bin .../textures/block/machine/machine_large.png | Bin .../block/machine/machine_maximum.png | Bin .../textures/block/machine/machine_normal.png | Bin .../textures/block/machine/machine_small.png | Bin .../textures/block/machine/machine_tiny.png | Bin .../textures/block/machine/overlay.png | Bin .../textures/block/machine/tint.png | Bin .../textures/block/tunnels/down.png | Bin .../textures/block/tunnels/east.png | Bin .../textures/block/tunnels/indicator.png | Bin .../textures/block/tunnels/none.png | Bin .../textures/block/tunnels/north.png | Bin .../textures/block/tunnels/south.png | Bin .../textures/block/tunnels/tunnel.png | Bin .../textures/block/tunnels/up.png | Bin .../textures/block/tunnels/west.png | Bin .../textures/block/upgrades/upgrade_giant.png | Bin .../textures/block/upgrades/upgrade_large.png | Bin .../block/upgrades/upgrade_maximum.png | Bin .../block/upgrades/upgrade_normal.png | Bin .../textures/block/upgrades/upgrade_small.png | Bin .../textures/block/upgrades/upgrade_tiny.png | Bin .../compactmachines/textures/block/wall.png | Bin .../textures/curios/empty_psd.png | Bin .../textures/entities/villager.png | Bin .../textures/gui/field_example.png | Bin .../textures/gui/psd_screen.png | Bin .../textures/gui/room_menu.png | Bin .../compactmachines/textures/gui/tabicons.png | Bin .../textures/item/minifluiddrop.png | Bin .../item/personal_shrinking_device.png | Bin .../textures/item/room_core.png | Bin .../compactmachines/textures/item/tunnel.png | Bin .../textures/particles/blockmarker.png | Bin .../textures/upgrades/chunkloader.png | Bin .../src}/main/resources/pack.mcmeta | 0 .../machines/test/GameTestEventHandler.java | 0 .../compactmods/machines/test/MathTests.java | 0 .../machines/test/ServerEvents.java | 0 .../machines/test/TestBatches.java | 0 .../test/core/CompactMachinesTests.java | 0 .../machines/test/crossmod/Mekanism.java | 0 .../machines/test/data/CodecTests.java | 0 .../test/migrators/EarlyFileLoaderTests.java | 0 .../RoomInfoPre520MigratorTests.java | 0 .../machines/test/util/FileHelper.java | 0 .../machines/test/util/TestUtil.java | 0 .../test/worldgen/DimensionTests.java | 0 .../test/worldgen/RoomGenerationTests.java | 0 .../structures/empty_15x15.nbt | Bin .../structures/empty_15x31.nbt | Bin .../compactmachines/structures/empty_1x1.nbt | Bin .../compactmachines/structures/empty_5x5.nbt | Bin .../data/compactmachines/structures/giant.nbt | Bin .../data/compactmachines/structures/large.nbt | Bin .../compactmachines/structures/maximum.nbt | Bin .../structures/mekanism/empty_1x1.nbt | Bin .../compactmachines/structures/normal.nbt | Bin .../data/compactmachines/structures/small.nbt | Bin .../structures/template_max.nbt | Bin .../data/compactmachines/structures/tiny.nbt | Bin .../structures/tunneltests.solid_wall_3x3.nbt | Bin .../resources/migrate/pre520/connections.dat | Bin .../test/resources/migrate/pre520/level.dat | Bin .../resources/migrate/pre520/level.dat_old | Bin .../resources/migrate/pre520/machines.dat | Bin .../resources/migrate/pre520/room_data.dat | Bin .../migrate/pre520/tunnels_0_-64.dat | Bin .../compactmachines_connections.nbt | Bin .../compactmachines_machines.nbt | Bin .../compactmachines_rooms.nbt | Bin .../machines_external.nbt | Bin .../machines_internal.dat | Bin .../single-machine-player-inside/players.dat | Bin forge-tunnels/build.gradle.kts | 26 ++ .../machines/tunnel/BuiltinTunnels.java | 2 +- .../definitions/BufferedItemTunnel.java | 0 .../tunnel/definitions/FluidTunnel.java | 0 .../tunnel/definitions/ForgeEnergyTunnel.java | 0 .../tunnel/definitions/SmartItemTunnel.java | 0 .../redstone/RedstoneInTunnelDefinition.java | 0 gradle.properties | 6 - raw-assets/field-projector-setup-example.png | Bin 85178 -> 0 bytes raw-assets/projector-texture.psd | Bin 78807 -> 0 bytes .../recipes/giant_machine.json | 53 --- .../recipes/large_machine.json | 44 -- .../recipes/maximum_machine.json | 54 --- .../recipes/normal_machine.json | 43 -- .../recipes/small_machine.json | 43 -- .../compactmachines/recipes/tiny_machine.json | 36 -- .../compact-crafting-alpha2/pack.mcmeta | 6 - .../recipes/giant_machine.json | 55 --- .../recipes/large_machine.json | 45 -- .../recipes/maximum_machine.json | 56 --- .../recipes/normal_machine.json | 45 -- .../recipes/small_machine.json | 45 -- .../compactmachines/recipes/tiny_machine.json | 37 -- .../data/compactmachines/recipes/wall.json | 37 -- recipepacks/compact-crafting/pack.mcmeta | 6 - .../recipes/giant_machine.json | 20 - .../recipes/large_machine.json | 20 - .../compactmachines/recipes/machine_wall.json | 20 - .../recipes/maximum_machine.json | 20 - .../recipes/normal_machine.json | 20 - .../recipes/small_machine.json | 20 - .../compactmachines/recipes/tiny_machine.json | 20 - recipepacks/vanilla/pack.mcmeta | 6 - settings.gradle | 1 - settings.gradle.kts | 23 + .../RedstoneOutTunnelDefinition.java | 24 - 476 files changed, 2633 insertions(+), 1199 deletions(-) create mode 100644 assets/machine.aseprite rename {raw-assets => assets}/personal_shrinking_device.aseprite (100%) rename {raw-assets => assets}/personal_shrinking_device.png (100%) delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 forge-api/build.gradle.kts rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/CompactMachinesAddon.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/ICompactMachinesAddon.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/Advancements.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/CMCommands.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/CMRegistries.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/CMTags.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/Constants.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/JeiInfo.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/Messages.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/core/Tooltips.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/dimension/CompactDimension.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/location/IDimensionalPosition.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/machine/MachineNbt.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/machine/MachineTags.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/IRoomHistory.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/IRoomLookup.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/RoomSize.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/RoomTemplate.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/Rooms.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/shrinking/PSDTags.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java (100%) rename {src/api => forge-api/src/main}/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java (100%) create mode 100644 forge-main/build.gradle.kts create mode 100644 forge-main/gradle.properties rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java (100%) rename {src => forge-main/src}/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java (100%) create mode 100644 forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b create mode 100644 forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c create mode 100644 forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 create mode 100644 forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 create mode 100644 forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 create mode 100644 forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 create mode 100644 forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 create mode 100644 forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e create mode 100644 forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f create mode 100644 forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 create mode 100644 forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json create mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/root.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/wall.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json create mode 100644 forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json create mode 100644 forge-main/src/generated/resources/data/curios/tags/items/psd.json create mode 100644 forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json create mode 100644 forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json rename {src => forge-main/src}/main/java/dev/compactmods/machines/CompactMachines.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/ModDataUpgrader.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/ClientEventHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/Resources.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/GuiIds.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/level/RenderingLevel.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/level/TemplateChunk.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/render/RenderTypes.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/codec/CodecExtensions.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/codec/NbtListCollector.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/Commands.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/InterModCompat.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/config/CommonConfig.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/config/ServerConfig.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/CommonEventHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/CompactMachinesNet.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/ModBusEvents.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/Registries.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/ServerEventHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/core/UIRegistration.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/dimension/Dimension.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/Graph.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/GraphEdgeType.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/IGraphEdge.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/IGraphNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/IGraphNodeType.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/i18n/TranslationUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/location/LevelBlockPosition.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/location/SimpleTeleporter.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/Machines.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/client/MachineColors.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/RoomCapabilities.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/RoomEventHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/Rooms.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/data/LootFunctions.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/data/RoomPreview.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/network/InitialRoomBlockDataPacket.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/shrinking/Shrinking.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/SidedPosition.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/TunnelItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/Tunnels.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java (100%) rename {src/tunnels => forge-main/src/main}/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/graph/readme.md (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/DimensionUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/MathUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/NbtUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/PlayerUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/SavedDataHelper.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/util/VersionUtil.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/wall/ItemBlockWall.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/wall/SolidWallBlock.java (100%) rename {src => forge-main/src}/main/java/dev/compactmods/machines/wall/Walls.java (100%) rename {src => forge-main/src}/main/resources/META-INF/accesstransformer.cfg (100%) rename {src => forge-main/src}/main/resources/META-INF/mods.toml (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/shaders/core/block_fullbright.fsh (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/shaders/core/block_fullbright.json (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/shaders/core/block_fullbright.vsh (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/shaders/core/wall.fsh (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/shaders/core/wall.json (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/border.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_giant.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_large.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_maximum.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_normal.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_small.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/machine_tiny.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/overlay.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/machine/tint.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/down.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/east.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/indicator.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/none.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/north.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/south.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/tunnel.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/up.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/tunnels/west.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_giant.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_large.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_maximum.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_normal.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_small.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_tiny.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/block/wall.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/curios/empty_psd.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/entities/villager.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/gui/field_example.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/gui/psd_screen.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/gui/room_menu.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/gui/tabicons.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/item/minifluiddrop.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/item/personal_shrinking_device.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/item/room_core.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/item/tunnel.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/particles/blockmarker.png (100%) rename {src => forge-main/src}/main/resources/assets/compactmachines/textures/upgrades/chunkloader.png (100%) rename {src => forge-main/src}/main/resources/pack.mcmeta (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/GameTestEventHandler.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/MathTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/ServerEvents.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/TestBatches.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/data/CodecTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/util/FileHelper.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/util/TestUtil.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java (100%) rename {src => forge-main/src}/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/empty_15x15.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/empty_15x31.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/empty_1x1.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/empty_5x5.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/giant.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/large.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/maximum.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/normal.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/small.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/template_max.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/tiny.nbt (100%) rename {src => forge-main/src}/test/resources/data/compactmachines/structures/tunneltests.solid_wall_3x3.nbt (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/connections.dat (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/level.dat (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/level.dat_old (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/machines.dat (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/room_data.dat (100%) rename {src => forge-main/src}/test/resources/migrate/pre520/tunnels_0_-64.dat (100%) rename {src => forge-main/src}/test/resources/scenario/simple-connection/compactmachines_connections.nbt (100%) rename {src => forge-main/src}/test/resources/scenario/simple-connection/compactmachines_machines.nbt (100%) rename {src => forge-main/src}/test/resources/scenario/simple-connection/compactmachines_rooms.nbt (100%) rename {src => forge-main/src}/test/resources/scenario/single-machine-player-inside/machines_external.nbt (100%) rename {src => forge-main/src}/test/resources/scenario/single-machine-player-inside/machines_internal.dat (100%) rename {src => forge-main/src}/test/resources/scenario/single-machine-player-inside/players.dat (100%) create mode 100644 forge-tunnels/build.gradle.kts rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java (100%) rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java (100%) rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java (100%) rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java (100%) rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java (100%) rename {src/tunnels => forge-tunnels/src/main}/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java (100%) delete mode 100644 raw-assets/field-projector-setup-example.png delete mode 100644 raw-assets/projector-texture.psd delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/giant_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/large_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/maximum_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/normal_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/small_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/tiny_machine.json delete mode 100644 recipepacks/compact-crafting-alpha2/pack.mcmeta delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/giant_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/large_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/maximum_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/normal_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/small_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/tiny_machine.json delete mode 100644 recipepacks/compact-crafting/data/compactmachines/recipes/wall.json delete mode 100644 recipepacks/compact-crafting/pack.mcmeta delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/giant_machine.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/large_machine.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/machine_wall.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/maximum_machine.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/normal_machine.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/small_machine.json delete mode 100644 recipepacks/vanilla/data/compactmachines/recipes/tiny_machine.json delete mode 100644 recipepacks/vanilla/pack.mcmeta delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts delete mode 100644 tunnels/definitions/RedstoneOutTunnelDefinition.java diff --git a/.gitignore b/.gitignore index 82e424a6..a4e9dffa 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,6 @@ logs/ *.dot -src/generated/ +forge-main/src-old/generated/ raw-assets/ diff --git a/assets/machine.aseprite b/assets/machine.aseprite new file mode 100644 index 0000000000000000000000000000000000000000..5a862e98cfbf511bcc05b1a0115e8ae2c41c51a8 GIT binary patch literal 1899 zcmcIkeM}Q)7=H?d!YG9(5rtt799ugBQZ*_Y0+u2ep+sRbizZO$t#*_i9vvcIb(3i_ zjN)`N1ZOqK+%ThYn~Tl~0mO_&Wnvu0%oL{?!w(SY3beGh=dSWGEr0HLbI-kZ@ALb3 zpZD5A0YHBf4+w7X06>k`OaudueF;1q|3^IX1+b4qaHp*!otLuqllH5x5mQX+}dIQhGF8kIc{rXvK&`2FxNA7_dEx{@oW{&Bg11c zPv}Hl0L^D7a4t`hGjCxzpWS;f>YxZJAU(^$uy~}zjAWRR204%b(FjFx;1gb$r-B9e zf}En&BrU=D%d5eVsyC?g8Xc)7+;wi2s295L3n`S2qDz)=EZ&%>I>u@Qz-F?5U03Dn z$mnUI*(HIHqt)*sBq>yJF-c2b^H?N=>>`y;M@Tl%lwLX)k&>dZijbsHI<<6WTeH=I zAwxxLNJ5g8U!qlOReI?g9tDFS4HpfBM4?p`QF`^9WtplnLZT!M+eun$Af;lCEpoaE z_=q8ZtWuKJsdl+dz1XE-$lk6}YxNpr;%CpZn&~*<`bHxZpTK_(&HA>zf_M(X_Xw$|d)@Y+U9z~Vu`J}^pPLdsO&h@n z?;4(?b0i~^1NvZ|qfdko;wW{uHSfcEaj|SoxmADVPIu@}4>O)RoYifX;W3BP)t59H zd-h^qIQvWWA$&c$a5%dkGs9ErQ&t3i-VpQ0`gLyq0*}b-BfmS$Yuv7I_JxQyho9=u`O%7%hK5RXn%g?Q7sU933 z6kJp;9~$6Qms+aE?(Vcy6(ri7=lXkAx?FOL>5C!iHsd|P$X!W?BFq&I#kZV6;amn^ z*&QcLzH$6=z(4cWu1h<(;QRRWeFu62Hnht>4@u3x8TnD$Uojs`qlP5g_V2iKbhFoW zNuw>rZ)=alvT()fXW}JeYsXuDUH;B+<^3$pwrty>YFDD4sUo&|Rd}njJ+?qFRwb~U zF}KW=w{*49{KlD`XW*=J1bG*&LmG{1T^Bg)$T_)2roFYDVo eGsXV* { + manifest { + val now = java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(java.util.Date()) + attributes(mapOf( + "Specification-Title" to "Compact Machines", + "Specification-Vendor" to "", + "Specification-Version" to "1", // We are version 1 of ourselves + "Implementation-Title" to project.name, + "Implementation-Version" to archiveVersion, + "Implementation-Vendor" to "", + "Implementation-Timestamp" to now + )) + } +} diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts new file mode 100644 index 00000000..8eaab039 --- /dev/null +++ b/forge-api/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + java + id("net.minecraftforge.gradle") version ("5.1.+") + id("org.parchmentmc.librarian.forgegradle") version ("1.+") +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + withSourcesJar() +} + +var minecraft_version: String by extra +var forge_version: String by extra +var parchment_version: String by extra + +minecraft { + mappings("parchment", parchment_version) +} + +dependencies { + minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") +} \ No newline at end of file diff --git a/src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java b/forge-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/CompactMachinesAddon.java rename to forge-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java diff --git a/src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java b/forge-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/ICompactMachinesAddon.java rename to forge-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java diff --git a/src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java b/forge-api/src/main/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java rename to forge-api/src/main/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java diff --git a/src/api/java/dev/compactmods/machines/api/core/Advancements.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/Advancements.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java diff --git a/src/api/java/dev/compactmods/machines/api/core/CMCommands.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/CMCommands.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java diff --git a/src/api/java/dev/compactmods/machines/api/core/CMRegistries.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/CMRegistries.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java diff --git a/src/api/java/dev/compactmods/machines/api/core/CMTags.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/CMTags.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java diff --git a/src/api/java/dev/compactmods/machines/api/core/Constants.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/Constants.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java diff --git a/src/api/java/dev/compactmods/machines/api/core/JeiInfo.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/JeiInfo.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java diff --git a/src/api/java/dev/compactmods/machines/api/core/Messages.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/Messages.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java diff --git a/src/api/java/dev/compactmods/machines/api/core/Tooltips.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/core/Tooltips.java rename to forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java diff --git a/src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/dimension/CompactDimension.java rename to forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java diff --git a/src/api/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java b/forge-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java rename to forge-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java b/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java rename to forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java diff --git a/src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/location/IDimensionalPosition.java rename to forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java diff --git a/src/api/java/dev/compactmods/machines/api/machine/MachineNbt.java b/forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/machine/MachineNbt.java rename to forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java diff --git a/src/api/java/dev/compactmods/machines/api/machine/MachineTags.java b/forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/machine/MachineTags.java rename to forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java diff --git a/src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java b/forge-api/src/main/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java rename to forge-api/src/main/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java diff --git a/src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java b/forge-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java rename to forge-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java diff --git a/src/api/java/dev/compactmods/machines/api/room/IRoomHistory.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/IRoomHistory.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java diff --git a/src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/IRoomLookup.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java diff --git a/src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomSize.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/RoomSize.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java diff --git a/src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/RoomTemplate.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java diff --git a/src/api/java/dev/compactmods/machines/api/room/Rooms.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/Rooms.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java diff --git a/src/api/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java diff --git a/src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java diff --git a/src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java rename to forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java diff --git a/src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java b/forge-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/shrinking/PSDTags.java rename to forge-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java rename to forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java diff --git a/src/api/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java b/forge-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java similarity index 100% rename from src/api/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java rename to forge-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts new file mode 100644 index 00000000..0403a6dd --- /dev/null +++ b/forge-main/build.gradle.kts @@ -0,0 +1,244 @@ +var mod_id: String by extra +var minecraft_version: String by extra +var forge_version: String by extra +var parchment_version: String by extra + +plugins { + id("idea") + id("eclipse") + id("maven-publish") + id("net.minecraftforge.gradle") version ("5.1.+") + id("org.parchmentmc.librarian.forgegradle") version ("1.+") +} + +base { + archivesName.set(mod_id) +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +sourceSets.main { + java { + srcDir("src/main/resources") + srcDir("src/generated/resources") + } +} + +sourceSets.test { + java.srcDir("src/test/java") + resources.srcDir("src/test/resources") +} + +val datagen = sourceSets.create("datagen") { + compileClasspath += sourceSets.main.get().output +} + +project.evaluationDependsOn(project(":forge-api").path) + +repositories { + mavenLocal() + mavenCentral() { + content { + includeGroup("com.aventrix.jnanoid") + } + } + + maven("https://www.cursemaven.com") { + content { + includeGroup("curse.maven") + } + } + + // location of the maven that hosts JEI files + maven("https://dvs1.progwml6.com/files/maven") { + content { + includeGroup("mezz.jei") + } + } + + maven("https://maven.theillusivec4.top/") { + content { + includeGroup("top.theillusivec4.curios") + } + } +} + +val jei_version: String? by extra +val jei_mc_version: String by extra +val curios_version: String? by extra + +jarJar.enable() + +dependencies { + minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + + implementation(project(":forge-api")) + implementation(project(":forge-tunnels")) + testImplementation(project(":forge-api")) + + // JEI + if (project.extra.has("jei_version") && project.extra.has("jei_mc_version")) { + compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}")) + compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}")) + runtimeOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}")) + } + + // The One Probe + implementation(fg.deobf("curse.maven:theoneprobe-245211:3927520")) + + // Curios + if (project.extra.has("curios_version")) { + runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")) + compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")) + } + + minecraftLibrary("com.aventrix.jnanoid", "jnanoid", "2.0.0") + jarJar("com.aventrix.jnanoid", "jnanoid", "[2.0.0]") + + val include_test_mods: String? by extra + if (!System.getenv().containsKey("CI") && include_test_mods.equals("true")) { + // Nicephore - Screenshots and Stuff + runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3879841")) + + // Testing Mods - Trash Cans, Pipez, Create, Refined Pipes, Pretty Pipes, Refined Storage + runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3910759")) + runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3871885")) + + // runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3871082")) + // runtimeOnly(fg.deobf("curse.maven:create-328085:3737418")) + + // runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151")) + // runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145")) + // runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324")) + + // Scalable Cat's Force, BdLib, Advanced Generators + // runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756")) + // runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149")) + // runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335")) + + // Immersive Eng - 7.1.0-145 (Dec 31) + // runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149")) + + // FTB Chunks + // runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711")) + // runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501")) + // runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485")) + // runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113")) + + // Mekanism + Mek Generators - Tunnel testing + runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3922056")) + runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3922058")) + + // Soul Shards (FTB) + // runtimeOnly(fg.deobf("curse.maven:polylib-576589:3751528")) + // runtimeOnly(fg.deobf("curse.maven:soulshards-551523:3757202")) + + // Everlasting Abilities + // runtimeOnly(fg.deobf("curse.maven:cyclopscore-232758:3809427")) + // runtimeOnly(fg.deobf("curse.maven:everlastabilities-248353:3768481")) + } +} + +val runDepends: List = listOf( + project(":forge-api"), + project(":forge-tunnels") +) + +runDepends.forEach { + project.evaluationDependsOn(it.path) +} + +minecraft { + mappings("parchment", parchment_version) + accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) + + runs { + all { + // Recommended logging data for a userdev environment + property("forge.logging.markers", "") // "SCAN,REGISTRIES,REGISTRYDUMP" + + // Recommended logging level for the console + property("forge.logging.console.level", "debug") + + property("mixin.env.remapRefMap", "true") + property("mixin.env.refMapRemappingFile", "${buildDir}/createSrgToMcp/output.srg") + + // JetBrains Runtime Hotswap + jvmArg("-XX:+AllowEnhancedClassRedefinition") + jvmArg("-XX:HotswapAgent=fatjar") + + mods.create(mod_id) { + source(sourceSets.main.get()) + for(p in runDepends) + source(p.sourceSets.main.get()) + } + } + + create("client") { + taskName("runClient-Nano") + workingDirectory(file("run/client")) + + args("--username", "Nano") + args("--width", 1920) + args("--height", 1080) + } + + create("datagen") { + workingDirectory(file("run/data")) + + mods.named(mod_id) { + source(datagen) + } + } + } +} + +reobf { + jarJar { + + } +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +tasks.jar { + from(sourceSets.main.get().output) + + finalizedBy("reobfJar") + archiveClassifier.set("slim") +} + +tasks.jarJar { + archiveClassifier.set("") + project(":forge-api").tasks.jar.get().archiveFile.map { + zipTree(it) + } +} + +publishing { + publications.register("release") { + artifactId = mod_id + groupId = "dev.compactmods" + + artifacts { + artifact(tasks.jar.get()) + // artifact apiJar + artifact(tasks.jarJar) + } + } + + repositories { + // GitHub Packages + maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/forge-main/gradle.properties b/forge-main/gradle.properties new file mode 100644 index 00000000..89d64c59 --- /dev/null +++ b/forge-main/gradle.properties @@ -0,0 +1,5 @@ +# Dependencies and Libs +jei_mc_version=1.19.2 +jei_version=11.2.0.247 +#top_version=1.16-3.1.4-22 +curios_version=1.19.2-5.1.1.0 \ No newline at end of file diff --git a/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java diff --git a/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java similarity index 100% rename from src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java rename to forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java diff --git a/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b new file mode 100644 index 00000000..cb097ede --- /dev/null +++ b/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b @@ -0,0 +1,5 @@ +// 1.19.2 2022-10-10T13:15:36.6876701 Tags for minecraft:item +5deeff46b9a9ad61978c7e2a72ae779550d014bf data/compactmachines/tags/items/machine.json +ae46c155704ef695a6d4fa06df4d154bd002b9ec data/compactmachines/tags/items/room_upgrade.json +708451278800e756af7e96fb71b87c05a92eb269 data/compactmachines/tags/items/shrinking_device.json +708451278800e756af7e96fb71b87c05a92eb269 data/curios/tags/items/psd.json diff --git a/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c b/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c new file mode 100644 index 00000000..b5a8b9d3 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c @@ -0,0 +1,4 @@ +// 1.19.2 2022-08-14T02:50:32.8266281 compactmachines:levelgen +03d40bd639cf147cdc45dff1ee653e638bf5085a data/compactmachines/dimension/compact_world.json +058639237007bad853b9cdd18ab2275f04c166b5 data/compactmachines/dimension_type/compact_world.json +68fbde096cff93e3c6e5443633a4d71c9a31f612 data/compactmachines/worldgen/biome/machine.json diff --git a/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 b/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 new file mode 100644 index 00000000..3565d449 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 @@ -0,0 +1,8 @@ +// 1.19.2 2022-10-10T13:15:36.6836116 compactmachines/room_templates generator for compactmachines +467d391d0dc30dd7b9b3d71fc4e6fecb828ef037 data/compactmachines/compactmachines/room_templates/absurd.json +82708900a5f1480d39bd9544c09175c869223780 data/compactmachines/compactmachines/room_templates/colossal.json +562202b058b85065731a603f4ba8668614710a9e data/compactmachines/compactmachines/room_templates/giant.json +29f10c189e4eb414e60eff75d7a52714d43938f8 data/compactmachines/compactmachines/room_templates/large.json +c26bd54dce42b5fe82423c71e76184eee0478016 data/compactmachines/compactmachines/room_templates/normal.json +0ddbe8ac46777eaa04f388f4f6cbcb2319e0b2f2 data/compactmachines/compactmachines/room_templates/small.json +585e6aaa5f616eb4a53ea074e28b3bb9fb617353 data/compactmachines/compactmachines/room_templates/tiny.json diff --git a/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 b/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 new file mode 100644 index 00000000..e5c612a2 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 @@ -0,0 +1,14 @@ +// 1.19.2 2022-10-09T08:59:48.6168024 Item Models: compactmachines +990ed9172747e593636e1c60350721a6b520966a assets/compactmachines/models/item/chunkloader_upgrade.json +5507a63beccf1e4d6c99f3b0a2f0657b79732d3d assets/compactmachines/models/item/machine.json +e5f0d47a6ddb30e2e823b972444c95a0d5085109 assets/compactmachines/models/item/machine_giant.json +2cbaf11c6ce4fb3707016a111744058dadc5e097 assets/compactmachines/models/item/machine_large.json +21f009141ecfbc26ac81266ee2aa9efa242ce6b6 assets/compactmachines/models/item/machine_maximum.json +d35abe205d01915a3f58638e43a9e863eb3cf246 assets/compactmachines/models/item/machine_normal.json +eb7fe7f4a1be98ed0c1241c357bdca660eee3f59 assets/compactmachines/models/item/machine_small.json +3600e7ad6f574163b708cf0445704183c2a6dafc assets/compactmachines/models/item/machine_tiny.json +5507a63beccf1e4d6c99f3b0a2f0657b79732d3d assets/compactmachines/models/item/new_machine.json +95c08370ef1e0e03cf65ad5f1b38cd66d471bd08 assets/compactmachines/models/item/personal_shrinking_device.json +c5d1c5214a7675a3b69d29a5c6cfa5dcb18ed9d1 assets/compactmachines/models/item/solid_wall.json +d4989b21bafab1f597145fb3d065e7a197cc468a assets/compactmachines/models/item/tunnel.json +c5d1c5214a7675a3b69d29a5c6cfa5dcb18ed9d1 assets/compactmachines/models/item/wall.json diff --git a/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 new file mode 100644 index 00000000..555560d0 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 @@ -0,0 +1,9 @@ +// 1.19.2 2022-10-09T06:25:22.5370764 LootTables +77081d7de6275421c55be81619b1c42db5e2d220 data/compactmachines/loot_tables/blocks/machine.json +87b56e6b6d0b65b8da9104b8ca2e9605abf5e30b data/compactmachines/loot_tables/blocks/machine_giant.json +0f5eb4176f0aef8c68e20a20956554d2c899c37d data/compactmachines/loot_tables/blocks/machine_large.json +a0f3182a08a5d0bc541ddc27ff8919cef981241c data/compactmachines/loot_tables/blocks/machine_maximum.json +551c29282dfc490d897de745e819811dadb51f85 data/compactmachines/loot_tables/blocks/machine_normal.json +cdcf45e2259ce617823999c0e020298cf2e6db7a data/compactmachines/loot_tables/blocks/machine_small.json +e3541b1a2f1f829db53545d62a602700745bf9c4 data/compactmachines/loot_tables/blocks/machine_tiny.json +e44d02b0e62a2762eccac056a342373e172b89c3 data/compactmachines/loot_tables/blocks/wall.json diff --git a/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 new file mode 100644 index 00000000..e4b51ad0 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 @@ -0,0 +1,5 @@ +// 1.19.2 2022-10-10T13:15:36.6866127 Tags for minecraft:block +60e219a280627ad3250ee8899d65356050a6916b data/compactmachines/tags/blocks/legacy_machines.json +79362b5b837973baf1a191564ce11c351ab26ad6 data/compactmachines/tags/blocks/machine.json +7cb0079d5c84af250a5219a21083a8b6151be1dc data/minecraft/tags/blocks/mineable/pickaxe.json +7cb0079d5c84af250a5219a21083a8b6151be1dc data/minecraft/tags/blocks/needs_iron_tool.json diff --git a/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 b/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 new file mode 100644 index 00000000..c716be87 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 @@ -0,0 +1,12 @@ +// 1.19.2 2022-08-14T02:50:32.8236272 CompactMachinesAdvancements +d124c4f474c54859fadcd94bf01aedcdbb67a6a1 data/compactmachines/advancements/claimed_machine_giant.json +b28307695529a0b29f4d01cb73b676971101817b data/compactmachines/advancements/claimed_machine_large.json +e2627beb8745fefdd856cef48a5c0abef6e5c62a data/compactmachines/advancements/claimed_machine_max.json +549e22e4df1ebc3e0da00ff807193c7e11cbb43f data/compactmachines/advancements/claimed_machine_normal.json +9aa0bedced8b989bba9235b85e366f5f6d07a6d9 data/compactmachines/advancements/claimed_machine_small.json +5445a0386a71fa115e6a9ba43909094691c04419 data/compactmachines/advancements/claimed_machine_tiny.json +531ada45a355332d1d03882d4721e7bfa5c048fe data/compactmachines/advancements/foundations.json +e094ff2c19817e4529f02a7146715bca6e3bb69b data/compactmachines/advancements/got_shrinking_device.json +d17c2a961a7a811609f4198758ae6af4dc4a1db6 data/compactmachines/advancements/how_did_you_get_here.json +6ce018a59dae8ccf2eacdfe4615788468190e4a8 data/compactmachines/advancements/recursion.json +40e748d08908f1b51c0719a43163af9d8356d559 data/compactmachines/advancements/root.json diff --git a/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e new file mode 100644 index 00000000..4701277a --- /dev/null +++ b/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -0,0 +1,25 @@ +// 1.19.2 2022-10-10T13:15:36.6896128 Recipes +a40fb5a9e2ba7fef974aaabb75e6c9a84888e5a7 data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json +a73918d656d32c9ce3a74ecfb16926101f563e61 data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json +98a4dadbd8d0894168023952ea86e78f3c94fb40 data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json +0b5f3cab41068d6f1ff3ec574665c38ea5c814a7 data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json +9874a022df16a973c65c20f8b3719023cf88cdad data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json +0734786e487603bc255ea7871a1773c86de7445a data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json +939624ed040f0a2f3a3543e55f843e55c8a1ba03 data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json +a3beadc24cd989d67cdfef1e5b76ded9ff72b583 data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json +af154134241d2106d572f3024930488b0bb7274a data/compactmachines/advancements/recipes/compactmachines/wall.json +a04fe3fd0cea208672ae7fdf3fcb74d25d71d302 data/compactmachines/advancements/recipes/energy.json +fbf5d1ad14eb0eded4022f19992452e3834053e2 data/compactmachines/advancements/recipes/fluid.json +0886a28152999b97d2902d9133333ab77d792025 data/compactmachines/advancements/recipes/item.json +dc38bf15549c2be65b416ef60d642f6199290a1a data/compactmachines/recipes/new_machine_absurd.json +f8fab00a4f4a605e8e9c70ae98e60e1bf5a0f609 data/compactmachines/recipes/new_machine_colossal.json +69528b01fdea6f0c2c00512c9decd11bbfe58361 data/compactmachines/recipes/new_machine_giant.json +d3e05608248ece456b53635376631ab4cd3bc525 data/compactmachines/recipes/new_machine_large.json +84a2ca0d9bb1415f5ecd73122ec8535ecb7f311d data/compactmachines/recipes/new_machine_normal.json +172e205b7b37e98ba3cf67f229b4168400391b06 data/compactmachines/recipes/new_machine_small.json +49514929dd1cc4245e055cd415bb00b1dd4b5fa3 data/compactmachines/recipes/new_machine_tiny.json +1af8e645ea754a22f6d88b87de8433874e9ec764 data/compactmachines/recipes/personal_shrinking_device.json +0b5d49b372abf7f61ed22f1f17bc093e14aee3c6 data/compactmachines/recipes/tunnels/energy.json +2f3cd088f27ae53590354d1211b90a1542e28006 data/compactmachines/recipes/tunnels/fluid.json +c0fe55504226cdd739d58e2b5031d2d79974a52d data/compactmachines/recipes/tunnels/item.json +ccc5da141955fe7d7eb06975918163c6b7d2a4ea data/compactmachines/recipes/wall.json diff --git a/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f b/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f new file mode 100644 index 00000000..a96d8d11 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f @@ -0,0 +1,18 @@ +// 1.19.2 2022-10-10T13:15:36.6886123 Block States: compactmachines +ce14ef21a1140b8e0a1bd0171ca4202530beaace assets/compactmachines/blockstates/machine.json +3b05ee7c9e5de4938db8e0d489acc59a35ba3f81 assets/compactmachines/blockstates/machine_giant.json +c1f0c78f19124f6a51cad307e4783c4e695635aa assets/compactmachines/blockstates/machine_large.json +85e949c79dd97e0cba6a253659bd29ac96f96241 assets/compactmachines/blockstates/machine_maximum.json +f4cab3f335810a51045246ac7797e0cdf7e14c95 assets/compactmachines/blockstates/machine_normal.json +0462147abbe9aa16b9c4befd9b7efd63a95538fd assets/compactmachines/blockstates/machine_small.json +615cb06be5f4ac7825e5d45c10df1f85924ce347 assets/compactmachines/blockstates/machine_tiny.json +dcc59fe8ec89ed7fab8ee1c31c25ff63553c9f3f assets/compactmachines/blockstates/solid_wall.json +dcc59fe8ec89ed7fab8ee1c31c25ff63553c9f3f assets/compactmachines/blockstates/wall.json +8a8cc056d7151e26a53fd293b275f7877c504143 assets/compactmachines/models/block/machine/machine.json +a52974cd16cd480f3069d8fc5f85ee02f30bc8a4 assets/compactmachines/models/block/machine/machine_giant.json +48f9571ccd08d09b81deb3308e4407d3aea9a0aa assets/compactmachines/models/block/machine/machine_large.json +0bbc4a5b78432dcc02c82bed1840d2e8988675a0 assets/compactmachines/models/block/machine/machine_maximum.json +2b738565ace8a161751fb04320333772521fbef2 assets/compactmachines/models/block/machine/machine_normal.json +ecfdae7fa81d5286d1c345069084229db909d899 assets/compactmachines/models/block/machine/machine_small.json +bfe2149896d457fa3985464a2975b2fc914dd4bd assets/compactmachines/models/block/machine/machine_tiny.json +22f424881e73a00d7649c1bb8ddac3192e25ed1a assets/compactmachines/models/block/wall.json diff --git a/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 new file mode 100644 index 00000000..36f8f816 --- /dev/null +++ b/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 @@ -0,0 +1,2 @@ +// 1.19.2 2022-10-10T13:15:36.6866127 Languages: en_us +f49b1d3c9b1b8c41cfbf52097b144c0b3ba3469c assets/compactmachines/lang/en_us.json diff --git a/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e b/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e new file mode 100644 index 00000000..1d529d6f --- /dev/null +++ b/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e @@ -0,0 +1,2 @@ +// 1.19.2 2022-08-14T02:50:32.8286271 Languages: ru_ru +c408ab4961d8b56e39340d80345f39c3d6acd565 assets/compactmachines/lang/ru_ru.json diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json new file mode 100644 index 00000000..1fbb9448 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json new file mode 100644 index 00000000..3814639b --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_giant" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json new file mode 100644 index 00000000..5147b8fe --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_large" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json new file mode 100644 index 00000000..2c323e3d --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_maximum" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json new file mode 100644 index 00000000..ba8f16cf --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_normal" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json new file mode 100644 index 00000000..2535b2f5 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_small" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json new file mode 100644 index 00000000..570dd30c --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/machine/machine_tiny" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json new file mode 100644 index 00000000..13189c5c --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/wall" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json new file mode 100644 index 00000000..a28d3738 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json @@ -0,0 +1,22 @@ +{ + "variants": { + "connected_side=down": { + "model": "compactmachines:tunnels/down" + }, + "connected_side=east": { + "model": "compactmachines:tunnels/east" + }, + "connected_side=north": { + "model": "compactmachines:tunnels/north" + }, + "connected_side=south": { + "model": "compactmachines:tunnels/south" + }, + "connected_side=up": { + "model": "compactmachines:tunnels/up" + }, + "connected_side=west": { + "model": "compactmachines:tunnels/west" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json new file mode 100644 index 00000000..13189c5c --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "compactmachines:block/wall" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json b/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json new file mode 100644 index 00000000..f979fae0 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json @@ -0,0 +1,105 @@ +{ + "advancement.compactmachines.claimed_machine_giant": "Got Enough Space?", + "advancement.compactmachines.claimed_machine_giant.desc": "Claim a giant compact machine.", + "advancement.compactmachines.claimed_machine_large": "Room to Grow", + "advancement.compactmachines.claimed_machine_large.desc": "Claim a large compact machine.", + "advancement.compactmachines.claimed_machine_max": "Room for Activities!", + "advancement.compactmachines.claimed_machine_max.desc": "Claim a maximum compact machine.", + "advancement.compactmachines.claimed_machine_normal": "Bigger on the Inside", + "advancement.compactmachines.claimed_machine_normal.desc": "Claim a normal compact machine.", + "advancement.compactmachines.claimed_machine_small": "I Can Breathe", + "advancement.compactmachines.claimed_machine_small.desc": "Claim a small compact machine.", + "advancement.compactmachines.claimed_machine_tiny": "Small Spaces, Big Ideas", + "advancement.compactmachines.claimed_machine_tiny.desc": "Claim a tiny compact machine.", + "advancement.compactmachines.foundations": "Foundations", + "advancement.compactmachines.foundations.desc": "Obtain a breakable wall block.", + "advancement.compactmachines.got_shrinking_device": "Personal Shrinking Device", + "advancement.compactmachines.got_shrinking_device.desc": "Obtain a Personal Shrinking Device", + "advancement.compactmachines.how_did_you_get_here": "How Did You Get Here?!", + "advancement.compactmachines.how_did_you_get_here.desc": "Which machine is the player in?!", + "advancement.compactmachines.recursion": "Recursive Rooms", + "advancement.compactmachines.recursion.desc": "To understand recursion, you must first understand recursion.", + "advancement.compactmachines.root": "Compact Machines", + "advancement.compactmachines.root.desc": "", + "biome.compactmachines.machine": "Compact Machine", + "block.compactmachines.machine_giant": "Compact Machine (Giant)", + "block.compactmachines.machine_large": "Compact Machine (Large)", + "block.compactmachines.machine_maximum": "Compact Machine (Maximum)", + "block.compactmachines.machine_normal": "Compact Machine (Normal)", + "block.compactmachines.machine_small": "Compact Machine (Small)", + "block.compactmachines.machine_tiny": "Compact Machine (Tiny)", + "block.compactmachines.solid_wall": "Solid Compact Machine Wall", + "block.compactmachines.tunnel_wall": "Solid Compact Machine Wall (with Tunnel)", + "block.compactmachines.wall": "Compact Machine Wall", + "command.compactmachines.cannot_give_machine_item": "Failed to give a new machine to player.", + "command.compactmachines.failed_command_file_error": "Failed to execute command; there was a file error. Check logs.", + "command.compactmachines.level_not_found": "Compact Machine dimension could not be found.", + "command.compactmachines.level_registered": "Compact Machine dimension found.", + "command.compactmachines.machine_given_successfully": "Created a new machine item and gave it to %s.", + "command.compactmachines.machine_not_bound": "Machine at %s is not bound to a room.", + "command.compactmachines.not_in_compact_dim": "Cannot use that command outside of a machine room.", + "command.compactmachines.room_not_found": "Room [%s] could not be found.", + "command.compactmachines.room_reg_count": "Number of registered rooms: %s", + "command.compactmachines.spawn_changed_successfully": "Spawn point for room [%s] was changed successfully.", + "command.compactmachines.summary.machines.dimension": "[%s]: %s", + "command.compactmachines.summary.machines.total": "Total: %s", + "compactmachines.connected_block": "Connected: %s", + "compactmachines.direction.down": "Down", + "compactmachines.direction.east": "East", + "compactmachines.direction.north": "North", + "compactmachines.direction.side": "Side: %s", + "compactmachines.direction.south": "South", + "compactmachines.direction.up": "Up", + "compactmachines.direction.west": "West", + "compactmachines.psd.pages.machines": "Compact Machines are the core mechanic of this mod. They allow you to build large rooms in a single block space connected to the outside world. They come in various sizes ranging from 3x3x3 to 13x13x13.\n\nYou can use Tunnels to connect the outside block faces with any of the inside walls to transport items, fluids etc.\n\nYou can enter a Compact Machine by right-clicking it with a Personal Shrinking Device. Please use JEI to look up crafting recipes.", + "compactmachines.psd.pages.machines.title": "Compact Machines", + "curios.identifier.psd": "Personal Shrinking Device", + "death.attack.compactmachines_voidair": "%1$s failed to enter the void", + "item.compactmachines.personal_shrinking_device": "Personal Shrinking Device", + "item.compactmachines.tunnels.energy": "Energy Tunnel", + "item.compactmachines.tunnels.fluid": "Fluid Tunnel", + "item.compactmachines.tunnels.item": "Item Tunnel", + "item.compactmachines.upgrades.chunkloader": "Chunkloader Upgrade", + "item.compactmachines.upgrades.unnamed": "Unnamed Room Upgrade", + "itemGroup.compactmachines": "Compact Machines", + "jei.compactmachines.machines": "Machines are used to make pocket dimensions. Craft a machine and place it in world, then use a Personal Shrinking Device to go inside.", + "jei.compactmachines.shrinking_device": "Use the Personal Shrinking Device (PSD) on a machine in order to enter a compact space. You can also right click it in the overworld for more info.", + "machine.compactmachines.absurd": "Compact Machine (Absurd)", + "machine.compactmachines.colossal": "Compact Machine (Colossal)", + "machine.compactmachines.giant": "Compact Machine (Giant)", + "machine.compactmachines.large": "Compact Machine (Large)", + "machine.compactmachines.normal": "Compact Machine (Normal)", + "machine.compactmachines.small": "Compact Machine (Small)", + "machine.compactmachines.tiny": "Compact Machine (Tiny)", + "message.compactmachines.cannot_enter": "You fumble with the shrinking device, to no avail. It refuses to work.", + "message.compactmachines.cannot_rename_not_owner": "Only %s may rename this room.", + "message.compactmachines.how_did_you_get_here": "How did you get here?!", + "message.compactmachines.machine_room_info": "Machine at %1$s is bound to a %2$s size room at %3$s", + "message.compactmachines.new_machine": "New Machine", + "message.compactmachines.no_available_sides": "There are no available sides for this tunnel type.", + "message.compactmachines.no_machine_data": "No machine data loaded; report this.", + "message.compactmachines.not_the_room_owner": "You are not the room owner; only %s may make changes.", + "message.compactmachines.player_room_info": "Player '%1$s' is inside a %3$s room at %2$s.", + "message.compactmachines.spawnpoint_set": "New spawn point set.", + "message.compactmachines.teleport_oob": "An otherworldly force prevents your teleportation.", + "message.compactmachines.unknown_room_chunk": "Unknown room at %s; please verify it exists.", + "message.compactmachines.upgrade_add_failed": "Upgrade failed to apply to room.", + "message.compactmachines.upgrade_already_present": "Upgrade has already been applied to room.", + "message.compactmachines.upgrade_applied": "Upgrade applied to room.", + "message.compactmachines.upgrade_not_present": "Upgrade is not applied to the room.", + "message.compactmachines.upgrade_remove_failed": "Upgrade removal failed to apply to room.", + "message.compactmachines.upgrade_removed": "Upgrade removed from room.", + "tooltip.compactmachines.details.psd": "Used as in-game documentation and to enter Compact Machines.", + "tooltip.compactmachines.details.solid_wall": "Warning! Unbreakable for non-creative players!", + "tooltip.compactmachines.hint.hold_shift": "Hold shift for details.", + "tooltip.compactmachines.machine.bound_to": "Bound to: %1$s", + "tooltip.compactmachines.machine.id": "Machine #%s", + "tooltip.compactmachines.machine.owner": "Owner: %s", + "tooltip.compactmachines.machine.size": "Internal Size: %1$sx%1$sx%1$s", + "tooltip.compactmachines.room_name": "Bound to room: %s", + "tooltip.compactmachines.room_upgrade_type": "Type: %s", + "tooltip.compactmachines.tunnel_type": "Type ID: %1$s", + "tooltip.compactmachines.tutorial_apply_room_upgrade": "Use on a bound machine block to apply upgrade.", + "tooltip.compactmachines.unknown_player": "Unknown Player", + "tooltip.compactmachines.unknown_tunnel_type": "Unknown Tunnel Type (%s)" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json b/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json new file mode 100644 index 00000000..0edb0aab --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json @@ -0,0 +1,36 @@ +{ + "block.compactmachines.machine_giant": "Компактный механизм (Гигантский)", + "block.compactmachines.machine_large": "Компактный механизм (Большой)", + "block.compactmachines.machine_maximum": "Компактный механизм (Максимальный)", + "block.compactmachines.machine_normal": "Компактный механизм (Средний)", + "block.compactmachines.machine_small": "Компактный механизм (Маленький)", + "block.compactmachines.machine_tiny": "Компактный механизм (Крошечный)", + "block.compactmachines.solid_wall": "Прочная стена компактного механизма", + "block.compactmachines.tunnel_wall": "Прочная стена компактного механизма (с Туннелем)", + "block.compactmachines.wall": "Стена компактного механизма", + "compactmachines.connected_block": "Подключено: %s", + "compactmachines.direction.down": "Низ", + "compactmachines.direction.east": "Восток", + "compactmachines.direction.north": "Север", + "compactmachines.direction.side": "Сторона: %s", + "compactmachines.direction.south": "Юг", + "compactmachines.direction.up": "Верх", + "compactmachines.direction.west": "Запад", + "compactmachines.psd.pages.machines": "Компактные механизмы являются основной механикой этого мода. Они позволяют Вам строить большие комнаты в пространстве размером в один блок, соединённого с внешним миром.\nОни бывают разных размеров, начиная от 3x3x3 и заканчивая 13x13x13.\n\nВы можете использовать Туннели, чтобы соединять внешние стороны блока с внутренними стенами для транспортировки предметов, жидкостей и т.д.\n\nВойти в механизм можно, нажав по нему ПКМ Персональным сжимающим устройством. Пожалуйста, используйте JEI для просмотра рецептов создания.", + "compactmachines.psd.pages.machines.title": "Компактные механизмы", + "item.compactmachines.personal_shrinking_device": "Персональное сжимающее устройство", + "item.compactmachines.tunnel": "Предметный туннель", + "itemGroup.compactmachines": "Компактные механизмы", + "message.compactmachines.cannot_enter": "Вы возитесь с персональным сжимающим устройством, но безрезультатно. Оно отказывается работать.", + "message.compactmachines.no_machine_data": "Данные механизма не загружены; сообщите об этом разработчику.", + "message.compactmachines.spawnpoint_set": "Новая точка возрождения установлена.", + "tooltip.compactmachines.details.psd": "Используется в качестве внутриигровой документации, а также для входа в Компактные механизмы.", + "tooltip.compactmachines.details.solid_wall": "Внимание! Неразрушим для игроков без творческого режима!", + "tooltip.compactmachines.hint.hold_shift": "Удерживайте Shift для просмотра деталей.", + "tooltip.compactmachines.machine.id": "ID механизма: %s", + "tooltip.compactmachines.machine.owner": "Владелец: %s", + "tooltip.compactmachines.machine.size": "Размер: %1$sx%1$sx%1$s", + "tooltip.compactmachines.tunnel_type": "ID типа: %1$s", + "tooltip.compactmachines.unknown_player": "Неизвестный игрок", + "tooltip.compactmachines.unknown_tunnel_type": "Неизвестный тип канала (%s)" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json new file mode 100644 index 00000000..29db3656 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json @@ -0,0 +1,143 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#border" + }, + "east": { + "cullface": "east", + "texture": "#border" + }, + "north": { + "cullface": "north", + "texture": "#border" + }, + "south": { + "cullface": "south", + "texture": "#border" + }, + "up": { + "cullface": "up", + "texture": "#border" + }, + "west": { + "cullface": "west", + "texture": "#border" + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + }, + { + "faces": { + "down": { + "cullface": "down", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + }, + "east": { + "cullface": "east", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + }, + "south": { + "cullface": "south", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + }, + "up": { + "cullface": "up", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + }, + "west": { + "cullface": "west", + "emissivity": 2, + "texture": "#tint", + "tintindex": 0 + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + }, + { + "faces": { + "down": { + "cullface": "down", + "texture": "#overlay", + "tintindex": 1 + }, + "east": { + "cullface": "east", + "texture": "#overlay", + "tintindex": 1 + }, + "north": { + "cullface": "north", + "texture": "#overlay", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#overlay", + "tintindex": 1 + }, + "up": { + "cullface": "up", + "texture": "#overlay", + "tintindex": 1 + }, + "west": { + "cullface": "west", + "texture": "#overlay", + "tintindex": 1 + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + } + ], + "render_type": "minecraft:cutout_mipped_all", + "textures": { + "border": "compactmachines:block/machine/border", + "overlay": "compactmachines:block/machine/overlay", + "tint": "compactmachines:block/machine/tint" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json new file mode 100644 index 00000000..cd99e368 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_giant" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json new file mode 100644 index 00000000..004a4292 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_large" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json new file mode 100644 index 00000000..689a2f68 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_maximum" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json new file mode 100644 index 00000000..92b1ed83 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_normal" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json new file mode 100644 index 00000000..efa0936b --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_small" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json new file mode 100644 index 00000000..7ecb26b9 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/machine/machine_tiny" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json new file mode 100644 index 00000000..60f431ce --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "compactmachines:block/wall" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json new file mode 100644 index 00000000..ba002789 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "compactmachines:upgrades/chunkloader" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json new file mode 100644 index 00000000..03f0b5b1 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json new file mode 100644 index 00000000..3d3b9b68 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_giant" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json new file mode 100644 index 00000000..c7f0b63f --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_large" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json new file mode 100644 index 00000000..6c3c130f --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_maximum" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json new file mode 100644 index 00000000..0e5006ea --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_normal" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json new file mode 100644 index 00000000..eaa64590 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_small" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json new file mode 100644 index 00000000..d289b421 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine_tiny" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json new file mode 100644 index 00000000..03f0b5b1 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/machine/machine" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json new file mode 100644 index 00000000..0ac4acb9 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "compactmachines:item/personal_shrinking_device" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json new file mode 100644 index 00000000..b62025de --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/wall" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json new file mode 100644 index 00000000..46ed8ef1 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "compactmachines:item/tunnel" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json new file mode 100644 index 00000000..b62025de --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json @@ -0,0 +1,3 @@ +{ + "parent": "compactmachines:block/wall" +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json new file mode 100644 index 00000000..5333b73c --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json @@ -0,0 +1,135 @@ +{ + "parent": "minecraft:block/block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#wall" + }, + "east": { + "cullface": "east", + "texture": "#wall" + }, + "north": { + "cullface": "north", + "texture": "#wall" + }, + "south": { + "cullface": "south", + "texture": "#wall" + }, + "up": { + "cullface": "up", + "texture": "#wall" + }, + "west": { + "cullface": "west", + "texture": "#wall" + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + }, + { + "faces": { + "down": { + "cullface": "down", + "texture": "#tunnel", + "tintindex": 0 + }, + "east": { + "cullface": "east", + "texture": "#tunnel", + "tintindex": 0 + }, + "north": { + "cullface": "north", + "texture": "#tunnel", + "tintindex": 0 + }, + "south": { + "cullface": "south", + "texture": "#tunnel", + "tintindex": 0 + }, + "up": { + "cullface": "up", + "texture": "#tunnel", + "tintindex": 0 + }, + "west": { + "cullface": "west", + "texture": "#tunnel", + "tintindex": 0 + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + }, + { + "faces": { + "down": { + "cullface": "down", + "texture": "#indicator", + "tintindex": 1 + }, + "east": { + "cullface": "east", + "texture": "#indicator", + "tintindex": 1 + }, + "north": { + "cullface": "north", + "texture": "#indicator", + "tintindex": 1 + }, + "south": { + "cullface": "south", + "texture": "#indicator", + "tintindex": 1 + }, + "up": { + "cullface": "up", + "texture": "#indicator", + "tintindex": 1 + }, + "west": { + "cullface": "west", + "texture": "#indicator", + "tintindex": 1 + } + }, + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + } + ], + "textures": { + "indicator": "compactmachines:block/tunnels/indicator", + "tunnel": "compactmachines:block/tunnels/tunnel" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json new file mode 100644 index 00000000..04aa8827 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/down" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json new file mode 100644 index 00000000..65bfb276 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/east" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json new file mode 100644 index 00000000..f1ccc1ec --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/north" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json new file mode 100644 index 00000000..847de2b4 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/south" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json new file mode 100644 index 00000000..dc98bc5a --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/up" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json new file mode 100644 index 00000000..b16d9202 --- /dev/null +++ b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json @@ -0,0 +1,7 @@ +{ + "parent": "compactmachines:tunnels/base", + "render_type": "minecraft:cutout", + "textures": { + "wall": "compactmachines:block/tunnels/west" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json new file mode 100644 index 00000000..5047ad60 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_giant" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_giant.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_giant" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_giant" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json new file mode 100644 index 00000000..a0e2c9a6 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_large" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_large.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_large" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_large" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json new file mode 100644 index 00000000..0d54759f --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_max" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_max.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_maximum" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_max" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json new file mode 100644 index 00000000..ed908267 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_normal" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_normal.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_normal" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_normal" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json new file mode 100644 index 00000000..ef4a0eb0 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_small" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_small.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_small" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_small" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json new file mode 100644 index 00000000..fe7e6e1e --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:got_shrinking_device", + "criteria": { + "claimed_machine": { + "conditions": {}, + "trigger": "compactmachines:claimed_machine_tiny" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.claimed_machine_tiny.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_tiny" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.claimed_machine_tiny" + } + }, + "requirements": [ + [ + "claimed_machine" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json b/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json new file mode 100644 index 00000000..06ce065b --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json @@ -0,0 +1,37 @@ +{ + "parent": "compactmachines:root", + "criteria": { + "obtained_wall": { + "conditions": { + "items": [ + { + "items": [ + "compactmachines:wall" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.foundations.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:wall" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.foundations" + } + }, + "requirements": [ + [ + "obtained_wall" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json new file mode 100644 index 00000000..2bd77b32 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json @@ -0,0 +1,37 @@ +{ + "parent": "compactmachines:root", + "criteria": { + "obtained_psd": { + "conditions": { + "items": [ + { + "items": [ + "compactmachines:personal_shrinking_device" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.got_shrinking_device.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:personal_shrinking_device" + }, + "show_toast": true, + "title": { + "translate": "advancement.compactmachines.got_shrinking_device" + } + }, + "requirements": [ + [ + "obtained_psd" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json b/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json new file mode 100644 index 00000000..40f0e867 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:root", + "criteria": { + "got_stuck": { + "conditions": {}, + "trigger": "compactmachines:how_did_you_get_here" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.how_did_you_get_here.desc" + }, + "frame": "challenge", + "hidden": true, + "icon": { + "item": "compactmachines:personal_shrinking_device" + }, + "show_toast": false, + "title": { + "translate": "advancement.compactmachines.how_did_you_get_here" + } + }, + "requirements": [ + [ + "got_stuck" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json new file mode 100644 index 00000000..9c183b45 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_absurd" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_absurd" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json new file mode 100644 index 00000000..60cad3db --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_colossal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_colossal" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json new file mode 100644 index 00000000..8595c653 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_giant" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_giant" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json new file mode 100644 index 00000000..9d02638a --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_large" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_large" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json new file mode 100644 index 00000000..d33c1b95 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_normal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_normal" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json new file mode 100644 index 00000000..709d8380 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_small" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_small" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json new file mode 100644 index 00000000..b823f78c --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json @@ -0,0 +1,20 @@ +{ + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:new_machine_tiny" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:new_machine_tiny" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json new file mode 100644 index 00000000..b559b9a1 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:personal_shrinking_device" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "picked_up_ender_eye": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:ender_eye" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "picked_up_ender_eye", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:personal_shrinking_device" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json new file mode 100644 index 00000000..6d2e55cf --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:wall" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "picked_up_deepslate": { + "conditions": { + "items": [ + { + "tag": "forge:cobblestone/deepslate" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "picked_up_deepslate", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:wall" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json new file mode 100644 index 00000000..3ec08921 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:tunnels/energy" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "observer": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:observer" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "observer", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:energy" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json new file mode 100644 index 00000000..8fa3c89a --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:tunnels/fluid" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "observer": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:observer" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "observer", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:fluid" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json new file mode 100644 index 00000000..bd2ca9d4 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "compactmachines:tunnels/item" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "observer": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:observer" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "observer", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "compactmachines:item" + ] + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json new file mode 100644 index 00000000..802395c9 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json @@ -0,0 +1,29 @@ +{ + "parent": "compactmachines:root", + "criteria": { + "recursion": { + "conditions": {}, + "trigger": "compactmachines:recursion" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancement.compactmachines.recursion.desc" + }, + "frame": "challenge", + "hidden": true, + "icon": { + "item": "compactmachines:personal_shrinking_device" + }, + "show_toast": false, + "title": { + "translate": "advancement.compactmachines.recursion" + } + }, + "requirements": [ + [ + "recursion" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/root.json b/forge-main/src/generated/resources/data/compactmachines/advancements/root.json new file mode 100644 index 00000000..3b4810e7 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/advancements/root.json @@ -0,0 +1,28 @@ +{ + "criteria": { + "root": { + "trigger": "minecraft:impossible" + } + }, + "display": { + "announce_to_chat": false, + "background": "compactmachines:textures/block/wall.png", + "description": { + "translate": "advancement.compactmachines.root.desc" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "compactmachines:machine_normal" + }, + "show_toast": false, + "title": { + "translate": "advancement.compactmachines.root" + } + }, + "requirements": [ + [ + "root" + ] + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json new file mode 100644 index 00000000..14b452ab --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json @@ -0,0 +1,4 @@ +{ + "color": -16734632, + "dimensions": [ 25, 25, 25 ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json new file mode 100644 index 00000000..713c2f80 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json @@ -0,0 +1,8 @@ +{ + "color": -12435646, + "dimensions": [ + 13, + 13, + 13 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json new file mode 100644 index 00000000..280b719d --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json @@ -0,0 +1,8 @@ +{ + "color": -12331315, + "dimensions": [ + 11, + 11, + 11 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json new file mode 100644 index 00000000..0a855755 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json @@ -0,0 +1,8 @@ +{ + "color": -14607570, + "dimensions": [ + 9, + 9, + 9 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json new file mode 100644 index 00000000..3caa8209 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json @@ -0,0 +1,8 @@ +{ + "color": -265674, + "dimensions": [ + 7, + 7, + 7 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json new file mode 100644 index 00000000..168f1b61 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json @@ -0,0 +1,8 @@ +{ + "color": -2829614, + "dimensions": [ + 5, + 5, + 5 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json new file mode 100644 index 00000000..706ea617 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json @@ -0,0 +1,8 @@ +{ + "color": -3581165, + "dimensions": [ + 3, + 3, + 3 + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json b/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json new file mode 100644 index 00000000..cd685317 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json @@ -0,0 +1,17 @@ +{ + "type": "ResourceKey[minecraft:dimension / compactmachines:compact_world]", + "generator": { + "type": "minecraft:flat", + "settings": { + "biome": "compactmachines:machine", + "features": false, + "lakes": false, + "layers": [ + { + "block": "compactmachines:machine_void_air", + "height": 256 + } + ] + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json b/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json new file mode 100644 index 00000000..06c3fac6 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json @@ -0,0 +1,26 @@ +{ + "ambient_light": 0.0, + "bed_works": false, + "coordinate_scale": 1.0, + "effects": "minecraft:overworld", + "fixed_time": 18000, + "has_ceiling": false, + "has_raids": false, + "has_skylight": true, + "height": 256, + "infiniburn": "#minecraft:infiniburn_overworld", + "logical_height": 256, + "min_y": 0, + "monster_spawn_block_light_limit": 0, + "monster_spawn_light_level": { + "type": "minecraft:uniform", + "value": { + "max_inclusive": 7, + "min_inclusive": 0 + } + }, + "natural": false, + "piglin_safe": false, + "respawn_anchor_works": false, + "ultrawarm": false +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json new file mode 100644 index 00000000..358695d2 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json new file mode 100644 index 00000000..698b696b --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_giant", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json new file mode 100644 index 00000000..73a4ec72 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_large", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json new file mode 100644 index 00000000..49cea905 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_maximum", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json new file mode 100644 index 00000000..8d032983 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_normal", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json new file mode 100644 index 00000000..5f68eccd --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_small", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json new file mode 100644 index 00000000..ce53a963 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:machine" + } + ], + "functions": [ + { + "function": "compactmachines:copy_room_binding" + } + ], + "name": "compactmachines:machine_tiny", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json new file mode 100644 index 00000000..a92ff7f0 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "compactmachines:wall" + } + ], + "name": "compactmachines:wall", + "rolls": 1.0 + } + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json new file mode 100644 index 00000000..af76abbf --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:nether_stars" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -16734632, + "template_id": "compactmachines:absurd" + }, + "machine_color": -16734632, + "template_id": "compactmachines:absurd" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json new file mode 100644 index 00000000..74855294 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:ingots/netherite" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -12435646, + "template_id": "compactmachines:colossal" + }, + "machine_color": -12435646, + "template_id": "compactmachines:colossal" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json new file mode 100644 index 00000000..9cb943ef --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:obsidian" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -12331315, + "template_id": "compactmachines:giant" + }, + "machine_color": -12331315, + "template_id": "compactmachines:giant" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json new file mode 100644 index 00000000..db3d272d --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:storage_blocks/diamond" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -14607570, + "template_id": "compactmachines:large" + }, + "machine_color": -14607570, + "template_id": "compactmachines:large" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json new file mode 100644 index 00000000..5d359968 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:storage_blocks/gold" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -265674, + "template_id": "compactmachines:normal" + }, + "machine_color": -265674, + "template_id": "compactmachines:normal" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json new file mode 100644 index 00000000..b8d6eeba --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:storage_blocks/iron" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -2829614, + "template_id": "compactmachines:small" + }, + "machine_color": -2829614, + "template_id": "compactmachines:small" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json new file mode 100644 index 00000000..2ab2adaa --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "C": { + "tag": "forge:storage_blocks/copper" + }, + "W": { + "item": "compactmachines:wall" + } + }, + "pattern": [ + "WWW", + "WCW", + "WWW" + ], + "result": { + "item": "compactmachines:new_machine", + "nbt": { + "BlockEntityTag": { + "id": "compactmachines:compact_machine", + "machine_color": -3581165, + "template_id": "compactmachines:tiny" + }, + "machine_color": -3581165, + "template_id": "compactmachines:tiny" + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json new file mode 100644 index 00000000..1744ce2f --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "B": { + "item": "minecraft:book" + }, + "E": { + "item": "minecraft:ender_eye" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "P": { + "tag": "forge:glass_panes" + } + }, + "pattern": [ + " P ", + "EBE", + " I " + ], + "result": { + "item": "compactmachines:personal_shrinking_device" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json new file mode 100644 index 00000000..2957a313 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:glowstone_dust" + }, + { + "item": "minecraft:ender_pearl" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:observer" + } + ], + "result": { + "count": 2, + "item": "compactmachines:tunnel", + "nbt": { + "definition": { + "id": "compactmachines:energy" + } + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json new file mode 100644 index 00000000..393ad8eb --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:bucket" + }, + { + "item": "minecraft:ender_pearl" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:observer" + } + ], + "result": { + "count": 2, + "item": "compactmachines:tunnel", + "nbt": { + "definition": { + "id": "compactmachines:fluid" + } + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json new file mode 100644 index 00000000..3c157386 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "tag": "forge:chests" + }, + { + "item": "minecraft:ender_pearl" + }, + { + "item": "minecraft:redstone" + }, + { + "item": "minecraft:observer" + } + ], + "result": { + "count": 2, + "item": "compactmachines:tunnel", + "nbt": { + "definition": { + "id": "compactmachines:item" + } + } + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json b/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json new file mode 100644 index 00000000..264133a3 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "key": { + "D": { + "item": "minecraft:polished_deepslate" + } + }, + "pattern": [ + "DDD", + "D D", + "DDD" + ], + "result": { + "count": 8, + "item": "compactmachines:wall" + } +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json new file mode 100644 index 00000000..d26628e8 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json @@ -0,0 +1,10 @@ +{ + "values": [ + "compactmachines:machine_tiny", + "compactmachines:machine_large", + "compactmachines:machine_normal", + "compactmachines:machine_maximum", + "compactmachines:machine_small", + "compactmachines:machine_giant" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json new file mode 100644 index 00000000..3172cee4 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json @@ -0,0 +1,11 @@ +{ + "values": [ + "compactmachines:machine_tiny", + "compactmachines:machine_large", + "compactmachines:machine_normal", + "compactmachines:machine_maximum", + "compactmachines:machine_small", + "compactmachines:machine_giant", + "compactmachines:machine" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json new file mode 100644 index 00000000..d50bdd2d --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json @@ -0,0 +1,12 @@ +{ + "values": [ + "compactmachines:machine_small", + "compactmachines:machine_tiny", + "compactmachines:machine_maximum", + "compactmachines:machine_normal", + "compactmachines:machine_giant", + "compactmachines:machine_large", + "compactmachines:machine", + "compactmachines:new_machine" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json new file mode 100644 index 00000000..50be3eec --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json @@ -0,0 +1,5 @@ +{ + "values": [ + "compactmachines:chunkloader_upgrade" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json new file mode 100644 index 00000000..eca08a1c --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json @@ -0,0 +1,5 @@ +{ + "values": [ + "compactmachines:personal_shrinking_device" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json b/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json new file mode 100644 index 00000000..fb710fa1 --- /dev/null +++ b/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json @@ -0,0 +1,124 @@ +{ + "carvers": {}, + "downfall": 0.0, + "effects": { + "fog_color": 12638463, + "sky_color": -16777216, + "water_color": 4159204, + "water_fog_color": 329011 + }, + "features": [], + "precipitation": "none", + "spawn_costs": {}, + "spawners": { + "ambient": [ + { + "type": "minecraft:bat", + "maxCount": 8, + "minCount": 8, + "weight": 10 + } + ], + "axolotls": [], + "creature": [ + { + "type": "minecraft:sheep", + "maxCount": 4, + "minCount": 4, + "weight": 12 + }, + { + "type": "minecraft:pig", + "maxCount": 4, + "minCount": 4, + "weight": 10 + }, + { + "type": "minecraft:chicken", + "maxCount": 4, + "minCount": 4, + "weight": 10 + }, + { + "type": "minecraft:cow", + "maxCount": 4, + "minCount": 4, + "weight": 8 + }, + { + "type": "minecraft:horse", + "maxCount": 6, + "minCount": 2, + "weight": 5 + }, + { + "type": "minecraft:donkey", + "maxCount": 3, + "minCount": 1, + "weight": 1 + } + ], + "misc": [], + "monster": [ + { + "type": "minecraft:spider", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:zombie", + "maxCount": 4, + "minCount": 4, + "weight": 95 + }, + { + "type": "minecraft:zombie_villager", + "maxCount": 1, + "minCount": 1, + "weight": 5 + }, + { + "type": "minecraft:skeleton", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:creeper", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:slime", + "maxCount": 4, + "minCount": 4, + "weight": 100 + }, + { + "type": "minecraft:enderman", + "maxCount": 4, + "minCount": 1, + "weight": 10 + }, + { + "type": "minecraft:witch", + "maxCount": 1, + "minCount": 1, + "weight": 5 + } + ], + "underground_water_creature": [ + { + "type": "minecraft:glow_squid", + "maxCount": 6, + "minCount": 4, + "weight": 10 + } + ], + "water_ambient": [], + "water_creature": [] + }, + "temperature": 0.8 +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/curios/tags/items/psd.json b/forge-main/src/generated/resources/data/curios/tags/items/psd.json new file mode 100644 index 00000000..eca08a1c --- /dev/null +++ b/forge-main/src/generated/resources/data/curios/tags/items/psd.json @@ -0,0 +1,5 @@ +{ + "values": [ + "compactmachines:personal_shrinking_device" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 00000000..dae8e6c0 --- /dev/null +++ b/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,12 @@ +{ + "values": [ + "compactmachines:wall", + "compactmachines:machine_tiny", + "compactmachines:machine_large", + "compactmachines:machine_normal", + "compactmachines:machine_maximum", + "compactmachines:machine_small", + "compactmachines:machine_giant", + "compactmachines:machine" + ] +} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json new file mode 100644 index 00000000..dae8e6c0 --- /dev/null +++ b/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json @@ -0,0 +1,12 @@ +{ + "values": [ + "compactmachines:wall", + "compactmachines:machine_tiny", + "compactmachines:machine_large", + "compactmachines:machine_normal", + "compactmachines:machine_maximum", + "compactmachines:machine_small", + "compactmachines:machine_giant", + "compactmachines:machine" + ] +} \ No newline at end of file diff --git a/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java similarity index 100% rename from src/main/java/dev/compactmods/machines/CompactMachines.java rename to forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java diff --git a/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java similarity index 100% rename from src/main/java/dev/compactmods/machines/ModDataUpgrader.java rename to forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java diff --git a/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java diff --git a/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java diff --git a/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java diff --git a/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java diff --git a/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java diff --git a/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java similarity index 100% rename from src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java rename to forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java diff --git a/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/ClientEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java diff --git a/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java b/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java rename to forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java diff --git a/src/main/java/dev/compactmods/machines/client/Resources.java b/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/Resources.java rename to forge-main/src/main/java/dev/compactmods/machines/client/Resources.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/GuiIds.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java diff --git a/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java rename to forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java diff --git a/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java rename to forge-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java diff --git a/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java rename to forge-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java diff --git a/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java rename to forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java diff --git a/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java rename to forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java diff --git a/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java diff --git a/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/render/RenderTypes.java rename to forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java diff --git a/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java b/forge-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java rename to forge-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java diff --git a/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java b/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java rename to forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java diff --git a/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java similarity index 100% rename from src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java diff --git a/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java b/forge-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java similarity index 100% rename from src/main/java/dev/compactmods/machines/codec/CodecExtensions.java rename to forge-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java diff --git a/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java b/forge-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java similarity index 100% rename from src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java rename to forge-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java diff --git a/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java b/forge-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java similarity index 100% rename from src/main/java/dev/compactmods/machines/codec/NbtListCollector.java rename to forge-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java diff --git a/src/main/java/dev/compactmods/machines/command/Commands.java b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/Commands.java rename to forge-main/src/main/java/dev/compactmods/machines/command/Commands.java diff --git a/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java diff --git a/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java diff --git a/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java diff --git a/src/main/java/dev/compactmods/machines/compat/InterModCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/InterModCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java diff --git a/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java diff --git a/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java diff --git a/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java diff --git a/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java similarity index 100% rename from src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java diff --git a/src/main/java/dev/compactmods/machines/config/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java similarity index 100% rename from src/main/java/dev/compactmods/machines/config/CommonConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java diff --git a/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java similarity index 100% rename from src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java rename to forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java diff --git a/src/main/java/dev/compactmods/machines/config/ServerConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java similarity index 100% rename from src/main/java/dev/compactmods/machines/config/ServerConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java diff --git a/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/CommonEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java diff --git a/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java rename to forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java diff --git a/src/main/java/dev/compactmods/machines/core/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/ModBusEvents.java rename to forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java diff --git a/src/main/java/dev/compactmods/machines/core/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/Registries.java rename to forge-main/src/main/java/dev/compactmods/machines/core/Registries.java diff --git a/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/ServerEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java diff --git a/src/main/java/dev/compactmods/machines/core/UIRegistration.java b/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java similarity index 100% rename from src/main/java/dev/compactmods/machines/core/UIRegistration.java rename to forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java diff --git a/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java similarity index 100% rename from src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java rename to forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java diff --git a/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java similarity index 100% rename from src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java diff --git a/src/main/java/dev/compactmods/machines/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java similarity index 100% rename from src/main/java/dev/compactmods/machines/dimension/Dimension.java rename to forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java diff --git a/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java diff --git a/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java b/forge-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java diff --git a/src/main/java/dev/compactmods/machines/graph/Graph.java b/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/Graph.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java diff --git a/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java b/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/IGraphEdge.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphNode.java b/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/IGraphNode.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java diff --git a/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java diff --git a/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java diff --git a/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java similarity index 100% rename from src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java rename to forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java diff --git a/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java b/forge-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java diff --git a/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java similarity index 100% rename from src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java rename to forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java diff --git a/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java similarity index 100% rename from src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java rename to forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java diff --git a/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java b/forge-main/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java similarity index 100% rename from src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java rename to forge-main/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java diff --git a/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java b/forge-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java diff --git a/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java b/forge-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java diff --git a/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java diff --git a/src/main/java/dev/compactmods/machines/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/Machines.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java diff --git a/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java diff --git a/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java diff --git a/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java diff --git a/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java diff --git a/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/client/MachineColors.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java diff --git a/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java diff --git a/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java b/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java diff --git a/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java b/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java diff --git a/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java diff --git a/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java diff --git a/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java diff --git a/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java diff --git a/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java diff --git a/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java diff --git a/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java diff --git a/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java b/forge-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java rename to forge-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java diff --git a/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/RoomCapabilities.java rename to forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java diff --git a/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java diff --git a/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/RoomEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java diff --git a/src/main/java/dev/compactmods/machines/room/Rooms.java b/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/Rooms.java rename to forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java diff --git a/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java rename to forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java diff --git a/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java diff --git a/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java diff --git a/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java rename to forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java diff --git a/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java rename to forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java diff --git a/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java rename to forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java diff --git a/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/data/LootFunctions.java rename to forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java diff --git a/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/data/RoomPreview.java rename to forge-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java diff --git a/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java b/forge-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java rename to forge-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java diff --git a/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java rename to forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java diff --git a/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java b/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java rename to forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java diff --git a/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java rename to forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java diff --git a/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java diff --git a/src/main/java/dev/compactmods/machines/room/network/InitialRoomBlockDataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/InitialRoomBlockDataPacket.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/network/InitialRoomBlockDataPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/room/network/InitialRoomBlockDataPacket.java diff --git a/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java diff --git a/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerStartedRoomTrackingPacket.java diff --git a/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java diff --git a/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java similarity index 100% rename from src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java rename to forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java diff --git a/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java similarity index 100% rename from src/main/java/dev/compactmods/machines/shrinking/Shrinking.java rename to forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/Tunnels.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java diff --git a/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/graph/readme.md rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md diff --git a/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java similarity index 100% rename from src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java diff --git a/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java similarity index 100% rename from src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java diff --git a/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java diff --git a/src/main/java/dev/compactmods/machines/util/DimensionUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/DimensionUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java diff --git a/src/main/java/dev/compactmods/machines/util/MathUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/MathUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java diff --git a/src/main/java/dev/compactmods/machines/util/NbtUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/NbtUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java diff --git a/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/PlayerUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java diff --git a/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java b/forge-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/SavedDataHelper.java rename to forge-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java diff --git a/src/main/java/dev/compactmods/machines/util/VersionUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/VersionUtil.java similarity index 100% rename from src/main/java/dev/compactmods/machines/util/VersionUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/util/VersionUtil.java diff --git a/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java diff --git a/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java b/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java similarity index 100% rename from src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java diff --git a/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java diff --git a/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java similarity index 100% rename from src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java diff --git a/src/main/java/dev/compactmods/machines/wall/Walls.java b/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java similarity index 100% rename from src/main/java/dev/compactmods/machines/wall/Walls.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/forge-main/src/main/resources/META-INF/accesstransformer.cfg similarity index 100% rename from src/main/resources/META-INF/accesstransformer.cfg rename to forge-main/src/main/resources/META-INF/accesstransformer.cfg diff --git a/src/main/resources/META-INF/mods.toml b/forge-main/src/main/resources/META-INF/mods.toml similarity index 100% rename from src/main/resources/META-INF/mods.toml rename to forge-main/src/main/resources/META-INF/mods.toml diff --git a/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.fsh b/forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.fsh similarity index 100% rename from src/main/resources/assets/compactmachines/shaders/core/block_fullbright.fsh rename to forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.fsh diff --git a/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.json b/forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.json similarity index 100% rename from src/main/resources/assets/compactmachines/shaders/core/block_fullbright.json rename to forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.json diff --git a/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.vsh b/forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.vsh similarity index 100% rename from src/main/resources/assets/compactmachines/shaders/core/block_fullbright.vsh rename to forge-main/src/main/resources/assets/compactmachines/shaders/core/block_fullbright.vsh diff --git a/src/main/resources/assets/compactmachines/shaders/core/wall.fsh b/forge-main/src/main/resources/assets/compactmachines/shaders/core/wall.fsh similarity index 100% rename from src/main/resources/assets/compactmachines/shaders/core/wall.fsh rename to forge-main/src/main/resources/assets/compactmachines/shaders/core/wall.fsh diff --git a/src/main/resources/assets/compactmachines/shaders/core/wall.json b/forge-main/src/main/resources/assets/compactmachines/shaders/core/wall.json similarity index 100% rename from src/main/resources/assets/compactmachines/shaders/core/wall.json rename to forge-main/src/main/resources/assets/compactmachines/shaders/core/wall.json diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/border.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/border.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/border.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/border.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_giant.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_giant.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_giant.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_giant.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_large.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_large.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_large.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_large.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_maximum.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_maximum.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_maximum.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_maximum.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_normal.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_normal.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_normal.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_normal.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_small.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_small.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_small.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_small.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/machine_tiny.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_tiny.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/machine_tiny.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/machine_tiny.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/overlay.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png diff --git a/src/main/resources/assets/compactmachines/textures/block/machine/tint.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/tint.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/machine/tint.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/machine/tint.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/down.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/down.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/down.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/down.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/east.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/east.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/east.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/east.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/indicator.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/indicator.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/indicator.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/indicator.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/none.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/none.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/none.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/none.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/north.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/north.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/north.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/north.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/south.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/south.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/south.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/south.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/tunnel.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/tunnel.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/tunnel.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/tunnel.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/up.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/up.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/up.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/up.png diff --git a/src/main/resources/assets/compactmachines/textures/block/tunnels/west.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/west.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/tunnels/west.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/tunnels/west.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_giant.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_giant.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_giant.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_giant.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_large.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_large.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_large.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_large.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_maximum.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_maximum.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_maximum.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_maximum.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_normal.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_normal.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_normal.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_normal.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_small.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_small.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_small.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_small.png diff --git a/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_tiny.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_tiny.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_tiny.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/upgrades/upgrade_tiny.png diff --git a/src/main/resources/assets/compactmachines/textures/block/wall.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/wall.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/block/wall.png rename to forge-main/src/main/resources/assets/compactmachines/textures/block/wall.png diff --git a/src/main/resources/assets/compactmachines/textures/curios/empty_psd.png b/forge-main/src/main/resources/assets/compactmachines/textures/curios/empty_psd.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/curios/empty_psd.png rename to forge-main/src/main/resources/assets/compactmachines/textures/curios/empty_psd.png diff --git a/src/main/resources/assets/compactmachines/textures/entities/villager.png b/forge-main/src/main/resources/assets/compactmachines/textures/entities/villager.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/entities/villager.png rename to forge-main/src/main/resources/assets/compactmachines/textures/entities/villager.png diff --git a/src/main/resources/assets/compactmachines/textures/gui/field_example.png b/forge-main/src/main/resources/assets/compactmachines/textures/gui/field_example.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/gui/field_example.png rename to forge-main/src/main/resources/assets/compactmachines/textures/gui/field_example.png diff --git a/src/main/resources/assets/compactmachines/textures/gui/psd_screen.png b/forge-main/src/main/resources/assets/compactmachines/textures/gui/psd_screen.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/gui/psd_screen.png rename to forge-main/src/main/resources/assets/compactmachines/textures/gui/psd_screen.png diff --git a/src/main/resources/assets/compactmachines/textures/gui/room_menu.png b/forge-main/src/main/resources/assets/compactmachines/textures/gui/room_menu.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/gui/room_menu.png rename to forge-main/src/main/resources/assets/compactmachines/textures/gui/room_menu.png diff --git a/src/main/resources/assets/compactmachines/textures/gui/tabicons.png b/forge-main/src/main/resources/assets/compactmachines/textures/gui/tabicons.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/gui/tabicons.png rename to forge-main/src/main/resources/assets/compactmachines/textures/gui/tabicons.png diff --git a/src/main/resources/assets/compactmachines/textures/item/minifluiddrop.png b/forge-main/src/main/resources/assets/compactmachines/textures/item/minifluiddrop.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/item/minifluiddrop.png rename to forge-main/src/main/resources/assets/compactmachines/textures/item/minifluiddrop.png diff --git a/src/main/resources/assets/compactmachines/textures/item/personal_shrinking_device.png b/forge-main/src/main/resources/assets/compactmachines/textures/item/personal_shrinking_device.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/item/personal_shrinking_device.png rename to forge-main/src/main/resources/assets/compactmachines/textures/item/personal_shrinking_device.png diff --git a/src/main/resources/assets/compactmachines/textures/item/room_core.png b/forge-main/src/main/resources/assets/compactmachines/textures/item/room_core.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/item/room_core.png rename to forge-main/src/main/resources/assets/compactmachines/textures/item/room_core.png diff --git a/src/main/resources/assets/compactmachines/textures/item/tunnel.png b/forge-main/src/main/resources/assets/compactmachines/textures/item/tunnel.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/item/tunnel.png rename to forge-main/src/main/resources/assets/compactmachines/textures/item/tunnel.png diff --git a/src/main/resources/assets/compactmachines/textures/particles/blockmarker.png b/forge-main/src/main/resources/assets/compactmachines/textures/particles/blockmarker.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/particles/blockmarker.png rename to forge-main/src/main/resources/assets/compactmachines/textures/particles/blockmarker.png diff --git a/src/main/resources/assets/compactmachines/textures/upgrades/chunkloader.png b/forge-main/src/main/resources/assets/compactmachines/textures/upgrades/chunkloader.png similarity index 100% rename from src/main/resources/assets/compactmachines/textures/upgrades/chunkloader.png rename to forge-main/src/main/resources/assets/compactmachines/textures/upgrades/chunkloader.png diff --git a/src/main/resources/pack.mcmeta b/forge-main/src/main/resources/pack.mcmeta similarity index 100% rename from src/main/resources/pack.mcmeta rename to forge-main/src/main/resources/pack.mcmeta diff --git a/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java b/forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java rename to forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java diff --git a/src/test/java/dev/compactmods/machines/test/MathTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/MathTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java diff --git a/src/test/java/dev/compactmods/machines/test/ServerEvents.java b/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/ServerEvents.java rename to forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java diff --git a/src/test/java/dev/compactmods/machines/test/TestBatches.java b/forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/TestBatches.java rename to forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java diff --git a/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java diff --git a/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java b/forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java rename to forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java diff --git a/src/test/java/dev/compactmods/machines/test/data/CodecTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/data/CodecTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java diff --git a/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java diff --git a/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java diff --git a/src/test/java/dev/compactmods/machines/test/util/FileHelper.java b/forge-main/src/test/java/dev/compactmods/machines/test/util/FileHelper.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/util/FileHelper.java rename to forge-main/src/test/java/dev/compactmods/machines/test/util/FileHelper.java diff --git a/src/test/java/dev/compactmods/machines/test/util/TestUtil.java b/forge-main/src/test/java/dev/compactmods/machines/test/util/TestUtil.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/util/TestUtil.java rename to forge-main/src/test/java/dev/compactmods/machines/test/util/TestUtil.java diff --git a/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java diff --git a/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java similarity index 100% rename from src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java rename to forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java diff --git a/src/test/resources/data/compactmachines/structures/empty_15x15.nbt b/forge-main/src/test/resources/data/compactmachines/structures/empty_15x15.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/empty_15x15.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/empty_15x15.nbt diff --git a/src/test/resources/data/compactmachines/structures/empty_15x31.nbt b/forge-main/src/test/resources/data/compactmachines/structures/empty_15x31.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/empty_15x31.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/empty_15x31.nbt diff --git a/src/test/resources/data/compactmachines/structures/empty_1x1.nbt b/forge-main/src/test/resources/data/compactmachines/structures/empty_1x1.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/empty_1x1.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/empty_1x1.nbt diff --git a/src/test/resources/data/compactmachines/structures/empty_5x5.nbt b/forge-main/src/test/resources/data/compactmachines/structures/empty_5x5.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/empty_5x5.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/empty_5x5.nbt diff --git a/src/test/resources/data/compactmachines/structures/giant.nbt b/forge-main/src/test/resources/data/compactmachines/structures/giant.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/giant.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/giant.nbt diff --git a/src/test/resources/data/compactmachines/structures/large.nbt b/forge-main/src/test/resources/data/compactmachines/structures/large.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/large.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/large.nbt diff --git a/src/test/resources/data/compactmachines/structures/maximum.nbt b/forge-main/src/test/resources/data/compactmachines/structures/maximum.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/maximum.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/maximum.nbt diff --git a/src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt b/forge-main/src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/mekanism/empty_1x1.nbt diff --git a/src/test/resources/data/compactmachines/structures/normal.nbt b/forge-main/src/test/resources/data/compactmachines/structures/normal.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/normal.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/normal.nbt diff --git a/src/test/resources/data/compactmachines/structures/small.nbt b/forge-main/src/test/resources/data/compactmachines/structures/small.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/small.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/small.nbt diff --git a/src/test/resources/data/compactmachines/structures/template_max.nbt b/forge-main/src/test/resources/data/compactmachines/structures/template_max.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/template_max.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/template_max.nbt diff --git a/src/test/resources/data/compactmachines/structures/tiny.nbt b/forge-main/src/test/resources/data/compactmachines/structures/tiny.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/tiny.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/tiny.nbt diff --git a/src/test/resources/data/compactmachines/structures/tunneltests.solid_wall_3x3.nbt b/forge-main/src/test/resources/data/compactmachines/structures/tunneltests.solid_wall_3x3.nbt similarity index 100% rename from src/test/resources/data/compactmachines/structures/tunneltests.solid_wall_3x3.nbt rename to forge-main/src/test/resources/data/compactmachines/structures/tunneltests.solid_wall_3x3.nbt diff --git a/src/test/resources/migrate/pre520/connections.dat b/forge-main/src/test/resources/migrate/pre520/connections.dat similarity index 100% rename from src/test/resources/migrate/pre520/connections.dat rename to forge-main/src/test/resources/migrate/pre520/connections.dat diff --git a/src/test/resources/migrate/pre520/level.dat b/forge-main/src/test/resources/migrate/pre520/level.dat similarity index 100% rename from src/test/resources/migrate/pre520/level.dat rename to forge-main/src/test/resources/migrate/pre520/level.dat diff --git a/src/test/resources/migrate/pre520/level.dat_old b/forge-main/src/test/resources/migrate/pre520/level.dat_old similarity index 100% rename from src/test/resources/migrate/pre520/level.dat_old rename to forge-main/src/test/resources/migrate/pre520/level.dat_old diff --git a/src/test/resources/migrate/pre520/machines.dat b/forge-main/src/test/resources/migrate/pre520/machines.dat similarity index 100% rename from src/test/resources/migrate/pre520/machines.dat rename to forge-main/src/test/resources/migrate/pre520/machines.dat diff --git a/src/test/resources/migrate/pre520/room_data.dat b/forge-main/src/test/resources/migrate/pre520/room_data.dat similarity index 100% rename from src/test/resources/migrate/pre520/room_data.dat rename to forge-main/src/test/resources/migrate/pre520/room_data.dat diff --git a/src/test/resources/migrate/pre520/tunnels_0_-64.dat b/forge-main/src/test/resources/migrate/pre520/tunnels_0_-64.dat similarity index 100% rename from src/test/resources/migrate/pre520/tunnels_0_-64.dat rename to forge-main/src/test/resources/migrate/pre520/tunnels_0_-64.dat diff --git a/src/test/resources/scenario/simple-connection/compactmachines_connections.nbt b/forge-main/src/test/resources/scenario/simple-connection/compactmachines_connections.nbt similarity index 100% rename from src/test/resources/scenario/simple-connection/compactmachines_connections.nbt rename to forge-main/src/test/resources/scenario/simple-connection/compactmachines_connections.nbt diff --git a/src/test/resources/scenario/simple-connection/compactmachines_machines.nbt b/forge-main/src/test/resources/scenario/simple-connection/compactmachines_machines.nbt similarity index 100% rename from src/test/resources/scenario/simple-connection/compactmachines_machines.nbt rename to forge-main/src/test/resources/scenario/simple-connection/compactmachines_machines.nbt diff --git a/src/test/resources/scenario/simple-connection/compactmachines_rooms.nbt b/forge-main/src/test/resources/scenario/simple-connection/compactmachines_rooms.nbt similarity index 100% rename from src/test/resources/scenario/simple-connection/compactmachines_rooms.nbt rename to forge-main/src/test/resources/scenario/simple-connection/compactmachines_rooms.nbt diff --git a/src/test/resources/scenario/single-machine-player-inside/machines_external.nbt b/forge-main/src/test/resources/scenario/single-machine-player-inside/machines_external.nbt similarity index 100% rename from src/test/resources/scenario/single-machine-player-inside/machines_external.nbt rename to forge-main/src/test/resources/scenario/single-machine-player-inside/machines_external.nbt diff --git a/src/test/resources/scenario/single-machine-player-inside/machines_internal.dat b/forge-main/src/test/resources/scenario/single-machine-player-inside/machines_internal.dat similarity index 100% rename from src/test/resources/scenario/single-machine-player-inside/machines_internal.dat rename to forge-main/src/test/resources/scenario/single-machine-player-inside/machines_internal.dat diff --git a/src/test/resources/scenario/single-machine-player-inside/players.dat b/forge-main/src/test/resources/scenario/single-machine-player-inside/players.dat similarity index 100% rename from src/test/resources/scenario/single-machine-player-inside/players.dat rename to forge-main/src/test/resources/scenario/single-machine-player-inside/players.dat diff --git a/forge-tunnels/build.gradle.kts b/forge-tunnels/build.gradle.kts new file mode 100644 index 00000000..017bac91 --- /dev/null +++ b/forge-tunnels/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + java + id("net.minecraftforge.gradle") version("5.1.+") + id("org.parchmentmc.librarian.forgegradle") version("1.+") +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + withSourcesJar() +} + +var minecraft_version: String by extra +var forge_version: String by extra +var parchment_version: String by extra + +project.evaluationDependsOn(project(":forge-api").path) + +dependencies { + minecraft (group = "net.minecraftforge", name = "forge", version = "${minecraft_version}-${forge_version}") + + compileOnly(project(":forge-api")) +} + +minecraft { + mappings("parchment", parchment_version) +} \ No newline at end of file diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java index e4e5a463..ed9b374e 100644 --- a/src/tunnels/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java @@ -7,9 +7,9 @@ import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; import dev.compactmods.machines.tunnel.definitions.FluidTunnel; import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; -import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java diff --git a/src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java similarity index 100% rename from src/tunnels/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java diff --git a/gradle.properties b/gradle.properties index 4db64bb2..8f30723a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,12 +9,6 @@ parchment_version=2022.08.10-1.19.2 mod_id=compactmachines -# Dependencies and Libs -jei_mc_version=1.19.2 -jei_version=11.2.0.247 -#top_version=1.16-3.1.4-22 -curios_version=1.19.2-5.1.1.0 - # Curseforge cf_project=224218 cf_release_type=release diff --git a/raw-assets/field-projector-setup-example.png b/raw-assets/field-projector-setup-example.png deleted file mode 100644 index b0f86517cc79abddb567939ece7793a9cb90f3bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 85178 zcmeFacRbba|37}6W2TULg~&*vjEwAg8j3<>lNHC_oNSI)Q&vj}p-8eLo2Z2BWRzJE zIac;Oe6Q!xdU?OzeLvsZ_xrp3{;AvTbk1{J>wZ1<<8f86hWc?@8WtJ=0IiDh(bE8s z;gJtDCA?!V#-<0qHn}JpxC5|xJMuw+=vZa|q{nTw^*!{}RAnrj9S@jWI-kWJ@N#s4 zZv!Bw=;dN=VUP9TJd3rqb&}_rC@JUSw6&Dy(i2w`R&zOmwXs$9al>l)sB2sJ*jq?j zaw#g%$a%@Y4ji!_=A2%R4o>beUh-U|er4cqAPbF;LP zIeqllx8dNGJeQ4!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N+oF)pT8*VyyaVx{y${NB^?TqPH0zU z@dw0JBNrP75nKXTb;ZV;gvMA8zGksdwr2#-7zkCMBtZsjEm{r zNA^5rSFZjLzxT8|+@cg8-b0q`g)+T4WR!<(TA{K>m?8@C;XU(&CGRq6@MJHPQId4z z#*Wl+`>S@ag{6(CBp=*bwAGG~Iq6y2Z#|hT>dhHsv<=&gRBziAor2PIas_1u7PW8v zpf^P&sRP&IolGz&eqd0(D)tYErsII#nvn@MR+^X>_*6C z!`^=7H>-?G9ufFmE8}8%b(TF(d6Xp|;`g3*hg+25!>7rTy-=nXyNvR%O)FIP2vbBM zK74wfu;g7P4W8_UGD?z;+}M#i?s?S%wy?AjmE?nKi>~${WKMdPo@-AoF1jjbkkK}5 zGg7_nQFIDQ%gK7m3=HbI`h%-dRFY=!EW|Dt6hAO1Ulq>>#8b?m9wf4@7=;}aZOe3G b*^X$E{;%Rlz)U|nTJl|l(Vc!LMtS}J=Q%G& diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/giant_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/giant_machine.json deleted file mode 100644 index 2aa94e78..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/giant_machine.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "version": 1, - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W", "W", "W"], - ["W", "-", "-", "-", "W"], - ["W", "-", "D", "-", "W"], - ["W", "-", "-", "-", "W"], - ["W", "W", "W", "W", "W"] - ] - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - }, - "D": { - "Name": "minecraft:diamond_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_giant", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/large_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/large_machine.json deleted file mode 100644 index 8e20fa9e..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/large_machine.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "version": 1, - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_large", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/maximum_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/maximum_machine.json deleted file mode 100644 index 0cf06b94..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/maximum_machine.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "version": 1, - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W", "W", "W"], - ["W", "-", "-", "-", "W"], - ["W", "-", "E", "-", "W"], - ["W", "-", "-", "-", "W"], - ["W", "W", "W", "W", "W"] - ] - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - }, - - "E": { - "Name": "minecraft:emerald_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_maximum", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/normal_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/normal_machine.json deleted file mode 100644 index 2f637249..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/normal_machine.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": 1, - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W"], - ["W", "G", "W"], - ["W", "W", "W"] - ] - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - }, - "G": { - "Name": "minecraft:gold_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_normal", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/small_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/small_machine.json deleted file mode 100644 index 60d4bce2..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/small_machine.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": 1, - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W"], - ["W", "I", "W"], - ["W", "W", "W"] - ] - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - }, - "I": { - "Name": "minecraft:iron_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_small", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/tiny_machine.json b/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/tiny_machine.json deleted file mode 100644 index d6800816..00000000 --- a/recipepacks/compact-crafting-alpha2/data/compactmachines/recipes/tiny_machine.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": 1, - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "Name": "compactmachines:wall" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_tiny", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting-alpha2/pack.mcmeta b/recipepacks/compact-crafting-alpha2/pack.mcmeta deleted file mode 100644 index 04b45ab6..00000000 --- a/recipepacks/compact-crafting-alpha2/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 6, - "description": "Integration of Compact Machines and Compact Crafting." - } -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/giant_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/giant_machine.json deleted file mode 100644 index 4316719c..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/giant_machine.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W", "W", "W"], - ["W", "-", "-", "-", "W"], - ["W", "-", "D", "-", "W"], - ["W", "-", "-", "-", "W"], - ["W", "W", "W", "W", "W"] - ] - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - }, - "D": { - "type": "compactcrafting:block", - "block": "minecraft:diamond_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_giant", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/large_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/large_machine.json deleted file mode 100644 index c1aab734..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/large_machine.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_large", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/maximum_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/maximum_machine.json deleted file mode 100644 index 83bf0f9b..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/maximum_machine.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 5, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W", "W", "W"], - ["W", "-", "-", "-", "W"], - ["W", "-", "E", "-", "W"], - ["W", "-", "-", "-", "W"], - ["W", "W", "W", "W", "W"] - ] - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - }, - - "E": { - "type": "compactcrafting:block", - "block": "minecraft:emerald_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_maximum", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/normal_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/normal_machine.json deleted file mode 100644 index d6d397ea..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/normal_machine.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W"], - ["W", "G", "W"], - ["W", "W", "W"] - ] - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - }, - "G": { - "type": "compactcrafting:block", - "block": "minecraft:gold_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_normal", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/small_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/small_machine.json deleted file mode 100644 index 05c7accc..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/small_machine.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:mixed", - "pattern": [ - ["W", "W", "W"], - ["W", "I", "W"], - ["W", "W", "W"] - ] - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - }, - "I": { - "type": "compactcrafting:block", - "block": "minecraft:iron_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_small", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/tiny_machine.json b/recipepacks/compact-crafting/data/compactmachines/recipes/tiny_machine.json deleted file mode 100644 index d38c1fbb..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/tiny_machine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 3, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "W" - }, - { - "type": "compactcrafting:hollow", - "wall": "W" - }, - { - "type": "compactcrafting:filled", - "component": "W" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "W": { - "type": "compactcrafting:block", - "block": "compactmachines:wall" - } - }, - - "outputs": [ - { - "id": "compactmachines:machine_tiny", - "Count": 1 - } - ] -} \ No newline at end of file diff --git a/recipepacks/compact-crafting/data/compactmachines/recipes/wall.json b/recipepacks/compact-crafting/data/compactmachines/recipes/wall.json deleted file mode 100644 index 7c3bc21e..00000000 --- a/recipepacks/compact-crafting/data/compactmachines/recipes/wall.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "compactcrafting:miniaturization", - "recipeSize": 1, - "layers": [ - { - "type": "compactcrafting:filled", - "component": "R" - }, - { - "type": "compactcrafting:filled", - "component": "I" - } - ], - - "catalyst": { - "id": "minecraft:ender_pearl", - "Count": 1 - }, - - "components": { - "R": { - "type": "compactcrafting:block", - "block": "minecraft:redstone_wire" - }, - "I": { - "type": "compactcrafting:block", - "block": "minecraft:iron_block" - } - }, - - "outputs": [ - { - "id": "compactmachines:wall", - "Count": 16 - } - ] - } \ No newline at end of file diff --git a/recipepacks/compact-crafting/pack.mcmeta b/recipepacks/compact-crafting/pack.mcmeta deleted file mode 100644 index 04b45ab6..00000000 --- a/recipepacks/compact-crafting/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 6, - "description": "Integration of Compact Machines and Compact Crafting." - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/giant_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/giant_machine.json deleted file mode 100644 index 149cf0ba..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/giant_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_giant", - "count": 1 - }, - "pattern": [ - "www", - "wdw", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "d": { - "item": "minecraft:diamond_block" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/large_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/large_machine.json deleted file mode 100644 index ff8602f5..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/large_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_large", - "count": 1 - }, - "pattern": [ - "www", - "wow", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "o": { - "item": "minecraft:obsidian" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/machine_wall.json b/recipepacks/vanilla/data/compactmachines/recipes/machine_wall.json deleted file mode 100644 index 5103a05f..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/machine_wall.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:wall", - "count": 16 - }, - "pattern": [ - " ", - " r ", - " i " - ], - "key": { - "r": { - "item": "minecraft:redstone" - }, - "i": { - "item": "minecraft:iron_block" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/maximum_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/maximum_machine.json deleted file mode 100644 index 2f9d2daa..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/maximum_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_maximum", - "count": 1 - }, - "pattern": [ - "www", - "wew", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "e": { - "item": "minecraft:emerald_block" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/normal_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/normal_machine.json deleted file mode 100644 index cc4471b2..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/normal_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_normal", - "count": 1 - }, - "pattern": [ - "www", - "wgw", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "g": { - "item": "minecraft:gold_block" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/small_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/small_machine.json deleted file mode 100644 index 2835b2da..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/small_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_small", - "count": 1 - }, - "pattern": [ - "www", - "wiw", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "i": { - "item": "minecraft:iron_block" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/data/compactmachines/recipes/tiny_machine.json b/recipepacks/vanilla/data/compactmachines/recipes/tiny_machine.json deleted file mode 100644 index f30ace4c..00000000 --- a/recipepacks/vanilla/data/compactmachines/recipes/tiny_machine.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "result": { - "item": "compactmachines:machine_tiny", - "count": 1 - }, - "pattern": [ - "www", - "wpw", - "www" - ], - "key": { - "w": { - "item": "compactmachines:wall" - }, - "p": { - "tag": "minecraft:planks" - } - } -} \ No newline at end of file diff --git a/recipepacks/vanilla/pack.mcmeta b/recipepacks/vanilla/pack.mcmeta deleted file mode 100644 index 2b78c1d0..00000000 --- a/recipepacks/vanilla/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 6, - "description": "Provides recipes for vanilla Compact Machines integration." - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 69c30d59..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "Compact Machines" \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..9013f30a --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + mavenCentral() + mavenLocal() + maven("https://repo.spongepowered.org/repository/maven-public") + maven("https://maven.minecraftforge.net") + maven("https://maven.parchmentmc.org") + } + + resolutionStrategy { + eachPlugin { + if (requested.id.id == "net.minecraftforge.gradle") { + useModule("${requested.id}:ForgeGradle:${requested.version}") + } + if (requested.id.id == "org.spongepowered.mixin") { + useModule("org.spongepowered:mixingradle:${requested.version}") + } + } + } +} + +rootProject.name = "Compact Machines" +include("forge-api", "forge-main", "forge-tunnels") \ No newline at end of file diff --git a/tunnels/definitions/RedstoneOutTunnelDefinition.java b/tunnels/definitions/RedstoneOutTunnelDefinition.java deleted file mode 100644 index 2e2643bc..00000000 --- a/tunnels/definitions/RedstoneOutTunnelDefinition.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.compactmods.machines.tunnel.definitions; - -import dev.compactmods.machines.api.tunnels.ITunnelConnectionInfo; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.api.tunnels.redstone.IRedstoneWriterTunnel; - -import java.awt.Color; - -public class RedstoneOutTunnelDefinition extends TunnelDefinition implements IRedstoneWriterTunnel { - @Override - public int getStrongPower(ITunnelConnectionInfo connectionInfo) { - return 0; - } - - @Override - public int getWeakPower(ITunnelConnectionInfo connectionInfo) { - return 0; - } - - @Override - public int getTunnelRingColor() { - return new Color(167, 38, 38).getRGB(); - } -} From add3691f40906608a51c6aa5174142fbed955b3e Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Oct 2022 00:32:05 -0400 Subject: [PATCH 22/85] Fix most build issues, checkin --- .gitignore | 4 + build.gradle.kts | 43 +----- forge-api/.gitignore | 2 + forge-api/build.gradle.kts | 23 ++- forge-main/.gitignore | 3 + forge-main/build.gradle.kts | 78 +++++++--- .../03e4de26f1265135874f8cdcaebc09d9c08eb42b | 5 - .../07c329cab0b84ebb758f69c1df0c195805d0452c | 4 - .../12ec2377279d0d674d2996377e6aadd07db02702 | 8 - .../41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 | 14 -- .../67cce32b1c3cbbcb1f646605f4914e3f196986c2 | 9 -- .../75bcd4dba6ca7d365462b0ec45e291d1056349c4 | 5 - .../7614da1b3e3c7e6a5801139b6d50d862727ab0e1 | 12 -- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 25 --- .../ad1d2f850013c48c78ac9faccdcfe00a5a273d1f | 18 --- .../c622617f6fabf890a00b9275cd5f643584a8a2c8 | 2 - .../cc4a2989348227984ebea88deca578b68e58344e | 2 - .../compactmachines/blockstates/machine.json | 7 - .../blockstates/machine_giant.json | 7 - .../blockstates/machine_large.json | 7 - .../blockstates/machine_maximum.json | 7 - .../blockstates/machine_normal.json | 7 - .../blockstates/machine_small.json | 7 - .../blockstates/machine_tiny.json | 7 - .../blockstates/solid_wall.json | 7 - .../blockstates/tunnel_wall.json | 22 --- .../compactmachines/blockstates/wall.json | 7 - .../assets/compactmachines/lang/en_us.json | 105 ------------- .../assets/compactmachines/lang/ru_ru.json | 36 ----- .../models/block/machine/machine.json | 143 ------------------ .../models/block/machine/machine_giant.json | 6 - .../models/block/machine/machine_large.json | 6 - .../models/block/machine/machine_maximum.json | 6 - .../models/block/machine/machine_normal.json | 6 - .../models/block/machine/machine_small.json | 6 - .../models/block/machine/machine_tiny.json | 6 - .../compactmachines/models/block/wall.json | 6 - .../models/item/chunkloader_upgrade.json | 6 - .../compactmachines/models/item/machine.json | 3 - .../models/item/machine_giant.json | 3 - .../models/item/machine_large.json | 3 - .../models/item/machine_maximum.json | 3 - .../models/item/machine_normal.json | 3 - .../models/item/machine_small.json | 3 - .../models/item/machine_tiny.json | 3 - .../models/item/new_machine.json | 3 - .../item/personal_shrinking_device.json | 6 - .../models/item/solid_wall.json | 3 - .../compactmachines/models/item/tunnel.json | 6 - .../compactmachines/models/item/wall.json | 3 - .../compactmachines/models/tunnels/base.json | 135 ----------------- .../compactmachines/models/tunnels/down.json | 7 - .../compactmachines/models/tunnels/east.json | 7 - .../compactmachines/models/tunnels/north.json | 7 - .../compactmachines/models/tunnels/south.json | 7 - .../compactmachines/models/tunnels/up.json | 7 - .../compactmachines/models/tunnels/west.json | 7 - .../advancements/claimed_machine_giant.json | 29 ---- .../advancements/claimed_machine_large.json | 29 ---- .../advancements/claimed_machine_max.json | 29 ---- .../advancements/claimed_machine_normal.json | 29 ---- .../advancements/claimed_machine_small.json | 29 ---- .../advancements/claimed_machine_tiny.json | 29 ---- .../advancements/foundations.json | 37 ----- .../advancements/got_shrinking_device.json | 37 ----- .../advancements/how_did_you_get_here.json | 29 ---- .../compactmachines/new_machine_absurd.json | 20 --- .../compactmachines/new_machine_colossal.json | 20 --- .../compactmachines/new_machine_giant.json | 20 --- .../compactmachines/new_machine_large.json | 20 --- .../compactmachines/new_machine_normal.json | 20 --- .../compactmachines/new_machine_small.json | 20 --- .../compactmachines/new_machine_tiny.json | 20 --- .../personal_shrinking_device.json | 34 ----- .../recipes/compactmachines/wall.json | 32 ---- .../advancements/recipes/energy.json | 34 ----- .../advancements/recipes/fluid.json | 34 ----- .../advancements/recipes/item.json | 34 ----- .../advancements/recursion.json | 29 ---- .../compactmachines/advancements/root.json | 28 ---- .../room_templates/absurd.json | 4 - .../room_templates/colossal.json | 8 - .../compactmachines/room_templates/giant.json | 8 - .../compactmachines/room_templates/large.json | 8 - .../room_templates/normal.json | 8 - .../compactmachines/room_templates/small.json | 8 - .../compactmachines/room_templates/tiny.json | 8 - .../dimension/compact_world.json | 17 --- .../dimension_type/compact_world.json | 26 ---- .../loot_tables/blocks/machine.json | 26 ---- .../loot_tables/blocks/machine_giant.json | 26 ---- .../loot_tables/blocks/machine_large.json | 26 ---- .../loot_tables/blocks/machine_maximum.json | 26 ---- .../loot_tables/blocks/machine_normal.json | 26 ---- .../loot_tables/blocks/machine_small.json | 26 ---- .../loot_tables/blocks/machine_tiny.json | 26 ---- .../loot_tables/blocks/wall.json | 21 --- .../recipes/new_machine_absurd.json | 28 ---- .../recipes/new_machine_colossal.json | 28 ---- .../recipes/new_machine_giant.json | 28 ---- .../recipes/new_machine_large.json | 28 ---- .../recipes/new_machine_normal.json | 28 ---- .../recipes/new_machine_small.json | 28 ---- .../recipes/new_machine_tiny.json | 28 ---- .../recipes/personal_shrinking_device.json | 25 --- .../recipes/tunnels/energy.json | 26 ---- .../recipes/tunnels/fluid.json | 26 ---- .../compactmachines/recipes/tunnels/item.json | 26 ---- .../data/compactmachines/recipes/wall.json | 17 --- .../tags/blocks/legacy_machines.json | 10 -- .../compactmachines/tags/blocks/machine.json | 11 -- .../compactmachines/tags/items/machine.json | 12 -- .../tags/items/room_upgrade.json | 5 - .../tags/items/shrinking_device.json | 5 - .../worldgen/biome/machine.json | 124 --------------- .../resources/data/curios/tags/items/psd.json | 5 - .../tags/blocks/mineable/pickaxe.json | 12 -- .../tags/blocks/needs_iron_tool.json | 12 -- .../datagen/AdvancementGenerator.java | 0 .../datagen/AdvancementLangBuilder.java | 0 .../machines/datagen/BlockLootGenerator.java | 0 .../machines/datagen/DataGenUtil.java | 0 .../machines/datagen/DataGeneration.java | 2 +- .../datagen/DimensionTypeBuilder.java | 0 .../machines/datagen/ItemModelGenerator.java | 0 .../machines/datagen/LevelBiomeGenerator.java | 6 +- .../machines/datagen/RecipeGenerator.java | 12 +- .../machines/datagen/StateGenerator.java | 0 .../datagen/TunnelWallStateGenerator.java | 0 .../datagen/lang/BaseLangGenerator.java | 0 .../datagen/lang/EnglishLangGenerator.java | 0 .../datagen/lang/RussianLangGenerator.java | 0 .../machines/datagen/room/RoomTemplates.java | 0 .../datagen/tags/BlockTagGenerator.java | 0 .../datagen/tags/ItemTagGenerator.java | 0 forge-tunnels/build.gradle.kts | 1 + gradle.properties | 4 - settings.gradle.kts | 3 - 138 files changed, 102 insertions(+), 2271 deletions(-) create mode 100644 forge-api/.gitignore create mode 100644 forge-main/.gitignore delete mode 100644 forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b delete mode 100644 forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c delete mode 100644 forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 delete mode 100644 forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 delete mode 100644 forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 delete mode 100644 forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 delete mode 100644 forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 delete mode 100644 forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e delete mode 100644 forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f delete mode 100644 forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 delete mode 100644 forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json delete mode 100644 forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/advancements/root.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/recipes/wall.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json delete mode 100644 forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json delete mode 100644 forge-main/src/generated/resources/data/curios/tags/items/psd.json delete mode 100644 forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json delete mode 100644 forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/AdvancementGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/BlockLootGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/DataGenUtil.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/DataGeneration.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/ItemModelGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java (94%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/RecipeGenerator.java (91%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/StateGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/room/RoomTemplates.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java (100%) rename forge-main/src/{datagen => main}/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java (100%) diff --git a/.gitignore b/.gitignore index a4e9dffa..a4111ad0 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,7 @@ logs/ forge-main/src-old/generated/ raw-assets/ + +forge-main/src/generated/resources/.cache/ + +forge-main/src/generated/ diff --git a/build.gradle.kts b/build.gradle.kts index 3dfda84b..651d9645 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,32 +65,6 @@ tasks.create("getBuildInfo") { // } //} - -// -//jarJar.enable(); -//dependencies { -// // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed -// // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. -// // The userdev artifact is a special name and will get all sorts of transformations applied to it. -// minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" -// -// -//} -// - -// -//compileDatagenJava { -// options.encoding = 'UTF-8' -//} -// -//// FIXME: Remove once https://github.com/MinecraftForge/ForgeGradle/issues/883 is closed - -// -//tasks.jarJar.configure { -// classifier '' -//} -// - //// ////task apiJar(type: Jar) { //// from sourceSets.api.output @@ -101,19 +75,4 @@ tasks.create("getBuildInfo") { //artifacts { // archives jar // , apiJar //} -// - -tasks.withType { - manifest { - val now = java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(java.util.Date()) - attributes(mapOf( - "Specification-Title" to "Compact Machines", - "Specification-Vendor" to "", - "Specification-Version" to "1", // We are version 1 of ourselves - "Implementation-Title" to project.name, - "Implementation-Version" to archiveVersion, - "Implementation-Vendor" to "", - "Implementation-Timestamp" to now - )) - } -} +// \ No newline at end of file diff --git a/forge-api/.gitignore b/forge-api/.gitignore new file mode 100644 index 00000000..5dd0b448 --- /dev/null +++ b/forge-api/.gitignore @@ -0,0 +1,2 @@ +build/ +run/ \ No newline at end of file diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts index 8eaab039..805e8f18 100644 --- a/forge-api/build.gradle.kts +++ b/forge-api/build.gradle.kts @@ -1,3 +1,5 @@ +import net.minecraftforge.gradle.userdev.UserDevExtension + plugins { java id("net.minecraftforge.gradle") version ("5.1.+") @@ -13,10 +15,27 @@ var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra -minecraft { +sourceSets { + named("main") { + resources { + //The API has no resources + setSrcDirs(emptyList()) + } + } + + named("test") { + resources { + //The test module has no resources + setSrcDirs(emptyList()) + } + } +} + +configure { mappings("parchment", parchment_version) + accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) } dependencies { - minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") } \ No newline at end of file diff --git a/forge-main/.gitignore b/forge-main/.gitignore new file mode 100644 index 00000000..454ab39a --- /dev/null +++ b/forge-main/.gitignore @@ -0,0 +1,3 @@ +build/ +run/ +src/generated/ \ No newline at end of file diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 0403a6dd..a30e183a 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -1,3 +1,6 @@ +import java.text.SimpleDateFormat +import java.util.* + var mod_id: String by extra var minecraft_version: String by extra var forge_version: String by extra @@ -13,6 +16,7 @@ plugins { base { archivesName.set(mod_id) + version = "5.0.0" } java { @@ -20,7 +24,7 @@ java { } sourceSets.main { - java { + resources { srcDir("src/main/resources") srcDir("src/generated/resources") } @@ -31,10 +35,6 @@ sourceSets.test { resources.srcDir("src/test/resources") } -val datagen = sourceSets.create("datagen") { - compileClasspath += sourceSets.main.get().output -} - project.evaluationDependsOn(project(":forge-api").path) repositories { @@ -72,12 +72,14 @@ val curios_version: String? by extra jarJar.enable() dependencies { - minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") implementation(project(":forge-api")) - implementation(project(":forge-tunnels")) testImplementation(project(":forge-api")) + implementation(project(":forge-tunnels")) + testImplementation(project(":forge-tunnels")) + // JEI if (project.extra.has("jei_version") && project.extra.has("jei_mc_version")) { compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}")) @@ -165,13 +167,18 @@ minecraft { property("mixin.env.remapRefMap", "true") property("mixin.env.refMapRemappingFile", "${buildDir}/createSrgToMcp/output.srg") - // JetBrains Runtime Hotswap - jvmArg("-XX:+AllowEnhancedClassRedefinition") - jvmArg("-XX:HotswapAgent=fatjar") + ideaModule("Compact_Machines.forge-main.main") + + if (!System.getenv().containsKey("CI")) { + // JetBrains Runtime Hotswap + jvmArg("-XX:+AllowEnhancedClassRedefinition") + jvmArg("-XX:HotswapAgent=fatjar") + } + source(sourceSets.main.get()) mods.create(mod_id) { source(sourceSets.main.get()) - for(p in runDepends) + for (p in runDepends) source(p.sourceSets.main.get()) } } @@ -185,20 +192,25 @@ minecraft { args("--height", 1080) } - create("datagen") { + create("data") { + taskName("runData") workingDirectory(file("run/data")) + forceExit(false) - mods.named(mod_id) { - source(datagen) - } + args("--mod", mod_id) + args("--existing", file("src/main/resources")) + args("--all") + args("--output", file("src/generated/resources/")) } } } reobf { - jarJar { + jarJar { } +} - } +tasks.compileJava { + options.encoding = "UTF-8"; } tasks.withType { @@ -207,16 +219,42 @@ tasks.withType { tasks.jar { from(sourceSets.main.get().output) + from(project(":forge-tunnels").sourceSets.main.get().output) finalizedBy("reobfJar") archiveClassifier.set("slim") + + this.exclude("dev/compactmods/machines/datagen/**") + + manifest { + val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) + attributes(mapOf( + "Specification-Title" to "Compact Machines", + "Specification-Vendor" to "", + "Specification-Version" to "1", // We are version 1 of ourselves + "Implementation-Title" to project.name, + "Implementation-Version" to archiveVersion, + "Implementation-Vendor" to "", + "Implementation-Timestamp" to now + )) + } } tasks.jarJar { archiveClassifier.set("") - project(":forge-api").tasks.jar.get().archiveFile.map { - zipTree(it) - } + this.exclude("dev/compactmods/machines/datagen/**") + + // TODO - Switch to API jar when JarInJar supports it better + val api = project(":forge-api").tasks.jar.get().archiveFile; + from(api.map { zipTree(it) }) + + val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; + from(tunnels.map { zipTree(it) }) +} + +artifacts { + archives(tasks.jar.get()) + archives(tasks.jarJar.get()) } publishing { diff --git a/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b b/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b deleted file mode 100644 index cb097ede..00000000 --- a/forge-main/src/generated/resources/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b +++ /dev/null @@ -1,5 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6876701 Tags for minecraft:item -5deeff46b9a9ad61978c7e2a72ae779550d014bf data/compactmachines/tags/items/machine.json -ae46c155704ef695a6d4fa06df4d154bd002b9ec data/compactmachines/tags/items/room_upgrade.json -708451278800e756af7e96fb71b87c05a92eb269 data/compactmachines/tags/items/shrinking_device.json -708451278800e756af7e96fb71b87c05a92eb269 data/curios/tags/items/psd.json diff --git a/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c b/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c deleted file mode 100644 index b5a8b9d3..00000000 --- a/forge-main/src/generated/resources/.cache/07c329cab0b84ebb758f69c1df0c195805d0452c +++ /dev/null @@ -1,4 +0,0 @@ -// 1.19.2 2022-08-14T02:50:32.8266281 compactmachines:levelgen -03d40bd639cf147cdc45dff1ee653e638bf5085a data/compactmachines/dimension/compact_world.json -058639237007bad853b9cdd18ab2275f04c166b5 data/compactmachines/dimension_type/compact_world.json -68fbde096cff93e3c6e5443633a4d71c9a31f612 data/compactmachines/worldgen/biome/machine.json diff --git a/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 b/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 deleted file mode 100644 index 3565d449..00000000 --- a/forge-main/src/generated/resources/.cache/12ec2377279d0d674d2996377e6aadd07db02702 +++ /dev/null @@ -1,8 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6836116 compactmachines/room_templates generator for compactmachines -467d391d0dc30dd7b9b3d71fc4e6fecb828ef037 data/compactmachines/compactmachines/room_templates/absurd.json -82708900a5f1480d39bd9544c09175c869223780 data/compactmachines/compactmachines/room_templates/colossal.json -562202b058b85065731a603f4ba8668614710a9e data/compactmachines/compactmachines/room_templates/giant.json -29f10c189e4eb414e60eff75d7a52714d43938f8 data/compactmachines/compactmachines/room_templates/large.json -c26bd54dce42b5fe82423c71e76184eee0478016 data/compactmachines/compactmachines/room_templates/normal.json -0ddbe8ac46777eaa04f388f4f6cbcb2319e0b2f2 data/compactmachines/compactmachines/room_templates/small.json -585e6aaa5f616eb4a53ea074e28b3bb9fb617353 data/compactmachines/compactmachines/room_templates/tiny.json diff --git a/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 b/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 deleted file mode 100644 index e5c612a2..00000000 --- a/forge-main/src/generated/resources/.cache/41f2032f3b08b9a2d8730bdc9c266d7b578ae4a1 +++ /dev/null @@ -1,14 +0,0 @@ -// 1.19.2 2022-10-09T08:59:48.6168024 Item Models: compactmachines -990ed9172747e593636e1c60350721a6b520966a assets/compactmachines/models/item/chunkloader_upgrade.json -5507a63beccf1e4d6c99f3b0a2f0657b79732d3d assets/compactmachines/models/item/machine.json -e5f0d47a6ddb30e2e823b972444c95a0d5085109 assets/compactmachines/models/item/machine_giant.json -2cbaf11c6ce4fb3707016a111744058dadc5e097 assets/compactmachines/models/item/machine_large.json -21f009141ecfbc26ac81266ee2aa9efa242ce6b6 assets/compactmachines/models/item/machine_maximum.json -d35abe205d01915a3f58638e43a9e863eb3cf246 assets/compactmachines/models/item/machine_normal.json -eb7fe7f4a1be98ed0c1241c357bdca660eee3f59 assets/compactmachines/models/item/machine_small.json -3600e7ad6f574163b708cf0445704183c2a6dafc assets/compactmachines/models/item/machine_tiny.json -5507a63beccf1e4d6c99f3b0a2f0657b79732d3d assets/compactmachines/models/item/new_machine.json -95c08370ef1e0e03cf65ad5f1b38cd66d471bd08 assets/compactmachines/models/item/personal_shrinking_device.json -c5d1c5214a7675a3b69d29a5c6cfa5dcb18ed9d1 assets/compactmachines/models/item/solid_wall.json -d4989b21bafab1f597145fb3d065e7a197cc468a assets/compactmachines/models/item/tunnel.json -c5d1c5214a7675a3b69d29a5c6cfa5dcb18ed9d1 assets/compactmachines/models/item/wall.json diff --git a/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 b/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 deleted file mode 100644 index 555560d0..00000000 --- a/forge-main/src/generated/resources/.cache/67cce32b1c3cbbcb1f646605f4914e3f196986c2 +++ /dev/null @@ -1,9 +0,0 @@ -// 1.19.2 2022-10-09T06:25:22.5370764 LootTables -77081d7de6275421c55be81619b1c42db5e2d220 data/compactmachines/loot_tables/blocks/machine.json -87b56e6b6d0b65b8da9104b8ca2e9605abf5e30b data/compactmachines/loot_tables/blocks/machine_giant.json -0f5eb4176f0aef8c68e20a20956554d2c899c37d data/compactmachines/loot_tables/blocks/machine_large.json -a0f3182a08a5d0bc541ddc27ff8919cef981241c data/compactmachines/loot_tables/blocks/machine_maximum.json -551c29282dfc490d897de745e819811dadb51f85 data/compactmachines/loot_tables/blocks/machine_normal.json -cdcf45e2259ce617823999c0e020298cf2e6db7a data/compactmachines/loot_tables/blocks/machine_small.json -e3541b1a2f1f829db53545d62a602700745bf9c4 data/compactmachines/loot_tables/blocks/machine_tiny.json -e44d02b0e62a2762eccac056a342373e172b89c3 data/compactmachines/loot_tables/blocks/wall.json diff --git a/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 b/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 deleted file mode 100644 index e4b51ad0..00000000 --- a/forge-main/src/generated/resources/.cache/75bcd4dba6ca7d365462b0ec45e291d1056349c4 +++ /dev/null @@ -1,5 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6866127 Tags for minecraft:block -60e219a280627ad3250ee8899d65356050a6916b data/compactmachines/tags/blocks/legacy_machines.json -79362b5b837973baf1a191564ce11c351ab26ad6 data/compactmachines/tags/blocks/machine.json -7cb0079d5c84af250a5219a21083a8b6151be1dc data/minecraft/tags/blocks/mineable/pickaxe.json -7cb0079d5c84af250a5219a21083a8b6151be1dc data/minecraft/tags/blocks/needs_iron_tool.json diff --git a/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 b/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 deleted file mode 100644 index c716be87..00000000 --- a/forge-main/src/generated/resources/.cache/7614da1b3e3c7e6a5801139b6d50d862727ab0e1 +++ /dev/null @@ -1,12 +0,0 @@ -// 1.19.2 2022-08-14T02:50:32.8236272 CompactMachinesAdvancements -d124c4f474c54859fadcd94bf01aedcdbb67a6a1 data/compactmachines/advancements/claimed_machine_giant.json -b28307695529a0b29f4d01cb73b676971101817b data/compactmachines/advancements/claimed_machine_large.json -e2627beb8745fefdd856cef48a5c0abef6e5c62a data/compactmachines/advancements/claimed_machine_max.json -549e22e4df1ebc3e0da00ff807193c7e11cbb43f data/compactmachines/advancements/claimed_machine_normal.json -9aa0bedced8b989bba9235b85e366f5f6d07a6d9 data/compactmachines/advancements/claimed_machine_small.json -5445a0386a71fa115e6a9ba43909094691c04419 data/compactmachines/advancements/claimed_machine_tiny.json -531ada45a355332d1d03882d4721e7bfa5c048fe data/compactmachines/advancements/foundations.json -e094ff2c19817e4529f02a7146715bca6e3bb69b data/compactmachines/advancements/got_shrinking_device.json -d17c2a961a7a811609f4198758ae6af4dc4a1db6 data/compactmachines/advancements/how_did_you_get_here.json -6ce018a59dae8ccf2eacdfe4615788468190e4a8 data/compactmachines/advancements/recursion.json -40e748d08908f1b51c0719a43163af9d8356d559 data/compactmachines/advancements/root.json diff --git a/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e deleted file mode 100644 index 4701277a..00000000 --- a/forge-main/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ /dev/null @@ -1,25 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6896128 Recipes -a40fb5a9e2ba7fef974aaabb75e6c9a84888e5a7 data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json -a73918d656d32c9ce3a74ecfb16926101f563e61 data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json -98a4dadbd8d0894168023952ea86e78f3c94fb40 data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json -0b5f3cab41068d6f1ff3ec574665c38ea5c814a7 data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json -9874a022df16a973c65c20f8b3719023cf88cdad data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json -0734786e487603bc255ea7871a1773c86de7445a data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json -939624ed040f0a2f3a3543e55f843e55c8a1ba03 data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json -a3beadc24cd989d67cdfef1e5b76ded9ff72b583 data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json -af154134241d2106d572f3024930488b0bb7274a data/compactmachines/advancements/recipes/compactmachines/wall.json -a04fe3fd0cea208672ae7fdf3fcb74d25d71d302 data/compactmachines/advancements/recipes/energy.json -fbf5d1ad14eb0eded4022f19992452e3834053e2 data/compactmachines/advancements/recipes/fluid.json -0886a28152999b97d2902d9133333ab77d792025 data/compactmachines/advancements/recipes/item.json -dc38bf15549c2be65b416ef60d642f6199290a1a data/compactmachines/recipes/new_machine_absurd.json -f8fab00a4f4a605e8e9c70ae98e60e1bf5a0f609 data/compactmachines/recipes/new_machine_colossal.json -69528b01fdea6f0c2c00512c9decd11bbfe58361 data/compactmachines/recipes/new_machine_giant.json -d3e05608248ece456b53635376631ab4cd3bc525 data/compactmachines/recipes/new_machine_large.json -84a2ca0d9bb1415f5ecd73122ec8535ecb7f311d data/compactmachines/recipes/new_machine_normal.json -172e205b7b37e98ba3cf67f229b4168400391b06 data/compactmachines/recipes/new_machine_small.json -49514929dd1cc4245e055cd415bb00b1dd4b5fa3 data/compactmachines/recipes/new_machine_tiny.json -1af8e645ea754a22f6d88b87de8433874e9ec764 data/compactmachines/recipes/personal_shrinking_device.json -0b5d49b372abf7f61ed22f1f17bc093e14aee3c6 data/compactmachines/recipes/tunnels/energy.json -2f3cd088f27ae53590354d1211b90a1542e28006 data/compactmachines/recipes/tunnels/fluid.json -c0fe55504226cdd739d58e2b5031d2d79974a52d data/compactmachines/recipes/tunnels/item.json -ccc5da141955fe7d7eb06975918163c6b7d2a4ea data/compactmachines/recipes/wall.json diff --git a/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f b/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f deleted file mode 100644 index a96d8d11..00000000 --- a/forge-main/src/generated/resources/.cache/ad1d2f850013c48c78ac9faccdcfe00a5a273d1f +++ /dev/null @@ -1,18 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6886123 Block States: compactmachines -ce14ef21a1140b8e0a1bd0171ca4202530beaace assets/compactmachines/blockstates/machine.json -3b05ee7c9e5de4938db8e0d489acc59a35ba3f81 assets/compactmachines/blockstates/machine_giant.json -c1f0c78f19124f6a51cad307e4783c4e695635aa assets/compactmachines/blockstates/machine_large.json -85e949c79dd97e0cba6a253659bd29ac96f96241 assets/compactmachines/blockstates/machine_maximum.json -f4cab3f335810a51045246ac7797e0cdf7e14c95 assets/compactmachines/blockstates/machine_normal.json -0462147abbe9aa16b9c4befd9b7efd63a95538fd assets/compactmachines/blockstates/machine_small.json -615cb06be5f4ac7825e5d45c10df1f85924ce347 assets/compactmachines/blockstates/machine_tiny.json -dcc59fe8ec89ed7fab8ee1c31c25ff63553c9f3f assets/compactmachines/blockstates/solid_wall.json -dcc59fe8ec89ed7fab8ee1c31c25ff63553c9f3f assets/compactmachines/blockstates/wall.json -8a8cc056d7151e26a53fd293b275f7877c504143 assets/compactmachines/models/block/machine/machine.json -a52974cd16cd480f3069d8fc5f85ee02f30bc8a4 assets/compactmachines/models/block/machine/machine_giant.json -48f9571ccd08d09b81deb3308e4407d3aea9a0aa assets/compactmachines/models/block/machine/machine_large.json -0bbc4a5b78432dcc02c82bed1840d2e8988675a0 assets/compactmachines/models/block/machine/machine_maximum.json -2b738565ace8a161751fb04320333772521fbef2 assets/compactmachines/models/block/machine/machine_normal.json -ecfdae7fa81d5286d1c345069084229db909d899 assets/compactmachines/models/block/machine/machine_small.json -bfe2149896d457fa3985464a2975b2fc914dd4bd assets/compactmachines/models/block/machine/machine_tiny.json -22f424881e73a00d7649c1bb8ddac3192e25ed1a assets/compactmachines/models/block/wall.json diff --git a/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 deleted file mode 100644 index 36f8f816..00000000 --- a/forge-main/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ /dev/null @@ -1,2 +0,0 @@ -// 1.19.2 2022-10-10T13:15:36.6866127 Languages: en_us -f49b1d3c9b1b8c41cfbf52097b144c0b3ba3469c assets/compactmachines/lang/en_us.json diff --git a/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e b/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e deleted file mode 100644 index 1d529d6f..00000000 --- a/forge-main/src/generated/resources/.cache/cc4a2989348227984ebea88deca578b68e58344e +++ /dev/null @@ -1,2 +0,0 @@ -// 1.19.2 2022-08-14T02:50:32.8286271 Languages: ru_ru -c408ab4961d8b56e39340d80345f39c3d6acd565 assets/compactmachines/lang/ru_ru.json diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json deleted file mode 100644 index 1fbb9448..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json deleted file mode 100644 index 3814639b..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_giant.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_giant" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json deleted file mode 100644 index 5147b8fe..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_large.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_large" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json deleted file mode 100644 index 2c323e3d..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_maximum.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_maximum" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json deleted file mode 100644 index ba8f16cf..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_normal.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_normal" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json deleted file mode 100644 index 2535b2f5..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_small.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_small" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json deleted file mode 100644 index 570dd30c..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/machine_tiny.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/machine/machine_tiny" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json deleted file mode 100644 index 13189c5c..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/solid_wall.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/wall" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json deleted file mode 100644 index a28d3738..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/tunnel_wall.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "variants": { - "connected_side=down": { - "model": "compactmachines:tunnels/down" - }, - "connected_side=east": { - "model": "compactmachines:tunnels/east" - }, - "connected_side=north": { - "model": "compactmachines:tunnels/north" - }, - "connected_side=south": { - "model": "compactmachines:tunnels/south" - }, - "connected_side=up": { - "model": "compactmachines:tunnels/up" - }, - "connected_side=west": { - "model": "compactmachines:tunnels/west" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json b/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json deleted file mode 100644 index 13189c5c..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/blockstates/wall.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "compactmachines:block/wall" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json b/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json deleted file mode 100644 index f979fae0..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/lang/en_us.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "advancement.compactmachines.claimed_machine_giant": "Got Enough Space?", - "advancement.compactmachines.claimed_machine_giant.desc": "Claim a giant compact machine.", - "advancement.compactmachines.claimed_machine_large": "Room to Grow", - "advancement.compactmachines.claimed_machine_large.desc": "Claim a large compact machine.", - "advancement.compactmachines.claimed_machine_max": "Room for Activities!", - "advancement.compactmachines.claimed_machine_max.desc": "Claim a maximum compact machine.", - "advancement.compactmachines.claimed_machine_normal": "Bigger on the Inside", - "advancement.compactmachines.claimed_machine_normal.desc": "Claim a normal compact machine.", - "advancement.compactmachines.claimed_machine_small": "I Can Breathe", - "advancement.compactmachines.claimed_machine_small.desc": "Claim a small compact machine.", - "advancement.compactmachines.claimed_machine_tiny": "Small Spaces, Big Ideas", - "advancement.compactmachines.claimed_machine_tiny.desc": "Claim a tiny compact machine.", - "advancement.compactmachines.foundations": "Foundations", - "advancement.compactmachines.foundations.desc": "Obtain a breakable wall block.", - "advancement.compactmachines.got_shrinking_device": "Personal Shrinking Device", - "advancement.compactmachines.got_shrinking_device.desc": "Obtain a Personal Shrinking Device", - "advancement.compactmachines.how_did_you_get_here": "How Did You Get Here?!", - "advancement.compactmachines.how_did_you_get_here.desc": "Which machine is the player in?!", - "advancement.compactmachines.recursion": "Recursive Rooms", - "advancement.compactmachines.recursion.desc": "To understand recursion, you must first understand recursion.", - "advancement.compactmachines.root": "Compact Machines", - "advancement.compactmachines.root.desc": "", - "biome.compactmachines.machine": "Compact Machine", - "block.compactmachines.machine_giant": "Compact Machine (Giant)", - "block.compactmachines.machine_large": "Compact Machine (Large)", - "block.compactmachines.machine_maximum": "Compact Machine (Maximum)", - "block.compactmachines.machine_normal": "Compact Machine (Normal)", - "block.compactmachines.machine_small": "Compact Machine (Small)", - "block.compactmachines.machine_tiny": "Compact Machine (Tiny)", - "block.compactmachines.solid_wall": "Solid Compact Machine Wall", - "block.compactmachines.tunnel_wall": "Solid Compact Machine Wall (with Tunnel)", - "block.compactmachines.wall": "Compact Machine Wall", - "command.compactmachines.cannot_give_machine_item": "Failed to give a new machine to player.", - "command.compactmachines.failed_command_file_error": "Failed to execute command; there was a file error. Check logs.", - "command.compactmachines.level_not_found": "Compact Machine dimension could not be found.", - "command.compactmachines.level_registered": "Compact Machine dimension found.", - "command.compactmachines.machine_given_successfully": "Created a new machine item and gave it to %s.", - "command.compactmachines.machine_not_bound": "Machine at %s is not bound to a room.", - "command.compactmachines.not_in_compact_dim": "Cannot use that command outside of a machine room.", - "command.compactmachines.room_not_found": "Room [%s] could not be found.", - "command.compactmachines.room_reg_count": "Number of registered rooms: %s", - "command.compactmachines.spawn_changed_successfully": "Spawn point for room [%s] was changed successfully.", - "command.compactmachines.summary.machines.dimension": "[%s]: %s", - "command.compactmachines.summary.machines.total": "Total: %s", - "compactmachines.connected_block": "Connected: %s", - "compactmachines.direction.down": "Down", - "compactmachines.direction.east": "East", - "compactmachines.direction.north": "North", - "compactmachines.direction.side": "Side: %s", - "compactmachines.direction.south": "South", - "compactmachines.direction.up": "Up", - "compactmachines.direction.west": "West", - "compactmachines.psd.pages.machines": "Compact Machines are the core mechanic of this mod. They allow you to build large rooms in a single block space connected to the outside world. They come in various sizes ranging from 3x3x3 to 13x13x13.\n\nYou can use Tunnels to connect the outside block faces with any of the inside walls to transport items, fluids etc.\n\nYou can enter a Compact Machine by right-clicking it with a Personal Shrinking Device. Please use JEI to look up crafting recipes.", - "compactmachines.psd.pages.machines.title": "Compact Machines", - "curios.identifier.psd": "Personal Shrinking Device", - "death.attack.compactmachines_voidair": "%1$s failed to enter the void", - "item.compactmachines.personal_shrinking_device": "Personal Shrinking Device", - "item.compactmachines.tunnels.energy": "Energy Tunnel", - "item.compactmachines.tunnels.fluid": "Fluid Tunnel", - "item.compactmachines.tunnels.item": "Item Tunnel", - "item.compactmachines.upgrades.chunkloader": "Chunkloader Upgrade", - "item.compactmachines.upgrades.unnamed": "Unnamed Room Upgrade", - "itemGroup.compactmachines": "Compact Machines", - "jei.compactmachines.machines": "Machines are used to make pocket dimensions. Craft a machine and place it in world, then use a Personal Shrinking Device to go inside.", - "jei.compactmachines.shrinking_device": "Use the Personal Shrinking Device (PSD) on a machine in order to enter a compact space. You can also right click it in the overworld for more info.", - "machine.compactmachines.absurd": "Compact Machine (Absurd)", - "machine.compactmachines.colossal": "Compact Machine (Colossal)", - "machine.compactmachines.giant": "Compact Machine (Giant)", - "machine.compactmachines.large": "Compact Machine (Large)", - "machine.compactmachines.normal": "Compact Machine (Normal)", - "machine.compactmachines.small": "Compact Machine (Small)", - "machine.compactmachines.tiny": "Compact Machine (Tiny)", - "message.compactmachines.cannot_enter": "You fumble with the shrinking device, to no avail. It refuses to work.", - "message.compactmachines.cannot_rename_not_owner": "Only %s may rename this room.", - "message.compactmachines.how_did_you_get_here": "How did you get here?!", - "message.compactmachines.machine_room_info": "Machine at %1$s is bound to a %2$s size room at %3$s", - "message.compactmachines.new_machine": "New Machine", - "message.compactmachines.no_available_sides": "There are no available sides for this tunnel type.", - "message.compactmachines.no_machine_data": "No machine data loaded; report this.", - "message.compactmachines.not_the_room_owner": "You are not the room owner; only %s may make changes.", - "message.compactmachines.player_room_info": "Player '%1$s' is inside a %3$s room at %2$s.", - "message.compactmachines.spawnpoint_set": "New spawn point set.", - "message.compactmachines.teleport_oob": "An otherworldly force prevents your teleportation.", - "message.compactmachines.unknown_room_chunk": "Unknown room at %s; please verify it exists.", - "message.compactmachines.upgrade_add_failed": "Upgrade failed to apply to room.", - "message.compactmachines.upgrade_already_present": "Upgrade has already been applied to room.", - "message.compactmachines.upgrade_applied": "Upgrade applied to room.", - "message.compactmachines.upgrade_not_present": "Upgrade is not applied to the room.", - "message.compactmachines.upgrade_remove_failed": "Upgrade removal failed to apply to room.", - "message.compactmachines.upgrade_removed": "Upgrade removed from room.", - "tooltip.compactmachines.details.psd": "Used as in-game documentation and to enter Compact Machines.", - "tooltip.compactmachines.details.solid_wall": "Warning! Unbreakable for non-creative players!", - "tooltip.compactmachines.hint.hold_shift": "Hold shift for details.", - "tooltip.compactmachines.machine.bound_to": "Bound to: %1$s", - "tooltip.compactmachines.machine.id": "Machine #%s", - "tooltip.compactmachines.machine.owner": "Owner: %s", - "tooltip.compactmachines.machine.size": "Internal Size: %1$sx%1$sx%1$s", - "tooltip.compactmachines.room_name": "Bound to room: %s", - "tooltip.compactmachines.room_upgrade_type": "Type: %s", - "tooltip.compactmachines.tunnel_type": "Type ID: %1$s", - "tooltip.compactmachines.tutorial_apply_room_upgrade": "Use on a bound machine block to apply upgrade.", - "tooltip.compactmachines.unknown_player": "Unknown Player", - "tooltip.compactmachines.unknown_tunnel_type": "Unknown Tunnel Type (%s)" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json b/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json deleted file mode 100644 index 0edb0aab..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/lang/ru_ru.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "block.compactmachines.machine_giant": "Компактный механизм (Гигантский)", - "block.compactmachines.machine_large": "Компактный механизм (Большой)", - "block.compactmachines.machine_maximum": "Компактный механизм (Максимальный)", - "block.compactmachines.machine_normal": "Компактный механизм (Средний)", - "block.compactmachines.machine_small": "Компактный механизм (Маленький)", - "block.compactmachines.machine_tiny": "Компактный механизм (Крошечный)", - "block.compactmachines.solid_wall": "Прочная стена компактного механизма", - "block.compactmachines.tunnel_wall": "Прочная стена компактного механизма (с Туннелем)", - "block.compactmachines.wall": "Стена компактного механизма", - "compactmachines.connected_block": "Подключено: %s", - "compactmachines.direction.down": "Низ", - "compactmachines.direction.east": "Восток", - "compactmachines.direction.north": "Север", - "compactmachines.direction.side": "Сторона: %s", - "compactmachines.direction.south": "Юг", - "compactmachines.direction.up": "Верх", - "compactmachines.direction.west": "Запад", - "compactmachines.psd.pages.machines": "Компактные механизмы являются основной механикой этого мода. Они позволяют Вам строить большие комнаты в пространстве размером в один блок, соединённого с внешним миром.\nОни бывают разных размеров, начиная от 3x3x3 и заканчивая 13x13x13.\n\nВы можете использовать Туннели, чтобы соединять внешние стороны блока с внутренними стенами для транспортировки предметов, жидкостей и т.д.\n\nВойти в механизм можно, нажав по нему ПКМ Персональным сжимающим устройством. Пожалуйста, используйте JEI для просмотра рецептов создания.", - "compactmachines.psd.pages.machines.title": "Компактные механизмы", - "item.compactmachines.personal_shrinking_device": "Персональное сжимающее устройство", - "item.compactmachines.tunnel": "Предметный туннель", - "itemGroup.compactmachines": "Компактные механизмы", - "message.compactmachines.cannot_enter": "Вы возитесь с персональным сжимающим устройством, но безрезультатно. Оно отказывается работать.", - "message.compactmachines.no_machine_data": "Данные механизма не загружены; сообщите об этом разработчику.", - "message.compactmachines.spawnpoint_set": "Новая точка возрождения установлена.", - "tooltip.compactmachines.details.psd": "Используется в качестве внутриигровой документации, а также для входа в Компактные механизмы.", - "tooltip.compactmachines.details.solid_wall": "Внимание! Неразрушим для игроков без творческого режима!", - "tooltip.compactmachines.hint.hold_shift": "Удерживайте Shift для просмотра деталей.", - "tooltip.compactmachines.machine.id": "ID механизма: %s", - "tooltip.compactmachines.machine.owner": "Владелец: %s", - "tooltip.compactmachines.machine.size": "Размер: %1$sx%1$sx%1$s", - "tooltip.compactmachines.tunnel_type": "ID типа: %1$s", - "tooltip.compactmachines.unknown_player": "Неизвестный игрок", - "tooltip.compactmachines.unknown_tunnel_type": "Неизвестный тип канала (%s)" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json deleted file mode 100644 index 29db3656..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "parent": "minecraft:block/block", - "elements": [ - { - "faces": { - "down": { - "cullface": "down", - "texture": "#border" - }, - "east": { - "cullface": "east", - "texture": "#border" - }, - "north": { - "cullface": "north", - "texture": "#border" - }, - "south": { - "cullface": "south", - "texture": "#border" - }, - "up": { - "cullface": "up", - "texture": "#border" - }, - "west": { - "cullface": "west", - "texture": "#border" - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - }, - { - "faces": { - "down": { - "cullface": "down", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - }, - "east": { - "cullface": "east", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - }, - "north": { - "cullface": "north", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - }, - "south": { - "cullface": "south", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - }, - "up": { - "cullface": "up", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - }, - "west": { - "cullface": "west", - "emissivity": 2, - "texture": "#tint", - "tintindex": 0 - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - }, - { - "faces": { - "down": { - "cullface": "down", - "texture": "#overlay", - "tintindex": 1 - }, - "east": { - "cullface": "east", - "texture": "#overlay", - "tintindex": 1 - }, - "north": { - "cullface": "north", - "texture": "#overlay", - "tintindex": 1 - }, - "south": { - "cullface": "south", - "texture": "#overlay", - "tintindex": 1 - }, - "up": { - "cullface": "up", - "texture": "#overlay", - "tintindex": 1 - }, - "west": { - "cullface": "west", - "texture": "#overlay", - "tintindex": 1 - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - } - ], - "render_type": "minecraft:cutout_mipped_all", - "textures": { - "border": "compactmachines:block/machine/border", - "overlay": "compactmachines:block/machine/overlay", - "tint": "compactmachines:block/machine/tint" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json deleted file mode 100644 index cd99e368..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_giant.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_giant" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json deleted file mode 100644 index 004a4292..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_large.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_large" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json deleted file mode 100644 index 689a2f68..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_maximum.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_maximum" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json deleted file mode 100644 index 92b1ed83..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_normal.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_normal" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json deleted file mode 100644 index efa0936b..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_small.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_small" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json deleted file mode 100644 index 7ecb26b9..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/machine/machine_tiny.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/machine/machine_tiny" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json deleted file mode 100644 index 60f431ce..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/block/wall.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "textures": { - "all": "compactmachines:block/wall" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json deleted file mode 100644 index ba002789..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/chunkloader_upgrade.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "compactmachines:upgrades/chunkloader" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json deleted file mode 100644 index 03f0b5b1..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json deleted file mode 100644 index 3d3b9b68..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_giant.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_giant" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json deleted file mode 100644 index c7f0b63f..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_large.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_large" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json deleted file mode 100644 index 6c3c130f..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_maximum.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_maximum" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json deleted file mode 100644 index 0e5006ea..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_normal.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_normal" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json deleted file mode 100644 index eaa64590..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_small.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_small" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json deleted file mode 100644 index d289b421..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/machine_tiny.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine_tiny" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json deleted file mode 100644 index 03f0b5b1..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/new_machine.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/machine/machine" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json deleted file mode 100644 index 0ac4acb9..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/personal_shrinking_device.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "compactmachines:item/personal_shrinking_device" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json deleted file mode 100644 index b62025de..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/solid_wall.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/wall" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json deleted file mode 100644 index 46ed8ef1..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/tunnel.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "compactmachines:item/tunnel" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json b/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json deleted file mode 100644 index b62025de..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/item/wall.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "compactmachines:block/wall" -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json deleted file mode 100644 index 5333b73c..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/base.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "parent": "minecraft:block/block", - "elements": [ - { - "faces": { - "down": { - "cullface": "down", - "texture": "#wall" - }, - "east": { - "cullface": "east", - "texture": "#wall" - }, - "north": { - "cullface": "north", - "texture": "#wall" - }, - "south": { - "cullface": "south", - "texture": "#wall" - }, - "up": { - "cullface": "up", - "texture": "#wall" - }, - "west": { - "cullface": "west", - "texture": "#wall" - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - }, - { - "faces": { - "down": { - "cullface": "down", - "texture": "#tunnel", - "tintindex": 0 - }, - "east": { - "cullface": "east", - "texture": "#tunnel", - "tintindex": 0 - }, - "north": { - "cullface": "north", - "texture": "#tunnel", - "tintindex": 0 - }, - "south": { - "cullface": "south", - "texture": "#tunnel", - "tintindex": 0 - }, - "up": { - "cullface": "up", - "texture": "#tunnel", - "tintindex": 0 - }, - "west": { - "cullface": "west", - "texture": "#tunnel", - "tintindex": 0 - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - }, - { - "faces": { - "down": { - "cullface": "down", - "texture": "#indicator", - "tintindex": 1 - }, - "east": { - "cullface": "east", - "texture": "#indicator", - "tintindex": 1 - }, - "north": { - "cullface": "north", - "texture": "#indicator", - "tintindex": 1 - }, - "south": { - "cullface": "south", - "texture": "#indicator", - "tintindex": 1 - }, - "up": { - "cullface": "up", - "texture": "#indicator", - "tintindex": 1 - }, - "west": { - "cullface": "west", - "texture": "#indicator", - "tintindex": 1 - } - }, - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 16 - ] - } - ], - "textures": { - "indicator": "compactmachines:block/tunnels/indicator", - "tunnel": "compactmachines:block/tunnels/tunnel" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json deleted file mode 100644 index 04aa8827..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/down.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/down" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json deleted file mode 100644 index 65bfb276..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/east.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/east" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json deleted file mode 100644 index f1ccc1ec..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/north.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/north" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json deleted file mode 100644 index 847de2b4..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/south.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/south" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json deleted file mode 100644 index dc98bc5a..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/up.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/up" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json b/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json deleted file mode 100644 index b16d9202..00000000 --- a/forge-main/src/generated/resources/assets/compactmachines/models/tunnels/west.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "compactmachines:tunnels/base", - "render_type": "minecraft:cutout", - "textures": { - "wall": "compactmachines:block/tunnels/west" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json deleted file mode 100644 index 5047ad60..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_giant.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_giant" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_giant.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_giant" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_giant" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json deleted file mode 100644 index a0e2c9a6..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_large.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_large" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_large.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_large" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_large" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json deleted file mode 100644 index 0d54759f..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_max.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_max" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_max.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_maximum" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_max" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json deleted file mode 100644 index ed908267..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_normal.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_normal" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_normal.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_normal" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_normal" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json deleted file mode 100644 index ef4a0eb0..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_small.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_small" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_small.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_small" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_small" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json deleted file mode 100644 index fe7e6e1e..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/claimed_machine_tiny.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:got_shrinking_device", - "criteria": { - "claimed_machine": { - "conditions": {}, - "trigger": "compactmachines:claimed_machine_tiny" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.claimed_machine_tiny.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_tiny" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.claimed_machine_tiny" - } - }, - "requirements": [ - [ - "claimed_machine" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json b/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json deleted file mode 100644 index 06ce065b..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/foundations.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "parent": "compactmachines:root", - "criteria": { - "obtained_wall": { - "conditions": { - "items": [ - { - "items": [ - "compactmachines:wall" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.foundations.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:wall" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.foundations" - } - }, - "requirements": [ - [ - "obtained_wall" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json deleted file mode 100644 index 2bd77b32..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/got_shrinking_device.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "parent": "compactmachines:root", - "criteria": { - "obtained_psd": { - "conditions": { - "items": [ - { - "items": [ - "compactmachines:personal_shrinking_device" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.got_shrinking_device.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:personal_shrinking_device" - }, - "show_toast": true, - "title": { - "translate": "advancement.compactmachines.got_shrinking_device" - } - }, - "requirements": [ - [ - "obtained_psd" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json b/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json deleted file mode 100644 index 40f0e867..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/how_did_you_get_here.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:root", - "criteria": { - "got_stuck": { - "conditions": {}, - "trigger": "compactmachines:how_did_you_get_here" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.how_did_you_get_here.desc" - }, - "frame": "challenge", - "hidden": true, - "icon": { - "item": "compactmachines:personal_shrinking_device" - }, - "show_toast": false, - "title": { - "translate": "advancement.compactmachines.how_did_you_get_here" - } - }, - "requirements": [ - [ - "got_stuck" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json deleted file mode 100644 index 9c183b45..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_absurd.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_absurd" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_absurd" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json deleted file mode 100644 index 60cad3db..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_colossal.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_colossal" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_colossal" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json deleted file mode 100644 index 8595c653..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_giant.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_giant" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_giant" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json deleted file mode 100644 index 9d02638a..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_large.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_large" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_large" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json deleted file mode 100644 index d33c1b95..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_normal.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_normal" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_normal" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json deleted file mode 100644 index 709d8380..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_small.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_small" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_small" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json deleted file mode 100644 index b823f78c..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/new_machine_tiny.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:new_machine_tiny" - }, - "trigger": "minecraft:recipe_unlocked" - } - }, - "requirements": [ - [ - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:new_machine_tiny" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json deleted file mode 100644 index b559b9a1..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/personal_shrinking_device.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:personal_shrinking_device" - }, - "trigger": "minecraft:recipe_unlocked" - }, - "picked_up_ender_eye": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:ender_eye" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "requirements": [ - [ - "picked_up_ender_eye", - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:personal_shrinking_device" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json deleted file mode 100644 index 6d2e55cf..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/compactmachines/wall.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:wall" - }, - "trigger": "minecraft:recipe_unlocked" - }, - "picked_up_deepslate": { - "conditions": { - "items": [ - { - "tag": "forge:cobblestone/deepslate" - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "requirements": [ - [ - "picked_up_deepslate", - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:wall" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json deleted file mode 100644 index 3ec08921..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/energy.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:tunnels/energy" - }, - "trigger": "minecraft:recipe_unlocked" - }, - "observer": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:observer" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "requirements": [ - [ - "observer", - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:energy" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json deleted file mode 100644 index 8fa3c89a..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/fluid.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:tunnels/fluid" - }, - "trigger": "minecraft:recipe_unlocked" - }, - "observer": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:observer" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "requirements": [ - [ - "observer", - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:fluid" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json deleted file mode 100644 index bd2ca9d4..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recipes/item.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "parent": "minecraft:recipes/root", - "criteria": { - "has_the_recipe": { - "conditions": { - "recipe": "compactmachines:tunnels/item" - }, - "trigger": "minecraft:recipe_unlocked" - }, - "observer": { - "conditions": { - "items": [ - { - "items": [ - "minecraft:observer" - ] - } - ] - }, - "trigger": "minecraft:inventory_changed" - } - }, - "requirements": [ - [ - "observer", - "has_the_recipe" - ] - ], - "rewards": { - "recipes": [ - "compactmachines:item" - ] - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json b/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json deleted file mode 100644 index 802395c9..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/recursion.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "parent": "compactmachines:root", - "criteria": { - "recursion": { - "conditions": {}, - "trigger": "compactmachines:recursion" - } - }, - "display": { - "announce_to_chat": true, - "description": { - "translate": "advancement.compactmachines.recursion.desc" - }, - "frame": "challenge", - "hidden": true, - "icon": { - "item": "compactmachines:personal_shrinking_device" - }, - "show_toast": false, - "title": { - "translate": "advancement.compactmachines.recursion" - } - }, - "requirements": [ - [ - "recursion" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/advancements/root.json b/forge-main/src/generated/resources/data/compactmachines/advancements/root.json deleted file mode 100644 index 3b4810e7..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/advancements/root.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "criteria": { - "root": { - "trigger": "minecraft:impossible" - } - }, - "display": { - "announce_to_chat": false, - "background": "compactmachines:textures/block/wall.png", - "description": { - "translate": "advancement.compactmachines.root.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "compactmachines:machine_normal" - }, - "show_toast": false, - "title": { - "translate": "advancement.compactmachines.root" - } - }, - "requirements": [ - [ - "root" - ] - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json deleted file mode 100644 index 14b452ab..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/absurd.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "color": -16734632, - "dimensions": [ 25, 25, 25 ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json deleted file mode 100644 index 713c2f80..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/colossal.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -12435646, - "dimensions": [ - 13, - 13, - 13 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json deleted file mode 100644 index 280b719d..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/giant.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -12331315, - "dimensions": [ - 11, - 11, - 11 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json deleted file mode 100644 index 0a855755..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/large.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -14607570, - "dimensions": [ - 9, - 9, - 9 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json deleted file mode 100644 index 3caa8209..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/normal.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -265674, - "dimensions": [ - 7, - 7, - 7 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json deleted file mode 100644 index 168f1b61..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/small.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -2829614, - "dimensions": [ - 5, - 5, - 5 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json b/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json deleted file mode 100644 index 706ea617..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/compactmachines/room_templates/tiny.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": -3581165, - "dimensions": [ - 3, - 3, - 3 - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json b/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json deleted file mode 100644 index cd685317..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/dimension/compact_world.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "ResourceKey[minecraft:dimension / compactmachines:compact_world]", - "generator": { - "type": "minecraft:flat", - "settings": { - "biome": "compactmachines:machine", - "features": false, - "lakes": false, - "layers": [ - { - "block": "compactmachines:machine_void_air", - "height": 256 - } - ] - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json b/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json deleted file mode 100644 index 06c3fac6..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/dimension_type/compact_world.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "ambient_light": 0.0, - "bed_works": false, - "coordinate_scale": 1.0, - "effects": "minecraft:overworld", - "fixed_time": 18000, - "has_ceiling": false, - "has_raids": false, - "has_skylight": true, - "height": 256, - "infiniburn": "#minecraft:infiniburn_overworld", - "logical_height": 256, - "min_y": 0, - "monster_spawn_block_light_limit": 0, - "monster_spawn_light_level": { - "type": "minecraft:uniform", - "value": { - "max_inclusive": 7, - "min_inclusive": 0 - } - }, - "natural": false, - "piglin_safe": false, - "respawn_anchor_works": false, - "ultrawarm": false -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json deleted file mode 100644 index 358695d2..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json deleted file mode 100644 index 698b696b..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_giant.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_giant", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json deleted file mode 100644 index 73a4ec72..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_large.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_large", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json deleted file mode 100644 index 49cea905..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_maximum.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_maximum", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json deleted file mode 100644 index 8d032983..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_normal.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_normal", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json deleted file mode 100644 index 5f68eccd..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_small.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_small", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json deleted file mode 100644 index ce53a963..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/machine_tiny.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:machine" - } - ], - "functions": [ - { - "function": "compactmachines:copy_room_binding" - } - ], - "name": "compactmachines:machine_tiny", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json b/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json deleted file mode 100644 index a92ff7f0..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/loot_tables/blocks/wall.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "compactmachines:wall" - } - ], - "name": "compactmachines:wall", - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json deleted file mode 100644 index af76abbf..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_absurd.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:nether_stars" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -16734632, - "template_id": "compactmachines:absurd" - }, - "machine_color": -16734632, - "template_id": "compactmachines:absurd" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json deleted file mode 100644 index 74855294..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_colossal.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:ingots/netherite" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -12435646, - "template_id": "compactmachines:colossal" - }, - "machine_color": -12435646, - "template_id": "compactmachines:colossal" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json deleted file mode 100644 index 9cb943ef..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_giant.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:obsidian" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -12331315, - "template_id": "compactmachines:giant" - }, - "machine_color": -12331315, - "template_id": "compactmachines:giant" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json deleted file mode 100644 index db3d272d..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_large.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:storage_blocks/diamond" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -14607570, - "template_id": "compactmachines:large" - }, - "machine_color": -14607570, - "template_id": "compactmachines:large" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json deleted file mode 100644 index 5d359968..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_normal.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:storage_blocks/gold" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -265674, - "template_id": "compactmachines:normal" - }, - "machine_color": -265674, - "template_id": "compactmachines:normal" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json deleted file mode 100644 index b8d6eeba..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_small.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:storage_blocks/iron" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -2829614, - "template_id": "compactmachines:small" - }, - "machine_color": -2829614, - "template_id": "compactmachines:small" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json b/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json deleted file mode 100644 index 2ab2adaa..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/new_machine_tiny.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "C": { - "tag": "forge:storage_blocks/copper" - }, - "W": { - "item": "compactmachines:wall" - } - }, - "pattern": [ - "WWW", - "WCW", - "WWW" - ], - "result": { - "item": "compactmachines:new_machine", - "nbt": { - "BlockEntityTag": { - "id": "compactmachines:compact_machine", - "machine_color": -3581165, - "template_id": "compactmachines:tiny" - }, - "machine_color": -3581165, - "template_id": "compactmachines:tiny" - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json deleted file mode 100644 index 1744ce2f..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/personal_shrinking_device.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "B": { - "item": "minecraft:book" - }, - "E": { - "item": "minecraft:ender_eye" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "P": { - "tag": "forge:glass_panes" - } - }, - "pattern": [ - " P ", - "EBE", - " I " - ], - "result": { - "item": "compactmachines:personal_shrinking_device" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json deleted file mode 100644 index 2957a313..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/energy.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "ingredients": [ - { - "item": "minecraft:glowstone_dust" - }, - { - "item": "minecraft:ender_pearl" - }, - { - "item": "minecraft:redstone" - }, - { - "item": "minecraft:observer" - } - ], - "result": { - "count": 2, - "item": "compactmachines:tunnel", - "nbt": { - "definition": { - "id": "compactmachines:energy" - } - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json deleted file mode 100644 index 393ad8eb..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/fluid.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "ingredients": [ - { - "item": "minecraft:bucket" - }, - { - "item": "minecraft:ender_pearl" - }, - { - "item": "minecraft:redstone" - }, - { - "item": "minecraft:observer" - } - ], - "result": { - "count": 2, - "item": "compactmachines:tunnel", - "nbt": { - "definition": { - "id": "compactmachines:fluid" - } - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json b/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json deleted file mode 100644 index 3c157386..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/tunnels/item.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "ingredients": [ - { - "tag": "forge:chests" - }, - { - "item": "minecraft:ender_pearl" - }, - { - "item": "minecraft:redstone" - }, - { - "item": "minecraft:observer" - } - ], - "result": { - "count": 2, - "item": "compactmachines:tunnel", - "nbt": { - "definition": { - "id": "compactmachines:item" - } - } - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json b/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json deleted file mode 100644 index 264133a3..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/recipes/wall.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "D": { - "item": "minecraft:polished_deepslate" - } - }, - "pattern": [ - "DDD", - "D D", - "DDD" - ], - "result": { - "count": 8, - "item": "compactmachines:wall" - } -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json deleted file mode 100644 index d26628e8..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/legacy_machines.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "compactmachines:machine_tiny", - "compactmachines:machine_large", - "compactmachines:machine_normal", - "compactmachines:machine_maximum", - "compactmachines:machine_small", - "compactmachines:machine_giant" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json b/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json deleted file mode 100644 index 3172cee4..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/tags/blocks/machine.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "compactmachines:machine_tiny", - "compactmachines:machine_large", - "compactmachines:machine_normal", - "compactmachines:machine_maximum", - "compactmachines:machine_small", - "compactmachines:machine_giant", - "compactmachines:machine" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json deleted file mode 100644 index d50bdd2d..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/tags/items/machine.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "compactmachines:machine_small", - "compactmachines:machine_tiny", - "compactmachines:machine_maximum", - "compactmachines:machine_normal", - "compactmachines:machine_giant", - "compactmachines:machine_large", - "compactmachines:machine", - "compactmachines:new_machine" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json deleted file mode 100644 index 50be3eec..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/tags/items/room_upgrade.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "compactmachines:chunkloader_upgrade" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json b/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json deleted file mode 100644 index eca08a1c..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/tags/items/shrinking_device.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "compactmachines:personal_shrinking_device" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json b/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json deleted file mode 100644 index fb710fa1..00000000 --- a/forge-main/src/generated/resources/data/compactmachines/worldgen/biome/machine.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "carvers": {}, - "downfall": 0.0, - "effects": { - "fog_color": 12638463, - "sky_color": -16777216, - "water_color": 4159204, - "water_fog_color": 329011 - }, - "features": [], - "precipitation": "none", - "spawn_costs": {}, - "spawners": { - "ambient": [ - { - "type": "minecraft:bat", - "maxCount": 8, - "minCount": 8, - "weight": 10 - } - ], - "axolotls": [], - "creature": [ - { - "type": "minecraft:sheep", - "maxCount": 4, - "minCount": 4, - "weight": 12 - }, - { - "type": "minecraft:pig", - "maxCount": 4, - "minCount": 4, - "weight": 10 - }, - { - "type": "minecraft:chicken", - "maxCount": 4, - "minCount": 4, - "weight": 10 - }, - { - "type": "minecraft:cow", - "maxCount": 4, - "minCount": 4, - "weight": 8 - }, - { - "type": "minecraft:horse", - "maxCount": 6, - "minCount": 2, - "weight": 5 - }, - { - "type": "minecraft:donkey", - "maxCount": 3, - "minCount": 1, - "weight": 1 - } - ], - "misc": [], - "monster": [ - { - "type": "minecraft:spider", - "maxCount": 4, - "minCount": 4, - "weight": 100 - }, - { - "type": "minecraft:zombie", - "maxCount": 4, - "minCount": 4, - "weight": 95 - }, - { - "type": "minecraft:zombie_villager", - "maxCount": 1, - "minCount": 1, - "weight": 5 - }, - { - "type": "minecraft:skeleton", - "maxCount": 4, - "minCount": 4, - "weight": 100 - }, - { - "type": "minecraft:creeper", - "maxCount": 4, - "minCount": 4, - "weight": 100 - }, - { - "type": "minecraft:slime", - "maxCount": 4, - "minCount": 4, - "weight": 100 - }, - { - "type": "minecraft:enderman", - "maxCount": 4, - "minCount": 1, - "weight": 10 - }, - { - "type": "minecraft:witch", - "maxCount": 1, - "minCount": 1, - "weight": 5 - } - ], - "underground_water_creature": [ - { - "type": "minecraft:glow_squid", - "maxCount": 6, - "minCount": 4, - "weight": 10 - } - ], - "water_ambient": [], - "water_creature": [] - }, - "temperature": 0.8 -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/curios/tags/items/psd.json b/forge-main/src/generated/resources/data/curios/tags/items/psd.json deleted file mode 100644 index eca08a1c..00000000 --- a/forge-main/src/generated/resources/data/curios/tags/items/psd.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "compactmachines:personal_shrinking_device" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json deleted file mode 100644 index dae8e6c0..00000000 --- a/forge-main/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "compactmachines:wall", - "compactmachines:machine_tiny", - "compactmachines:machine_large", - "compactmachines:machine_normal", - "compactmachines:machine_maximum", - "compactmachines:machine_small", - "compactmachines:machine_giant", - "compactmachines:machine" - ] -} \ No newline at end of file diff --git a/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json deleted file mode 100644 index dae8e6c0..00000000 --- a/forge-main/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "compactmachines:wall", - "compactmachines:machine_tiny", - "compactmachines:machine_large", - "compactmachines:machine_normal", - "compactmachines:machine_maximum", - "compactmachines:machine_small", - "compactmachines:machine_giant", - "compactmachines:machine" - ] -} \ No newline at end of file diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/BlockLootGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGenUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java index 3dbcd52e..f7a4403f 100644 --- a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DataGeneration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java @@ -1,11 +1,11 @@ package dev.compactmods.machines.datagen; -import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.datagen.lang.EnglishLangGenerator; import dev.compactmods.machines.datagen.lang.RussianLangGenerator; import dev.compactmods.machines.datagen.room.RoomTemplates; import dev.compactmods.machines.datagen.tags.BlockTagGenerator; import dev.compactmods.machines.datagen.tags.ItemTagGenerator; +import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/ItemModelGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java similarity index 94% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java index 87490f8a..95a39aa1 100644 --- a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java @@ -66,7 +66,11 @@ public void run(@Nonnull CachedOutput cache) { private JsonElement writeFlatDimension(LevelStem dimension) { JsonObject d = new JsonObject(); - d.addProperty("type", CompactDimension.LEVEL_KEY.toString()); + final var regAccess = RegistryAccess.builtinCopy(); + final var dimTypes = regAccess.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); + + d.add("type", ResourceLocation.CODEC.encodeStart(JsonOps.INSTANCE, CompactDimension.LEVEL_KEY.location()) + .getOrThrow(false, CompactMachines.LOGGER::fatal)); var gen = ChunkGenerator.CODEC.encodeStart(JsonOps.INSTANCE, dimension.generator()) .getOrThrow(false, CompactMachines.LOGGER::error) diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java similarity index 91% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 8128063b..405ef007 100644 --- a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -38,7 +38,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .pattern("D D") .pattern("DDD") .define('D', Items.POLISHED_DEEPSLATE) - .unlockedBy("picked_up_deepslate", RecipeProvider.has(Tags.Items.COBBLESTONE_DEEPSLATE)) + .unlockedBy("picked_up_deepslate", has(Tags.Items.COBBLESTONE_DEEPSLATE)) .save(consumer); ShapedRecipeBuilder.shaped(Shrinking.PERSONAL_SHRINKING_DEVICE.get()) @@ -49,7 +49,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .define('E', Items.ENDER_EYE) .define('B', Items.BOOK) .define('I', Tags.Items.INGOTS_IRON) - .unlockedBy("picked_up_ender_eye", RecipeProvider.has(Items.ENDER_EYE)) + .unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE)) .save(consumer); TunnelRecipeBuilder.tunnel(BuiltinTunnels.ITEM_TUNNEL_DEF, 2) @@ -57,7 +57,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) .requires(Items.OBSERVER) - .unlockedBy("observer", RecipeProvider.has(Items.OBSERVER)) + .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); TunnelRecipeBuilder.tunnel(BuiltinTunnels.FLUID_TUNNEL_DEF, 2) @@ -65,7 +65,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) .requires(Items.OBSERVER) - .unlockedBy("observer", RecipeProvider.has(Items.OBSERVER)) + .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); TunnelRecipeBuilder.tunnel(BuiltinTunnels.FORGE_ENERGY, 2) @@ -73,7 +73,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) .requires(Items.OBSERVER) - .unlockedBy("observer", RecipeProvider.has(Items.OBSERVER)) + .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); addMachineRecipes(consumer); @@ -110,7 +110,7 @@ protected void registerMachineRecipe(Consumer consumer, Resource if (center != null) recipe.define('C', center); - recipe.unlockedBy("has_recipe", RecipeProvider.has(wall)); + recipe.unlockedBy("has_recipe", has(wall)); recipe.addWriter(r -> { final var nbt = new JsonObject(); MachineDataTagBuilder.forTemplate(temId, tem) diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/StateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/room/RoomTemplates.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java diff --git a/forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java similarity index 100% rename from forge-main/src/datagen/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java diff --git a/forge-tunnels/build.gradle.kts b/forge-tunnels/build.gradle.kts index 017bac91..d62dcfe8 100644 --- a/forge-tunnels/build.gradle.kts +++ b/forge-tunnels/build.gradle.kts @@ -23,4 +23,5 @@ dependencies { minecraft { mappings("parchment", parchment_version) + accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8f30723a..525ba4ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,8 +13,4 @@ mod_id=compactmachines cf_project=224218 cf_release_type=release -# Plugins that shall not be named -mixin_version = 0.8.5 -mixingradle_version = 0.7-SNAPSHOT - include_test_mods = true \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 9013f30a..d2271f38 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,9 +12,6 @@ pluginManagement { if (requested.id.id == "net.minecraftforge.gradle") { useModule("${requested.id}:ForgeGradle:${requested.version}") } - if (requested.id.id == "org.spongepowered.mixin") { - useModule("org.spongepowered:mixingradle:${requested.version}") - } } } } From 0be4991f66643c6123947273d29a0e6410f48deb Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Oct 2022 04:46:45 -0400 Subject: [PATCH 23/85] The build configs, they taunt me --- .github/workflows/ci-tests-nightly.yml | 2 +- build.gradle.kts | 79 +------------------------- forge-api/build.gradle.kts | 71 ++++++++++++++++++++++- forge-main/build.gradle.kts | 64 ++++++++++++++------- 4 files changed, 117 insertions(+), 99 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 2007cd99..871aa265 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -146,7 +146,7 @@ jobs: CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - name: Publish gradle nightly jar - run: ./gradlew publishReleasePublicationToGitHubPackagesRepository + run: ./gradlew publishAllPublicationsToGitHubPackagesRepository env: CM_RELEASE: false CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} diff --git a/build.gradle.kts b/build.gradle.kts index 651d9645..a0396fc0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,78 +1 @@ -var semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -var buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" - -var nightlyVersion: String = "${semver}+nightly-b${buildNumber}" -var isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) - -var mod_id: String by extra - -version = if(isRelease) semver else nightlyVersion -group = "dev.compactmods" - -tasks.create("getBuildInfo") { - println("Mod ID: ${mod_id}") - println("Version: ${version}") - println("Semver Version: ${semver}") - println("Nightly Build: ${nightlyVersion}") -} - - -//println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) -//minecraft { -// mappings channel: 'parchment', version: parchment_version -// // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. -// -// -// -// // Default run configurations. -// // These can be tweaked, removed, or duplicated as needed. -// runs { -// all { -// // Recommended logging data for a userdev environment -// property 'forge.logging.markers', '' // 'SCAN,REGISTRIES,REGISTRYDUMP' -// -// // Recommended logging level for the console -// property 'forge.logging.console.level', 'debug' -// -// property 'mixin.env.remapRefMap', 'true' -// property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" -// -// if (!System.getenv().containsKey("CI")) { -// // JetBrains Runtime Hotswap -// jvmArg '-XX:+AllowEnhancedClassRedefinition' -// jvmArg '-XX:HotswapAgent=fatjar' -// } else { -// forceExit false -// } -// } -// -// client { -// workingDirectory project.file('run/client') -// -// args '--username', 'Nano' -// args '--width', 1920 -// args '--height', 1080 -// -// -// source sourceSets.api -// mods { -// compactmachines { -// source sourceSets.tunnels -// source sourceSets.main -// } -// } -// } -// } -//} - -//// -////task apiJar(type: Jar) { -//// from sourceSets.api.output -//// // Sources included because of MinecraftForge/ForgeGradle#369 -//// classifier 'api' -////} -// -//artifacts { -// archives jar // , apiJar -//} -// \ No newline at end of file +// no-op \ No newline at end of file diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts index 805e8f18..4c752581 100644 --- a/forge-api/build.gradle.kts +++ b/forge-api/build.gradle.kts @@ -1,11 +1,29 @@ + import net.minecraftforge.gradle.userdev.UserDevExtension +import java.text.SimpleDateFormat +import java.util.* + +val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" +val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" +val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) + +var mod_id: String by extra plugins { - java + id("idea") + id("eclipse") + id("maven-publish") id("net.minecraftforge.gradle") version ("5.1.+") id("org.parchmentmc.librarian.forgegradle") version ("1.+") } +base { + archivesName.set(mod_id) + group = "dev.compactmods" + version = if(isRelease) semver else nightlyVersion +} + java { toolchain.languageVersion.set(JavaLanguageVersion.of(17)) withSourcesJar() @@ -38,4 +56,55 @@ configure { dependencies { minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") +} + +tasks.withType { + manifest { + val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) + attributes(mapOf( + "Specification-Title" to "Compact Machines API", + "Specification-Vendor" to "", + "Specification-Version" to "1", // We are version 1 of ourselves + "Implementation-Title" to "Compact Machines API", + "Implementation-Version" to archiveVersion, + "Implementation-Vendor" to "", + "Implementation-Timestamp" to now + )) + } +} + +tasks.jar { + archiveClassifier.set("api") +} + +tasks.named("sourcesJar") { + archiveClassifier.set("api-sources") +} + +artifacts { + archives(tasks.jar.get()) + archives(tasks.named("sourcesJar").get()) +} + +publishing { + publications.register("releaseApi") { + artifactId = "compactmachines" + groupId = "dev.compactmods" + + artifacts { + artifact(tasks.jar.get()) + artifact(tasks.named("sourcesJar").get()) + } + } + + repositories { + // GitHub Packages + maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } \ No newline at end of file diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index a30e183a..937a42eb 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -1,11 +1,24 @@ import java.text.SimpleDateFormat import java.util.* +val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" +val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" + +val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) + var mod_id: String by extra var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra +tasks.create("getBuildInfo") { + println("Mod ID: ${mod_id}") + println("Version: ${version}") + println("Semver Version: ${semver}") + println("Nightly Build: ${nightlyVersion}") +} + plugins { id("idea") id("eclipse") @@ -16,7 +29,8 @@ plugins { base { archivesName.set(mod_id) - version = "5.0.0" + group = "dev.compactmods" + version = if(isRelease) semver else nightlyVersion } java { @@ -202,6 +216,19 @@ minecraft { args("--all") args("--output", file("src/generated/resources/")) } + + create("gameTestServer") { + taskName("runGameTestServer") + workingDirectory(file("run/gametests")) + ideaModule("Compact_Machines.forge-main.test") + + forceExit(false) + environment("CM5_TEST_RESOURCES", file("src/test/resources")) + + mods.named(mod_id) { + source(sourceSets.test.get()) + } + } } } @@ -217,14 +244,17 @@ tasks.withType { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -tasks.jar { - from(sourceSets.main.get().output) - from(project(":forge-tunnels").sourceSets.main.get().output) +tasks.withType { + // Remove datagen source and cache info + this.exclude("dev/compactmods/machines/datagen/**") + this.exclude(".cache/**") - finalizedBy("reobfJar") - archiveClassifier.set("slim") + // TODO - Switch to API jar when JarInJar supports it better + val api = project(":forge-api").tasks.jar.get().archiveFile; + from(api.map { zipTree(it) }) - this.exclude("dev/compactmods/machines/datagen/**") + val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; + from(tunnels.map { zipTree(it) }) manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) @@ -232,7 +262,7 @@ tasks.jar { "Specification-Title" to "Compact Machines", "Specification-Vendor" to "", "Specification-Version" to "1", // We are version 1 of ourselves - "Implementation-Title" to project.name, + "Implementation-Title" to "Compact Machines", "Implementation-Version" to archiveVersion, "Implementation-Vendor" to "", "Implementation-Timestamp" to now @@ -240,16 +270,13 @@ tasks.jar { } } +tasks.jar { + finalizedBy("reobfJar") + archiveClassifier.set("slim") +} + tasks.jarJar { archiveClassifier.set("") - this.exclude("dev/compactmods/machines/datagen/**") - - // TODO - Switch to API jar when JarInJar supports it better - val api = project(":forge-api").tasks.jar.get().archiveFile; - from(api.map { zipTree(it) }) - - val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; - from(tunnels.map { zipTree(it) }) } artifacts { @@ -258,14 +285,13 @@ artifacts { } publishing { - publications.register("release") { + publications.register("releaseMain") { artifactId = mod_id groupId = "dev.compactmods" artifacts { artifact(tasks.jar.get()) - // artifact apiJar - artifact(tasks.jarJar) + artifact(tasks.jarJar.get()) } } From 578dcec30a6d53ed6f6c4fdcb2f8750bbc7ebf00 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Oct 2022 16:06:53 -0400 Subject: [PATCH 24/85] Reobfuscate everything --- forge-api/build.gradle.kts | 1 + forge-main/build.gradle.kts | 5 +++-- forge-tunnels/build.gradle.kts | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts index 4c752581..121688e1 100644 --- a/forge-api/build.gradle.kts +++ b/forge-api/build.gradle.kts @@ -75,6 +75,7 @@ tasks.withType { tasks.jar { archiveClassifier.set("api") + finalizedBy("reobfJar") } tasks.named("sourcesJar") { diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 937a42eb..3253ab3c 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -233,7 +233,7 @@ minecraft { } reobf { - jarJar { } + this.create("jarJar") } tasks.compileJava { @@ -271,12 +271,13 @@ tasks.withType { } tasks.jar { - finalizedBy("reobfJar") archiveClassifier.set("slim") + finalizedBy("reobfJar") } tasks.jarJar { archiveClassifier.set("") + finalizedBy("reobfJarJar") } artifacts { diff --git a/forge-tunnels/build.gradle.kts b/forge-tunnels/build.gradle.kts index d62dcfe8..42c90819 100644 --- a/forge-tunnels/build.gradle.kts +++ b/forge-tunnels/build.gradle.kts @@ -24,4 +24,8 @@ dependencies { minecraft { mappings("parchment", parchment_version) accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) +} + +tasks.jar { + finalizedBy("reobfJar") } \ No newline at end of file From a8a93e92ad8cafdc0c2063ad19123622b3ef0755 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Oct 2022 19:29:37 -0400 Subject: [PATCH 25/85] [ci] Another attempt at publishing under one root project --- .github/workflows/ci-tests-nightly.yml | 2 +- build.gradle.kts | 39 +++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 871aa265..3b49078a 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -146,7 +146,7 @@ jobs: CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - name: Publish gradle nightly jar - run: ./gradlew publishAllPublicationsToGitHubPackagesRepository + run: ./gradlew publishAllForgePublicationToGitHubPackagesRepository env: CM_RELEASE: false CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} diff --git a/build.gradle.kts b/build.gradle.kts index a0396fc0..d027fc9d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1 +1,38 @@ -// no-op \ No newline at end of file +// no-op +plugins { + id("java") + id("maven-publish") +} + +val mod_id: String by extra +val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" +val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" +val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) +val aVersion = if(isRelease) semver else nightlyVersion + +project.evaluationDependsOn(project(":forge-api").path) +project.evaluationDependsOn(project(":forge-main").path) + +publishing { + publications.register("allForge") { + artifactId = mod_id + groupId = "dev.compactmods" + version = aVersion + + this.artifact(project(":forge-api").tasks.jar.get()) + this.artifact(project(":forge-api").tasks.named("sourcesJar").get()) + this.artifact(project(":forge-main").tasks.jar.get()) + } + + repositories { + // GitHub Packages + maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file From d61573871dc62497d8a929c5f7e6a9df98646a31 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Fri, 14 Oct 2022 13:09:12 -0400 Subject: [PATCH 26/85] Fix classloading issue on dedicated servers, nightly version change for semver --- build.gradle.kts | 3 ++- forge-api/build.gradle.kts | 2 +- forge-main/build.gradle.kts | 2 +- .../machine/block/CompactMachineBlock.java | 4 ++-- .../machine/item/UnboundCompactMachineItem.java | 4 ++-- .../dev/compactmods/machines/room/RoomHelper.java | 14 ++++++++++++++ .../machines/room/client/RoomClientHelper.java | 4 +--- .../machines/room/server/RoomServerHelper.java | 14 ++++++++++++++ 8 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java diff --git a/build.gradle.kts b/build.gradle.kts index d027fc9d..1563ef57 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { val mod_id: String by extra val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val nightlyVersion: String = "${semver}.${buildNumber}-nightly" val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) val aVersion = if(isRelease) semver else nightlyVersion @@ -23,6 +23,7 @@ publishing { this.artifact(project(":forge-api").tasks.jar.get()) this.artifact(project(":forge-api").tasks.named("sourcesJar").get()) this.artifact(project(":forge-main").tasks.jar.get()) + this.artifact(project(":forge-main").tasks.named("jarJar").get()) } repositories { diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts index 121688e1..2b059a0e 100644 --- a/forge-api/build.gradle.kts +++ b/forge-api/build.gradle.kts @@ -5,7 +5,7 @@ import java.util.* val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val nightlyVersion: String = "${semver}.${buildNumber}-nightly" val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) var mod_id: String by extra diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 3253ab3c..55bbd8ef 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -4,7 +4,7 @@ import java.util.* val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}+nightly-b${buildNumber}" +val nightlyVersion: String = "${semver}.${buildNumber}-nightly" val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) var mod_id: String by extra diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java index e739c922..b6560e94 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.room.client.RoomClientHelper; +import dev.compactmods.machines.room.RoomHelper; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.server.MinecraftServer; @@ -65,7 +65,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder tabItems) { - var reg = RoomClientHelper.getTemplates(); + var reg = RoomHelper.getTemplates(); tabItems.addAll(reg.entrySet() .stream() .map((template) -> UnboundCompactMachineItem.forTemplate(template.getKey().location(), template.getValue())) diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java index 70d0b23d..34437d75 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; -import dev.compactmods.machines.room.client.RoomClientHelper; +import dev.compactmods.machines.room.RoomHelper; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.gui.screens.Screen; @@ -108,7 +108,7 @@ public static ResourceLocation getTemplateId(ItemStack stack) { public static Optional getTemplate(ItemStack stack) { var template = getTemplateId(stack); if (!template.equals(RoomTemplate.NO_TEMPLATE)) { - final var actualTemplate = RoomClientHelper.getTemplates().get(template); + final var actualTemplate = RoomHelper.getTemplates().get(template); return Optional.ofNullable(actualTemplate); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java new file mode 100644 index 00000000..42b52af1 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.room; + +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.room.client.RoomClientHelper; +import dev.compactmods.machines.room.server.RoomServerHelper; +import net.minecraft.core.Registry; +import net.minecraftforge.fml.DistExecutor; + +public class RoomHelper { + + public static Registry getTemplates() { + return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> RoomServerHelper::getTemplates); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java index d45a5b83..1588089d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java @@ -6,9 +6,7 @@ import net.minecraft.core.Registry; public class RoomClientHelper { - public static Registry getTemplates() { - return Minecraft.getInstance().level.registryAccess() - .registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); + return Minecraft.getInstance().level.registryAccess().registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java new file mode 100644 index 00000000..2f59511a --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.room.server; + +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.room.RoomTemplate; +import net.minecraft.core.Registry; +import net.minecraftforge.server.ServerLifecycleHooks; + +public class RoomServerHelper { + public static Registry getTemplates() { + return ServerLifecycleHooks.getCurrentServer() + .registryAccess() + .registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); + } +} From 36eadb03378183547c14fcdb387aab040a443c56 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 15 Oct 2022 13:54:12 -0400 Subject: [PATCH 27/85] Temp fix entities, start debug room info renderer --- .../api/location/IDimensionalPosition.java | 3 + .../api/room/IPlayerRoomMetadata.java | 13 ++ .../api/room/IPlayerRoomMetadataProvider.java | 15 ++ .../machines/api/room/IRoomHistory.java | 2 + .../room/RoomTemplateDimensionComparator.java | 12 ++ .../machines/client/PlayerFaceRenderer.java | 3 + .../compat/carryon/CarryOnCompat.java | 1 + .../machines/datagen/RecipeGenerator.java | 2 + .../machines/datagen/StateGenerator.java | 1 + .../datagen/lang/BaseLangGenerator.java | 1 + .../machines/datagen/room/RoomTemplates.java | 1 + .../datagen/tags/BlockTagGenerator.java | 1 + .../machines/location/LevelBlockPosition.java | 6 + .../location/PreciseDimensionalPosition.java | 7 + .../machines/machine/Machines.java | 1 + .../machine/block/CompactMachineBlock.java | 3 +- .../block/LegacySizedCompactMachineBlock.java | 3 +- .../machine/block/MachineBlockUtil.java | 19 +-- .../item/LegacyCompactMachineItem.java | 1 + .../room/PlayerRoomMetadataProvider.java | 65 +++++++++ .../machines/room/RoomCapabilities.java | 10 +- .../machines/room/RoomEventHandler.java | 23 ++- .../compactmods/machines/room/RoomHelper.java | 137 ++++++++++++++++++ ...er.java => PlayerRoomHistoryProvider.java} | 13 +- .../PlayerRoomMetadataProviderProvider.java | 51 +++++++ .../room/capability/RoomCapEventHandler.java | 5 +- .../room/client/RoomClientEventHandler.java | 18 +++ .../overlay/RoomMetadataDebugOverlay.java | 52 +++++++ .../room/graph/CompactRoomProvider.java | 7 + .../machines/room/graph/RoomChunkEdge.java | 11 ++ .../PlayerRequestedTeleportPacket.java | 4 +- .../shrinking/PersonalShrinkingDevice.java | 3 +- .../compactmods/machines/util/MathUtil.java | 12 ++ .../compactmods/machines/util/PlayerUtil.java | 88 +---------- .../machines/test/data/CodecTests.java | 1 + 35 files changed, 460 insertions(+), 135 deletions(-) create mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java create mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java create mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java rename forge-main/src/main/java/dev/compactmods/machines/room/capability/{PlayerRoomHistoryCapProvider.java => PlayerRoomHistoryProvider.java} (83%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java index 801ed3c5..0eafb422 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java +++ b/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java @@ -3,6 +3,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -14,4 +15,6 @@ public interface IDimensionalPosition { ServerLevel level(MinecraftServer server); boolean isLoaded(MinecraftServer serv); + + ChunkPos chunkPos(); } diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java new file mode 100644 index 00000000..1e52e8ee --- /dev/null +++ b/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java @@ -0,0 +1,13 @@ +package dev.compactmods.machines.api.room; + +import org.jetbrains.annotations.NotNull; + +import java.util.UUID; + +public interface IPlayerRoomMetadata { + @NotNull + String roomCode(); + + @NotNull + UUID owner(); +} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java new file mode 100644 index 00000000..a9f5c42d --- /dev/null +++ b/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.api.room; + +import net.minecraftforge.common.capabilities.AutoRegisterCapability; + +import java.util.Optional; +import java.util.UUID; + +@AutoRegisterCapability +public interface IPlayerRoomMetadataProvider { + Optional currentRoom(); + Optional roomCode(); + Optional owner(); + void clearCurrent(); + void setCurrent(IPlayerRoomMetadata current); +} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java index efaf6f73..74d81a6f 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java +++ b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java @@ -2,8 +2,10 @@ import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import net.minecraft.nbt.ListTag; +import net.minecraftforge.common.capabilities.AutoRegisterCapability; import net.minecraftforge.common.util.INBTSerializable; +@AutoRegisterCapability public interface IRoomHistory extends INBTSerializable { void clear(); diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java new file mode 100644 index 00000000..439e61c3 --- /dev/null +++ b/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java @@ -0,0 +1,12 @@ +package dev.compactmods.machines.api.room; + +import java.util.Comparator; + +public class RoomTemplateDimensionComparator implements Comparator { + @Override + public int compare(RoomTemplate o1, RoomTemplate o2) { + final var dim1 = o1.dimensions().getX() * o1.dimensions().getY() * o1.dimensions().getZ(); + final var dim2 = o2.dimensions().getX() * o2.dimensions().getY() * o2.dimensions().getZ(); + return dim1 - dim2; + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java b/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java index 20e39ef6..65b31845 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java @@ -3,9 +3,12 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.Util; import net.minecraft.client.Minecraft; public class PlayerFaceRenderer { + public static final GameProfile EMPTY_PROFILE = new GameProfile(Util.NIL_UUID, "Empty Player"); + public static void render(GameProfile profile, PoseStack poseStack, int x, int y) { final var skins = Minecraft.getInstance().getSkinManager(); final var playerSkin = skins.getInsecureSkinLocation(profile); diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java index feecbf8f..a4bbdacf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java @@ -10,6 +10,7 @@ public class CarryOnCompat { private static final String MOD_ID = "carryon"; + @SuppressWarnings("removal") public static void sendIMC() { // Denies the machine blocks from being picked up by CarryOn users. // Prevents duplication of data on block movement. diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 405ef007..8366a13b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -79,6 +79,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) addMachineRecipes(consumer); } + @SuppressWarnings("removal") private void addMachineRecipes(Consumer consumer) { registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_TINY, Tags.Items.STORAGE_BLOCKS_COPPER); registerMachineRecipe(consumer, LegacySizedTemplates.EMPTY_SMALL, Tags.Items.STORAGE_BLOCKS_IRON); @@ -92,6 +93,7 @@ private void addMachineRecipes(Consumer consumer) { Tags.Items.NETHER_STARS); } + @Deprecated(forRemoval = true, since = "5.2.0") protected void registerMachineRecipe(Consumer consumer, LegacySizedTemplates template, TagKey center) { registerMachineRecipe(consumer, template.id(), template.template(), center); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java index b9a3dc41..72fcaa4a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java @@ -17,6 +17,7 @@ public StateGenerator(DataGenerator gen, ExistingFileHelper exFileHelper) { } @Override + @SuppressWarnings("removal") protected void registerStatesAndModels() { // Wall block model BlockModelProvider models = models(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java index f28584ca..d5b42fe2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java @@ -39,6 +39,7 @@ protected String getMachineTranslation() { } @Override + @SuppressWarnings("removal") protected void addTranslations() { // Machine Block names final var machineTranslation = getMachineTranslation(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java index aaf039d8..65672f98 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java @@ -17,6 +17,7 @@ public class RoomTemplates { + @SuppressWarnings("removal") public static void make(GatherDataEvent event) { final var templates = new HashMap(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java index c4bf33e5..f49186eb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java @@ -20,6 +20,7 @@ public BlockTagGenerator(DataGenerator generator, ExistingFileHelper files) { } @Override + @SuppressWarnings("removal") public void addTags() { var legacySizedMachines = Set.of(Machines.MACHINE_BLOCK_TINY.get(), Machines.MACHINE_BLOCK_SMALL.get(), diff --git a/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java index 87867bcd..9e0f375b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java +++ b/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java @@ -12,6 +12,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -57,6 +58,11 @@ public boolean isLoaded(MinecraftServer server) { return level.isLoaded(blockPos); } + @Override + public ChunkPos chunkPos() { + return new ChunkPos(blockPos); + } + public static LevelBlockPosition fromNBT(CompoundTag nbt) { return CODEC.parse(NbtOps.INSTANCE, nbt).getOrThrow(false, CompactMachines.LOGGER::error); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java index fc5b51a7..6128fb91 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java +++ b/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java @@ -4,12 +4,14 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.location.IDimensionalPosition; import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.util.MathUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; @@ -39,6 +41,11 @@ public boolean isLoaded(MinecraftServer serv) { return level(serv).isLoaded(new BlockPos(position)); } + @Override + public ChunkPos chunkPos() { + return MathUtil.getChunkPos(this.position); + } + @Override public boolean equals(Object obj) { if (obj == this) return true; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java index 1adf11e5..d70f99fb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java @@ -18,6 +18,7 @@ import java.util.function.Supplier; +@SuppressWarnings("removal") public class Machines { static final BlockBehaviour.Properties MACHINE_BLOCK_PROPS = BlockBehaviour.Properties .of(Material.METAL) diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java index b6560e94..a236b228 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java @@ -66,6 +66,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder tabItems) { var reg = RoomHelper.getTemplates(); + // todo - fix ordering tabItems.addAll(reg.entrySet() .stream() .map((template) -> UnboundCompactMachineItem.forTemplate(template.getKey().location(), template.getValue())) @@ -91,7 +92,7 @@ public InteractionResult use(@Nonnull BlockState state, Level level, @Nonnull Bl MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { - return MachineBlockUtil.tryRoomTeleport(level, pos, player, server, sp); + return MachineBlockUtil.tryRoomTeleport(level, pos, player, server); } return InteractionResult.sidedSuccess(level.isClientSide); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index 587ce096..0da81539 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -54,6 +54,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +@SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") public class LegacySizedCompactMachineBlock extends Block implements EntityBlock { @@ -163,7 +164,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { - return MachineBlockUtil.tryRoomTeleport(level, pos, player, server, sp); + return MachineBlockUtil.tryRoomTeleport(level, pos, player, server); } // Try and pull the name off the nametag and apply it to the room diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index 837064ca..f047294a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -6,20 +6,16 @@ import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.location.PreciseDimensionalPosition; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.room.RoomHelper; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import dev.compactmods.machines.util.CompactStructureGenerator; -import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -31,15 +27,16 @@ import java.util.Optional; import java.util.UUID; +@SuppressWarnings("removal") public class MachineBlockUtil { @Nonnull - static InteractionResult tryRoomTeleport(Level level, BlockPos pos, Player player, MinecraftServer server, ServerPlayer sp) { + static InteractionResult tryRoomTeleport(Level level, BlockPos pos, Player player, MinecraftServer server) { // Try teleport to compact machine dimension if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { tile.roomInfo().ifPresentOrElse(room -> { try { - PlayerUtil.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), room); + RoomHelper.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), room); } catch (MissingDimensionException e) { e.printStackTrace(); } @@ -87,13 +84,7 @@ static void createAndEnterRoom(Player owner, MinecraftServer server, RoomTemplat machine.setConnectedRoom(newRoom); - PlayerUtil.teleportPlayerIntoRoom(server, owner, newRoom); - - // Mark the player as inside the machine, set external spawn, and yeet - owner.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { - var entry = PreciseDimensionalPosition.fromPlayer(owner); - hist.addHistory(new PlayerRoomHistoryItem(entry, machine.getLevelPosition())); - }); + RoomHelper.teleportPlayerIntoRoom(server, owner, newRoom, machine.getLevelPosition()); } catch (MissingDimensionException | NonexistentRoomException e) { CompactMachines.LOGGER.error("Error occurred while generating new room and machine info for first player entry.", e); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java index 71b13690..aa5d82cd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -18,6 +18,7 @@ import javax.annotation.Nullable; import java.util.List; +@SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") public class LegacyCompactMachineItem extends CompactMachineItem { public LegacyCompactMachineItem(Block blockIn, Properties builder) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java new file mode 100644 index 00000000..90bbceb8 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java @@ -0,0 +1,65 @@ +package dev.compactmods.machines.room; + +import dev.compactmods.machines.api.room.IPlayerRoomMetadata; +import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; +import java.util.UUID; + +public class PlayerRoomMetadataProvider implements IPlayerRoomMetadataProvider { + + @Nullable + private IPlayerRoomMetadata currentRoom; + + private final LazyOptional lazy; + + public PlayerRoomMetadataProvider() { + this.lazy = LazyOptional.of(this::lazyRoom).cast(); + } + + private IPlayerRoomMetadata lazyRoom() { + return currentRoom; + } + + public LazyOptional getRoomLazy() { + if(currentRoom == null) + return LazyOptional.empty(); + + return lazy; + } + + @Override + public Optional currentRoom() { + return Optional.ofNullable(currentRoom); + } + + @Override + public Optional roomCode() { + if(currentRoom == null) + return Optional.empty(); + + return Optional.of(currentRoom.roomCode()); + } + + @Override + public Optional owner() { + if(currentRoom == null) return Optional.empty(); + return Optional.of(currentRoom.owner()); + } + + @Override + public void clearCurrent() { + this.currentRoom = null; + this.lazy.invalidate(); + } + + @Override + public void setCurrent(IPlayerRoomMetadata current) { + this.currentRoom = current; + this.lazy.invalidate(); + } + + record CurrentRoomData(String roomCode, UUID owner) implements IPlayerRoomMetadata {} +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java index 7eb8f8b9..8eba0632 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java @@ -1,22 +1,14 @@ package dev.compactmods.machines.room; -import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IRoomHistory; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; -import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -@Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class RoomCapabilities { public static final Capability ROOM_HISTORY = CapabilityManager.get(new CapabilityToken<>() { }); - @SubscribeEvent - void onCapRegistration(final RegisterCapabilitiesEvent evt) { - evt.register(IRoomHistory.class); - } + } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java index 604a0f2d..4f71127f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java @@ -3,15 +3,12 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityJoinLevelEvent; @@ -75,15 +72,17 @@ private static boolean positionInsideRoom(Entity entity, Vec3 target) { if (!level.dimension().equals(CompactDimension.LEVEL_KEY)) return false; if (level instanceof ServerLevel compactDim) { - ChunkPos playerChunk = entity.chunkPosition(); - - final var roomInfo = CompactRoomProvider.instance(compactDim); - return roomInfo.isRoomChunk(playerChunk) - ? roomInfo.findByChunk(playerChunk) - .map(IRoomRegistration::innerBounds) - .map(ib -> ib.contains(target)) - .orElse(false) - : false; + // TODO - Add chunk map check here + return true; + +// ChunkPos playerChunk = entity.chunkPosition(); +// final var roomInfo = CompactRoomProvider.instance(compactDim); +// return roomInfo.isRoomChunk(playerChunk) +// ? roomInfo.findByChunk(playerChunk) +// .map(IRoomRegistration::innerBounds) +// .map(ib -> ib.contains(target)) +// .orElse(false) +// : false; } return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java index 42b52af1..377cc323 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java @@ -1,14 +1,151 @@ package dev.compactmods.machines.room; +import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.advancement.AdvancementTriggers; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.history.IRoomHistoryItem; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.location.PreciseDimensionalPosition; +import dev.compactmods.machines.location.SimpleTeleporter; import dev.compactmods.machines.room.client.RoomClientHelper; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import dev.compactmods.machines.room.server.RoomServerHelper; +import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.Registry; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.DistExecutor; +import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nonnull; public class RoomHelper { + private static final Capability CURRENT_ROOM_META = CapabilityManager.get(new CapabilityToken<>() { + }); + public static Registry getTemplates() { return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> RoomServerHelper::getTemplates); } + + public static void teleportPlayerIntoMachine(Level machineLevel, Player player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { + MinecraftServer serv = machineLevel.getServer(); + + // Recursion check. Player tried to enter the room they're already in. + if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { + final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { + if (player instanceof ServerPlayer sp && room.chunks().anyMatch(chunk -> sp.chunkPosition().equals(chunk))) { + AdvancementTriggers.RECURSIVE_ROOMS.trigger(sp); + return true; + } + + return false; + }).orElse(false); + + if (recursion) return; + } + + try { + final var entry = PreciseDimensionalPosition.fromPlayer(player); + + + teleportPlayerIntoRoom(serv, player, room); + + // Mark the player as inside the machine, set external spawn, and yeet + player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { + hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); + + setCurrentRoom(serv, player, room); + }); + } catch (MissingDimensionException | NonexistentRoomException e) { + CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); + } + } + + public static void setCurrentRoom(MinecraftServer server, Player player, IRoomRegistration room) { + // Mark current room, invalidates any listeners + debug screen + final var roomProvider = CompactRoomProvider.instance(server); + player.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(room.code(), room.owner(roomProvider))); + }); + } + + public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room) throws MissingDimensionException, NonexistentRoomException { + teleportPlayerIntoRoom(serv, player, room, null); + } + + public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room, @Nullable LevelBlockPosition from) + throws MissingDimensionException, NonexistentRoomException { + final var compactDim = CompactDimension.forServer(serv); + final var roomProvider = CompactRoomProvider.instance(compactDim); + + serv.submitAsync(() -> { + + if (player instanceof ServerPlayer servPlayer) { + servPlayer.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(roomProvider), room.spawnRotation(roomProvider))); + } + }); + + if(from != null) { + // Mark the player as inside the machine, set external spawn + player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { + var entry = PreciseDimensionalPosition.fromPlayer(player); + hist.addHistory(new PlayerRoomHistoryItem(entry, from)); + + }); + } + + // Mark current room, invalidates any listeners + debug screen + RoomHelper.setCurrentRoom(serv, player, room); + } + + public static void teleportPlayerOutOfMachine(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { + + MinecraftServer serv = compactDim.getServer(); + final var roomProvider = CompactRoomProvider.instance(compactDim); + + final LazyOptional history = serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY); + + if (!history.isPresent()) { + PlayerUtil.howDidYouGetThere(serverPlayer); + return; + } + + history.ifPresent(hist -> { + if (hist.hasHistory()) { + final IRoomHistoryItem prevArea = hist.pop(); + // Mark current room, invalidates any listeners + debug screen + serverPlayer.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { + roomProvider.findByChunk(prevArea.getEntryLocation().chunkPos()).ifPresent(roomMeta -> { + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(roomMeta.code(), roomMeta.owner(roomProvider))); + }); + }); + + var spawnPoint = prevArea.getEntryLocation(); + final var enteredMachine = prevArea.getMachine().getBlockPosition(); + + final var level = spawnPoint.level(serv); + serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); + } else { + PlayerUtil.howDidYouGetThere(serverPlayer); + + hist.clear(); + PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); + } + }); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java index 27ae8414..335e6ec5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryCapProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java @@ -1,25 +1,24 @@ package dev.compactmods.machines.room.capability; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.room.RoomCapabilities; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; -import net.minecraft.world.entity.player.Player; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; -public class PlayerRoomHistoryCapProvider implements ICapabilityProvider, INBTSerializable { +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class PlayerRoomHistoryProvider implements ICapabilityProvider, INBTSerializable { private final CMRoomHistory history; - private LazyOptional opt = LazyOptional.empty(); + private final LazyOptional opt; - public PlayerRoomHistoryCapProvider(Player player) { + public PlayerRoomHistoryProvider() { this.history = new CMRoomHistory(); this.opt = LazyOptional.of(() -> this.history); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java new file mode 100644 index 00000000..756182ef --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java @@ -0,0 +1,51 @@ +package dev.compactmods.machines.room.capability; + +import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import dev.compactmods.machines.room.PlayerRoomMetadataProvider; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.INBTSerializable; +import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +// Provider provider. Because Java. +public class PlayerRoomMetadataProviderProvider implements ICapabilityProvider, INBTSerializable { + private static final Capability CURRENT_ROOM_META = CapabilityManager.get(new CapabilityToken<>() { + }); + + private final IPlayerRoomMetadataProvider provider; + + private final LazyOptional lazy; + + public PlayerRoomMetadataProviderProvider() { + provider = new PlayerRoomMetadataProvider(); + lazy = LazyOptional.of(this::getCurrentRoomMetadataProvider); + } + + private IPlayerRoomMetadataProvider getCurrentRoomMetadataProvider() { + return this.provider; + } + + @Override + public @NotNull LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { + if(cap == CURRENT_ROOM_META) + return lazy.cast(); + + return LazyOptional.empty(); + } + + @Override + public CompoundTag serializeNBT() { + return new CompoundTag(); + } + + @Override + public void deserializeNBT(CompoundTag nbt) { + + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java index 38e31b29..1ba64e03 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java @@ -18,6 +18,9 @@ static void onCapPlayerAttach(final AttachCapabilitiesEvent event) { event.addCapability( new ResourceLocation(Constants.MOD_ID, "room_history"), - new PlayerRoomHistoryCapProvider(player)); + new PlayerRoomHistoryProvider()); + + final var meta = new PlayerRoomMetadataProviderProvider(); + event.addCapability(new ResourceLocation(Constants.MOD_ID, "room_metadata"), meta); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java new file mode 100644 index 00000000..0771f74e --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.room.client; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.room.client.overlay.RoomMetadataDebugOverlay; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; +import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) +public class RoomClientEventHandler { + + @SubscribeEvent + public static void onOverlayRegistration(final RegisterGuiOverlaysEvent overlays) { + overlays.registerAbove(VanillaGuiOverlay.DEBUG_TEXT.id(), "room_meta_debug", new RoomMetadataDebugOverlay()); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java new file mode 100644 index 00000000..3ec2316b --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java @@ -0,0 +1,52 @@ +package dev.compactmods.machines.room.client.overlay; + +import com.mojang.blaze3d.vertex.PoseStack; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import net.minecraft.client.Minecraft; +import net.minecraft.util.FastColor; +import net.minecraftforge.client.gui.overlay.ForgeGui; +import net.minecraftforge.client.gui.overlay.IGuiOverlay; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; + +public class RoomMetadataDebugOverlay implements IGuiOverlay { + private static final Capability CURRENT_ROOM_META = CapabilityManager.get(new CapabilityToken<>() { + }); + + @Override + public void render(ForgeGui gui, PoseStack poseStack, float partialTick, int screenWidth, int screenHeight) { + final var player = Minecraft.getInstance().player; + if (player == null || !player.level.dimension().equals(CompactDimension.LEVEL_KEY)) + return; + + if(!gui.getMinecraft().options.renderDebug) + return; + + final var font = gui.getFont(); + final var center = screenWidth / 2f; + + poseStack.pushPose(); + poseStack.translate(center, screenHeight - 75, 0); + int w = font.width("(room meta WIP)"); + font.drawShadow(poseStack, "(room meta WIP)", -(w / 2f), 0, FastColor.ARGB32.color(200, 200, 200, 255)); + poseStack.popPose(); + +// player.getCapability(CURRENT_ROOM_META) +// .resolve() +// .flatMap(IPlayerRoomMetadataProvider::currentRoom) +// .ifPresent(room -> { + +// +// final int ownerWidth = font.width(room.owner().toString()); +// final int codeWidth = font.width(room.roomCode()); +// +// PlayerFaceRenderer.render(PlayerFaceRenderer.EMPTY_PROFILE, poseStack, -8, -8); +// +// poseStack.translate(0, 20, 0); +// font.drawShadow(poseStack, room.owner().toString(), -(ownerWidth / 2f), 0, 0xFFFFFFFF, false); +// font.drawShadow(poseStack, room.roomCode(), -(codeWidth / 2f), font.lineHeight + 3, 0xFFFFFFFF, false); +// }); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java index 76023636..b4314fea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -270,6 +270,13 @@ public IRoomRegistration registerNew(String code, Function { + final var roomChunkNode = new RoomChunkNode(c); + chunks.put(c, roomChunkNode); + graph.putEdgeValue(roomNode, roomChunkNode, new RoomChunkEdge()); + }); setDirty(); return roomNode; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java new file mode 100644 index 00000000..3e4cc005 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java @@ -0,0 +1,11 @@ +package dev.compactmods.machines.room.graph; + +import dev.compactmods.machines.graph.IGraphEdgeType; +import org.jetbrains.annotations.NotNull; + +public record RoomChunkEdge() implements dev.compactmods.machines.graph.IGraphEdge { + @Override + public @NotNull IGraphEdgeType getEdgeType() { + return null; + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java index 8876b961..1c5aa922 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/network/PlayerRequestedTeleportPacket.java @@ -4,8 +4,8 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.room.RoomHelper; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; @@ -30,7 +30,7 @@ public boolean handle(Supplier ctx) { final var provider = CompactRoomProvider.instance(CompactDimension.forServer(player.server)); provider.forRoom(room).ifPresent(info -> { try { - PlayerUtil.teleportPlayerIntoMachine(player.level, player, machine, info); + RoomHelper.teleportPlayerIntoMachine(player.level, player, machine, info); } catch (MissingDimensionException ignored) { } }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index f7687702..1df6c7d0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -6,6 +6,7 @@ import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; import dev.compactmods.machines.client.gui.PersonalShrinkingDeviceScreen; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.room.RoomHelper; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.ChatFormatting; @@ -79,7 +80,7 @@ public InteractionResultHolder use(Level world, Player player, Intera player.displayClientMessage(tc, true); } else { - PlayerUtil.teleportPlayerOutOfMachine(playerDim, serverPlayer); + RoomHelper.teleportPlayerOutOfMachine(playerDim, serverPlayer); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java index 41af0dd6..2efa27fa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java @@ -1,10 +1,22 @@ package dev.compactmods.machines.util; import net.minecraft.core.BlockPos; +import net.minecraft.core.SectionPos; import net.minecraft.world.level.ChunkPos; import net.minecraft.core.Vec3i; +import net.minecraft.world.phys.Vec3; public class MathUtil { + public static ChunkPos getChunkPos(Vec3 precise) { + final var x = SectionPos.blockToSectionCoord(precise.x); + final var z = SectionPos.blockToSectionCoord(precise.z); + return new ChunkPos(x, z); + } + + public static int volumeOf(Vec3i dimensions) { + return dimensions.getX() * dimensions.getY() * dimensions.getZ(); + } + /** * * @param i diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index fad315c0..a10765b7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -1,37 +1,24 @@ package dev.compactmods.machines.util; import com.mojang.authlib.GameProfile; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.api.room.history.IRoomHistoryItem; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.location.PreciseDimensionalPosition; import dev.compactmods.machines.location.SimpleTeleporter; -import dev.compactmods.machines.room.RoomCapabilities; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.util.LazyOptional; import javax.annotation.Nonnull; import java.util.Optional; import java.util.UUID; public abstract class PlayerUtil { + public static Optional getProfileByUUID(MinecraftServer server, UUID uuid) { final var player = server.getPlayerList().getPlayer(uuid); if (player == null) { @@ -53,79 +40,6 @@ public static Optional getProfileByUUID(LevelAccessor world, UUID u return Optional.of(profile); } - public static void teleportPlayerIntoMachine(Level machineLevel, Player player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { - MinecraftServer serv = machineLevel.getServer(); - - // Recursion check. Player tried to enter the room they're already in. - if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { - final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { - if (player instanceof ServerPlayer sp && room.chunks().anyMatch(chunk -> sp.chunkPosition().equals(chunk))) { - AdvancementTriggers.RECURSIVE_ROOMS.trigger(sp); - return true; - } - - return false; - }).orElse(false); - - if (recursion) return; - } - - try { - final var entry = PreciseDimensionalPosition.fromPlayer(player); - - teleportPlayerIntoRoom(serv, player, room); - - // Mark the player as inside the machine, set external spawn, and yeet - player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { - hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); - }); - } catch (MissingDimensionException | NonexistentRoomException e) { - CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); - } - } - - public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room) - throws MissingDimensionException, NonexistentRoomException { - final var compactDim = CompactDimension.forServer(serv); - final var spawnLookup = CompactRoomProvider.instance(compactDim); - - serv.submitAsync(() -> { - - if (player instanceof ServerPlayer servPlayer) { - servPlayer.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(spawnLookup), room.spawnRotation(spawnLookup))); - } - }); - } - - public static void teleportPlayerOutOfMachine(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { - - MinecraftServer serv = compactDim.getServer(); - - final LazyOptional history = serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY); - - if (!history.isPresent()) { - howDidYouGetThere(serverPlayer); - return; - } - - history.ifPresent(hist -> { - if (hist.hasHistory()) { - final IRoomHistoryItem prevArea = hist.pop(); - - var spawnPoint = prevArea.getEntryLocation(); - final var enteredMachine = prevArea.getMachine().getBlockPosition(); - - final var level = spawnPoint.level(serv); - serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); - } else { - howDidYouGetThere(serverPlayer); - - hist.clear(); - teleportPlayerToRespawnOrOverworld(serv, serverPlayer); - } - }); - } - public static void howDidYouGetThere(@Nonnull ServerPlayer serverPlayer) { AdvancementTriggers.HOW_DID_YOU_GET_HERE.trigger(serverPlayer); diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java index 60b69e96..81ae806a 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java @@ -41,6 +41,7 @@ public static void canSerializeVector3d(final GameTestHelper test) { test.succeed(); } + @Deprecated(forRemoval = true, since = "5.2.0") @GameTest(template = "empty_1x1", batch = TestBatches.CODEC_TESTS) public static void canSerializeMachineSize(final GameTestHelper test) { DataResult result = RoomSize.CODEC.encodeStart(NbtOps.INSTANCE, RoomSize.LARGE); From 864285994e89be3b487b382253ed5129ffabb263 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 16 Oct 2022 06:58:51 -0400 Subject: [PATCH 28/85] Room upgrade command classname fix --- .../dev/compactmods/machines/command/Commands.java | 4 ++-- ...gradeRoomCommand.java => CMRoomUpgradeCommand.java} | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) rename forge-main/src/main/java/dev/compactmods/machines/upgrade/command/{CMUpgradeRoomCommand.java => CMRoomUpgradeCommand.java} (93%) diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java index 15f1f04c..80b497a3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java @@ -12,7 +12,7 @@ import dev.compactmods.machines.command.subcommand.CMUnbindSubcommand; import dev.compactmods.machines.command.subcommand.SpawnSubcommand; import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.upgrade.command.CMUpgradeRoomCommand; +import dev.compactmods.machines.upgrade.command.CMRoomUpgradeCommand; import dev.compactmods.machines.upgrade.command.RoomUpgradeArgument; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.synchronization.ArgumentTypeInfos; @@ -44,7 +44,7 @@ public static void onCommandsRegister(final RegisterCommandsEvent event) { root.then(CMDataSubcommand.make()); root.then(CMGiveMachineSubcommand.make()); root.then(SpawnSubcommand.make()); - root.then(CMUpgradeRoomCommand.make()); + root.then(CMRoomUpgradeCommand.make()); event.getDispatcher().register(root); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java index 48ebfdaa..dadfd665 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMUpgradeRoomCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java @@ -15,7 +15,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.ChunkPos; -public class CMUpgradeRoomCommand { +public class CMRoomUpgradeCommand { public static ArgumentBuilder make() { final var root = Commands.literal("upgrades") .requires(cs -> cs.hasPermission(ServerConfig.changeUpgrades())); @@ -23,9 +23,9 @@ public class CMUpgradeRoomCommand { final var addRoot = Commands.literal("add"); final var addUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) - .executes(CMUpgradeRoomCommand::addToCurrentRoom); + .executes(CMRoomUpgradeCommand::addToCurrentRoom); - addUpgRoot.then(Commands.literal("current").executes(CMUpgradeRoomCommand::addToCurrentRoom)); + addUpgRoot.then(Commands.literal("current").executes(CMRoomUpgradeCommand::addToCurrentRoom)); // addUpgRoot.then(Commands.argument("room", RoomPositionArgument.room()).executes(CMUpgradeRoomCommand::addToSpecificRoom)); addRoot.then(addUpgRoot); root.then(addRoot); @@ -33,9 +33,9 @@ public class CMUpgradeRoomCommand { final var remRoot = Commands.literal("remove"); final var remUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) - .executes(CMUpgradeRoomCommand::removeFromCurrentRoom); + .executes(CMRoomUpgradeCommand::removeFromCurrentRoom); - remUpgRoot.then(Commands.literal("current").executes(CMUpgradeRoomCommand::removeFromCurrentRoom)); + remUpgRoot.then(Commands.literal("current").executes(CMRoomUpgradeCommand::removeFromCurrentRoom)); // remUpgRoot.then(Commands.argument("room", RoomPositionArgument.room()).executes(CMUpgradeRoomCommand::removeFromSpecificRoom)); remRoot.then(remUpgRoot); root.then(remRoot); From 20a3005c2e3aad4b5197b1ecad5b5c08c087a6f6 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 16 Oct 2022 06:59:12 -0400 Subject: [PATCH 29/85] Sync basic room metadata on entry, debug info, chunk fixes --- .../api/dimension/CompactDimension.java | 5 + .../machines/core/CompactMachinesNet.java | 7 ++ .../machine/block/CompactMachineBlock.java | 2 +- .../block/LegacySizedCompactMachineBlock.java | 2 +- .../machine/block/MachineBlockUtil.java | 5 +- .../room/PlayerRoomMetadataProvider.java | 2 +- .../machines/room/RoomEventHandler.java | 56 +++++++---- .../compactmods/machines/room/RoomHelper.java | 94 ++++++++++--------- .../dev/compactmods/machines/room/Rooms.java | 7 ++ .../PlayerRoomMetadataProviderProvider.java | 11 ++- .../room/client/ClientRoomMetadata.java | 9 ++ .../overlay/RoomMetadataDebugOverlay.java | 54 +++++++---- .../room/graph/CompactRoomProvider.java | 59 ++++++------ .../machines/room/graph/RoomChunkEdge.java | 7 +- .../machines/room/graph/RoomChunkNode.java | 10 +- .../network/ClientRoomNetworkHandler.java | 14 ++- .../room/network/SyncRoomMetadataPacket.java | 23 +++++ .../shrinking/PersonalShrinkingDevice.java | 2 +- .../compactmods/machines/util/PlayerUtil.java | 11 +++ 19 files changed, 259 insertions(+), 121 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/network/SyncRoomMetadataPacket.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java index b89ff8fe..e9fef491 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java +++ b/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java @@ -49,4 +49,9 @@ public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.Le final var fixer = DataFixers.getDataFixer(); return new DimensionDataStorage(dimPath.resolve("data").toFile(), fixer); } + + @NotNull + public static boolean isLevelCompact(Level level) { + return level.dimension().equals(LEVEL_KEY); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java index 117b7386..bec2b7d6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.room.network.PlayerRequestedTeleportPacket; +import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; import dev.compactmods.machines.util.VersionUtil; import net.minecraft.resources.ResourceLocation; @@ -44,5 +45,11 @@ public static void setupMessages() { .decoder(PlayerRequestedTeleportPacket::new) .consumerMainThread(PlayerRequestedTeleportPacket::handle) .add(); + + CHANNEL.messageBuilder(SyncRoomMetadataPacket.class, 3, NetworkDirection.PLAY_TO_CLIENT) + .encoder(SyncRoomMetadataPacket::encode) + .decoder(SyncRoomMetadataPacket::new) + .consumerMainThread(SyncRoomMetadataPacket::handle) + .add(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java index a236b228..94eb042a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java @@ -92,7 +92,7 @@ public InteractionResult use(@Nonnull BlockState state, Level level, @Nonnull Bl MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { - return MachineBlockUtil.tryRoomTeleport(level, pos, player, server); + return MachineBlockUtil.tryRoomTeleport(level, pos, sp, server); } return InteractionResult.sidedSuccess(level.isClientSide); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index 0da81539..146407f7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -164,7 +164,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { - return MachineBlockUtil.tryRoomTeleport(level, pos, player, server); + return MachineBlockUtil.tryRoomTeleport(level, pos, sp, server); } // Try and pull the name off the nametag and apply it to the room diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index f047294a..588efbe2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -16,6 +16,7 @@ import dev.compactmods.machines.util.CompactStructureGenerator; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -31,7 +32,7 @@ public class MachineBlockUtil { @Nonnull - static InteractionResult tryRoomTeleport(Level level, BlockPos pos, Player player, MinecraftServer server) { + static InteractionResult tryRoomTeleport(Level level, BlockPos pos, ServerPlayer player, MinecraftServer server) { // Try teleport to compact machine dimension if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { tile.roomInfo().ifPresentOrElse(room -> { @@ -60,7 +61,7 @@ static InteractionResult tryRoomTeleport(Level level, BlockPos pos, Player playe return InteractionResult.sidedSuccess(level.isClientSide); } - static void createAndEnterRoom(Player owner, MinecraftServer server, RoomTemplate template, CompactMachineBlockEntity machine) { + static void createAndEnterRoom(ServerPlayer owner, MinecraftServer server, RoomTemplate template, CompactMachineBlockEntity machine) { try { final var compactDim = CompactDimension.forServer(server); if(template.equals(RoomTemplate.INVALID_TEMPLATE)) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java index 90bbceb8..40f6eb9f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java @@ -61,5 +61,5 @@ public void setCurrent(IPlayerRoomMetadata current) { this.lazy.invalidate(); } - record CurrentRoomData(String roomCode, UUID owner) implements IPlayerRoomMetadata {} + public record CurrentRoomData(String roomCode, UUID owner) implements IPlayerRoomMetadata {} } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java index 4f71127f..765cc535 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java @@ -3,12 +3,17 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; import net.minecraft.ChatFormatting; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.EntityJoinLevelEvent; @@ -17,6 +22,7 @@ import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.network.PacketDistributor; @Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class RoomEventHandler { @@ -25,14 +31,27 @@ public class RoomEventHandler { public static void entityJoined(final EntityJoinLevelEvent evt) { Entity ent = evt.getEntity(); - // Early exit if spawning in non-CM dimensions - if ((ent instanceof Player) || !ent.level.dimension().equals(CompactDimension.LEVEL_KEY)) return; - - // no-op clients, we only care about blocking server spawns - if(ent.level.isClientSide) return; - - if (!positionInsideRoom(ent, ent.position())) { - evt.setCanceled(true); + boolean isPlayer = ent instanceof Player; + boolean isCompact = CompactDimension.isLevelCompact(ent.level); + + // no-op clients and non-compact dimensions, we only care about server spawns + if (!isCompact || ent.level.isClientSide) + return; + + // Handle players + if (isPlayer && ent instanceof ServerPlayer serverPlayer) { + // sync current room info to client player + final var roomProvider = CompactRoomProvider.instance(serverPlayer.getLevel()); + roomProvider.findByChunk(serverPlayer.chunkPosition()).ifPresent(roomInfo -> { + CompactMachinesNet.CHANNEL.send( + PacketDistributor.PLAYER.with(() -> serverPlayer), + new SyncRoomMetadataPacket(roomInfo.code(), roomInfo.owner(roomProvider)) + ); + }); + } else { + if (!positionInsideRoom(ent, ent.position())) { + evt.setCanceled(true); + } } } @@ -52,7 +71,7 @@ public static void onCheckSpawn(final LivingSpawnEvent.CheckSpawn evt) { public static void onEntityTeleport(final EntityTeleportEvent evt) { // Allow teleport commands, we don't want to trap people anywhere if (evt instanceof EntityTeleportEvent.TeleportCommand) return; - if(!evt.getEntity().level.dimension().equals(CompactDimension.LEVEL_KEY)) return; + if (!evt.getEntity().level.dimension().equals(CompactDimension.LEVEL_KEY)) return; Entity ent = evt.getEntity(); doEntityTeleportHandle(evt, evt.getTarget(), ent); @@ -72,17 +91,14 @@ private static boolean positionInsideRoom(Entity entity, Vec3 target) { if (!level.dimension().equals(CompactDimension.LEVEL_KEY)) return false; if (level instanceof ServerLevel compactDim) { - // TODO - Add chunk map check here - return true; - -// ChunkPos playerChunk = entity.chunkPosition(); -// final var roomInfo = CompactRoomProvider.instance(compactDim); -// return roomInfo.isRoomChunk(playerChunk) -// ? roomInfo.findByChunk(playerChunk) -// .map(IRoomRegistration::innerBounds) -// .map(ib -> ib.contains(target)) -// .orElse(false) -// : false; + ChunkPos playerChunk = entity.chunkPosition(); + final var roomInfo = CompactRoomProvider.instance(compactDim); + return roomInfo.isRoomChunk(playerChunk) + ? roomInfo.findByChunk(playerChunk) + .map(IRoomRegistration::innerBounds) + .map(ib -> ib.contains(target)) + .orElse(false) + : false; } return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java index 377cc323..8711e0eb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java @@ -5,10 +5,10 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; -import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.location.PreciseDimensionalPosition; import dev.compactmods.machines.location.SimpleTeleporter; @@ -16,40 +16,40 @@ import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; +import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; import dev.compactmods.machines.room.server.RoomServerHelper; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.Registry; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; -import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.network.PacketDistributor; import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; public class RoomHelper { - private static final Capability CURRENT_ROOM_META = CapabilityManager.get(new CapabilityToken<>() { + public static final Capability CURRENT_ROOM_META = CapabilityManager.get(new CapabilityToken<>() { }); public static Registry getTemplates() { return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> RoomServerHelper::getTemplates); } - public static void teleportPlayerIntoMachine(Level machineLevel, Player player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { + public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { MinecraftServer serv = machineLevel.getServer(); // Recursion check. Player tried to enter the room they're already in. if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { - if (player instanceof ServerPlayer sp && room.chunks().anyMatch(chunk -> sp.chunkPosition().equals(chunk))) { - AdvancementTriggers.RECURSIVE_ROOMS.trigger(sp); + if (room.chunks().anyMatch(chunk -> player.chunkPosition().equals(chunk))) { + AdvancementTriggers.RECURSIVE_ROOMS.trigger(player); return true; } @@ -76,28 +76,29 @@ public static void teleportPlayerIntoMachine(Level machineLevel, Player player, } } - public static void setCurrentRoom(MinecraftServer server, Player player, IRoomRegistration room) { + public static void setCurrentRoom(MinecraftServer server, ServerPlayer player, IRoomRegistration room) { // Mark current room, invalidates any listeners + debug screen final var roomProvider = CompactRoomProvider.instance(server); + final var roomOwner = room.owner(roomProvider); player.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { - provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(room.code(), room.owner(roomProvider))); + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(room.code(), roomOwner)); }); + + final var sync = new SyncRoomMetadataPacket(room.code(), roomOwner); + CompactMachinesNet.CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), sync); } - public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room) throws MissingDimensionException, NonexistentRoomException { + public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer player, IRoomRegistration room) throws MissingDimensionException, NonexistentRoomException { teleportPlayerIntoRoom(serv, player, room, null); } - public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, IRoomRegistration room, @Nullable LevelBlockPosition from) + public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer player, IRoomRegistration room, @Nullable LevelBlockPosition from) throws MissingDimensionException, NonexistentRoomException { final var compactDim = CompactDimension.forServer(serv); final var roomProvider = CompactRoomProvider.instance(compactDim); serv.submitAsync(() -> { - - if (player instanceof ServerPlayer servPlayer) { - servPlayer.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(roomProvider), room.spawnRotation(roomProvider))); - } + player.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(roomProvider), room.spawnRotation(roomProvider))); }); if(from != null) { @@ -113,39 +114,44 @@ public static void teleportPlayerIntoRoom(MinecraftServer serv, Player player, I RoomHelper.setCurrentRoom(serv, player, room); } - public static void teleportPlayerOutOfMachine(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { + public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { MinecraftServer serv = compactDim.getServer(); - final var roomProvider = CompactRoomProvider.instance(compactDim); - - final LazyOptional history = serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY); - - if (!history.isPresent()) { - PlayerUtil.howDidYouGetThere(serverPlayer); + if(!serverPlayer.level.dimension().equals(CompactDimension.LEVEL_KEY)) return; - } - history.ifPresent(hist -> { - if (hist.hasHistory()) { - final IRoomHistoryItem prevArea = hist.pop(); - // Mark current room, invalidates any listeners + debug screen - serverPlayer.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { - roomProvider.findByChunk(prevArea.getEntryLocation().chunkPos()).ifPresent(roomMeta -> { - provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(roomMeta.code(), roomMeta.owner(roomProvider))); - }); + serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY) + .resolve() + .ifPresentOrElse(hist -> { + if (hist.hasHistory()) { + final var roomProvider = CompactRoomProvider.instance(compactDim); + final IRoomHistoryItem prevArea = hist.pop(); + // Mark current room, invalidates any listeners + debug screen + serverPlayer.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { + // Check entry dimension - if it isn't a machine room, clear room info + if(!prevArea.getEntryLocation().dimension().equals(CompactDimension.LEVEL_KEY)) + provider.clearCurrent(); + else { + roomProvider.findByChunk(prevArea.getEntryLocation().chunkPos()).ifPresent(roomMeta -> { + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(roomMeta.code(), roomMeta.owner(roomProvider))); + }); + } + }); + + var spawnPoint = prevArea.getEntryLocation(); + final var enteredMachine = prevArea.getMachine().getBlockPosition(); + + final var level = spawnPoint.level(serv); + serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); + } else { + PlayerUtil.howDidYouGetThere(serverPlayer); + + hist.clear(); + PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); + } + }, () -> { + PlayerUtil.howDidYouGetThere(serverPlayer); + PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); }); - - var spawnPoint = prevArea.getEntryLocation(); - final var enteredMachine = prevArea.getMachine().getBlockPosition(); - - final var level = spawnPoint.level(serv); - serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); - } else { - PlayerUtil.howDidYouGetThere(serverPlayer); - - hist.clear(); - PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); - } - }); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java b/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java index 001d26a8..47f3f1b1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java @@ -10,6 +10,8 @@ import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.room.graph.RoomChunkEdge; +import dev.compactmods.machines.room.graph.RoomChunkNode; import dev.compactmods.machines.room.graph.RoomMetadataNode; import dev.compactmods.machines.room.graph.RoomOwnerEdge; import dev.compactmods.machines.room.graph.RoomOwnerNode; @@ -39,10 +41,15 @@ public class Rooms { public static final RegistryObject> ROOM_OWNER_NODE = Registries.NODE_TYPES .register("room_owner", SimpleGraphNodeType.instance(RoomOwnerNode.CODEC)); + public static final RegistryObject> ROOM_CHUNK_NODE = Registries.NODE_TYPES + .register("room_chunk", SimpleGraphNodeType.instance(RoomChunkNode.CODEC)); + public static final RegistryObject> ROOM_META_NODE = Registries.NODE_TYPES .register("room_meta", SimpleGraphNodeType.instance(RoomMetadataNode.CODEC)); public static final RegistryObject> ROOM_OWNER_EDGE = Registries.EDGE_TYPES .register("room_owner", SimpleGraphEdgeType.instance(RoomOwnerEdge.CODEC)); + public static final RegistryObject> ROOM_CHUNK_EDGE = Registries.EDGE_TYPES + .register("room_chunk", SimpleGraphEdgeType.instance(RoomChunkEdge.CODEC)); public static void prepare() { } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java index 756182ef..8b58c4de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java @@ -41,11 +41,18 @@ private IPlayerRoomMetadataProvider getCurrentRoomMetadataProvider() { @Override public CompoundTag serializeNBT() { - return new CompoundTag(); + final var tag = new CompoundTag(); + provider.currentRoom().ifPresent(meta -> { + tag.putString("room", meta.roomCode()); + tag.putUUID("owner", meta.owner()); + }); + + return tag; } @Override public void deserializeNBT(CompoundTag nbt) { - + if(nbt.isEmpty()) return; + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(nbt.getString("room"), nbt.getUUID("owner"))); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java new file mode 100644 index 00000000..46f467d9 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.room.client; + +import dev.compactmods.machines.api.room.IPlayerRoomMetadata; + +import java.util.UUID; + +public record ClientRoomMetadata(String roomCode, UUID owner) + implements IPlayerRoomMetadata { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java index 3ec2316b..ca06f1bc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java @@ -3,8 +3,9 @@ import com.mojang.blaze3d.vertex.PoseStack; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import dev.compactmods.machines.client.PlayerFaceRenderer; +import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.client.Minecraft; -import net.minecraft.util.FastColor; import net.minecraftforge.client.gui.overlay.ForgeGui; import net.minecraftforge.client.gui.overlay.IGuiOverlay; import net.minecraftforge.common.capabilities.Capability; @@ -21,32 +22,47 @@ public void render(ForgeGui gui, PoseStack poseStack, float partialTick, int scr if (player == null || !player.level.dimension().equals(CompactDimension.LEVEL_KEY)) return; - if(!gui.getMinecraft().options.renderDebug) + if (!gui.getMinecraft().options.renderDebug) return; final var font = gui.getFont(); final var center = screenWidth / 2f; - poseStack.pushPose(); - poseStack.translate(center, screenHeight - 75, 0); - int w = font.width("(room meta WIP)"); - font.drawShadow(poseStack, "(room meta WIP)", -(w / 2f), 0, FastColor.ARGB32.color(200, 200, 200, 255)); - poseStack.popPose(); -// player.getCapability(CURRENT_ROOM_META) -// .resolve() -// .flatMap(IPlayerRoomMetadataProvider::currentRoom) -// .ifPresent(room -> { + player.getCapability(CURRENT_ROOM_META) + .resolve() + .flatMap(IPlayerRoomMetadataProvider::currentRoom) + .ifPresent(room -> { + poseStack.pushPose(); + poseStack.translate(center, screenHeight - 75, 0); + PlayerUtil.getProfileByUUID(player.level, room.owner()).ifPresent(ownerInfo -> { + final int ownerWidth = font.width(ownerInfo.getName()); + +// final var shader = GameRenderer.getPositionTexShader(); +// final var floatBackup = shader.COLOR_MODULATOR.getFloatBuffer() +// .duplicate(); // -// final int ownerWidth = font.width(room.owner().toString()); -// final int codeWidth = font.width(room.roomCode()); -// -// PlayerFaceRenderer.render(PlayerFaceRenderer.EMPTY_PROFILE, poseStack, -8, -8); // -// poseStack.translate(0, 20, 0); -// font.drawShadow(poseStack, room.owner().toString(), -(ownerWidth / 2f), 0, 0xFFFFFFFF, false); -// font.drawShadow(poseStack, room.roomCode(), -(codeWidth / 2f), font.lineHeight + 3, 0xFFFFFFFF, false); -// }); +// RenderSystem.setShader(GameRenderer::getPositionTexShader); +// shader.COLOR_MODULATOR.set(1, 1, 1, 0.2f); +// shader.COLOR_MODULATOR.upload(); + + PlayerFaceRenderer.render(ownerInfo, poseStack, -6, -14); + +// shader.COLOR_MODULATOR.getFloatBuffer().rewind(); +// shader.COLOR_MODULATOR.getFloatBuffer().put(floatBackup); +// shader.COLOR_MODULATOR.upload(); + + font.drawShadow(poseStack, ownerInfo.getName(), -(ownerWidth / 2f), 0, 0xFFFFFFFF, false); + poseStack.translate(0, 12, 0); + }); + + final int codeWidth = font.width(room.roomCode()); + font.drawShadow(poseStack, room.roomCode(), -(codeWidth / 2f), 0, 0xFFFFFFFF, false); + + poseStack.popPose(); + + }); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java index b4314fea..15881c11 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -113,6 +113,12 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { metaNodeIdMap.put(id, node); graph.metadata.put(node.code(), node); + + node.chunks().forEach(chunk -> { + RoomChunkNode chunkNode = new RoomChunkNode(chunk); + graph.graph.putEdgeValue(node, chunkNode, new RoomChunkEdge()); + graph.chunks.put(chunk, chunkNode); + }); }); } @@ -146,8 +152,6 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { return graph; } - - @Nonnull @Override public CompoundTag save(@Nonnull CompoundTag tag) { @@ -238,8 +242,11 @@ public Optional findByChunk(ChunkPos chunk) { if (!isRoomChunk(chunk)) return Optional.empty(); final var chunkNode = chunks.get(chunk); - // TODO - Implement with graph - return Optional.ofNullable(chunkNode.room(this)); + return graph.predecessors(chunkNode).stream() + .filter(RoomMetadataNode.class::isInstance) + .map(RoomMetadataNode.class::cast) + .map(IRoomRegistration.class::cast) + .findFirst(); } @Override @@ -252,22 +259,10 @@ public long count() { return metadata.size(); } - /** - * Registers a new room with a specified room code and data from the builder. - * This assumes that data is coming from a previous source such as a migrator, and - * will take all values from the returned builder. - * - * @param code - * @param newRoom - * @return - */ - public IRoomRegistration registerNew(String code, Function newRoom) { - final var builder = newRoom.apply(new NewRoomBuilder(code)); - - final var roomNode = builder.build(); + private IRoomRegistration finalizeNew(String code, RoomMetadataNode roomNode, UUID owner) { this.metadata.put(code, roomNode); - this.owners.computeIfAbsent(builder.owner, RoomOwnerNode::new); - final var ownerNode = owners.get(builder.owner); + this.owners.computeIfAbsent(owner, RoomOwnerNode::new); + final var ownerNode = owners.get(owner); graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); @@ -277,11 +272,28 @@ public IRoomRegistration registerNew(String code, Function newRoom) { + final var builder = newRoom.apply(new NewRoomBuilder(code)); + + final var roomNode = builder.build(); + return finalizeNew(code, roomNode, builder.owner); + } + public IRoomRegistration registerNew(Function newRoom) { final var newRoomCode = RoomCodeGenerator.generateRoomId(); @@ -294,14 +306,7 @@ public IRoomRegistration registerNew(Function ne builder.setCenter(newCenter); final var roomNode = builder.build(); - this.metadata.put(newRoomCode, roomNode); - this.owners.computeIfAbsent(builder.owner, RoomOwnerNode::new); - final var ownerNode = owners.get(builder.owner); - - graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); - setDirty(); - - return roomNode; + return finalizeNew(newRoomCode, roomNode, builder.owner); } public IMutableRoomRegistration edit(String room) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java index 3e4cc005..d3dcd5b7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java @@ -1,11 +1,16 @@ package dev.compactmods.machines.room.graph; +import com.mojang.serialization.Codec; import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.room.Rooms; import org.jetbrains.annotations.NotNull; public record RoomChunkEdge() implements dev.compactmods.machines.graph.IGraphEdge { + + public static final Codec CODEC = Codec.unit(new RoomChunkEdge()); + @Override public @NotNull IGraphEdgeType getEdgeType() { - return null; + return Rooms.ROOM_CHUNK_EDGE.get(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java index 7d8c64e5..827b562f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java @@ -1,16 +1,24 @@ package dev.compactmods.machines.room.graph; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.room.Rooms; import net.minecraft.world.level.ChunkPos; public record RoomChunkNode(ChunkPos chunk) implements IGraphNode { + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + CodecExtensions.CHUNKPOS.fieldOf("chunk").forGetter(RoomChunkNode::chunk) + ).apply(i, RoomChunkNode::new)); + @Override public IGraphNodeType getType() { - return null; + return Rooms.ROOM_CHUNK_NODE.get(); } public IRoomRegistration room(IRoomLookup lookup) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java index 2dcc7532..76ddb7b1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/network/ClientRoomNetworkHandler.java @@ -1,7 +1,9 @@ package dev.compactmods.machines.room.network; +import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.room.client.ClientRoomMetadata; import dev.compactmods.machines.room.client.MachineRoomScreen; -import dev.compactmods.machines.room.menu.MachineRoomMenu; +import net.minecraft.Util; import net.minecraft.client.Minecraft; public class ClientRoomNetworkHandler { @@ -12,4 +14,14 @@ public static void handleBlockData(InitialRoomBlockDataPacket blockData) { mrs.updateBlockRender(); } } + + public static void handleRoomSync(SyncRoomMetadataPacket sync) { + final var mc = Minecraft.getInstance(); + mc.player.getCapability(RoomHelper.CURRENT_ROOM_META).ifPresent(meta -> { + if(sync.owner().equals(Util.NIL_UUID)) + meta.clearCurrent(); + else + meta.setCurrent(new ClientRoomMetadata(sync.roomCode(), sync.owner())); + }); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/network/SyncRoomMetadataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/SyncRoomMetadataPacket.java new file mode 100644 index 00000000..6f57f0b8 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/room/network/SyncRoomMetadataPacket.java @@ -0,0 +1,23 @@ +package dev.compactmods.machines.room.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; + +import java.util.UUID; +import java.util.function.Supplier; + +public record SyncRoomMetadataPacket(String roomCode, UUID owner) { + public SyncRoomMetadataPacket(FriendlyByteBuf buffer) { + this(buffer.readUtf(), buffer.readUUID()); + } + + public void encode(FriendlyByteBuf buffer) { + buffer.writeUtf(roomCode); + buffer.writeUUID(owner); + } + + public void handle(Supplier contextSupplier) { + ClientRoomNetworkHandler.handleRoomSync(this); + contextSupplier.get().setPacketHandled(true); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index 1df6c7d0..4ad29f99 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -80,7 +80,7 @@ public InteractionResultHolder use(Level world, Player player, Intera player.displayClientMessage(tc, true); } else { - RoomHelper.teleportPlayerOutOfMachine(playerDim, serverPlayer); + RoomHelper.teleportPlayerOutOfRoom(playerDim, serverPlayer); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index a10765b7..96bab5c1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -3,8 +3,12 @@ import com.mojang.authlib.GameProfile; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.SimpleTeleporter; +import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; +import net.minecraft.Util; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -12,6 +16,7 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.PacketDistributor; import javax.annotation.Nonnull; import java.util.Optional; @@ -57,6 +62,12 @@ public static void teleportPlayerToRespawnOrOverworld(MinecraftServer serv, @Non worldPos = Vec3.atCenterOf(player.getRespawnPosition()); player.changeDimension(level, SimpleTeleporter.to(worldPos)); + + player.getCapability(RoomHelper.CURRENT_ROOM_META).ifPresent(provider -> { + provider.clearCurrent(); + CompactMachinesNet.CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), + new SyncRoomMetadataPacket("", Util.NIL_UUID)); + }); } public static Vec2 getLookDirection(Player player) { From e6a64546d2fb914043c82e849e787489ed9b872c Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 31 Oct 2022 04:50:57 -0400 Subject: [PATCH 30/85] More build testing --- assets/room-core.aseprite | Bin 0 -> 832 bytes build.gradle.kts | 39 ++++--- common-api/build.gradle.kts | 83 +++++++++++++++ .../machines/api/CompactMachinesAddon.java | 0 .../machines/api/ICompactMachinesAddon.java | 3 +- .../machines/api/core/Advancements.java | 20 ++++ .../machines/api/core/CMCommands.java | 38 +++++++ .../machines/api/core/CMRegistries.java | 15 +++ .../compactmods/machines/api/core/CMTags.java | 13 +++ .../machines/api/core/Constants.java | 6 ++ .../machines/api/core/JeiInfo.java | 9 ++ .../machines/api/core/Messages.java | 42 ++++++++ .../machines/api/core/Tooltips.java | 30 ++++++ .../api/dimension/CompactDimension.java | 11 -- .../dimension/MissingDimensionException.java | 0 .../location/IDimensionalBlockPosition.java | 0 .../api/location/IDimensionalPosition.java | 0 .../machines/api/machine/MachineNbt.java | 0 .../machines/api/machine/MachineTags.java | 4 +- .../api/recipe}/ItemWithNbtRecipeBuilder.java | 3 +- .../recipe}/ShapedWithNbtRecipeBuilder.java | 98 ++++++++++++++---- .../recipe/ShapelessRecipeWithNbtResult.java | 3 +- .../api/room/IPlayerRoomMetadata.java | 0 .../api/room/IPlayerRoomMetadataProvider.java | 3 - .../machines/api/room/IRoomHistory.java | 13 +++ .../machines/api/room/IRoomLookup.java | 0 .../machines/api/room/IRoomOwnerLookup.java | 0 .../machines/api/room/RoomSize.java | 0 .../machines/api/room/RoomTemplate.java | 0 .../compactmods/machines/api/room/Rooms.java | 21 ++++ .../api/room/history/IRoomHistoryItem.java | 0 .../api/room/registration/IBasicRoomInfo.java | 0 .../IMutableRoomRegistration.java | 0 .../room/registration/IRoomRegistration.java | 0 .../room/registration/IRoomSpawnLookup.java | 0 .../upgrade/ILevelLoadedUpgradeListener.java | 0 .../api/room/upgrade/RoomUpgrade.java | 0 .../api/room/upgrade/RoomUpgradeInstance.java | 0 .../machines/api/shrinking/PSDTags.java | 0 .../api/tunnels/TunnelDefinition.java | 0 .../machines/api/tunnels/TunnelPosition.java | 0 .../connection/RoomTunnelConnections.java | 0 .../tunnels/lifecycle/InstancedTunnel.java | 0 .../api/tunnels/lifecycle/TunnelInstance.java | 0 .../lifecycle/TunnelTeardownHandler.java | 0 .../tunnels/recipe/TunnelRecipeBuilder.java | 23 ++-- .../tunnels/recipe/TunnelRecipeHelper.java | 7 +- .../redstone/RedstoneReaderTunnel.java | 0 .../api/tunnels/redstone/RedstoneTunnel.java | 0 .../redstone/RedstoneWriterTunnel.java | 0 .../api/upgrade/RoomUpgradeHelper.java | 0 forge-api/build.gradle.kts | 10 +- .../machines/api/core/Advancements.java | 20 ---- .../machines/api/core/CMCommands.java | 38 ------- .../machines/api/core/CMRegistries.java | 22 ---- .../compactmods/machines/api/core/CMTags.java | 15 --- .../machines/api/core/Constants.java | 6 -- .../machines/api/core/JeiInfo.java | 9 -- .../machines/api/core/Messages.java | 42 -------- .../machines/api/core/Tooltips.java | 30 ------ .../machines/api/room/IRoomHistory.java | 17 --- .../room/RoomTemplateDimensionComparator.java | 12 --- .../compactmods/machines/api/room/Rooms.java | 13 --- .../capability/CapabilityLookupTunnel.java | 2 + .../tunnels/capability/CapabilityTunnel.java | 7 +- forge-main/build.gradle.kts | 25 ++--- .../compactmods/machines/CompactMachines.java | 22 +++- .../compactmods/machines/ModDataUpgrader.java | 2 +- .../advancement/AdvancementTriggers.java | 2 +- .../trigger/HowDidYouGetHereTrigger.java | 2 +- .../machines/client/ClientEventHandler.java | 2 +- .../machines/client/Resources.java | 2 +- .../gui/PersonalShrinkingDeviceScreen.java | 2 +- .../machines/client/gui/guide/GuidePage.java | 2 +- .../machines/client/render/RenderTypes.java | 2 +- .../machines/client/shader/CM4Shaders.java | 2 +- .../machines/command/Commands.java | 2 +- .../data/CMMachineDataExportCommand.java | 6 +- .../command/data/CMRoomDataExportCommand.java | 6 +- .../data/CMTunnelDataExportCommand.java | 10 +- .../subcommand/CMGiveMachineSubcommand.java | 8 +- .../CMReaddDimensionSubcommand.java | 2 +- .../subcommand/CMRebindSubcommand.java | 2 +- .../command/subcommand/CMRoomsSubcommand.java | 4 +- .../subcommand/CMSummarySubcommand.java | 2 +- .../subcommand/CMUnbindSubcommand.java | 2 +- .../command/subcommand/SpawnSubcommand.java | 8 +- .../machines/compat/InterModCompat.java | 2 +- .../machines/compat/curios/CuriosCompat.java | 2 +- .../compat/jei/CompactMachinesJeiPlugin.java | 4 +- .../elements/PlayerFaceElement.java | 2 +- .../overrides/CompactMachineNameOverride.java | 2 +- .../providers/CompactMachineProvider.java | 8 +- .../theoneprobe/providers/TunnelProvider.java | 2 +- .../machines/config/CommonConfig.java | 2 +- .../EnableVanillaRecipesConfigCondition.java | 2 +- .../machines/core/CommonEventHandler.java | 2 +- .../machines/core/CompactMachinesNet.java | 2 +- .../machines/core/ModBusEvents.java | 2 +- .../compactmods/machines/core/Registries.java | 18 +++- .../machines/core/ServerEventHandler.java | 2 +- .../machines/core/UIRegistration.java | 2 +- .../generated}/AdvancementGenerator.java | 6 +- .../generated}/AdvancementLangBuilder.java | 4 +- .../generated}/BlockLootGenerator.java | 2 +- .../generated}/DataGenUtil.java | 4 +- .../generated}/DataGeneration.java | 19 ++-- .../generated}/DimensionTypeBuilder.java | 2 +- .../generated}/ItemModelGenerator.java | 6 +- .../generated}/LevelBiomeGenerator.java | 8 +- .../generated}/RecipeGenerator.java | 12 +-- .../generated}/StateGenerator.java | 8 +- .../generated}/TunnelWallStateGenerator.java | 10 +- .../data/generated/VillagerTrades.java | 4 + .../generated}/lang/BaseLangGenerator.java | 8 +- .../generated}/lang/EnglishLangGenerator.java | 13 ++- .../generated}/lang/RussianLangGenerator.java | 8 +- .../generated}/room/RoomTemplates.java | 8 +- .../generated}/tags/BlockTagGenerator.java | 6 +- .../generated}/tags/ItemTagGenerator.java | 6 +- .../tags/PointOfInterestTagGenerator.java | 22 ++++ .../migration/Pre520RoomDataMigrator.java | 12 +-- .../machines/dimension/Dimension.java | 2 +- .../machines/dimension/VoidAirBlock.java | 2 +- .../dev/compactmods/machines/graph/Graph.java | 6 +- .../machine/LegacySizedTemplates.java | 2 +- .../machines/machine/Machines.java | 4 +- .../block/CompactMachineBlockEntity.java | 4 +- .../block/LegacySizedCompactMachineBlock.java | 6 +- .../machine/block/MachineBlockUtil.java | 2 +- .../machine/client/MachineColors.java | 2 +- .../machine/graph/CompactMachineNode.java | 6 +- .../machine/graph/DimensionMachineGraph.java | 2 +- .../machine/item/BoundCompactMachineItem.java | 2 +- .../item/LegacyCompactMachineItem.java | 2 +- .../item/UnboundCompactMachineItem.java | 4 +- .../machines/room/RoomEventHandler.java | 4 +- .../room/capability/CMRoomHistory.java | 10 +- .../PlayerRoomMetadataProviderProvider.java | 4 +- .../room/capability/RoomCapEventHandler.java | 2 +- .../room/client/MachineRoomScreen.java | 2 +- .../room/client/RoomClientEventHandler.java | 2 +- .../room/client/RoomClientHelper.java | 4 +- .../room/data/CopyRoomBindingFunction.java | 2 +- .../room/graph/CompactRoomProvider.java | 9 +- .../machines/room/graph/RoomOwnerNode.java | 4 +- .../room/history/PlayerRoomHistoryItem.java | 2 +- .../machines/room/menu/MachineRoomMenu.java | 2 +- .../room/network/RoomNetworkHandler.java | 2 +- .../room/server/RoomServerHelper.java | 4 +- .../shrinking/PersonalShrinkingDevice.java | 4 +- .../machines/tunnel/TunnelItem.java | 6 +- .../machines/tunnel/TunnelNetwork.java | 18 ++++ .../machines/tunnel/TunnelWallBlock.java | 2 +- .../machines/tunnel/TunnelWallEntity.java | 2 +- .../compactmods/machines/tunnel/Tunnels.java | 2 +- .../tunnel/graph/TunnelMachineEdge.java | 2 +- .../machines/tunnel/graph/TunnelNode.java | 2 +- .../machines/tunnel/graph/TunnelTypeEdge.java | 2 +- .../machines/tunnel/graph/TunnelTypeNode.java | 2 +- .../machines/upgrade/ChunkloadUpgrade.java | 4 +- .../machines/upgrade/MachineRoomUpgrades.java | 19 ++++ .../machines/upgrade/RoomUpgradeItem.java | 2 +- .../machines/upgrade/RoomUpgradeManager.java | 2 +- .../upgrade/command/CMRoomUpgradeCommand.java | 12 +-- .../upgrade/command/RoomUpgradeArgument.java | 6 +- .../upgrade/graph/RoomUpgradeGraphNode.java | 2 +- .../upgrade/graph/UpgradeConnectionEntry.java | 4 +- .../workbench/RoomUpgradeWorkbench.java | 21 ++++ .../workbench/RoomUpgradeWorkbenchEntity.java | 23 ++++ .../compactmods/machines/util/PlayerUtil.java | 2 +- .../villager/VillagerTradesEventHandler.java | 20 ++++ .../villager/VillagerUpgradeTrade.java | 4 + .../machines/villager/Villagers.java | 60 +++++++++++ .../machines/wall/ItemBlockWall.java | 2 +- .../textures/block/workbench/sides.png | Bin 0 -> 117 bytes .../textures/block/workbench/top.png | Bin 0 -> 117 bytes .../villager/profession/tinkerer-old.png | Bin 0 -> 4033 bytes .../villager/profession/tinkerer.aseprite | Bin 0 -> 4743 bytes .../entity/villager/profession/tinkerer.png | Bin 0 -> 3948 bytes .../villager/profession/tinkerer.png.mcmeta | 5 + .../machines/test/GameTestEventHandler.java | 2 +- .../compactmods/machines/test/MathTests.java | 2 +- .../machines/test/ServerEvents.java | 2 +- .../machines/test/TestBatches.java | 4 +- .../test/core/CompactMachinesTests.java | 2 +- .../machines/test/data/CodecTests.java | 2 +- .../test/migrators/EarlyFileLoaderTests.java | 2 +- .../RoomInfoPre520MigratorTests.java | 2 +- .../test/worldgen/DimensionTests.java | 2 +- .../test/worldgen/RoomGenerationTests.java | 2 +- forge-tunnels/build.gradle.kts | 20 ++-- .../machines/tunnel/BuiltinTunnels.java | 9 +- gradle.properties | 3 +- settings.gradle.kts | 15 ++- 195 files changed, 915 insertions(+), 549 deletions(-) create mode 100644 assets/room-core.aseprite create mode 100644 common-api/build.gradle.kts rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java (85%) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java (82%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java (74%) rename {forge-api/src/main/java/dev/compactmods/machines/api => common-api/src/main/java/dev/compactmods/machines/api/recipe}/ItemWithNbtRecipeBuilder.java (96%) rename {forge-api/src/main/java/dev/compactmods/machines/api/machine => common-api/src/main/java/dev/compactmods/machines/api/recipe}/ShapedWithNbtRecipeBuilder.java (57%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java (96%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java (77%) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/RoomSize.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java (100%) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java (62%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java (58%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java (100%) rename {forge-api => common-api}/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java (100%) delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java delete mode 100644 forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/AdvancementGenerator.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/AdvancementLangBuilder.java (86%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/BlockLootGenerator.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/DataGenUtil.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/DataGeneration.java (71%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/DimensionTypeBuilder.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/ItemModelGenerator.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/LevelBiomeGenerator.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/RecipeGenerator.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/StateGenerator.java (89%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/TunnelWallStateGenerator.java (88%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/lang/BaseLangGenerator.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/lang/EnglishLangGenerator.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/lang/RussianLangGenerator.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/room/RoomTemplates.java (89%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/tags/BlockTagGenerator.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{datagen => data/generated}/tags/ItemTagGenerator.java (93%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/block/workbench/sides.png create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/block/workbench/top.png create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer-old.png create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer.aseprite create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer.png create mode 100644 forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer.png.mcmeta diff --git a/assets/room-core.aseprite b/assets/room-core.aseprite new file mode 100644 index 0000000000000000000000000000000000000000..782e1a6c6fd17acf7311d20acaeabba03fc34a48 GIT binary patch literal 832 zcmcJNZAep57{{MEZINQ`%SwZGupEI!+YoJen-WE~`JoK9YQ&1w$_s535}Go~f>J2S zUYEfJmA$P7SqVZ;lSvd7MHwr>jMmGjg|0EywA+6((ocQsIoux)=iGb#zr(rZVxo6f zM8r}Z_N6Rr-aXn$v(~Wi_C3 zYa?i~jewRm0W=SM0H3@a2L%*S+pSLUh~p?&&GX_?f$%sWJ z0+EI&c`}LNy8jjwNJ5p{>UQj7>VGe*HsIY1HumE0 zw_hc;WNP$xH@6OV3=JOpQTXuq0ddn};|bF;XM$VcEA+pt>93nRA-}^njaZ|z`|f>= Q?Kzoe9ZRHLH{?Wq18<24a{vGU literal 0 HcmV?d00001 diff --git a/build.gradle.kts b/build.gradle.kts index 1563ef57..8fe7797e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,28 +1,41 @@ -// no-op -plugins { - id("java") - id("maven-publish") -} - val mod_id: String by extra val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" val nightlyVersion: String = "${semver}.${buildNumber}-nightly" val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) -val aVersion = if(isRelease) semver else nightlyVersion +val modVersion = if (isRelease) semver else nightlyVersion -project.evaluationDependsOn(project(":forge-api").path) -project.evaluationDependsOn(project(":forge-main").path) +plugins { + id("maven-publish") +} + +tasks.create("getBuildInfo") { + doFirst { + this.logger.info("Mod ID: ${mod_id}") + this.logger.info("Version: ${modVersion}") + this.logger.info("Semver Version: ${semver}") + this.logger.info("Nightly Build: ${nightlyVersion}") + } +} + +val deps = listOf( + project(":forge-api"), + project(":forge-main") +) + +deps.forEach { + project.evaluationDependsOn(it.path) +} publishing { - publications.register("allForge") { + publications.register("allLibs") { artifactId = mod_id groupId = "dev.compactmods" - version = aVersion + version = modVersion - this.artifact(project(":forge-api").tasks.jar.get()) + this.artifact(project(":forge-api").tasks.named("jar").get()) this.artifact(project(":forge-api").tasks.named("sourcesJar").get()) - this.artifact(project(":forge-main").tasks.jar.get()) + this.artifact(project(":forge-main").tasks.named("jar").get()) this.artifact(project(":forge-main").tasks.named("jarJar").get()) } diff --git a/common-api/build.gradle.kts b/common-api/build.gradle.kts new file mode 100644 index 00000000..2cf059de --- /dev/null +++ b/common-api/build.gradle.kts @@ -0,0 +1,83 @@ +val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" +val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" +val nightlyVersion: String = "${semver}.${buildNumber}-nightly" +val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) + +var mod_id: String by extra + +repositories { + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } +} + +plugins { + id("fabric-loom") + id("maven-publish") +} + +base { + archivesName.set(mod_id) + group = "dev.compactmods" + version = if(isRelease) semver else nightlyVersion +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +sourceSets { + named("main") { + resources { + //The API has no resources + setSrcDirs(emptyList()) + } + } + + named("test") { + resources { + //The test module has no resources + setSrcDirs(emptyList()) + } + } +} + +val minecraft_version: String by rootProject.extra +val parchment_version: String by rootProject.extra + +dependencies { + minecraft("net.minecraft", "minecraft", minecraft_version) + + mappings(loom.layered { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) +} + +tasks.withType { + options.encoding = "UTF-8" + options.compilerArgs.add("-proc:none") +} + +publishing { + publications.register("commonApi") { + artifactId = "compactmachines" + groupId = "dev.compactmods" + + artifacts { + artifact(tasks.jar.get()) + // artifact(tasks.named("sourcesJar").get()) + } + } + + repositories { + // GitHub Packages + maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java b/common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java rename to common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java b/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java similarity index 85% rename from forge-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java rename to common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java index 0d6583c4..e9a024c6 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java @@ -2,7 +2,6 @@ import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import net.minecraftforge.eventbus.api.IEventBus; import java.util.function.Supplier; @@ -12,7 +11,7 @@ default void prepare() { // no-op } - default void afterRegistration(IEventBus bus) { + default void afterRegistration() { // no-op } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java new file mode 100644 index 00000000..f9d892ad --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java @@ -0,0 +1,20 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.resources.ResourceLocation; + +public interface Advancements { + ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); + ResourceLocation ROOT = new ResourceLocation(Constants.MOD_ID, "root"); + ResourceLocation FOUNDATIONS = new ResourceLocation(Constants.MOD_ID, "foundations"); + + ResourceLocation GOT_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "got_shrinking_device"); + + ResourceLocation CLAIMED_TINY_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_tiny"); + ResourceLocation CLAIMED_SMALL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_small"); + ResourceLocation CLAIMED_NORMAL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_normal"); + ResourceLocation CLAIMED_LARGE_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_large"); + ResourceLocation CLAIMED_GIANT_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_giant"); + ResourceLocation CLAIMED_MAX_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_max"); + + ResourceLocation RECURSIVE_ROOMS = new ResourceLocation(Constants.MOD_ID, "recursion"); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java new file mode 100644 index 00000000..9dbab4eb --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java @@ -0,0 +1,38 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.resources.ResourceLocation; + +import static dev.compactmods.machines.api.core.Constants.MOD_ID; + +public interface CMCommands { + ResourceLocation LEVEL_REGISTERED = new ResourceLocation(MOD_ID, "level_registered"); + ResourceLocation LEVEL_NOT_FOUND = new ResourceLocation(MOD_ID, "level_not_found"); + + ResourceLocation ROOM_NOT_FOUND = new ResourceLocation(MOD_ID, "room_not_found"); + + /** + * Used for displaying the number of registered machines via summary commands. + */ + ResourceLocation MACHINE_REG_DIM = new ResourceLocation(MOD_ID, "summary.machines.dimension"); + ResourceLocation MACHINE_REG_TOTAL = new ResourceLocation(MOD_ID, "summary.machines.total"); + + /** + * Used for displaying the number of registered rooms via summary commands. + */ + ResourceLocation ROOM_REG_COUNT = new ResourceLocation(MOD_ID, "room_reg_count"); + ResourceLocation NOT_A_MACHINE_BLOCK = new ResourceLocation(MOD_ID, "not_a_machine_block"); + + /** + * Shows a machine is not bound. Takes in a single param, the machine position in world. + */ + ResourceLocation MACHINE_NOT_BOUND = new ResourceLocation(MOD_ID, "machine_not_bound"); + + ResourceLocation WRONG_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dimension"); + ResourceLocation NOT_IN_COMPACT_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dim"); + ResourceLocation FAILED_CMD_FILE_ERROR = new ResourceLocation(MOD_ID, "failed_command_file_error"); + + ResourceLocation CANNOT_GIVE_MACHINE = new ResourceLocation(MOD_ID, "cannot_give_machine_item"); + ResourceLocation MACHINE_GIVEN = new ResourceLocation(MOD_ID, "machine_given_successfully"); + ResourceLocation NO_REBIND_TUNNEL_PRESENT = new ResourceLocation(MOD_ID, "cannot_rebind_tunnel_present"); + ResourceLocation SPAWN_CHANGED_SUCCESSFULLY = new ResourceLocation(MOD_ID, "spawn_changed_successfully"); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java new file mode 100644 index 00000000..50e73640 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.api.core; + +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; + +import static dev.compactmods.machines.api.core.Constants.MOD_ID; + +public interface CMRegistries { + + ResourceKey> TYPES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); + + +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java new file mode 100644 index 00000000..68ea5be3 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java @@ -0,0 +1,13 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +public interface CMTags { + TagKey ROOM_UPGRADE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "room_upgrade")); + TagKey MACHINE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); + TagKey MACHINE_BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java new file mode 100644 index 00000000..68578915 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java @@ -0,0 +1,6 @@ +package dev.compactmods.machines.api.core; + +public interface Constants { + String MOD_ID = "compactmachines"; + +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java b/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java new file mode 100644 index 00000000..3a2b998c --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.resources.ResourceLocation; + +public interface JeiInfo { + ResourceLocation MACHINE = new ResourceLocation(Constants.MOD_ID, "machines"); + + ResourceLocation SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "shrinking_device"); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java new file mode 100644 index 00000000..80612fd5 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java @@ -0,0 +1,42 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.resources.ResourceLocation; + +public interface Messages { + ResourceLocation CANNOT_ENTER_MACHINE = new ResourceLocation(Constants.MOD_ID, "cannot_enter"); + ResourceLocation NO_MACHINE_DATA = new ResourceLocation(Constants.MOD_ID, "no_machine_data"); + ResourceLocation ROOM_SPAWNPOINT_SET = new ResourceLocation(Constants.MOD_ID, "spawnpoint_set"); + ResourceLocation TELEPORT_OUT_OF_BOUNDS = new ResourceLocation(Constants.MOD_ID, "teleport_oob"); + ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); + ResourceLocation UNKNOWN_TUNNEL = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); + ResourceLocation NO_TUNNEL_SIDE = new ResourceLocation(Constants.MOD_ID, "no_available_sides"); + ResourceLocation UNKNOWN_ROOM_CHUNK = new ResourceLocation(Constants.MOD_ID, "unknown_room_chunk"); + ResourceLocation UNREGISTERED_CM_DIM = new ResourceLocation(Constants.MOD_ID, "dimension_not_registered"); + ResourceLocation NEW_MACHINE = new ResourceLocation(Constants.MOD_ID, "new_machine"); + + /** + * Used to show information about a player inside a Compact room. + */ + ResourceLocation PLAYER_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "player_room_info"); + + /** + * Used to show information about a room, accessed via a bound machine. + */ + ResourceLocation MACHINE_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "machine_room_info"); + + /** + * Shown when a non-owner tries to rename a room. Takes the owner's display name. + */ + ResourceLocation CANNOT_RENAME_NOT_OWNER = new ResourceLocation(Constants.MOD_ID, "cannot_rename_not_owner"); + + /** + * Shown to players when they try to interact with a room they do not own. Provides the owner's display name. + */ + ResourceLocation NOT_ROOM_OWNER = new ResourceLocation(Constants.MOD_ID, "not_the_room_owner"); + ResourceLocation UPGRADE_APPLIED = new ResourceLocation(Constants.MOD_ID, "upgrade_applied"); + ResourceLocation UPGRADE_ADD_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_add_failed"); + ResourceLocation UPGRADE_REMOVED = new ResourceLocation(Constants.MOD_ID, "upgrade_removed"); + ResourceLocation UPGRADE_REM_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_remove_failed"); + ResourceLocation ALREADY_HAS_UPGRADE = new ResourceLocation(Constants.MOD_ID, "upgrade_already_present"); + ResourceLocation UPGRADE_NOT_PRESENT = new ResourceLocation(Constants.MOD_ID, "upgrade_not_present"); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java new file mode 100644 index 00000000..9e5533fa --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java @@ -0,0 +1,30 @@ +package dev.compactmods.machines.api.core; + +import net.minecraft.resources.ResourceLocation; + +public interface Tooltips { + + ResourceLocation UNKNOWN_PLAYER_NAME = new ResourceLocation(Constants.MOD_ID, "unknown_player"); + ResourceLocation TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); + ResourceLocation UNKNOWN_TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); + ResourceLocation ROOM_NAME = new ResourceLocation(Constants.MOD_ID, "room_name"); + ResourceLocation ROOM_UPGRADE_TYPE = new ResourceLocation(Constants.MOD_ID, "room_upgrade_type"); + ResourceLocation TUTORIAL_APPLY_ROOM_UPGRADE = new ResourceLocation(Constants.MOD_ID, "tutorial_apply_room_upgrade"); + ResourceLocation CRAFT_TO_UPGRADE = new ResourceLocation(Constants.MOD_ID, "craft_machine_to_upgrade"); + + interface Machines { + ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id"); + ResourceLocation OWNER = new ResourceLocation(Constants.MOD_ID, "machine.owner"); + ResourceLocation SIZE = new ResourceLocation(Constants.MOD_ID, "machine.size"); + ResourceLocation BOUND_TO = new ResourceLocation(Constants.MOD_ID, "machine.bound_to"); + } + + //#region Hints and Details + ResourceLocation HINT_HOLD_SHIFT = new ResourceLocation(Constants.MOD_ID, "hint.hold_shift"); + + interface Details { + ResourceLocation PERSONAL_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "details.psd"); + ResourceLocation SOLID_WALL = new ResourceLocation(Constants.MOD_ID, "details.solid_wall"); + } + //#endregion +} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java similarity index 82% rename from forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java rename to common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java index e9fef491..e7f8fe73 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java @@ -10,7 +10,6 @@ import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraftforge.server.ServerLifecycleHooks; import org.jetbrains.annotations.NotNull; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -24,16 +23,6 @@ public abstract class CompactDimension { private CompactDimension() {} - @NotNull - public static ServerLevel forCurrentServer() throws MissingDimensionException { - final var server = ServerLifecycleHooks.getCurrentServer(); - final var level = server.getLevel(LEVEL_KEY); - if(level == null) - throw new MissingDimensionException(); - - return level; - } - @NotNull public static ServerLevel forServer(MinecraftServer server) throws MissingDimensionException { final var level = server.getLevel(LEVEL_KEY); diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java b/common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java rename to common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java rename to common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java rename to common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java rename to common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java similarity index 74% rename from forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java rename to common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java index d1e07dcd..7239c59b 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java @@ -9,7 +9,7 @@ public interface MachineTags { - TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); - TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); + TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); } diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java similarity index 96% rename from forge-api/src/main/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java rename to common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java index 195c0d6d..d1b46d77 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/ItemWithNbtRecipeBuilder.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java @@ -1,8 +1,7 @@ -package dev.compactmods.machines.api; +package dev.compactmods.machines.api.recipe; import com.google.common.collect.Lists; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.recipe.ShapelessRecipeWithNbtResult; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeHelper; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementRewards; diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java similarity index 57% rename from forge-api/src/main/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java rename to common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java index f2138b4d..8d3928c6 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/machine/ShapedWithNbtRecipeBuilder.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java @@ -1,23 +1,25 @@ -package dev.compactmods.machines.api.machine; +package dev.compactmods.machines.api.recipe; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementRewards; import net.minecraft.advancements.CriterionTriggerInstance; import net.minecraft.advancements.RequirementsStrategy; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.Registry; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeBuilder; -import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; import java.util.Map; import java.util.function.Consumer; @@ -27,10 +29,10 @@ public class ShapedWithNbtRecipeBuilder implements RecipeBuilder { private String group; private final int count; private final List rows = Lists.newArrayList(); - private final Map key = Maps.newLinkedHashMap(); + private final Map keyMap = Maps.newLinkedHashMap(); private Advancement.Builder advancement; - private List> additionalNbtWriters = Lists.newArrayList(); + private final List> additionalNbtWriters = Lists.newArrayList(); public ShapedWithNbtRecipeBuilder(ItemLike pResult, int pCount) { this.result = pResult.asItem(); @@ -76,12 +78,12 @@ public ShapedWithNbtRecipeBuilder define(Character pSymbol, ItemLike pItem) { } public ShapedWithNbtRecipeBuilder define(Character pSymbol, Ingredient pIngredient) { - if (this.key.containsKey(pSymbol)) { + if (this.keyMap.containsKey(pSymbol)) { throw new IllegalArgumentException("Symbol '" + pSymbol + "' is already defined!"); } else if (pSymbol == ' ') { throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); } else { - this.key.put(pSymbol, pIngredient); + this.keyMap.put(pSymbol, pIngredient); return this; } } @@ -106,26 +108,84 @@ public void save(Consumer pFinishedRecipeConsumer, ResourceLocat .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) .requirements(RequirementsStrategy.OR); - pFinishedRecipeConsumer.accept(new ShapedWithNbtRecipeBuilder.Result(this, pRecipeId, this.result, this.count, - this.group == null ? "" : this.group, - this.rows, this.key, - this.advancement, - new ResourceLocation(pRecipeId.getNamespace(), "recipes/" + this.result.getItemCategory().getRecipeFolderName() + "/" + pRecipeId.getPath()))); + pFinishedRecipeConsumer.accept(new ShapedWithNbtRecipeBuilder.Result(this, pRecipeId, + new ResourceLocation(pRecipeId.getNamespace(), "recipes/" + + this.result.getItemCategory().getRecipeFolderName() + "/" + pRecipeId.getPath()))); } - public static class Result extends ShapedRecipeBuilder.Result { + public static class Result implements FinishedRecipe { private final ShapedWithNbtRecipeBuilder builder; - - public Result(ShapedWithNbtRecipeBuilder builder, ResourceLocation pId, Item pResult, int pCount, String pGroup, List pPattern, Map pKey, Advancement.Builder pAdvancement, ResourceLocation pAdvancementId) { - super(pId, pResult, pCount, pGroup, pPattern, pKey, pAdvancement, pAdvancementId); + private final ResourceLocation id; + private final Item result; + private final int count; + private final String group; + private final List pattern; + private final Map key; + private final Advancement.Builder advancement; + private final ResourceLocation advancementId; + + public Result(ShapedWithNbtRecipeBuilder builder, ResourceLocation pId, ResourceLocation advancementId) { + this.id = pId; + this.result = builder.result; + this.count = builder.count; + this.group = builder.group; + this.pattern = builder.rows; + this.key = builder.keyMap; + this.advancement = builder.advancement; + this.advancementId = advancementId; this.builder = builder; } @Override - public void serializeRecipeData(JsonObject pJson) { - super.serializeRecipeData(pJson); - this.builder.addResultNbt(pJson.getAsJsonObject("result")); + public void serializeRecipeData(JsonObject json) { + if (!this.group.isEmpty()) { + json.addProperty("group", this.group); + } + + JsonArray pattern = new JsonArray(); + for(var i : this.pattern) + pattern.add(i); + + json.add("pattern", pattern); + + + JsonObject keyMap = new JsonObject(); + for (var keyEntry : this.key.entrySet()) { + keyMap.add(String.valueOf(keyEntry.getKey()), keyEntry.getValue().toJson()); + } + json.add("key", keyMap); + + JsonObject result = new JsonObject(); + result.addProperty("item", Registry.ITEM.getKey(this.result).toString()); + if (this.count > 1) { + result.addProperty("count", this.count); + } + + this.builder.addResultNbt(result); + json.add("result", result); + } + + @Override + public ResourceLocation getId() { + return this.id; + } + + @Override + public RecipeSerializer getType() { + return RecipeSerializer.SHAPED_RECIPE; + } + + @Nullable + @Override + public JsonObject serializeAdvancement() { + return advancement.serializeToJson(); + } + + @Nullable + @Override + public ResourceLocation getAdvancementId() { + return advancementId; } } } diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java similarity index 96% rename from forge-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java rename to common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java index 192d0d40..a44b3d90 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java @@ -2,14 +2,13 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.ItemWithNbtRecipeBuilder; import net.minecraft.advancements.Advancement; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java similarity index 77% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java index a9f5c42d..8c83e940 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java @@ -1,11 +1,8 @@ package dev.compactmods.machines.api.room; -import net.minecraftforge.common.capabilities.AutoRegisterCapability; - import java.util.Optional; import java.util.UUID; -@AutoRegisterCapability public interface IPlayerRoomMetadataProvider { Optional currentRoom(); Optional roomCode(); diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java new file mode 100644 index 00000000..45a6d7e1 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java @@ -0,0 +1,13 @@ +package dev.compactmods.machines.api.room; + +import dev.compactmods.machines.api.room.history.IRoomHistoryItem; + +public interface IRoomHistory { + + void clear(); + boolean hasHistory(); + T peek(); + T pop(); + + void addHistory(T item); +} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java b/common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java b/common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java new file mode 100644 index 00000000..3100354c --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java @@ -0,0 +1,21 @@ +package dev.compactmods.machines.api.room; + +import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; + +import static dev.compactmods.machines.api.core.Constants.MOD_ID; + +public class Rooms { + + public static final ResourceKey> TEMPLATE_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); + + public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); + + public static Registry getTemplates(MinecraftServer server) { + final var regAccess = server.registryAccess(); + return regAccess.registryOrThrow(TEMPLATE_REG_KEY); + } +} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java b/common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java b/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java rename to common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java b/common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java rename to common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java similarity index 62% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java index 5ec35315..2e44ade0 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java @@ -1,18 +1,25 @@ package dev.compactmods.machines.api.tunnels.recipe; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.ItemWithNbtRecipeBuilder; +import dev.compactmods.machines.api.recipe.ItemWithNbtRecipeBuilder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.registries.RegistryObject; public class TunnelRecipeBuilder extends ItemWithNbtRecipeBuilder { - private TunnelRecipeBuilder(RegistryObject definition, int count) { - this.recipeId = definition.getId(); + private TunnelRecipeBuilder(ResourceLocation id, int count) { + this.recipeId = id; this.count = count; } + public static TunnelRecipeBuilder tunnel(ResourceLocation id) { + return new TunnelRecipeBuilder(id, 1); + } + + public static TunnelRecipeBuilder tunnel(ResourceLocation id, int count) { + return new TunnelRecipeBuilder(id, count); + } + @Override public ResourceLocation outputItemId() { return TunnelDefinition.TUNNEL_ID; @@ -23,14 +30,6 @@ public ResourceLocation outputRecipeId() { return TunnelRecipeHelper.getRecipeId(this.recipeId); } - public static TunnelRecipeBuilder tunnel(RegistryObject definition) { - return new TunnelRecipeBuilder(definition, 1); - } - - public static TunnelRecipeBuilder tunnel(RegistryObject definition, int count) { - return new TunnelRecipeBuilder(definition, count); - } - public TunnelRecipeBuilder setType(ResourceLocation id) { this.recipeId = id; return this; diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java similarity index 58% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java index ff79a287..bc941687 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java @@ -1,11 +1,10 @@ package dev.compactmods.machines.api.tunnels.recipe; import net.minecraft.resources.ResourceLocation; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public abstract class TunnelRecipeHelper { - public static ResourceLocation getRecipeId(@Nonnull ResourceLocation tunnelType) { - return new ResourceLocation(tunnelType.getNamespace(), "tunnels/" + tunnelType.getPath()); + public static ResourceLocation getRecipeId(@NotNull ResourceLocation tunnelType) { + return new ResourceLocation(tunnelType.getNamespace(), "dev/compactmods/machines/api/tunnels/" + tunnelType.getPath()); } } \ No newline at end of file diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java rename to common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java rename to common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java diff --git a/forge-api/build.gradle.kts b/forge-api/build.gradle.kts index 2b059a0e..ad0e44e2 100644 --- a/forge-api/build.gradle.kts +++ b/forge-api/build.gradle.kts @@ -50,15 +50,23 @@ sourceSets { } configure { - mappings("parchment", parchment_version) + mappings("parchment", "${parchment_version}-${minecraft_version}") accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) } +project.evaluationDependsOn(project(":common-api").path) + dependencies { minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + // implementation(project(":common-api")) + implementation(fg.deobf(project(":common-api"))) } tasks.withType { + // include common classes + val commonApi = project(":common-api").tasks.jar.get().archiveFile; + from(commonApi.map { zipTree(it) }) + manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) attributes(mapOf( diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java deleted file mode 100644 index 3adc0cf1..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public abstract class Advancements { - public static final ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); - public static final ResourceLocation ROOT = new ResourceLocation(Constants.MOD_ID, "root"); - public static final ResourceLocation FOUNDATIONS = new ResourceLocation(Constants.MOD_ID, "foundations"); - - public static final ResourceLocation GOT_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "got_shrinking_device"); - - public static final ResourceLocation CLAIMED_TINY_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_tiny"); - public static final ResourceLocation CLAIMED_SMALL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_small"); - public static final ResourceLocation CLAIMED_NORMAL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_normal"); - public static final ResourceLocation CLAIMED_LARGE_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_large"); - public static final ResourceLocation CLAIMED_GIANT_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_giant"); - public static final ResourceLocation CLAIMED_MAX_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_max"); - - public static final ResourceLocation RECURSIVE_ROOMS = new ResourceLocation(Constants.MOD_ID, "recursion"); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java deleted file mode 100644 index 3f365a38..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public abstract class CMCommands { - public static final ResourceLocation LEVEL_REGISTERED = new ResourceLocation(MOD_ID, "level_registered"); - public static final ResourceLocation LEVEL_NOT_FOUND = new ResourceLocation(MOD_ID, "level_not_found"); - - public static final ResourceLocation ROOM_NOT_FOUND = new ResourceLocation(MOD_ID, "room_not_found"); - - /** - * Used for displaying the number of registered machines via summary commands. - */ - public static final ResourceLocation MACHINE_REG_DIM = new ResourceLocation(MOD_ID, "summary.machines.dimension"); - public static final ResourceLocation MACHINE_REG_TOTAL = new ResourceLocation(MOD_ID, "summary.machines.total"); - - /** - * Used for displaying the number of registered rooms via summary commands. - */ - public static final ResourceLocation ROOM_REG_COUNT = new ResourceLocation(MOD_ID, "room_reg_count"); - public static final ResourceLocation NOT_A_MACHINE_BLOCK = new ResourceLocation(MOD_ID, "not_a_machine_block"); - - /** - * Shows a machine is not bound. Takes in a single param, the machine position in world. - */ - public static final ResourceLocation MACHINE_NOT_BOUND = new ResourceLocation(MOD_ID, "machine_not_bound"); - - public static final ResourceLocation WRONG_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dimension"); - public static final ResourceLocation NOT_IN_COMPACT_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dim"); - public static final ResourceLocation FAILED_CMD_FILE_ERROR = new ResourceLocation(MOD_ID, "failed_command_file_error"); - - public static final ResourceLocation CANNOT_GIVE_MACHINE = new ResourceLocation(MOD_ID, "cannot_give_machine_item"); - public static final ResourceLocation MACHINE_GIVEN = new ResourceLocation(MOD_ID, "machine_given_successfully"); - public static final ResourceLocation NO_REBIND_TUNNEL_PRESENT = new ResourceLocation(MOD_ID, "cannot_rebind_tunnel_present"); - public static final ResourceLocation SPAWN_CHANGED_SUCCESSFULLY = new ResourceLocation(MOD_ID, "spawn_changed_successfully"); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java deleted file mode 100644 index 6c56d742..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.compactmods.machines.api.core; - -import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public class CMRegistries { - - public static final ResourceKey> TYPES_REG_KEY = ResourceKey - .createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); - - public static ResourceKey> TEMPLATE_REG_KEY = - ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); - - public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey - .createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java deleted file mode 100644 index 36784eec..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; - -public abstract class CMTags { - - public static final TagKey ROOM_UPGRADE_ITEM = ItemTags.create(new ResourceLocation(Constants.MOD_ID, "room_upgrade")); - public static final TagKey MACHINE_ITEM = ItemTags.create(new ResourceLocation(Constants.MOD_ID, "machine")); - public static final TagKey MACHINE_BLOCK = BlockTags.create(new ResourceLocation(Constants.MOD_ID, "machine")); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java deleted file mode 100644 index 19bf6647..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/Constants.java +++ /dev/null @@ -1,6 +0,0 @@ -package dev.compactmods.machines.api.core; - -public abstract class Constants { - public static final String MOD_ID = "compactmachines"; - -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java deleted file mode 100644 index b2032f33..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public abstract class JeiInfo { - public static final ResourceLocation MACHINE = new ResourceLocation(Constants.MOD_ID, "machines"); - - public static final ResourceLocation SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "shrinking_device"); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java deleted file mode 100644 index c6d74540..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/Messages.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public abstract class Messages { - public static final ResourceLocation CANNOT_ENTER_MACHINE = new ResourceLocation(Constants.MOD_ID, "cannot_enter"); - public static final ResourceLocation NO_MACHINE_DATA = new ResourceLocation(Constants.MOD_ID, "no_machine_data"); - public static final ResourceLocation ROOM_SPAWNPOINT_SET = new ResourceLocation(Constants.MOD_ID, "spawnpoint_set"); - public static final ResourceLocation TELEPORT_OUT_OF_BOUNDS = new ResourceLocation(Constants.MOD_ID, "teleport_oob"); - public static final ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); - public static final ResourceLocation UNKNOWN_TUNNEL = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); - public static final ResourceLocation NO_TUNNEL_SIDE = new ResourceLocation(Constants.MOD_ID, "no_available_sides"); - public static final ResourceLocation UNKNOWN_ROOM_CHUNK = new ResourceLocation(Constants.MOD_ID, "unknown_room_chunk"); - public static final ResourceLocation UNREGISTERED_CM_DIM = new ResourceLocation(Constants.MOD_ID, "dimension_not_registered"); - public static final ResourceLocation NEW_MACHINE = new ResourceLocation(Constants.MOD_ID, "new_machine"); - - /** - * Used to show information about a player inside a Compact room. - */ - public static final ResourceLocation PLAYER_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "player_room_info"); - - /** - * Used to show information about a room, accessed via a bound machine. - */ - public static final ResourceLocation MACHINE_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "machine_room_info"); - - /** - * Shown when a non-owner tries to rename a room. Takes the owner's display name. - */ - public static final ResourceLocation CANNOT_RENAME_NOT_OWNER = new ResourceLocation(Constants.MOD_ID, "cannot_rename_not_owner"); - - /** - * Shown to players when they try to interact with a room they do not own. Provides the owner's display name. - */ - public static final ResourceLocation NOT_ROOM_OWNER = new ResourceLocation(Constants.MOD_ID, "not_the_room_owner"); - public static final ResourceLocation UPGRADE_APPLIED = new ResourceLocation(Constants.MOD_ID, "upgrade_applied"); - public static final ResourceLocation UPGRADE_ADD_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_add_failed"); - public static final ResourceLocation UPGRADE_REMOVED = new ResourceLocation(Constants.MOD_ID, "upgrade_removed"); - public static final ResourceLocation UPGRADE_REM_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_remove_failed"); - public static final ResourceLocation ALREADY_HAS_UPGRADE = new ResourceLocation(Constants.MOD_ID, "upgrade_already_present"); - public static final ResourceLocation UPGRADE_NOT_PRESENT = new ResourceLocation(Constants.MOD_ID, "upgrade_not_present"); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java b/forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java deleted file mode 100644 index db8a3eed..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public abstract class Tooltips { - - public static final ResourceLocation UNKNOWN_PLAYER_NAME = new ResourceLocation(Constants.MOD_ID, "unknown_player"); - public static final ResourceLocation TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); - public static final ResourceLocation UNKNOWN_TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); - public static final ResourceLocation ROOM_NAME = new ResourceLocation(Constants.MOD_ID, "room_name"); - public static final ResourceLocation ROOM_UPGRADE_TYPE = new ResourceLocation(Constants.MOD_ID, "room_upgrade_type"); - public static final ResourceLocation TUTORIAL_APPLY_ROOM_UPGRADE = new ResourceLocation(Constants.MOD_ID, "tutorial_apply_room_upgrade"); - public static final ResourceLocation CRAFT_TO_UPGRADE = new ResourceLocation(Constants.MOD_ID, "craft_machine_to_upgrade"); - - public static abstract class Machines { - public static final ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id"); - public static final ResourceLocation OWNER = new ResourceLocation(Constants.MOD_ID, "machine.owner"); - public static final ResourceLocation SIZE = new ResourceLocation(Constants.MOD_ID, "machine.size"); - public static final ResourceLocation BOUND_TO = new ResourceLocation(Constants.MOD_ID, "machine.bound_to"); - } - - //#region Hints and Details - public static final ResourceLocation HINT_HOLD_SHIFT = new ResourceLocation(Constants.MOD_ID, "hint.hold_shift"); - - public static abstract class Details { - public static final ResourceLocation PERSONAL_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "details.psd"); - public static final ResourceLocation SOLID_WALL = new ResourceLocation(Constants.MOD_ID, "details.solid_wall"); - } - //#endregion -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java deleted file mode 100644 index 74d81a6f..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java +++ /dev/null @@ -1,17 +0,0 @@ -package dev.compactmods.machines.api.room; - -import dev.compactmods.machines.api.room.history.IRoomHistoryItem; -import net.minecraft.nbt.ListTag; -import net.minecraftforge.common.capabilities.AutoRegisterCapability; -import net.minecraftforge.common.util.INBTSerializable; - -@AutoRegisterCapability -public interface IRoomHistory extends INBTSerializable { - - void clear(); - boolean hasHistory(); - T peek(); - T pop(); - - void addHistory(T item); -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java deleted file mode 100644 index 439e61c3..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplateDimensionComparator.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.api.room; - -import java.util.Comparator; - -public class RoomTemplateDimensionComparator implements Comparator { - @Override - public int compare(RoomTemplate o1, RoomTemplate o2) { - final var dim1 = o1.dimensions().getX() * o1.dimensions().getY() * o1.dimensions().getZ(); - final var dim2 = o2.dimensions().getX() * o2.dimensions().getY() * o2.dimensions().getZ(); - return dim1 - dim2; - } -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java b/forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java deleted file mode 100644 index 874cbf82..00000000 --- a/forge-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.compactmods.machines.api.room; - -import dev.compactmods.machines.api.core.CMRegistries; -import net.minecraft.core.Registry; -import net.minecraft.server.MinecraftServer; - -public class Rooms { - - public static Registry getTemplates(MinecraftServer server) { - final var regAccess = server.registryAccess(); - return regAccess.registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); - } -} diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java index eb9c01b5..0bafe054 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java +++ b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java @@ -6,7 +6,9 @@ import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.Experimental public interface CapabilityLookupTunnel { ImmutableSet> getSupportedCapabilities(); diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java index da45985a..b034cb17 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java +++ b/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java @@ -1,17 +1,12 @@ package dev.compactmods.machines.api.tunnels.capability; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.InstancedTunnel; +import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; -/** - * - * @param - * @deprecated Prefer new capability lookup tunnel instead - */ public interface CapabilityTunnel extends InstancedTunnel { ImmutableSet> getSupportedCapabilities(); diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 55bbd8ef..5fca8429 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -12,16 +12,7 @@ var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra -tasks.create("getBuildInfo") { - println("Mod ID: ${mod_id}") - println("Version: ${version}") - println("Semver Version: ${semver}") - println("Nightly Build: ${nightlyVersion}") -} - plugins { - id("idea") - id("eclipse") id("maven-publish") id("net.minecraftforge.gradle") version ("5.1.+") id("org.parchmentmc.librarian.forgegradle") version ("1.+") @@ -49,6 +40,7 @@ sourceSets.test { resources.srcDir("src/test/resources") } +project.evaluationDependsOn(project(":common-api").path) project.evaluationDependsOn(project(":forge-api").path) repositories { @@ -113,7 +105,7 @@ dependencies { minecraftLibrary("com.aventrix.jnanoid", "jnanoid", "2.0.0") jarJar("com.aventrix.jnanoid", "jnanoid", "[2.0.0]") - val include_test_mods: String? by extra + val include_test_mods: String? by project.extra if (!System.getenv().containsKey("CI") && include_test_mods.equals("true")) { // Nicephore - Screenshots and Stuff runtimeOnly(fg.deobf("curse.maven:nicephore-401014:3879841")) @@ -158,6 +150,7 @@ dependencies { } val runDepends: List = listOf( + project(":common-api"), project(":forge-api"), project(":forge-tunnels") ) @@ -167,7 +160,7 @@ runDepends.forEach { } minecraft { - mappings("parchment", parchment_version) + mappings("parchment", "${parchment_version}-${minecraft_version}") accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) runs { @@ -183,11 +176,11 @@ minecraft { ideaModule("Compact_Machines.forge-main.main") - if (!System.getenv().containsKey("CI")) { - // JetBrains Runtime Hotswap - jvmArg("-XX:+AllowEnhancedClassRedefinition") - jvmArg("-XX:HotswapAgent=fatjar") - } +// if (!System.getenv().containsKey("CI")) { +// // JetBrains Runtime Hotswap +// jvmArg("-XX:+AllowEnhancedClassRedefinition") +// jvmArg("-XX:HotswapAgent=fatjar") +// } source(sourceSets.main.get()) mods.create(mod_id) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index 9da57d7e..3ac802c5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -2,7 +2,9 @@ import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; +import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.config.CommonConfig; import dev.compactmods.machines.config.EnableVanillaRecipesConfigCondition; @@ -17,9 +19,11 @@ import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.villager.Villagers; import dev.compactmods.machines.wall.Walls; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; @@ -71,6 +75,14 @@ public CompactMachines() { mlCtx.registerConfig(ModConfig.Type.SERVER, ServerConfig.CONFIG); CraftingHelper.register(EnableVanillaRecipesConfigCondition.Serializer.INSTANCE); + + final var bus = FMLJavaModLoadingContext.get().getModEventBus(); + bus.addListener(this::registerCapabilities); + } + + private void registerCapabilities(final RegisterCapabilitiesEvent caps) { + caps.register(IPlayerRoomMetadataProvider.class); + caps.register(IRoomHistory.class); } /** @@ -90,7 +102,9 @@ private static void doRegistration() { Registries.EDGE_TYPES.register(bus); Registries.COMMAND_ARGUMENT_TYPES.register(bus); Registries.LOOT_FUNCS.register(bus); - + Registries.VILLAGERS.register(bus); + Villagers.TRADES.register(bus); + Registries.POINTS_OF_INTEREST.register(bus); CompactMachines.loadedAddons = ModList.get() .getAllScanData() @@ -113,7 +127,7 @@ private static void doRegistration() { CompactMachines.loadedAddons.forEach(addon -> { LOGGER.debug(ADDON_LIFECYCLE, "Sending registration hook to addon: {}", addon.getClass().getName()); - addon.afterRegistration(bus); + addon.afterRegistration(); }); } @@ -131,6 +145,8 @@ private static void preparePackages() { Graph.prepare(); Commands.prepare(); LootFunctions.prepare(); + + Villagers.prepare(); } public static Set getAddons() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java index 5a67ecdf..b0deebff 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java @@ -1,6 +1,6 @@ package dev.compactmods.machines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java index 1384fa36..e306d6d6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.Advancements; import dev.compactmods.machines.api.room.RoomSize; import net.minecraft.advancements.CriteriaTriggers; diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java index 6407bcf7..7a47fe2a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java +++ b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.advancement.trigger; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.Advancements; import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.DeserializationContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java index 03a12d8b..612c765a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.client; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.core.UIRegistration; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java b/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java index 149d77d9..0bbcccd2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.client; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import net.minecraft.resources.ResourceLocation; public class Resources { diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java index d54120ff..fab0c8fb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java @@ -2,7 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.client.gui.guide.GuideSection; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java index 16819d5b..bfe89203 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.client.gui.guide; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.client.gui.widget.AbstractCMGuiWidget; import dev.compactmods.machines.client.gui.widget.ScrollableWrappedTextWidget; import net.minecraft.ChatFormatting; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java index ead7c6a7..4414feb9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormatElement; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.client.shader.CM4Shaders; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java b/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java index 00d48510..1c84ce52 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java @@ -10,7 +10,7 @@ import java.io.IOException; -import static dev.compactmods.machines.api.core.Constants.MOD_ID; +import static dev.compactmods.machines.api.Constants.MOD_ID; @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class CM4Shaders diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java index 80b497a3..e83021a5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.command; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.command.data.CMDataSubcommand; import dev.compactmods.machines.command.subcommand.CMEjectSubcommand; import dev.compactmods.machines.command.subcommand.CMGiveMachineSubcommand; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index 700d0aa6..429e99f0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; @@ -66,7 +66,7 @@ private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { .addColumn("machine_x") .addColumn("machine_y") .addColumn("machine_z") - .addColumn("room") + .addColumn("dev/compactmods/machines/api/room") .build(writer); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java index fa8512b4..9ffb21c3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; @@ -58,7 +58,7 @@ private static int execAll(CommandContext ctx) { @Nonnull private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { return CsvOutput.builder() - .addColumn("room") + .addColumn("dev/compactmods/machines/api/room") .addColumn("owner_uuid") .addColumn("size_x") .addColumn("size_y") diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java index 8782b75d..3e02be27 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java @@ -5,8 +5,8 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; @@ -27,10 +27,10 @@ public class CMTunnelDataExportCommand { public static ArgumentBuilder makeTunnelCsv() { var chunk = Commands - .argument("room", StringArgumentType.string()) + .argument("dev/compactmods/machines/api/room", StringArgumentType.string()) .executes(CMTunnelDataExportCommand::exec); - return Commands.literal("tunnels") + return Commands.literal("dev/compactmods/machines/api/tunnels") .requires(cs -> cs.hasPermission(Commands.LEVEL_GAMEMASTERS)) .executes(CMTunnelDataExportCommand::execAll) .then(chunk); @@ -78,7 +78,7 @@ public static int exec(CommandContext ctx) throws CommandSyn var src = ctx.getSource(); ServerPlayer player = src.getPlayerOrException(); - final var room = StringArgumentType.getString(ctx, "room"); + final var room = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); final var compactDim = src.getServer().getLevel(CompactDimension.LEVEL_KEY); var outdir = src.getServer().getFile(Constants.MOD_ID); diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java index 9b4dee00..10b2a59a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java @@ -5,8 +5,8 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; @@ -23,7 +23,7 @@ public static LiteralArgumentBuilder make() { .requires(cs -> cs.hasPermission(ServerConfig.giveMachineLevel())); subRoot.then(Commands.argument("player", EntityArgument.player()) - .then(Commands.argument("room", StringArgumentType.string()) + .then(Commands.argument("dev/compactmods/machines/api/room", StringArgumentType.string()) .executes(CMGiveMachineSubcommand::giveMachine))); return subRoot; @@ -32,7 +32,7 @@ public static LiteralArgumentBuilder make() { private static int giveMachine(CommandContext ctx) throws CommandSyntaxException { final var src = ctx.getSource(); final var player = EntityArgument.getPlayer(ctx, "player"); - final var roomCode = StringArgumentType.getString(ctx, "room"); + final var roomCode = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); var roomProvider = CompactRoomProvider.instance(src.getServer()); roomProvider.forRoom(roomCode).ifPresentOrElse(room -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java index 2e41b7c2..29595a6c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java @@ -3,7 +3,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.util.DimensionUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java index b2eeecb1..53b233eb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java @@ -5,7 +5,7 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java index c39a42d1..9b0518b0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.machine.MachineTags; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java index 8b7baddf..153e4fc4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java @@ -2,7 +2,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java index 7206cf51..90833c75 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java @@ -4,7 +4,7 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java index f6be02f3..6c380b1c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; @@ -21,7 +21,7 @@ public class SpawnSubcommand { final var resetSpawn = Commands.literal("reset") .requires(cs -> cs.hasPermission(ServerConfig.changeRoomSpawn())) - .then(Commands.argument("room", StringArgumentType.string()) + .then(Commands.argument("dev/compactmods/machines/api/room", StringArgumentType.string()) .executes(SpawnSubcommand::resetRoomSpawn)); spawnRoot.then(resetSpawn); @@ -32,7 +32,7 @@ public class SpawnSubcommand { private static int resetRoomSpawn(CommandContext ctx) { final var src = ctx.getSource(); final var serv = src.getServer(); - final var roomCode = StringArgumentType.getString(ctx, "room"); + final var roomCode = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); try { final var compactDim = CompactDimension.forServer(serv); diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java index 1881fc08..858a4a4f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.compat.carryon.CarryOnCompat; import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.compat.theoneprobe.TheOneProbeCompat; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java index d4d1dbe3..b0e7e834 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.curios; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java index 6f1af433..3143618a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.compat.jei; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.JeiInfo; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.JeiInfo; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java index 5602a27d..0768d920 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java @@ -2,7 +2,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.client.PlayerFaceRenderer; import mcjty.theoneprobe.api.IElement; import net.minecraft.network.FriendlyByteBuf; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java index 27c308be..36fc88a8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.theoneprobe.overrides; -import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.CMTags; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java index c64f843c..37c8ba51 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.compat.theoneprobe.providers; -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; @@ -34,7 +34,7 @@ public class CompactMachineProvider implements IProbeInfoProvider { @Override public ResourceLocation getID() { - return new ResourceLocation(Constants.MOD_ID, "machine"); + return new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java index e05442de..56f781e8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.theoneprobe.providers; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.tunnel.TunnelWallBlock; import dev.compactmods.machines.tunnel.TunnelWallEntity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java index 630ed26e..c8178f18 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.config; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java index 6e922b7c..4298eab3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.config; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.crafting.conditions.IConditionSerializer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java index 1ed5d81f..37631724 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.wall.ProtectedWallBlock; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java index bec2b7d6..0d453201 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.room.network.PlayerRequestedTeleportPacket; import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java index e249f4ff..bcf5216a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java @@ -2,7 +2,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.AdvancementTriggers; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.room.network.RoomNetworkHandler; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java index 57eb61e6..222650e3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java @@ -1,8 +1,9 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.core.CMRegistries; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMRegistries; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphEdgeType; @@ -11,6 +12,8 @@ import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.ai.village.poi.PoiType; +import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -20,7 +23,7 @@ import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; -import static dev.compactmods.machines.api.core.Constants.MOD_ID; +import static dev.compactmods.machines.api.Constants.MOD_ID; public class Registries { @@ -36,7 +39,7 @@ public class Registries { public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); // MachineRoomUpgrades - public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistries.ROOM_UPGRADES_REG_KEY, MOD_ID); + public static final DeferredRegister UPGRADES = DeferredRegister.create(Rooms.ROOM_UPGRADES_REG_KEY, MOD_ID); // Graph @ApiStatus.Internal @@ -56,7 +59,12 @@ public class Registries { public static final DeferredRegister LOOT_FUNCS = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, MOD_ID); public static DeferredRegister ROOM_TEMPLATES = DeferredRegister - .create(CMRegistries.TEMPLATE_REG_KEY, Constants.MOD_ID); + .create(Rooms.TEMPLATE_REG_KEY, Constants.MOD_ID); + + // Villagers + public static final DeferredRegister VILLAGERS = DeferredRegister.create(ForgeRegistries.VILLAGER_PROFESSIONS, Constants.MOD_ID); + + public static final DeferredRegister POINTS_OF_INTEREST = DeferredRegister.create(ForgeRegistries.POI_TYPES, Constants.MOD_ID); public static void setup() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java index b3b53cca..ebd3f2fa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.core; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java b/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java index 70216946..fccf18af 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java @@ -8,7 +8,7 @@ public class UIRegistration { - public static final RegistryObject> MACHINE_MENU = Registries.CONTAINERS.register("machine", () -> IForgeMenuType.create( + public static final RegistryObject> MACHINE_MENU = Registries.CONTAINERS.register("dev/compactmods/machines/api/machine", () -> IForgeMenuType.create( ((windowId, inv, data) -> { data.readBlockPos(); final var mach = data.readWithCodec(LevelBlockPosition.CODEC); diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java index 800b1e3e..546dc38d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import com.google.common.collect.Sets; import com.google.gson.Gson; @@ -6,8 +6,8 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.core.Advancements; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Advancements; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java index 879a4d3f..2ed1db0d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.datagen.lang.BaseLangGenerator; +import dev.compactmods.machines.data.generated.lang.BaseLangGenerator; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java index 717ea908..c4c20325 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java index 8db1e7fd..3f606952 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import com.google.common.collect.ImmutableSet; import com.google.gson.Gson; @@ -6,7 +6,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java similarity index 71% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java index f7a4403f..cd761171 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java @@ -1,11 +1,12 @@ -package dev.compactmods.machines.datagen; - -import dev.compactmods.machines.datagen.lang.EnglishLangGenerator; -import dev.compactmods.machines.datagen.lang.RussianLangGenerator; -import dev.compactmods.machines.datagen.room.RoomTemplates; -import dev.compactmods.machines.datagen.tags.BlockTagGenerator; -import dev.compactmods.machines.datagen.tags.ItemTagGenerator; -import dev.compactmods.machines.api.core.Constants; +package dev.compactmods.machines.data.generated; + +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.data.generated.lang.EnglishLangGenerator; +import dev.compactmods.machines.data.generated.lang.RussianLangGenerator; +import dev.compactmods.machines.data.generated.room.RoomTemplates; +import dev.compactmods.machines.data.generated.tags.BlockTagGenerator; +import dev.compactmods.machines.data.generated.tags.ItemTagGenerator; +import dev.compactmods.machines.data.generated.tags.PointOfInterestTagGenerator; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -29,6 +30,8 @@ public static void gatherData(GatherDataEvent event) { generator.addProvider(server, blocks); generator.addProvider(server, new ItemTagGenerator(generator, blocks, helper)); + generator.addProvider(server, new PointOfInterestTagGenerator(generator, helper)); + RoomTemplates.make(event); // Client diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java index dc074516..5236a156 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java index f9e37269..e07f98dc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; @@ -33,6 +33,8 @@ protected void registerModels() { withExistingParent(MachineRoomUpgrades.CHUNKLOADER.getId().toString(), mcLoc("item/generated")) .texture("layer0", modLoc("upgrades/chunkloader")); + + withExistingParent(MachineRoomUpgrades.WORKBENCH_ITEM.getId().getPath(), modLoc("block/workbench")); } private void machine(String size) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java index 95a39aa1..cef5a767 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.dimension.Dimension; import net.minecraft.core.Holder; @@ -38,7 +38,7 @@ public class LevelBiomeGenerator implements DataProvider { private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final DataGenerator generator; - private final ResourceLocation COMPACT_BIOME = new ResourceLocation(Constants.MOD_ID, "machine"); + private final ResourceLocation COMPACT_BIOME = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); LevelBiomeGenerator(DataGenerator generator) { this.generator = generator; @@ -56,7 +56,7 @@ public void run(@Nonnull CachedOutput cache) { var dimTypeWriter = DataGenUtil.makeWriter(GSON, cache, data, ImmutableSet.of("dimension_type"), DimensionType.DIRECT_CODEC, dimTypes); - var dimWriter = DataGenUtil.makeCustomWriter(GSON, cache, data, ImmutableSet.of("dimension"), this::writeFlatDimension, dims); + var dimWriter = DataGenUtil.makeCustomWriter(GSON, cache, data, ImmutableSet.of("dev/compactmods/machines/api/dimension"), this::writeFlatDimension, dims); writeBiomes(biomeWriter); writeDimensionTypes(dimTypeWriter); diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java index 8366a13b..1f7e4b47 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.machine.ShapedWithNbtRecipeBuilder; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.recipe.ShapedWithNbtRecipeBuilder; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; import dev.compactmods.machines.machine.LegacySizedTemplates; @@ -52,7 +52,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.ITEM_TUNNEL_DEF, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.ITEM_TUNNEL_DEF.getId(), 2) .requires(Ingredient.of(Tags.Items.CHESTS)) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -60,7 +60,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.FLUID_TUNNEL_DEF, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.FLUID_TUNNEL_DEF.getId(), 2) .requires(Items.BUCKET) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -68,7 +68,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.FORGE_ENERGY, 2) + TunnelRecipeBuilder.tunnel(BuiltinTunnels.FORGE_ENERGY.getId(), 2) .requires(Items.GLOWSTONE_DUST) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java similarity index 89% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java index 72fcaa4a..d19cca20 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java @@ -1,9 +1,10 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.BlockModelProvider; @@ -66,5 +67,8 @@ protected void registerStatesAndModels() { .modelFile(models.cubeAll("block/machine/machine_" + sizeName, modLoc("block/machine/machine_" + sizeName))) .build()); } + + this.simpleBlock(MachineRoomUpgrades.WORKBENCH_BLOCK.get(), models() + .cubeTop("block/workbench", modLoc("block/workbench/top"), modLoc("block/workbench/sides"))); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java index b2fb109f..36353478 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.datagen; +package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.tunnel.TunnelWallBlock; import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.Direction; @@ -27,9 +27,9 @@ protected void registerStatesAndModels() { for (Direction dir : Direction.values()) { - String typedTunnelDirectional = "tunnels/" + dir.getSerializedName(); + String typedTunnelDirectional = "dev/compactmods/machines/api/tunnels/" + dir.getSerializedName(); models() - .withExistingParent(typedTunnelDirectional, modLoc("tunnels/base")) + .withExistingParent(typedTunnelDirectional, modLoc("dev/compactmods/machines/api/tunnels/base")) .texture("wall", modLoc("block/" + typedTunnelDirectional)) .renderType(mcLoc("cutout")); // NamedRenderTypeManager @@ -54,7 +54,7 @@ protected void registerStatesAndModels() { private void generateTunnelBaseModel() { BlockModelBuilder base = models() - .withExistingParent("tunnels/base", new ResourceLocation("minecraft", "block/block")) + .withExistingParent("dev/compactmods/machines/api/tunnels/base", new ResourceLocation("minecraft", "block/block")) .texture("tunnel", modLoc("block/tunnels/tunnel")) .texture("indicator", modLoc("block/tunnels/indicator")); diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java new file mode 100644 index 00000000..35d3930a --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.data.generated; + +public class VillagerTrades { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java index d5b42fe2..063f7258 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java @@ -1,11 +1,11 @@ -package dev.compactmods.machines.datagen.lang; +package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.core.Advancements; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Advancements; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.datagen.AdvancementLangBuilder; +import dev.compactmods.machines.data.generated.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java index 68a3ee57..28f08e2b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.datagen.lang; +package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.dimension.VoidAirBlock; @@ -133,6 +133,9 @@ protected void addTranslations() { add("death.attack." + VoidAirBlock.DAMAGE_SOURCE.msgId, "%1$s failed to enter the void"); add("curios.identifier.psd", "Personal Shrinking Device"); + + add(MachineRoomUpgrades.WORKBENCH_BLOCK.get(), "Workbench"); + add("entity.minecraft.villager.compactmachines.tinkerer", "Tinkerer"); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java index 328be67b..a166aabb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.datagen.lang; +package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java similarity index 89% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java index 65672f98..370acf1c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.datagen.room; +package dev.compactmods.machines.data.generated.room; import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.api.core.CMRegistries; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.machine.LegacySizedTemplates; import net.minecraft.core.RegistryAccess; import net.minecraft.core.Vec3i; @@ -38,7 +38,7 @@ public static void make(GatherDataEvent event) { final var files = event.getExistingFileHelper(); final var provider = JsonCodecProvider.forDatapackRegistry(gen, files, - Constants.MOD_ID, ops, CMRegistries.TEMPLATE_REG_KEY, templates); + Constants.MOD_ID, ops, Rooms.TEMPLATE_REG_KEY, templates); gen.addProvider(event.includeServer(), provider); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java index f49186eb..0e9af387 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.datagen.tags; +package dev.compactmods.machines.data.generated.tags; -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.wall.Walls; diff --git a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java index 1eede3a8..3630cd42 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.datagen.tags; +package dev.compactmods.machines.data.generated.tags; -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java new file mode 100644 index 00000000..bd034511 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.data.generated.tags; + +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.villager.Villagers; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.PoiTypeTagsProvider; +import net.minecraft.tags.PoiTypeTags; +import net.minecraft.world.entity.ai.village.poi.PoiType; +import net.minecraftforge.common.data.ExistingFileHelper; +import org.jetbrains.annotations.Nullable; + +public class PointOfInterestTagGenerator extends PoiTypeTagsProvider { + public PointOfInterestTagGenerator(DataGenerator gen, @Nullable ExistingFileHelper files) { + super(gen, Constants.MOD_ID, files); + } + + @Override + protected void addTags() { + TagAppender builder = tag(PoiTypeTags.ACQUIRABLE_JOB_SITE); + builder.add(Villagers.TINKERER_WORKBENCH_KEY); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java index 35b9fa24..1561f460 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.codec.CodecExtensions; @@ -125,12 +125,12 @@ public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory level .forEach(machConnTag -> { // Loop machine-room connection info, replace room pos with room code if (machConnTag instanceof CompoundTag ct) { - final var oldChunk = ct.getIntArray("room"); + final var oldChunk = ct.getIntArray("dev/compactmods/machines/api/room"); final var oldRoomPos = new ChunkPos(oldChunk[0], oldChunk[1]); if (roomChunkLookup.containsKey(oldRoomPos)) { final var newCode = roomChunkLookup.get(oldRoomPos); - ct.remove("room"); - ct.putString("room", newCode); + ct.remove("dev/compactmods/machines/api/room"); + ct.putString("dev/compactmods/machines/api/room", newCode); UPDATER_LOGGER.debug(UPDATER, "Assigning new code to room {}; code: {}", oldRoomPos.toString(), newCode); } } @@ -144,7 +144,7 @@ public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory level public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDirectory, HashMap roomChunkLookup, Path backupDir) throws IOException { - Files.createDirectories(backupDir.resolve("tunnels")); + Files.createDirectories(backupDir.resolve("dev/compactmods/machines/api/tunnels")); final var dataStore = CompactDimension.getDataStorage(levelDirectory); for(final var room : roomChunkLookup.entrySet()) { @@ -153,7 +153,7 @@ public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDir final var newFile = dataStore.getDataFile(TunnelConnectionGraph.getDataFilename(room.getValue())); if(oldFile.exists()) { final var oldFilePath = oldFile.toPath(); - Files.copy(oldFilePath, backupDir.resolve("tunnels").resolve(prevFilename + ".dat.backup")); + Files.copy(oldFilePath, backupDir.resolve("dev/compactmods/machines/api/tunnels").resolve(prevFilename + ".dat.backup")); Files.copy(oldFilePath, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.delete(oldFilePath); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java index 8f915e9a..6d1b9bd7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.dimension.DimensionType; import net.minecraftforge.registries.RegistryObject; -import static dev.compactmods.machines.api.core.Constants.MOD_ID; +import static dev.compactmods.machines.api.Constants.MOD_ID; public class Dimension { diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java index 26cfc4b0..5156da3d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; -import static dev.compactmods.machines.api.core.Constants.MOD_ID; +import static dev.compactmods.machines.api.Constants.MOD_ID; public class VoidAirBlock extends AirBlock { diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java b/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java index 3608ddb6..f8890a5b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java @@ -17,11 +17,11 @@ public class Graph { public static final RegistryObject> MACH_NODE = Registries.NODE_TYPES - .register("machine", SimpleGraphNodeType.instance(CompactMachineNode.CODEC)); + .register("dev/compactmods/machines/api/machine", SimpleGraphNodeType.instance(CompactMachineNode.CODEC)); public static final RegistryObject> DIM_NODE = Registries.NODE_TYPES - .register("dimension", SimpleGraphNodeType.instance(DimensionGraphNode.CODEC)); + .register("dev/compactmods/machines/api/dimension", SimpleGraphNodeType.instance(DimensionGraphNode.CODEC)); public static final RegistryObject> ROOM_REFERENCE_NODE = Registries.NODE_TYPES - .register("room", SimpleGraphNodeType.instance(RoomReferenceNode.CODEC)); + .register("dev/compactmods/machines/api/room", SimpleGraphNodeType.instance(RoomReferenceNode.CODEC)); public static final RegistryObject> ROOM_UPGRADE_NODE = Registries.NODE_TYPES .register("room_upgrade", SimpleGraphNodeType.instance(RoomUpgradeGraphNode.CODEC)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java index ff32e038..03a652b3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FastColor; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java index d70f99fb..04f981f8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java @@ -45,7 +45,7 @@ public class Machines { public static final RegistryObject MACHINE_BLOCK_MAXIMUM = Registries.BLOCKS.register("machine_maximum", () -> new LegacySizedCompactMachineBlock(RoomSize.MAXIMUM, MACHINE_BLOCK_PROPS)); - public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("machine", () -> + public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("dev/compactmods/machines/api/machine", () -> new CompactMachineBlock(MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_ITEM_TINY = Registries.ITEMS.register("machine_tiny", @@ -66,7 +66,7 @@ public class Machines { public static final RegistryObject MACHINE_BLOCK_ITEM_MAXIMUM = Registries.ITEMS.register("machine_maximum", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); - public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("machine", + public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("dev/compactmods/machines/api/machine", () -> new BoundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java index afeee784..f938b5e1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java @@ -1,11 +1,11 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; @@ -362,7 +362,7 @@ public int getColor() { public Optional getRoomTemplate() { if (level != null) { return level.registryAccess() - .registry(CMRegistries.TEMPLATE_REG_KEY) + .registry(Rooms.TEMPLATE_REG_KEY) .map(reg -> reg.get(roomTemplateId)); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index 146407f7..028c9e3e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomSize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index 588efbe2..09488fdd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.CMTags; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java index fd577fd9..9f298591 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.client; -import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.CMTags; import dev.compactmods.machines.machine.item.CompactMachineItem; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import net.minecraft.client.color.block.BlockColor; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java index 5113512a..49219586 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; @@ -18,10 +18,10 @@ public record CompactMachineNode(ResourceKey dimension, BlockPos position) implements IGraphNode { - public static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "machine"); + public static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Level.RESOURCE_KEY_CODEC.fieldOf("dimension").forGetter(CompactMachineNode::dimension), + Level.RESOURCE_KEY_CODEC.fieldOf("dev/compactmods/machines/api/dimension").forGetter(CompactMachineNode::dimension), BlockPos.CODEC.fieldOf("position").forGetter(CompactMachineNode::position), ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (dim, pos, type) -> new CompactMachineNode(dim, pos))); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java index 5cb51ed3..77d4b8d9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java @@ -216,7 +216,7 @@ public CompoundTag save(@Nonnull CompoundTag nbt) { private record CompactMachineConnectionInfo(String roomCode, List machines) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING - .fieldOf("room") + .fieldOf("dev/compactmods/machines/api/room") .forGetter(CompactMachineConnectionInfo::roomCode), BlockPos.CODEC.listOf() diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java index dcc705b7..3454999e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java index aa5d82cd..5fa97cf1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java index 34437d75..94846a0d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; @@ -38,7 +38,7 @@ public UnboundCompactMachineItem(Block blockIn, Properties builder) { @Nonnull @Override public String getDescriptionId(ItemStack stack) { - return Util.makeDescriptionId("machine", getTemplateId(stack)); + return Util.makeDescriptionId("dev/compactmods/machines/api/machine", getTemplateId(stack)); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java index 765cc535..36c7a2d4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.room; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.core.CompactMachinesNet; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java index e5ae7067..86e3116d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java @@ -1,16 +1,18 @@ package dev.compactmods.machines.room.capability; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.Optional; import com.mojang.serialization.DataResult; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.codec.NbtListCollector; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; +import net.minecraftforge.common.util.INBTSerializable; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Optional; -public class CMRoomHistory implements IRoomHistory { +public class CMRoomHistory implements IRoomHistory, INBTSerializable { private final Deque history; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java index 8b58c4de..1b6bd212 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java @@ -43,7 +43,7 @@ private IPlayerRoomMetadataProvider getCurrentRoomMetadataProvider() { public CompoundTag serializeNBT() { final var tag = new CompoundTag(); provider.currentRoom().ifPresent(meta -> { - tag.putString("room", meta.roomCode()); + tag.putString("dev/compactmods/machines/api/room", meta.roomCode()); tag.putUUID("owner", meta.owner()); }); @@ -53,6 +53,6 @@ public CompoundTag serializeNBT() { @Override public void deserializeNBT(CompoundTag nbt) { if(nbt.isEmpty()) return; - provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(nbt.getString("room"), nbt.getUUID("owner"))); + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(nbt.getString("dev/compactmods/machines/api/room"), nbt.getUUID("owner"))); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java index 1ba64e03..090be59c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.capability; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java index 164611e1..f6178713 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.client.gui.widget.PSDIconButton; import dev.compactmods.machines.client.level.RenderingLevel; import dev.compactmods.machines.client.render.RenderTypes; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java index 0771f74e..6008ea08 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.client; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.room.client.overlay.RoomMetadataDebugOverlay; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java index 1588089d..2500dca2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java @@ -1,12 +1,12 @@ package dev.compactmods.machines.room.client; -import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.Rooms; import net.minecraft.client.Minecraft; import net.minecraft.core.Registry; public class RoomClientHelper { public static Registry getTemplates() { - return Minecraft.getInstance().level.registryAccess().registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); + return Minecraft.getInstance().level.registryAccess().registryOrThrow(Rooms.TEMPLATE_REG_KEY); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java index ef2ed4e1..b6baa373 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java @@ -3,7 +3,7 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; -import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.CMTags; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import net.minecraft.world.item.ItemStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java index 15881c11..e2fb2c34 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -3,7 +3,7 @@ import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; @@ -30,6 +30,7 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.saveddata.SavedData; import net.minecraft.world.phys.Vec2; +import net.minecraftforge.server.ServerLifecycleHooks; import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; @@ -72,7 +73,7 @@ public static CompactRoomProvider empty() { @Nullable public static CompactRoomProvider instance() { try { - final ServerLevel level = CompactDimension.forCurrentServer(); + final ServerLevel level = CompactDimension.forServer(ServerLifecycleHooks.getCurrentServer()); return level.getDataStorage() .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); } catch (MissingDimensionException e) { @@ -142,7 +143,7 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { .stream() .map(CompoundTag.class::cast) .forEach(roomOwnerConn -> { - RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("room")); + RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("dev/compactmods/machines/api/room")); RoomOwnerNode owner = roomOwnerNodeMap.get(roomOwnerConn.getUUID("owner")); graph.graph.putEdgeValue(meta, owner, new RoomOwnerEdge()); }); @@ -196,7 +197,7 @@ public CompoundTag save(@Nonnull CompoundTag tag) { UUID roomId = metaNodeIdMap.get(roomNode.code()); UUID ownerId = ownerByUuidMap.get(roomOwner.owner()); CompoundTag connection = new CompoundTag(); - connection.putUUID("room", roomId); + connection.putUUID("dev/compactmods/machines/api/room", roomId); connection.putUUID("owner", ownerId); return connection; })) diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java index 6fe10508..425d847f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.room.Rooms; @@ -13,7 +13,7 @@ public record RoomOwnerNode(UUID owner) implements IGraphNode { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "room"); + private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/room"); public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( UUIDUtil.CODEC.fieldOf("owner").forGetter(RoomOwnerNode::owner), diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java b/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java index 86141107..df6157b0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java @@ -12,7 +12,7 @@ public record PlayerRoomHistoryItem(PreciseDimensionalPosition entry, LevelBlock public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( PreciseDimensionalPosition.CODEC.fieldOf("position").forGetter(PlayerRoomHistoryItem::entry), - LevelBlockPosition.CODEC.fieldOf("machine").forGetter(PlayerRoomHistoryItem::machine) + LevelBlockPosition.CODEC.fieldOf("dev/compactmods/machines/api/machine").forGetter(PlayerRoomHistoryItem::machine) ).apply(i, PlayerRoomHistoryItem::new)); @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java index 6cf8cc04..ec3f40a4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.room.menu; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.core.UIRegistration; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java index 298e75bd..0db0ab51 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.network; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.util.VersionUtil; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkDirection; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java b/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java index 2f59511a..9260c96c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.room.server; -import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.room.Rooms; import net.minecraft.core.Registry; import net.minecraftforge.server.ServerLifecycleHooks; @@ -9,6 +9,6 @@ public class RoomServerHelper { public static Registry getTemplates() { return ServerLifecycleHooks.getCurrentServer() .registryAccess() - .registryOrThrow(CMRegistries.TEMPLATE_REG_KEY); + .registryOrThrow(Rooms.TEMPLATE_REG_KEY); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index 4ad29f99..c3a3e537 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.shrinking; -import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; import dev.compactmods.machines.client.gui.PersonalShrinkingDeviceScreen; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index 2db5fcd3..d717b163 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java new file mode 100644 index 00000000..b1ddeedc --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.tunnel; + +import net.minecraft.resources.ResourceLocation; + +// TODO: Implementation + +/** + * A tunnel network helps to abstract storage and implementation details for both + * tunnels and upgrades, away from individual blocks and systems. + * For example, a pump upgrade for a machine may require insertion of fluids + * into a room's fluid storage. + */ +public class TunnelNetwork { + + public static TunnelNetwork forRoomAndType(String room, ResourceLocation networkType) { + return null; + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index 84752ebe..7716d446 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index c93551ae..b7f55c9a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -35,7 +35,7 @@ public class TunnelWallEntity extends BlockEntity { - private static final String NBT_LEGACY_MACHINE_KEY = "machine"; + private static final String NBT_LEGACY_MACHINE_KEY = "dev/compactmods/machines/api/machine"; private LevelBlockPosition connectedMachine; private TunnelDefinition tunnelType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index ee0ed186..d1268e48 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -22,7 +22,7 @@ import java.util.function.Supplier; -import static dev.compactmods.machines.api.core.Constants.MOD_ID; +import static dev.compactmods.machines.api.Constants.MOD_ID; public class Tunnels { diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java index df858583..ed861cd1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java index b301ec01..7b0b8f60 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.machine.graph.CompactMachineNode; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java index 7a857752..d6fdaca3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java index 7d3ba372..3ba4f2c9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java index c4c6afe3..9f67a667 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java @@ -2,9 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java index 3cbe1bb4..58f8b40e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java @@ -3,7 +3,14 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.upgrade.workbench.RoomUpgradeWorkbench; +import dev.compactmods.machines.upgrade.workbench.RoomUpgradeWorkbenchEntity; +import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.material.Material; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryBuilder; import net.minecraftforge.registries.RegistryObject; @@ -21,6 +28,18 @@ public class MachineRoomUpgrades { .tab(CompactMachines.COMPACT_MACHINES_ITEMS) .stacksTo(1))); + public static final RegistryObject WORKBENCH_BLOCK = Registries.BLOCKS.register("workbench", () -> + new RoomUpgradeWorkbench(BlockBehaviour.Properties.of(Material.METAL) + .requiresCorrectToolForDrops() + .lightLevel(state -> 3))); + + public static final RegistryObject WORKBENCH_ITEM = Registries.ITEMS.register("workbench", () -> + new BlockItem(WORKBENCH_BLOCK.get(), new Item.Properties().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); + + public static final RegistryObject> ROOM_UPDATE_ENTITY = Registries.BLOCK_ENTITIES.register( + "workbench", () -> BlockEntityType.Builder.of(RoomUpgradeWorkbenchEntity::new, WORKBENCH_BLOCK.get()) + .build(null)); + public static void prepare() { } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java index 73a3fb59..b00f7612 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.upgrade; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java index 46a829bd..f09a4ee9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java @@ -4,7 +4,7 @@ import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.room.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java index dadfd665..c12034dc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; @@ -21,7 +21,7 @@ public class CMRoomUpgradeCommand { .requires(cs -> cs.hasPermission(ServerConfig.changeUpgrades())); final var addRoot = Commands.literal("add"); - final var addUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) + final var addUpgRoot = Commands.argument("dev/compactmods/machines/api/upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) .executes(CMRoomUpgradeCommand::addToCurrentRoom); @@ -31,7 +31,7 @@ public class CMRoomUpgradeCommand { root.then(addRoot); final var remRoot = Commands.literal("remove"); - final var remUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) + final var remUpgRoot = Commands.argument("dev/compactmods/machines/api/upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) .executes(CMRoomUpgradeCommand::removeFromCurrentRoom); @@ -51,7 +51,7 @@ private static int addToCurrentRoom(CommandContext ctx) thro if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; - final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); + final var upg = RoomUpgradeArgument.getUpgrade(ctx, "dev/compactmods/machines/api/upgrade"); if (upg.isEmpty()) return -1; @@ -99,7 +99,7 @@ private static int removeFromCurrentRoom(CommandContext ctx) if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; - final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); + final var upg = RoomUpgradeArgument.getUpgrade(ctx, "dev/compactmods/machines/api/upgrade"); if (upg.isEmpty()) return -1; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java index f45924c0..9420d4bf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java @@ -4,8 +4,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; @@ -30,7 +30,7 @@ private RoomUpgradeArgument() { public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { final var UPGRADES = MachineRoomUpgrades.REGISTRY.get(); - ResourceKey resourcekey = getRegistryType(stack, argName, CMRegistries.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); + ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); return Optional.ofNullable(UPGRADES.getValue(resourcekey.location())); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java index 16fe89fe..0bee41bb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java @@ -10,7 +10,7 @@ public record RoomUpgradeGraphNode(ResourceLocation key) implements IGraphNode { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("upgrade").forGetter(RoomUpgradeGraphNode::key) + ResourceLocation.CODEC.fieldOf("dev/compactmods/machines/api/upgrade").forGetter(RoomUpgradeGraphNode::key) ).apply(i, RoomUpgradeGraphNode::new)); @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java index f2d19467..8303a8f8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java @@ -10,11 +10,11 @@ public record UpgradeConnectionEntry(String room, Resourc public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING - .fieldOf("room") + .fieldOf("dev/compactmods/machines/api/room") .forGetter(UpgradeConnectionEntry::room), ResourceKey.codec(RoomUpgrade.REG_KEY) - .fieldOf("upgrade") + .fieldOf("dev/compactmods/machines/api/upgrade") .forGetter(UpgradeConnectionEntry::upgradeKey), MachineRoomUpgrades.REGISTRY.get().getCodec() diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java new file mode 100644 index 00000000..b77b4e02 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java @@ -0,0 +1,21 @@ +package dev.compactmods.machines.upgrade.workbench; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +import javax.annotation.Nullable; + +public class RoomUpgradeWorkbench extends Block implements EntityBlock { + public RoomUpgradeWorkbench(Properties props) { + super(props); + } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { + return new RoomUpgradeWorkbenchEntity(pPos, pState); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java new file mode 100644 index 00000000..39478c68 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java @@ -0,0 +1,23 @@ +package dev.compactmods.machines.upgrade.workbench; + +import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +public class RoomUpgradeWorkbenchEntity extends BlockEntity { + public RoomUpgradeWorkbenchEntity(BlockPos pPos, BlockState pBlockState) { + super(MachineRoomUpgrades.ROOM_UPDATE_ENTITY.get(), pPos, pBlockState); + } + + @Override + protected void saveAdditional(CompoundTag tag) { + super.saveAdditional(tag); + } + + @Override + public void load(CompoundTag tag) { + super.load(tag); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index 96bab5c1..5f4adcae 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -2,7 +2,7 @@ import com.mojang.authlib.GameProfile; import dev.compactmods.machines.advancement.AdvancementTriggers; -import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.Messages; import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.SimpleTeleporter; diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java new file mode 100644 index 00000000..6cc25c57 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java @@ -0,0 +1,20 @@ +package dev.compactmods.machines.villager; + +import dev.compactmods.machines.api.Constants; +import net.minecraftforge.event.village.VillagerTradesEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID) +public class VillagerTradesEventHandler { + + @SubscribeEvent + public static void onVillagerTrades(final VillagerTradesEvent trades) { + final var tinkerer = Villagers.TINKERER.get(); + if(!trades.getType().equals(tinkerer)) + return; + + final var tradeList = trades.getTrades(); + tradeList.get(1).add(Villagers.TEST_TRADE.get()); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java new file mode 100644 index 00000000..e67751cf --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.villager; + +public class VillagerUpgradeTrade { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java new file mode 100644 index 00000000..039d0267 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java @@ -0,0 +1,60 @@ +package dev.compactmods.machines.villager; + +import com.google.common.collect.ImmutableSet; +import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.entity.ai.village.poi.PoiType; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.BasicItemListing; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.RegistryBuilder; +import net.minecraftforge.registries.RegistryObject; + +import java.util.function.Supplier; + +public class Villagers { + public static final ResourceLocation TINKERER_ID = new ResourceLocation(Constants.MOD_ID, "tinkerer"); + + public static final ResourceKey TINKERER_WORKBENCH_KEY = ResourceKey + .create(ForgeRegistries.POI_TYPES.getRegistryKey(), TINKERER_ID); + + public static final RegistryObject TINKERER = Registries.VILLAGERS.register("tinkerer", + () -> new VillagerProfession( + TINKERER_ID.toString(), + holder -> holder.is(TINKERER_WORKBENCH_KEY), //jobSite + holder -> holder.is(TINKERER_WORKBENCH_KEY), //acquirable jobSite + ImmutableSet.of(), + ImmutableSet.of(), + SoundEvents.VILLAGER_WORK_TOOLSMITH + )); + + public static final DeferredRegister TRADES = DeferredRegister.create( + new ResourceLocation(Constants.MOD_ID, "tinkerer_trades"), + Constants.MOD_ID + ); + + public static final Supplier> TRADES_REG = TRADES + .makeRegistry(RegistryBuilder::new); + + public static final RegistryObject TEST_TRADE = TRADES.register("test", + () -> new BasicItemListing(1, new ItemStack(Machines.MACHINE_BLOCK_ITEM_TINY.get()), 5, 100)); + + static { + Registries.POINTS_OF_INTEREST.register("tinkerer", () -> new PoiType( + ImmutableSet.of(MachineRoomUpgrades.WORKBENCH_BLOCK.get().defaultBlockState()), 1, 1) + ); + } + + public static void prepare() { + + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java b/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java index 2ca5e4e2..03b0e986 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java +++ b/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.wall; -import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.Tooltips; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; diff --git a/forge-main/src/main/resources/assets/compactmachines/textures/block/workbench/sides.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/workbench/sides.png new file mode 100644 index 0000000000000000000000000000000000000000..7f276fcbb148d48790a97af48a1aa7522e08971b GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WY&=~YLp(a)o^|A9FyJ|SAV+Ke z2kma7H~BnDZxfk6%zYQOX_ATY!rgDBqxJ)pLqQ#**QB>H8+IOH{r@m2dKyU7)78&q Iol`;+0A2?qeEpPPiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?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X?dSwK2kT zxZKJLVsLOU#Ctg^5TRRG6+wIpm6+Mgb4wo#w@~5+4TFP`!LVRVFd!HW3P$`rNH9~<<9h3%jK~Yc~VOM8!}exhgS#c?E>;F@OMk*i;s*iMh3E%HKWQjvXB@^FKZu4P2<4 zRWJ!yGVF)N-#m(Y=b8=>0m((5_Fv^|_7rmX!P^ulij`?{+MvW^971Jk+MWL{YGZb( z`4+v~y`NuKiJ`#1%fE%3?>LorEp2jf4=bkd()(ThPGT{wvmW)m z5!GEa^UwS9gxi)_%YJ!07kpsPV1bTtff{jB;=L0Ixvgs7TGoyZopZaAQ)2ptMkD66Nt-w@@M{83qtFlH6eK@xABGsFJ=}pkYYRk=gEn`Wnaj0Eux!x0KBO7a2X4 z-$F5|{3Vm_)20)eJ;hhP+-o|sJgj(_uP({=s>niKA;4Vz&Z{gChIxIJ=O)-fCOE`P ztlO#gEDot&OBUbpVT^9&U2IoyCobCaB)2RtvNMEwo=scyd#v%r(U&bW+>)+(w zt@UfGB0E=j4J}pdGN;@;Fa0%iD15NeIV)ph$ZKD@l!~EGDmj`d-S@>jDo6O8c&IL4 z>u0a@-}_w9O6wlDJzM-Ec=SQWTh}-b`r)w?Nt@(zjLetEH13m(zc+t2XzGhhMNpqj zQRm0Pq?7Zv3R7-=-S+lf+iakJV8E!aj&3$q%DdHeUz542z|lQ1Q3 z_l3%zoY+-h6EPQToGMDt0j+zoviK#xeA1h_US%%VkleQWO(?vsvC*f zx}O&OdlPIEO;e_}7_={^TQ_{Hxtz59B{Agj n<4rw1J(b%fWlieD5ZXTcPDL7L_V#|~M3V9JmK$K0WGFR$ literal 0 HcmV?d00001 diff --git a/forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer.png b/forge-main/src/main/resources/assets/compactmachines/textures/entity/villager/profession/tinkerer.png new file mode 100644 index 0000000000000000000000000000000000000000..7c89c99dae224044da3b95e43320530fc3791ad7 GIT binary patch literal 3948 zcmV-y50mhTP)uJ@VVD_U zC<6{NG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)wS@G{-RgA^nR#08J?dz4c2`+bOhqu=je z+fRi-brTqdv9Ynx=cxTeUWNDPMD_v064WP1I8`C)$575yx&5%v$;n9oK)c-zZOGfr z&(BNcySuyIy(omZEO<_!hC&@;KXG|6#!~SEo&^L6cvT3pZCmRwP1E$XRoAg@Y|}KQ z5Gb}y%?Bh&*d)a_DkefY#|p@yG%YfDgfZq_uhitKEoHkGynkm`}+U@ zUjOksHH=M8;PdZ)^Xj#Gfjl!dIdQEzPVN;Dm;b#2?Dkn`eP;e25JcFSpWQywnmP9c z8(+yj;mL>Z1Ar^~gj`!dlr=7*vj)1nysSM1u2!qq+S<}aiM6#gH|&o}r>CdBGQ%(c z0QGu3(a3X^iHqnIMu3Y6^Q&Agqg*b7F^2W^b)WfdY;3qZE{py61pqTMGpJN5Qa`SM zq={<Nk~4?si`Rdz(3EQ;MvYazOb?Y_q8`S004V?d)gl`3&*xResr^1%d@enI^6hNAnWh8@6FBPOhB$^{7~Y$I z@YuzJ$JzcD996w@RBx?o7uHu)OqK}D1cTmw(1FJ6>?~TXmQ?ojN0$yi7YY#H;IJON z)oMvX@-<(nRQ?Nz{*&G;P`K**deS6)rWco7?*)>8R;yKQJm)(obw9AWy6OU#J1&)C zv52|3IoP(1qoX5VeWTHcKkEcZB@b{MCvphAX%f!^IJRx4wgF0#z&s#mE4;b6SpWca z8!d8pc$f>}fq*<9%AUPmuS+{gE-(*+>KN*-bHs=dnc!bY=0%AxXOmk10000 = listOf( + project(":forge-api") +) + +runDepends.forEach { + project.evaluationDependsOn(it.path) +} dependencies { minecraft (group = "net.minecraftforge", name = "forge", version = "${minecraft_version}-${forge_version}") - - compileOnly(project(":forge-api")) + runDepends.forEach { + compileOnly(it) + } } minecraft { - mappings("parchment", parchment_version) + mappings("parchment", "${parchment_version}-${minecraft_version}") accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) -} - -tasks.jar { - finalizedBy("reobfJar") } \ No newline at end of file diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java index ed9b374e..f6904cec 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java @@ -2,8 +2,8 @@ import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.core.CMRegistries; -import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.CMRegistries; +import dev.compactmods.machines.api.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.api.tunnels.TunnelDefinition; @@ -11,7 +11,7 @@ import dev.compactmods.machines.tunnel.definitions.FluidTunnel; import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; -import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; @@ -36,7 +36,8 @@ public class BuiltinTunnels implements ICompactMachinesAddon { public static final RegistryObject REDSTONE_IN = DR.register("redstone_in", RedstoneInTunnelDefinition::new); @Override - public void afterRegistration(IEventBus bus) { + public void afterRegistration() { + var bus = FMLJavaModLoadingContext.get().getModEventBus(); DR.register(bus); } diff --git a/gradle.properties b/gradle.properties index 525ba4ac..c741a4a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,9 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false minecraft_version=1.19.2 +loom_version = 1.0-SNAPSHOT forge_version=43.1.15 -parchment_version=2022.08.10-1.19.2 +parchment_version=2022.10.16 mod_id=compactmachines diff --git a/settings.gradle.kts b/settings.gradle.kts index d2271f38..8efc0336 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,9 +2,15 @@ pluginManagement { repositories { mavenCentral() mavenLocal() - maven("https://repo.spongepowered.org/repository/maven-public") maven("https://maven.minecraftforge.net") - maven("https://maven.parchmentmc.org") + + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } + + maven("https://maven.fabricmc.net") { + name = "Fabric" + } } resolutionStrategy { @@ -14,7 +20,12 @@ pluginManagement { } } } + + plugins { + id("fabric-loom").version(settings.extra["loom_version"] as String) + } } rootProject.name = "Compact Machines" +include("common-api") include("forge-api", "forge-main", "forge-tunnels") \ No newline at end of file From 5234652b6b817cab1c9bcb82b830508f2f26cc29 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 31 Oct 2022 07:49:20 -0400 Subject: [PATCH 31/85] Fix a couple of deprecation warnings, set CI publish to all libs --- .github/workflows/ci-tests-nightly.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 3b49078a..e3514497 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -48,14 +48,14 @@ jobs: id: version run: | version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) - echo "::set-output name=version::$version" + echo "version=$version" >> $GITHUB_OUTPUT - name: Build Version id: build run: | buildver=$(git describe --tags --match v* | cut -d- -f2) echo "build = $buildver" - echo "::set-output name=buildver::$buildver" + echo "buildver=$buildver" >> $GITHUB_OUTPUT tests: name: Gradle Tests runs-on: ubuntu-20.04 @@ -146,7 +146,7 @@ jobs: CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - name: Publish gradle nightly jar - run: ./gradlew publishAllForgePublicationToGitHubPackagesRepository + run: ./gradlew publishAllLibsPublicationToGitHubPackagesRepository env: CM_RELEASE: false CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} From a5761e79dd53da5330754b0f7403cbeac26b7066 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 31 Oct 2022 08:02:13 -0400 Subject: [PATCH 32/85] Packages pls --- .github/workflows/ci-tests-nightly.yml | 17 ++++------------- forge-main/build.gradle.kts | 3 +++ .../compactmods/machines/CompactMachines.java | 2 +- .../compactmods/machines/ModDataUpgrader.java | 2 +- .../advancement/AdvancementTriggers.java | 2 +- .../trigger/HowDidYouGetHereTrigger.java | 2 +- .../machines/client/ClientEventHandler.java | 2 +- .../compactmods/machines/client/Resources.java | 2 +- .../gui/PersonalShrinkingDeviceScreen.java | 2 +- .../machines/client/gui/guide/GuidePage.java | 2 +- .../machines/client/render/RenderTypes.java | 2 +- .../machines/client/shader/CM4Shaders.java | 2 +- .../compactmods/machines/command/Commands.java | 2 +- .../data/CMMachineDataExportCommand.java | 4 ++-- .../command/data/CMRoomDataExportCommand.java | 4 ++-- .../command/data/CMTunnelDataExportCommand.java | 4 ++-- .../subcommand/CMGiveMachineSubcommand.java | 4 ++-- .../subcommand/CMReaddDimensionSubcommand.java | 2 +- .../command/subcommand/CMRebindSubcommand.java | 2 +- .../command/subcommand/CMRoomsSubcommand.java | 4 ++-- .../command/subcommand/CMSummarySubcommand.java | 2 +- .../command/subcommand/CMUnbindSubcommand.java | 2 +- .../command/subcommand/SpawnSubcommand.java | 4 ++-- .../machines/compat/InterModCompat.java | 2 +- .../machines/compat/curios/CuriosCompat.java | 2 +- .../compat/jei/CompactMachinesJeiPlugin.java | 4 ++-- .../theoneprobe/elements/PlayerFaceElement.java | 2 +- .../overrides/CompactMachineNameOverride.java | 2 +- .../providers/CompactMachineProvider.java | 6 +++--- .../theoneprobe/providers/TunnelProvider.java | 2 +- .../machines/config/CommonConfig.java | 2 +- .../EnableVanillaRecipesConfigCondition.java | 2 +- .../machines/core/CommonEventHandler.java | 2 +- .../machines/core/CompactMachinesNet.java | 2 +- .../compactmods/machines/core/ModBusEvents.java | 2 +- .../compactmods/machines/core/Registries.java | 6 +++--- .../machines/core/ServerEventHandler.java | 2 +- .../data/generated/AdvancementGenerator.java | 4 ++-- .../machines/data/generated/DataGenUtil.java | 2 +- .../machines/data/generated/DataGeneration.java | 2 +- .../data/generated/ItemModelGenerator.java | 2 +- .../data/generated/LevelBiomeGenerator.java | 2 +- .../data/generated/RecipeGenerator.java | 2 +- .../machines/data/generated/StateGenerator.java | 2 +- .../generated/TunnelWallStateGenerator.java | 2 +- .../data/generated/lang/BaseLangGenerator.java | 4 ++-- .../generated/lang/EnglishLangGenerator.java | 8 ++++---- .../generated/lang/RussianLangGenerator.java | 6 +++--- .../data/generated/room/RoomTemplates.java | 2 +- .../data/generated/tags/BlockTagGenerator.java | 4 ++-- .../data/generated/tags/ItemTagGenerator.java | 4 ++-- .../tags/PointOfInterestTagGenerator.java | 2 +- .../data/migration/Pre520RoomDataMigrator.java | 2 +- .../machines/dimension/Dimension.java | 2 +- .../machines/dimension/VoidAirBlock.java | 2 +- .../machines/machine/LegacySizedTemplates.java | 2 +- .../block/LegacySizedCompactMachineBlock.java | 6 +++--- .../machine/block/MachineBlockUtil.java | 2 +- .../machines/machine/client/MachineColors.java | 2 +- .../machine/graph/CompactMachineNode.java | 2 +- .../machine/item/BoundCompactMachineItem.java | 2 +- .../machine/item/LegacyCompactMachineItem.java | 2 +- .../machine/item/UnboundCompactMachineItem.java | 2 +- .../machines/room/RoomEventHandler.java | 4 ++-- .../room/capability/RoomCapEventHandler.java | 2 +- .../machines/room/client/MachineRoomScreen.java | 2 +- .../room/client/RoomClientEventHandler.java | 2 +- .../room/data/CopyRoomBindingFunction.java | 2 +- .../room/graph/CompactRoomProvider.java | 2 +- .../machines/room/graph/RoomOwnerNode.java | 2 +- .../machines/room/menu/MachineRoomMenu.java | 2 +- .../room/network/RoomNetworkHandler.java | 2 +- .../shrinking/PersonalShrinkingDevice.java | 4 ++-- .../compactmods/machines/tunnel/TunnelItem.java | 6 +++--- .../machines/tunnel/TunnelWallBlock.java | 2 +- .../compactmods/machines/tunnel/Tunnels.java | 2 +- .../tunnel/graph/TunnelMachineEdge.java | 2 +- .../machines/tunnel/graph/TunnelNode.java | 2 +- .../machines/tunnel/graph/TunnelTypeEdge.java | 2 +- .../machines/tunnel/graph/TunnelTypeNode.java | 2 +- .../machines/upgrade/ChunkloadUpgrade.java | 2 +- .../machines/upgrade/RoomUpgradeItem.java | 2 +- .../machines/upgrade/RoomUpgradeManager.java | 2 +- .../upgrade/command/CMRoomUpgradeCommand.java | 4 ++-- .../upgrade/command/RoomUpgradeArgument.java | 2 +- .../compactmods/machines/util/PlayerUtil.java | 2 +- .../villager/VillagerTradesEventHandler.java | 2 +- .../machines/villager/Villagers.java | 2 +- .../machines/wall/ItemBlockWall.java | 2 +- .../machines/test/GameTestEventHandler.java | 2 +- .../compactmods/machines/test/MathTests.java | 2 +- .../compactmods/machines/test/ServerEvents.java | 2 +- .../test/core/CompactMachinesTests.java | 2 +- .../machines/test/data/CodecTests.java | 2 +- .../test/migrators/EarlyFileLoaderTests.java | 2 +- .../migrators/RoomInfoPre520MigratorTests.java | 2 +- .../machines/test/worldgen/DimensionTests.java | 2 +- .../test/worldgen/RoomGenerationTests.java | 2 +- forge-tunnels/build.gradle.kts | 1 + .../machines/tunnel/BuiltinTunnels.java | 4 ++-- 100 files changed, 133 insertions(+), 138 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index e3514497..f8ede426 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -29,13 +29,10 @@ jobs: run: git fetch --prune --unshallow - name: Find Current Tag - id: current - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: '*-rc*' - commit-ish: '@' - skip-unshallow: 'true' + id: version + run: | + gv=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-rc*' '@') + echo "version=$gv" >> $GITHUB_OUTPUT - name: Release Type id: cf_release_type @@ -44,12 +41,6 @@ jobs: path: './gradle.properties' property: 'cf_release_type' - - name: Semver Version - id: version - run: | - version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) - echo "version=$version" >> $GITHUB_OUTPUT - - name: Build Version id: build run: | diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 5fca8429..34dd5331 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -80,6 +80,9 @@ jarJar.enable() dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + implementation(project(":common-api")) + testImplementation(project(":common-api")) + implementation(project(":forge-api")) testImplementation(project(":forge-api")) diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index 3ac802c5..d5ea103c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -2,7 +2,7 @@ import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; diff --git a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java index b0deebff..5a67ecdf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java @@ -1,6 +1,6 @@ package dev.compactmods.machines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java index e306d6d6..1384fa36 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.Advancements; +import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.room.RoomSize; import net.minecraft.advancements.CriteriaTriggers; diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java index 7a47fe2a..6407bcf7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java +++ b/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.advancement.trigger; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.Advancements; +import dev.compactmods.machines.api.core.Advancements; import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance; import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.DeserializationContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java index 612c765a..03a12d8b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.client; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.core.UIRegistration; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java b/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java index 0bbcccd2..149d77d9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.client; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraft.resources.ResourceLocation; public class Resources { diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java index fab0c8fb..d54120ff 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java @@ -2,7 +2,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.client.gui.guide.GuideSection; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java index bfe89203..16819d5b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.client.gui.guide; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.client.gui.widget.AbstractCMGuiWidget; import dev.compactmods.machines.client.gui.widget.ScrollableWrappedTextWidget; import net.minecraft.ChatFormatting; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java index 4414feb9..ead7c6a7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormatElement; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.client.shader.CM4Shaders; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java b/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java index 1c84ce52..00d48510 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java @@ -10,7 +10,7 @@ import java.io.IOException; -import static dev.compactmods.machines.api.Constants.MOD_ID; +import static dev.compactmods.machines.api.core.Constants.MOD_ID; @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class CM4Shaders diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java index e83021a5..80b497a3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.command; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.command.data.CMDataSubcommand; import dev.compactmods.machines.command.subcommand.CMEjectSubcommand; import dev.compactmods.machines.command.subcommand.CMGiveMachineSubcommand; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index 429e99f0..797c135d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java index 9ffb21c3..986598da 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java index 3e02be27..d4a9c93d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java @@ -5,8 +5,8 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java index 10b2a59a..a664afa0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java @@ -5,8 +5,8 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java index 29595a6c..2e41b7c2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java @@ -3,7 +3,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.util.DimensionUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java index 53b233eb..b2eeecb1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java @@ -5,7 +5,7 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java index 9b0518b0..c39a42d1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.machine.MachineTags; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java index 153e4fc4..8b7baddf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java @@ -2,7 +2,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java index 90833c75..7206cf51 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java @@ -4,7 +4,7 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java index 6c380b1c..1a9a4248 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.config.ServerConfig; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java index 858a4a4f..1881fc08 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.compat.carryon.CarryOnCompat; import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.compat.theoneprobe.TheOneProbeCompat; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java b/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java index b0e7e834..d4d1dbe3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.curios; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java index 3143618a..6f1af433 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.compat.jei; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.JeiInfo; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.JeiInfo; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java index 0768d920..5602a27d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java @@ -2,7 +2,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.client.PlayerFaceRenderer; import mcjty.theoneprobe.api.IElement; import net.minecraft.network.FriendlyByteBuf; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java index 36fc88a8..27c308be 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.theoneprobe.overrides; -import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java index 37c8ba51..74257e1c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.compat.theoneprobe.providers; -import dev.compactmods.machines.api.CMTags; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java index 56f781e8..e05442de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.compat.theoneprobe.providers; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.tunnel.TunnelWallBlock; import dev.compactmods.machines.tunnel.TunnelWallEntity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java index c8178f18..630ed26e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.config; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java index 4298eab3..6e922b7c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.config; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.crafting.conditions.IConditionSerializer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java index 37631724..1ed5d81f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.wall.ProtectedWallBlock; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java index 0d453201..bec2b7d6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/CompactMachinesNet.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.room.network.PlayerRequestedTeleportPacket; import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java index bcf5216a..e249f4ff 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java @@ -2,7 +2,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.AdvancementTriggers; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.room.network.RoomNetworkHandler; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java index 222650e3..6a157367 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.core; -import dev.compactmods.machines.api.CMRegistries; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; @@ -23,7 +23,7 @@ import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; -import static dev.compactmods.machines.api.Constants.MOD_ID; +import static dev.compactmods.machines.api.core.Constants.MOD_ID; public class Registries { diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java index ebd3f2fa..b3b53cca 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.core; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java index 546dc38d..0387ce45 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java @@ -6,8 +6,8 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.Advancements; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java index 3f606952..1dd0f4e3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java @@ -6,7 +6,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java index cd761171..5fa2c155 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.data.generated.lang.EnglishLangGenerator; import dev.compactmods.machines.data.generated.lang.RussianLangGenerator; import dev.compactmods.machines.data.generated.room.RoomTemplates; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java index e07f98dc..73bafcf0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java index cef5a767..8af5c1a8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java @@ -8,7 +8,7 @@ import com.google.gson.JsonObject; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.dimension.Dimension; import net.minecraft.core.Holder; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java index 1f7e4b47..4550efdd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated; import com.google.gson.JsonObject; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.recipe.ShapedWithNbtRecipeBuilder; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java index d19cca20..7c0fff0b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java index 36353478..e24262ef 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.tunnel.TunnelWallBlock; import dev.compactmods.machines.tunnel.Tunnels; import net.minecraft.core.Direction; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java index 063f7258..a4f3117c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.Advancements; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Advancements; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java index 28f08e2b..906c9448 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Messages; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.dimension.VoidAirBlock; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java index a166aabb..3c2a67fa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.data.generated.lang; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Messages; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java index 370acf1c..44a21543 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated.room; import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.machine.LegacySizedTemplates; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java index 0e9af387..19bcd65e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated.tags; -import dev.compactmods.machines.api.CMTags; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.wall.Walls; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java index 3630cd42..652475a9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.data.generated.tags; -import dev.compactmods.machines.api.CMTags; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java index bd034511..2b24308f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.data.generated.tags; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.villager.Villagers; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.PoiTypeTagsProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java index 1561f460..6f6ecf4c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.codec.CodecExtensions; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java index 6d1b9bd7..8f915e9a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.dimension.DimensionType; import net.minecraftforge.registries.RegistryObject; -import static dev.compactmods.machines.api.Constants.MOD_ID; +import static dev.compactmods.machines.api.core.Constants.MOD_ID; public class Dimension { diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java index 5156da3d..26cfc4b0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; -import static dev.compactmods.machines.api.Constants.MOD_ID; +import static dev.compactmods.machines.api.core.Constants.MOD_ID; public class VoidAirBlock extends AirBlock { diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java index 03a652b3..ff32e038 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FastColor; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index 028c9e3e..146407f7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMTags; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomSize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index 09488fdd..588efbe2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java index 9f298591..fd577fd9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.client; -import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.machine.item.CompactMachineItem; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import net.minecraft.client.color.block.BlockColor; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java index 49219586..06bfd1fa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java index 3454999e..dcc705b7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java index 5fa97cf1..aa5d82cd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java index 94846a0d..717366c9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.machine.item; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java index 36c7a2d4..765cc535 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.room; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.core.CompactMachinesNet; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java index 090be59c..1ba64e03 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.capability; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java index f6178713..164611e1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.client.gui.widget.PSDIconButton; import dev.compactmods.machines.client.level.RenderingLevel; import dev.compactmods.machines.client.render.RenderTypes; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java index 6008ea08..0771f74e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.client; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.room.client.overlay.RoomMetadataDebugOverlay; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java index b6baa373..ef2ed4e1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java @@ -3,7 +3,7 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; -import dev.compactmods.machines.api.CMTags; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import net.minecraft.world.item.ItemStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java index e2fb2c34..0cb98581 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -3,7 +3,7 @@ import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java index 425d847f..6b776d43 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.room.Rooms; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java index ec3f40a4..6cf8cc04 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.room.menu; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.core.UIRegistration; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java index 0db0ab51..298e75bd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/network/RoomNetworkHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.network; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.util.VersionUtil; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkDirection; diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index c3a3e537..4ad29f99 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.shrinking; -import dev.compactmods.machines.api.Messages; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; import dev.compactmods.machines.client.gui.PersonalShrinkingDeviceScreen; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index d717b163..2db5fcd3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -1,9 +1,9 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; -import dev.compactmods.machines.api.Messages; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index 7716d446..84752ebe 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index d1268e48..ee0ed186 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -22,7 +22,7 @@ import java.util.function.Supplier; -import static dev.compactmods.machines.api.Constants.MOD_ID; +import static dev.compactmods.machines.api.core.Constants.MOD_ID; public class Tunnels { diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java index ed861cd1..df858583 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java index 7b0b8f60..b301ec01 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.machine.graph.CompactMachineNode; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java index d6fdaca3..7a857752 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java index 3ba4f2c9..7d3ba372 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java index 9f67a667..52de0bef 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java index b00f7612..73a3fb59 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.upgrade; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java index f09a4ee9..46a829bd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java @@ -4,7 +4,7 @@ import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.room.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java index c12034dc..cfff446b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java @@ -3,8 +3,8 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.api.CMCommands; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java index 9420d4bf..36fc1e21 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java @@ -4,7 +4,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; -import dev.compactmods.machines.api.CMCommands; +import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index 5f4adcae..96bab5c1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -2,7 +2,7 @@ import com.mojang.authlib.GameProfile; import dev.compactmods.machines.advancement.AdvancementTriggers; -import dev.compactmods.machines.api.Messages; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.SimpleTeleporter; diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java index 6cc25c57..dde33f82 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.villager; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.event.village.VillagerTradesEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java index 039d0267..55029c8a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.villager; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.core.Registries; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java b/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java index 03b0e986..2ca5e4e2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java +++ b/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.wall; -import dev.compactmods.machines.api.Tooltips; +import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java b/forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java index 4f906e43..c5fdb3df 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/GameTestEventHandler.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.event.RegisterGameTestsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java index e114aa86..f031bc0f 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/MathTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.util.MathUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java b/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java index a62c5099..7abb243d 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.util.DimensionUtil; import net.minecraft.server.MinecraftServer; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java index e740af4d..1b93f65a 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.core; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestHelper; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java index 1b9c4e12..81ae806a 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/data/CodecTests.java @@ -2,7 +2,7 @@ import com.mojang.serialization.DataResult; import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java index 25ca362a..f8fff669 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.migrators; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.FileHelper; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java index 4e469362..e49fe83c 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.migrators; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.FileHelper; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java index 1654c406..570a2992 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/DimensionTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.worldgen; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java index 0b5a6a6a..ec58a3db 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.worldgen; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.util.CompactStructureGenerator; diff --git a/forge-tunnels/build.gradle.kts b/forge-tunnels/build.gradle.kts index c55e638e..7f452978 100644 --- a/forge-tunnels/build.gradle.kts +++ b/forge-tunnels/build.gradle.kts @@ -13,6 +13,7 @@ var forge_version: String by extra var parchment_version: String by extra val runDepends: List = listOf( + project(":common-api"), project(":forge-api") ) diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java index f6904cec..7345bd2f 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java @@ -2,8 +2,8 @@ import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.CMRegistries; -import dev.compactmods.machines.api.Constants; +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.api.tunnels.TunnelDefinition; From a809a20c44072096905d59ec7f81e62a6bf37e41 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 31 Oct 2022 08:20:43 -0400 Subject: [PATCH 33/85] Fix tunnel resource datagen, tweak nightly CI variable output --- .github/workflows/ci-tests-nightly.yml | 4 +--- .../machines/api/recipe/ShapedWithNbtRecipeBuilder.java | 2 +- forge-main/build.gradle.kts | 2 +- .../machines/data/generated/TunnelWallStateGenerator.java | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index f8ede426..3f8b36ad 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -30,9 +30,7 @@ jobs: - name: Find Current Tag id: version - run: | - gv=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-rc*' '@') - echo "version=$gv" >> $GITHUB_OUTPUT + run: echo "version=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-rc*' '@')" >> $GITHUB_OUTPUT - name: Release Type id: cf_release_type diff --git a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java index 8d3928c6..1f750ba0 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java @@ -139,7 +139,7 @@ public Result(ShapedWithNbtRecipeBuilder builder, ResourceLocation pId, Resource @Override public void serializeRecipeData(JsonObject json) { - if (!this.group.isEmpty()) { + if (this.group != null && !this.group.isEmpty()) { json.addProperty("group", this.group); } diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 34dd5331..1add72bf 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -208,7 +208,7 @@ minecraft { forceExit(false) args("--mod", mod_id) - args("--existing", file("src/main/resources")) + args("--existing", project.file("src/main/resources")) args("--all") args("--output", file("src/generated/resources/")) } diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java index e24262ef..24864561 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java @@ -27,9 +27,9 @@ protected void registerStatesAndModels() { for (Direction dir : Direction.values()) { - String typedTunnelDirectional = "dev/compactmods/machines/api/tunnels/" + dir.getSerializedName(); + String typedTunnelDirectional = "tunnels/" + dir.getSerializedName(); models() - .withExistingParent(typedTunnelDirectional, modLoc("dev/compactmods/machines/api/tunnels/base")) + .withExistingParent(typedTunnelDirectional, modLoc("tunnels/base")) .texture("wall", modLoc("block/" + typedTunnelDirectional)) .renderType(mcLoc("cutout")); // NamedRenderTypeManager @@ -54,7 +54,7 @@ protected void registerStatesAndModels() { private void generateTunnelBaseModel() { BlockModelBuilder base = models() - .withExistingParent("dev/compactmods/machines/api/tunnels/base", new ResourceLocation("minecraft", "block/block")) + .withExistingParent("tunnels/base", new ResourceLocation("minecraft", "block/block")) .texture("tunnel", modLoc("block/tunnels/tunnel")) .texture("indicator", modLoc("block/tunnels/indicator")); From 0995d94654987beff3523a4137a4c21e85e1a970 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 31 Oct 2022 08:46:47 -0400 Subject: [PATCH 34/85] Fix another deprecation and api rename issue --- .github/workflows/ci-tests-nightly.yml | 2 +- .../machines/data/generated/LevelBiomeGenerator.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 3f8b36ad..5d6dcb88 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -34,7 +34,7 @@ jobs: - name: Release Type id: cf_release_type - uses: christian-draeger/read-properties@1.0.1 + uses: christian-draeger/read-properties@1.1.1 with: path: './gradle.properties' property: 'cf_release_type' diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java index 8af5c1a8..82a6d582 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java @@ -38,7 +38,7 @@ public class LevelBiomeGenerator implements DataProvider { private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final DataGenerator generator; - private final ResourceLocation COMPACT_BIOME = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); + private final ResourceLocation COMPACT_BIOME = new ResourceLocation(Constants.MOD_ID, "machine"); LevelBiomeGenerator(DataGenerator generator) { this.generator = generator; @@ -56,7 +56,7 @@ public void run(@Nonnull CachedOutput cache) { var dimTypeWriter = DataGenUtil.makeWriter(GSON, cache, data, ImmutableSet.of("dimension_type"), DimensionType.DIRECT_CODEC, dimTypes); - var dimWriter = DataGenUtil.makeCustomWriter(GSON, cache, data, ImmutableSet.of("dev/compactmods/machines/api/dimension"), this::writeFlatDimension, dims); + var dimWriter = DataGenUtil.makeCustomWriter(GSON, cache, data, ImmutableSet.of("dimension"), this::writeFlatDimension, dims); writeBiomes(biomeWriter); writeDimensionTypes(dimTypeWriter); From f06eecce015bfa27fc8db57eb7a0eec441447034 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Fri, 4 Nov 2022 01:33:31 -0400 Subject: [PATCH 35/85] Working on getting more and more common logic out of the forge modules --- .../compactmods/machines/api/core/CMTags.java | 7 +- .../api/machine/IMachineBlockEntity.java | 5 + .../api/machine/MachineEntityNbt.java | 8 ++ .../machines/api/machine/MachineIds.java | 14 +++ .../machines/api/machine/MachineNbt.java | 5 +- .../machines/api/machine/MachineTags.java | 4 +- .../machines/api/tunnels/ITunnelHolder.java | 8 ++ .../connection/RoomTunnelConnections.java | 3 + .../tunnels/recipe/TunnelRecipeHelper.java | 2 +- common-main/build.gradle.kts | 100 ++++++++++++++++++ .../machines/ICompactMachinesMod.java | 12 +++ .../advancement/AdvancementTriggers.java | 24 +++++ .../GenericAdvancementTriggerListener.java | 0 ...GenericAdvancementTriggerListenerList.java | 8 +- .../trigger/BaseAdvancementTrigger.java | 0 .../trigger/BasicPlayerAdvTrigger.java | 0 .../trigger/HowDidYouGetHereTrigger.java | 0 .../machines/client/PlayerFaceRenderer.java | 0 .../machines/client/Resources.java | 0 .../machines/client/gui/GuiIds.java | 0 .../gui/PersonalShrinkingDeviceScreen.java | 2 +- .../machines/client/gui/guide/GuidePage.java | 0 .../client/gui/guide/GuideSection.java | 0 .../gui/widget/AbstractCMGuiWidget.java | 0 .../widget/ScrollableWrappedTextWidget.java | 0 .../client/level/EmptyLevelEntityGetter.java | 2 +- .../machines/client/level/FakeSpawnInfo.java | 0 .../client/render/SuperRenderTypeBuffer.java | 5 +- .../util/TransformingVertexBuilder.java | 16 +-- .../machines/codec/CodecExtensions.java | 5 +- .../codec/DoubleStreamExtensions.java | 0 .../machines/codec/NbtListCollector.java | 0 .../machines/command/Commands.java | 23 ++++ .../machines/core/LoggingUtil.java | 12 +++ .../machines/graph/DimensionGraphNode.java | 7 +- .../machines/graph/IGraphEdge.java | 0 .../machines/graph/IGraphEdgeType.java | 0 .../machines/graph/IGraphNode.java | 0 .../machines/graph/IGraphNodeType.java | 0 .../machines/graph/SimpleGraphEdgeType.java | 8 +- .../machines/graph/SimpleGraphNodeType.java | 8 +- .../machines/i18n/TranslationUtil.java | 0 .../machines/location/LevelBlockPosition.java | 8 +- .../location/PreciseDimensionalPosition.java | 0 .../machines/machine/BasicRoomInfo.java | 0 .../EnumMachinePlayersBreakHandling.java | 0 .../machine/LegacySizedTemplates.java | 0 .../machine/client/MachineColors.java | 8 +- .../machine/data/MachineDataTagBuilder.java | 29 ++--- .../NonexistentMachineException.java | 0 .../machine/graph/CompactMachineNode.java | 11 +- .../machine/graph/DimensionMachineGraph.java | 19 ++-- .../machine/graph/MachineRoomEdge.java | 13 ++- .../machine/item/ICompactMachineItem.java | 24 +++++ .../room/MutableRoomRegistration.java | 0 .../machines/room/RoomCodeGenerator.java | 0 .../room/client/ClientRoomMetadata.java | 0 .../room/client/RoomClientHelper.java | 0 .../machines/room/data/RoomPreview.java | 0 .../exceptions/NonexistentRoomException.java | 0 .../room/graph/CompactRoomProvider.java | 50 ++++----- .../machines/room/graph/NewRoomBuilder.java | 0 .../machines/room/graph/RoomChunkEdge.java | 6 +- .../machines/room/graph/RoomChunkNode.java | 8 +- .../machines/room/graph/RoomMetadataNode.java | 6 +- .../machines/room/graph/RoomOwnerEdge.java | 6 +- .../machines/room/graph/RoomOwnerNode.java | 8 +- .../room/graph/RoomReferenceNode.java | 8 +- .../machines/room/graph/RoomSpawnNode.java | 6 +- .../room/history/PlayerRoomHistoryItem.java | 2 +- .../room/server/RoomServerHelper.java | 6 +- .../room}/upgrade/ChunkloadUpgrade.java | 2 +- .../upgrade/graph/RoomUpgradeGraphNode.java | 10 +- .../machines/tunnel/BaseTunnelWallData.java | 2 +- .../machines/tunnel/ITunnelItem.java | 24 +++++ .../machines/tunnel/SidedPosition.java | 0 .../machines/tunnel/TunnelHelper.java | 20 +++- .../machines/tunnel/TunnelNetwork.java | 0 .../tunnel/client/ClientTunnelHandler.java | 4 +- .../machines/tunnel/client/TunnelColors.java | 33 ++++-- .../tunnel/definitions/UnknownTunnel.java | 0 .../tunnel/graph/TunnelMachineEdge.java | 10 +- .../tunnel/graph/TunnelMachineInfo.java | 0 .../machines/tunnel/graph/TunnelNode.java | 20 ++-- .../machines/tunnel/graph/TunnelTypeEdge.java | 10 +- .../machines/tunnel/graph/TunnelTypeNode.java | 40 +------ .../machines/tunnel/graph/readme.md | 0 .../util/CompactStructureGenerator.java | 11 +- .../machines/util/DimensionUtil.java | 12 +-- .../compactmods/machines/util/MathUtil.java | 0 .../compactmods/machines/util/NbtUtil.java | 4 +- .../compactmods/machines/util/PlayerUtil.java | 28 +---- .../machines/util/SavedDataHelper.java | 0 .../machines/wall/BreakableWallBlock.java | 2 - .../machines/wall/ItemBlockWall.java | 5 +- forge-main/build.gradle.kts | 36 ++++--- .../machines/{config => }/CommonConfig.java | 3 +- .../compactmods/machines/CompactMachines.java | 20 +--- .../dev/compactmods/machines/GraphCommon.java | 24 +++++ .../machines/{core => }/ModBusEvents.java | 13 ++- .../machines/{core => }/Registries.java | 10 +- .../machines/{config => }/ServerConfig.java | 8 +- .../{core => }/ServerEventHandler.java | 9 +- .../advancement/AdvancementTriggers.java | 39 ------- .../client/{shader => }/CM4Shaders.java | 2 +- .../machines/client/ClientEventHandler.java | 13 ++- .../machines/client/level/RenderingLevel.java | 8 +- .../machines/client/level/TemplateChunk.java | 23 ++-- .../client/level/TemplateChunkProvider.java | 12 +-- .../machines/client/render/RenderTypes.java | 2 +- .../{Commands.java => ForgeCommands.java} | 43 +++----- .../command/RoomUpgradeArgument.java | 4 +- .../data/CMMachineDataExportCommand.java | 15 +-- .../command/data/CMRoomDataExportCommand.java | 15 +-- .../data/CMTunnelDataExportCommand.java | 25 +++-- .../command/subcommand/CMEjectSubcommand.java | 8 +- .../subcommand/CMGiveMachineSubcommand.java | 13 ++- .../subcommand/CMRebindSubcommand.java | 2 +- .../subcommand}/CMRoomUpgradeCommand.java | 16 +-- .../subcommand/CMUnbindSubcommand.java | 2 +- .../command/subcommand/SpawnSubcommand.java | 6 +- .../providers/CompactMachineProvider.java | 2 +- .../EnableVanillaRecipesConfigCondition.java | 41 ------- .../data/generated/AdvancementGenerator.java | 9 +- .../data/generated/tags/ItemTagGenerator.java | 2 +- .../migration/EarlyLevelDataFileReader.java | 13 +-- .../migration/Pre520RoomDataMigrator.java | 10 +- .../machines/dimension/Dimension.java | 2 +- .../SimpleTeleporter.java | 2 +- .../machines/dimension/VoidAirBlock.java | 7 +- .../dev/compactmods/machines/graph/Graph.java | 41 ------- .../machines/graph/GraphEdgeType.java | 26 ----- .../machines/machine/Machines.java | 9 +- .../machine/block/CompactMachineBlock.java | 15 ++- .../block/CompactMachineBlockEntity.java | 12 ++- .../block/LegacySizedCompactMachineBlock.java | 13 ++- .../machine/block/MachineBlockUtil.java | 6 +- .../InvalidMachineStateException.java | 30 ------ .../machine/item/BoundCompactMachineItem.java | 19 +++- .../machine/item/CompactMachineItem.java | 29 ----- .../item/LegacyCompactMachineItem.java | 7 +- .../item/UnboundCompactMachineItem.java | 28 +++-- .../network/ClientRoomNetworkHandler.java | 4 +- .../{core => network}/CompactMachinesNet.java | 6 +- .../network/InitialRoomBlockDataPacket.java | 2 +- .../PlayerRequestedTeleportPacket.java | 2 +- .../PlayerStartedRoomTrackingPacket.java | 2 +- .../network/RoomNetworkHandler.java | 2 +- .../network/SyncRoomMetadataPacket.java | 2 +- .../room/ForgeCompactRoomProvider.java | 24 +++++ .../{client => }/RoomClientEventHandler.java | 4 +- .../machines/room/RoomEventHandler.java | 4 +- .../compactmods/machines/room/RoomHelper.java | 18 ++-- .../dev/compactmods/machines/room/Rooms.java | 26 ++--- .../room/capability/CMRoomHistory.java | 5 +- .../capability/PlayerRoomHistoryProvider.java | 1 - .../PlayerRoomMetadataProviderProvider.java | 4 +- .../{ => capability}/RoomCapabilities.java | 2 +- .../machines/room/data/LootFunctions.java | 2 +- .../room/{menu => ui}/MachineRoomMenu.java | 5 +- .../{client => ui}/MachineRoomScreen.java | 9 +- .../gui/widget => room/ui}/PSDIconButton.java | 7 +- .../ui/RoomUserInterfaceRegistration.java} | 8 +- .../overlay/RoomMetadataDebugOverlay.java | 2 +- .../upgrade/RoomUpgradeManager.java | 5 +- .../upgrade}/RoomUpgradeWorkbench.java | 5 +- .../upgrade}/RoomUpgradeWorkbenchEntity.java | 2 +- .../shrinking/PersonalShrinkingDevice.java | 2 +- .../machines/shrinking/Shrinking.java | 11 +- .../machines/tunnel/TunnelItem.java | 25 ++--- .../machines/tunnel/TunnelWallBlock.java | 3 +- .../machines/tunnel/TunnelWallEntity.java | 5 +- .../compactmods/machines/tunnel/Tunnels.java | 15 ++- .../tunnel/client/TunnelItemColor.java | 23 ---- .../tunnel/graph/TunnelConnectionGraph.java | 23 +++- .../upgrade/ChunkloadUpgradeItem.java | 1 + .../machines/upgrade/MachineRoomUpgrades.java | 7 +- .../upgrade/graph/RoomUpgradeConnection.java | 10 +- .../upgrade/graph/UpgradeConnectionEntry.java | 4 +- .../machines/util/ForgePlayerUtil.java | 33 ++++++ .../machines/villager/Villagers.java | 2 +- .../ProtectedBlockHandler.java} | 5 +- .../machines/wall/SolidWallBlock.java | 15 +-- .../dev/compactmods/machines/wall/Walls.java | 2 +- .../machines/test/TestBatches.java | 4 +- settings.gradle.kts | 4 +- 186 files changed, 958 insertions(+), 826 deletions(-) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java create mode 100644 common-main/build.gradle.kts create mode 100644 common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java create mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java (97%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/Resources.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java (98%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java (96%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java (99%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java (97%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java (93%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java (100%) create mode 100644 common-main/src/main/java/dev/compactmods/machines/command/Commands.java create mode 100644 common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java (79%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/IGraphNode.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java (67%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java (67%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java (94%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java (67%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java (65%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java (81%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java (93%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java (56%) create mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java (87%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java (69%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java (83%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java (94%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java (72%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java (81%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java (83%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java (81%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java (89%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java (65%) rename {forge-main/src/main/java/dev/compactmods/machines => common-main/src/main/java/dev/compactmods/machines/room}/upgrade/ChunkloadUpgrade.java (98%) rename {forge-main/src/main/java/dev/compactmods/machines => common-main/src/main/java/dev/compactmods/machines/room}/upgrade/graph/RoomUpgradeGraphNode.java (61%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java (94%) create mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java (64%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java (81%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java (53%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java (79%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java (70%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java (76%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java (50%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java (93%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/DimensionUtil.java (95%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/MathUtil.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/NbtUtil.java (74%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/PlayerUtil.java (57%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java (100%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java (74%) rename {forge-main => common-main}/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{config => }/CommonConfig.java (92%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java rename forge-main/src/main/java/dev/compactmods/machines/{core => }/ModBusEvents.java (63%) rename forge-main/src/main/java/dev/compactmods/machines/{core => }/Registries.java (89%) rename forge-main/src/main/java/dev/compactmods/machines/{config => }/ServerConfig.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{core => }/ServerEventHandler.java (92%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java rename forge-main/src/main/java/dev/compactmods/machines/client/{shader => }/CM4Shaders.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/command/{Commands.java => ForgeCommands.java} (56%) rename forge-main/src/main/java/dev/compactmods/machines/{upgrade => }/command/RoomUpgradeArgument.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{upgrade/command => command/subcommand}/CMRoomUpgradeCommand.java (89%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java rename forge-main/src/main/java/dev/compactmods/machines/{location => dimension}/SimpleTeleporter.java (98%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/ClientRoomNetworkHandler.java (89%) rename forge-main/src/main/java/dev/compactmods/machines/{core => network}/CompactMachinesNet.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/InitialRoomBlockDataPacket.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/PlayerRequestedTeleportPacket.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/PlayerStartedRoomTrackingPacket.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/RoomNetworkHandler.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{room => }/network/SyncRoomMetadataPacket.java (93%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/room/ForgeCompactRoomProvider.java rename forge-main/src/main/java/dev/compactmods/machines/room/{client => }/RoomClientEventHandler.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/room/{ => capability}/RoomCapabilities.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/room/{menu => ui}/MachineRoomMenu.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/room/{client => ui}/MachineRoomScreen.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{client/gui/widget => room/ui}/PSDIconButton.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/{core/UIRegistration.java => room/ui/RoomUserInterfaceRegistration.java} (76%) rename forge-main/src/main/java/dev/compactmods/machines/room/{client => ui}/overlay/RoomMetadataDebugOverlay.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => room}/upgrade/RoomUpgradeManager.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{upgrade/workbench => room/upgrade}/RoomUpgradeWorkbench.java (86%) rename forge-main/src/main/java/dev/compactmods/machines/{upgrade/workbench => room/upgrade}/RoomUpgradeWorkbenchEntity.java (92%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java rename forge-main/src/main/java/dev/compactmods/machines/{core/CommonEventHandler.java => wall/ProtectedBlockHandler.java} (84%) diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java index 68ea5be3..221f3b3c 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java @@ -8,6 +8,9 @@ public interface CMTags { TagKey ROOM_UPGRADE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "room_upgrade")); - TagKey MACHINE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); - TagKey MACHINE_BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); + TagKey MACHINE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + TagKey MACHINE_BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + + TagKey SOLID_WALL_ITEMS = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "solid_walls")); + TagKey SOLID_WALL_BLOCKS = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "solid_walls")); } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java new file mode 100644 index 00000000..e19964c4 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java @@ -0,0 +1,5 @@ +package dev.compactmods.machines.api.machine; + +public interface IMachineBlockEntity { + int getColor(); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java new file mode 100644 index 00000000..2a3616e4 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.api.machine; + +public interface MachineEntityNbt { + String NBT_ROOM_CODE = "room_code"; + String NBT_CUSTOM_COLOR = "machine_color"; + String NBT_TEMPLATE_ID = "template_id"; + String NBT_ROOM_COLOR = "room_color"; +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java new file mode 100644 index 00000000..25db4519 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.api.machine; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; + +public interface MachineIds { + ResourceLocation BLOCK_ENTITY = new ResourceLocation(Constants.MOD_ID, "compact_machine"); + + ResourceLocation UNBOUND_MACHINE_ITEM_ID = new ResourceLocation(Constants.MOD_ID, "new_machine"); + ResourceKey UNBOUND_MACHINE_ITEM_KEY = ResourceKey.create(Registry.ITEM_REGISTRY, UNBOUND_MACHINE_ITEM_ID); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java index c33d8eb6..432f36a2 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java @@ -2,5 +2,8 @@ public abstract class MachineNbt { public static final String OWNER = "owner"; - public final static String ID = "machine_id"; + public static final String ID = "machine_id"; + + public static final String NBT_TEMPLATE_ID = "template_id"; + public static final String NBT_COLOR = "machine_color"; } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java index 7239c59b..d1e07dcd 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java @@ -9,7 +9,7 @@ public interface MachineTags { - TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); - TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine")); + TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); + TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java new file mode 100644 index 00000000..5c637e2a --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.api.tunnels; + +public interface ITunnelHolder { + + TunnelDefinition getTunnelType(); + + void setTunnelType(TunnelDefinition type); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java index 7728da04..e0cbf585 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java @@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import java.util.Optional; import java.util.stream.Stream; public interface RoomTunnelConnections { @@ -15,4 +16,6 @@ public interface RoomTunnelConnections { * @return */ Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction facing); + + Optional getConnectedSide(BlockPos position); } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java index bc941687..6f346d31 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java @@ -5,6 +5,6 @@ public abstract class TunnelRecipeHelper { public static ResourceLocation getRecipeId(@NotNull ResourceLocation tunnelType) { - return new ResourceLocation(tunnelType.getNamespace(), "dev/compactmods/machines/api/tunnels/" + tunnelType.getPath()); + return new ResourceLocation(tunnelType.getNamespace(), "tunnels/" + tunnelType.getPath()); } } \ No newline at end of file diff --git a/common-main/build.gradle.kts b/common-main/build.gradle.kts new file mode 100644 index 00000000..b2a7f08c --- /dev/null +++ b/common-main/build.gradle.kts @@ -0,0 +1,100 @@ +val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" +val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" +val nightlyVersion: String = "${semver}.${buildNumber}-nightly" +val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) + +var mod_id: String by extra + +repositories { + mavenCentral() { + content { + includeGroup("com.aventrix.jnanoid") + } + } + + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } +} + +plugins { + id("fabric-loom") + id("maven-publish") +} + +base { + archivesName.set(mod_id) + group = "dev.compactmods" + version = if(isRelease) semver else nightlyVersion +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +sourceSets { + named("main") { + resources { + //The API has no resources + setSrcDirs(emptyList()) + } + } + + named("test") { + resources { + //The test module has no resources + setSrcDirs(emptyList()) + } + } +} + +val minecraft_version: String by rootProject.extra +val parchment_version: String by rootProject.extra + +val runDepends: List = listOf( + project(":common-api") +) + +runDepends.forEach { + project.evaluationDependsOn(it.path) +} + +dependencies { + minecraft("net.minecraft", "minecraft", minecraft_version) + + mappings(loom.layered { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + compileOnly(project(":common-api")) + compileOnly("com.aventrix.jnanoid", "jnanoid", "2.0.0") +} + +tasks.withType { + options.encoding = "UTF-8" + options.compilerArgs.add("-proc:none") +} + +publishing { + publications.register("common") { + artifactId = "compactmachines" + groupId = "dev.compactmods" + + artifacts { + artifact(tasks.jar.get()) + // artifact(tasks.named("sourcesJar").get()) + } + } + + repositories { + // GitHub Packages + maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java b/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java new file mode 100644 index 00000000..1e613923 --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java @@ -0,0 +1,12 @@ +package dev.compactmods.machines; + +import dev.compactmods.machines.core.LoggingUtil; +import org.apache.logging.log4j.Logger; + +public interface ICompactMachinesMod { + /** + * @deprecated Use {@link LoggingUtil#modLog} instead + */ + @Deprecated(forRemoval = true) + Logger LOGGER = LoggingUtil.modLog(); +} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java new file mode 100644 index 00000000..c7295841 --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java @@ -0,0 +1,24 @@ +package dev.compactmods.machines.advancement; + +import dev.compactmods.machines.ICompactMachinesMod; +import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; +import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; +import dev.compactmods.machines.api.core.Advancements; + +public class AdvancementTriggers { + + public static final BasicPlayerAdvTrigger RECURSIVE_ROOMS = new BasicPlayerAdvTrigger(Advancements.RECURSIVE_ROOMS); + + public static final HowDidYouGetHereTrigger HOW_DID_YOU_GET_HERE = new HowDidYouGetHereTrigger(); + + public static final BasicPlayerAdvTrigger CLAIMED_TINY = new BasicPlayerAdvTrigger(Advancements.CLAIMED_TINY_MACHINE); + public static final BasicPlayerAdvTrigger CLAIMED_SMALL = new BasicPlayerAdvTrigger(Advancements.CLAIMED_SMALL_MACHINE); + public static final BasicPlayerAdvTrigger CLAIMED_NORMAL = new BasicPlayerAdvTrigger(Advancements.CLAIMED_NORMAL_MACHINE); + public static final BasicPlayerAdvTrigger CLAIMED_LARGE = new BasicPlayerAdvTrigger(Advancements.CLAIMED_LARGE_MACHINE); + public static final BasicPlayerAdvTrigger CLAIMED_GIANT = new BasicPlayerAdvTrigger(Advancements.CLAIMED_GIANT_MACHINE); + public static final BasicPlayerAdvTrigger CLAIMED_MAX = new BasicPlayerAdvTrigger(Advancements.CLAIMED_MAX_MACHINE); + + public static void init() { + ICompactMachinesMod.LOGGER.trace("Registering advancement triggers."); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java b/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java rename to common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java b/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java rename to common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java index d66abdc7..273e5d35 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java +++ b/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java @@ -1,17 +1,17 @@ package dev.compactmods.machines.advancement; -import javax.annotation.Nullable; -import java.util.Map; import com.google.common.collect.Maps; -import net.minecraft.advancements.CriterionTriggerInstance; import net.minecraft.advancements.CriterionTrigger; +import net.minecraft.advancements.CriterionTriggerInstance; import net.minecraft.server.PlayerAdvancements; import net.minecraft.server.level.ServerPlayer; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; public class GenericAdvancementTriggerListenerList { private final Map> listeners = Maps.newHashMap(); - public void addPlayerListener(PlayerAdvancements advancements, CriterionTrigger.Listener listener) { GenericAdvancementTriggerListener listeners = this.listeners.computeIfAbsent(advancements, GenericAdvancementTriggerListener::new); listeners.add(listener); diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java rename to common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java rename to common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java rename to common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java b/common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java rename to common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/Resources.java b/common-main/src/main/java/dev/compactmods/machines/client/Resources.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/Resources.java rename to common-main/src/main/java/dev/compactmods/machines/client/Resources.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java index d54120ff..60d343be 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java +++ b/common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java @@ -8,8 +8,8 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java rename to common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java b/common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java rename to common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java index 1c42fa2b..a0c39462 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java +++ b/common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java @@ -4,8 +4,8 @@ import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.entity.LevelEntityGetter; import net.minecraft.world.phys.AABB; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collections; import java.util.UUID; import java.util.function.Consumer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java b/common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java rename to common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java b/common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java similarity index 99% rename from forge-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java rename to common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java index 5b9e42d2..33c10d56 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java +++ b/common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java @@ -1,10 +1,7 @@ package dev.compactmods.machines.client.render; -import java.util.SortedMap; - import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.VertexConsumer; - import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import net.minecraft.Util; import net.minecraft.client.renderer.ChunkBufferBuilderPack; @@ -13,6 +10,8 @@ import net.minecraft.client.renderer.Sheets; import net.minecraft.client.resources.model.ModelBakery; +import java.util.SortedMap; + /** * Copied from Create's ponder rendering code. Stripping this down for now, WIP */ diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java b/common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java rename to common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java index 58592063..16ac7aa9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java +++ b/common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java @@ -20,9 +20,9 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -64,7 +64,7 @@ public TransformingVertexBuilder(MultiBufferSource buffer, RenderType type) this(buffer, type, new PoseStack()); } - @Nonnull + @NotNull @Override public VertexConsumer vertex(double x, double y, double z) { @@ -72,7 +72,7 @@ public VertexConsumer vertex(double x, double y, double z) return this; } - @Nonnull + @NotNull @Override public VertexConsumer color(int red, int green, int blue, int alpha) { @@ -80,7 +80,7 @@ public VertexConsumer color(int red, int green, int blue, int alpha) return this; } - @Nonnull + @NotNull @Override public VertexConsumer uv(float u, float v) { @@ -88,7 +88,7 @@ public VertexConsumer uv(float u, float v) return this; } - @Nonnull + @NotNull @Override public VertexConsumer overlayCoords(int u, int v) { @@ -96,7 +96,7 @@ public VertexConsumer overlayCoords(int u, int v) return this; } - @Nonnull + @NotNull @Override public VertexConsumer uv2(int u, int v) { @@ -104,7 +104,7 @@ public VertexConsumer uv2(int u, int v) return this; } - @Nonnull + @NotNull @Override public VertexConsumer normal(float x, float y, float z) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java b/common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java rename to common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java index 1db6a135..0df07ea8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java +++ b/common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java @@ -2,7 +2,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.ICompactMachinesMod; import net.minecraft.Util; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; @@ -39,9 +39,10 @@ public abstract class CodecExtensions { }, UUID::toString).stable(); public static CompoundTag writeIntoTag(Codec codec, T instance, CompoundTag tag) { + final var encoded = codec .encodeStart(NbtOps.INSTANCE, instance) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, ICompactMachinesMod.LOGGER::fatal); if (encoded instanceof CompoundTag ect) tag.merge(ect); diff --git a/forge-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java b/common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java rename to common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java b/common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java rename to common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java diff --git a/common-main/src/main/java/dev/compactmods/machines/command/Commands.java b/common-main/src/main/java/dev/compactmods/machines/command/Commands.java new file mode 100644 index 00000000..ee53ed3b --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/command/Commands.java @@ -0,0 +1,23 @@ +package dev.compactmods.machines.command; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import dev.compactmods.machines.api.core.Constants; +import net.minecraft.commands.CommandSourceStack; + + +public class Commands { + + // TODO: /cm create + // TODO: /cm spawn set + + static final LiteralArgumentBuilder CM_COMMAND_ROOT + = LiteralArgumentBuilder.literal(Constants.MOD_ID); + + public static void prepare() { + + } + + public static LiteralArgumentBuilder getRoot() { + return CM_COMMAND_ROOT; + } +} diff --git a/common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java b/common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java new file mode 100644 index 00000000..20c615a8 --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java @@ -0,0 +1,12 @@ +package dev.compactmods.machines.core; + +import dev.compactmods.machines.api.core.Constants; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LoggingUtil { + + public static Logger modLog() { + return LogManager.getLogger(Constants.MOD_ID); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java similarity index 79% rename from forge-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java rename to common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java index 027786b7..6880a4c6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java @@ -12,14 +12,15 @@ public record DimensionGraphNode(ResourceKey dimension) implements IGraph ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(DimensionGraphNode::dimension) ).apply(i, DimensionGraphNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public String toString() { - return "DimensionGraphNode[" + - "dimension=" + dimension + ']'; + return "DimensionGraphNode[%s]".formatted(dimension); } @Override public IGraphNodeType getType() { - return Graph.DIM_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java rename to common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java rename to common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java rename to common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java rename to common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java similarity index 67% rename from forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java rename to common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java index 0c2e542c..e4e22c70 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java +++ b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java @@ -11,8 +11,12 @@ private SimpleGraphEdgeType(Codec codec) { this.codec = codec; } - public static Supplier> instance(Codec codec) { - return () -> new SimpleGraphEdgeType(codec); + public static SimpleGraphEdgeType instance(Codec codec) { + return new SimpleGraphEdgeType(codec); + } + + public static Supplier> supplier(Codec codec) { + return () -> instance(codec); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java similarity index 67% rename from forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java rename to common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java index 7f51c15a..018ee467 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java +++ b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java @@ -12,8 +12,12 @@ private SimpleGraphNodeType(Codec codec) { this.codec = codec; } - public static Supplier> instance(Codec codec) { - return () -> new SimpleGraphNodeType(codec); + public static SimpleGraphNodeType instance(Codec codec) { + return new SimpleGraphNodeType(codec); + } + + public static Supplier> supplier(Codec codec) { + return () -> instance(codec); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java b/common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java rename to common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java rename to common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java index 9e0f375b..4fe07c1c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java +++ b/common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java @@ -2,7 +2,6 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -17,8 +16,9 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import org.apache.logging.log4j.LogManager; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Objects; import java.util.Optional; @@ -39,7 +39,7 @@ public Vec3 position() { return Vec3.atCenterOf(blockPos); } - public ServerLevel level(@Nonnull MinecraftServer server) { + public ServerLevel level(@NotNull MinecraftServer server) { return server.getLevel(this.dimension); } @@ -64,7 +64,7 @@ public ChunkPos chunkPos() { } public static LevelBlockPosition fromNBT(CompoundTag nbt) { - return CODEC.parse(NbtOps.INSTANCE, nbt).getOrThrow(false, CompactMachines.LOGGER::error); + return CODEC.parse(NbtOps.INSTANCE, nbt).getOrThrow(false, e -> LogManager.getLogger().error(e)); } public BlockPos getBlockPosition() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java rename to common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java b/common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java rename to common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java b/common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java rename to common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java rename to common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java similarity index 67% rename from forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java rename to common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java index fd577fd9..4272720a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.machine.client; import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.machine.item.CompactMachineItem; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.api.machine.IMachineBlockEntity; +import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; @@ -10,14 +10,14 @@ public class MachineColors { public static final ItemColor ITEM = (stack, pTintIndex) -> { if(!stack.is(CMTags.MACHINE_ITEM)) return 0xFFFFFFFF; - return pTintIndex == 0 ? CompactMachineItem.getMachineColor(stack) : 0xFFFFFFFF; + return pTintIndex == 0 ? ICompactMachineItem.getMachineColor(stack) : 0xFFFFFFFF; }; public static final BlockColor BLOCK = (state, level, pos, tintIndex) -> { if(!state.is(CMTags.MACHINE_BLOCK) || level == null || pos == null) return 0xFFFFFFFF; - if(!(level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machineData)) + if(!(level.getBlockEntity(pos) instanceof IMachineBlockEntity machineData)) return 0xFFFFFFFF; return tintIndex == 0 ? machineData.getColor() : 0xFFFFFFFF; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java b/common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java similarity index 65% rename from forge-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java rename to common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java index 52a2fe56..e510d1a2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java @@ -1,13 +1,12 @@ package dev.compactmods.machines.machine.data; import com.google.gson.JsonObject; +import dev.compactmods.machines.api.machine.MachineEntityNbt; +import dev.compactmods.machines.api.machine.MachineIds; +import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; /** @@ -46,19 +45,21 @@ public MachineDataTagBuilder template(ResourceLocation templateId) { public MachineDataTagBuilder writeToItem(ItemStack stack) { final var tag = stack.getOrCreateTag(); - tag.putInt(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); - tag.putString(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); + tag.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, color); + tag.putString(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); return this; } public MachineDataTagBuilder writeToItemJson(JsonObject json) { - json.addProperty(UnboundCompactMachineItem.NBT_TEMPLATE_ID, templateId.toString()); - json.addProperty(UnboundCompactMachineItem.NBT_COLOR, color); + json.addProperty(MachineNbt.NBT_TEMPLATE_ID, templateId.toString()); + json.addProperty(MachineNbt.NBT_COLOR, color); return this; } public MachineDataTagBuilder writeToBlockData(ItemStack stack) { - BlockItem.setBlockEntityData(stack, Machines.MACHINE_TILE_ENTITY.get(), writeBlockDataTag()); + final var data = writeBlockDataTag(); + data.putString("id", MachineIds.BLOCK_ENTITY.toString()); + stack.addTagElement("BlockEntityTag", data); return this; } @@ -72,16 +73,16 @@ public MachineDataTagBuilder writeToBlockDataJson(JsonObject json) { private CompoundTag writeBlockDataTag() { final var tag = new CompoundTag(); - tag.putString(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); - tag.putInt(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); + tag.putString(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); + tag.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, color); return tag; } private JsonObject writeBlockDataJson() { final var tag = new JsonObject(); - tag.addProperty("id", Machines.MACHINE_TILE_ENTITY.getId().toString()); - tag.addProperty(CompactMachineBlockEntity.NBT_TEMPLATE_ID, templateId.toString()); - tag.addProperty(CompactMachineBlockEntity.NBT_CUSTOM_COLOR, color); + tag.addProperty("id", MachineIds.BLOCK_ENTITY.toString()); + tag.addProperty(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); + tag.addProperty(MachineEntityNbt.NBT_CUSTOM_COLOR, color); return tag; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java b/common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java rename to common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java similarity index 81% rename from forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java rename to common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java index 06bfd1fa..91830d9c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java @@ -3,9 +3,9 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.location.LevelBlockPosition; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceKey; @@ -18,14 +18,17 @@ public record CompactMachineNode(ResourceKey dimension, BlockPos position) implements IGraphNode { - public static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); + public static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "machine"); + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Level.RESOURCE_KEY_CODEC.fieldOf("dev/compactmods/machines/api/dimension").forGetter(CompactMachineNode::dimension), + Level.RESOURCE_KEY_CODEC.fieldOf("dimension").forGetter(CompactMachineNode::dimension), BlockPos.CODEC.fieldOf("position").forGetter(CompactMachineNode::position), ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (dim, pos, type) -> new CompactMachineNode(dim, pos))); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + public String toString() { return "Compact Machine {%s}".formatted(position); } @@ -36,6 +39,6 @@ public LevelBlockPosition dimpos() { @Override public IGraphNodeType getType() { - return Graph.MACH_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java rename to common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java index 77d4b8d9..59fab79e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java @@ -5,7 +5,7 @@ import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.graph.RoomReferenceNode; @@ -16,8 +16,9 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.saveddata.SavedData; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -34,6 +35,8 @@ */ public class DimensionMachineGraph extends SavedData { + private static final Logger LOG = LoggingUtil.modLog(); + private final ResourceKey level; private final MutableValueGraph graph; private final Map machines; @@ -55,14 +58,14 @@ private DimensionMachineGraph(ResourceKey level) { rooms = new HashMap<>(); } - public DimensionMachineGraph(ResourceKey level, @Nonnull CompoundTag nbt) { + public DimensionMachineGraph(ResourceKey level, @NotNull CompoundTag nbt) { this(level); if (nbt.contains("graph")) { CompoundTag graphNbt = nbt.getCompound("graph"); final var connectionData = CONN_CODEC.parse(NbtOps.INSTANCE, graphNbt) - .resultOrPartial(CompactMachines.LOGGER::error) + .resultOrPartial(LOG::error) .orElseThrow(); loadConnections(connectionData); @@ -198,13 +201,13 @@ public Optional getMachineNode(BlockPos worldPosition) { return Optional.ofNullable(machines.get(worldPosition)); } - @Nonnull + @NotNull @Override - public CompoundTag save(@Nonnull CompoundTag nbt) { + public CompoundTag save(@NotNull CompoundTag nbt) { final var connData = buildConnections(); CONN_CODEC.encodeStart(NbtOps.INSTANCE, connData) - .resultOrPartial(CompactMachines.LOGGER::error) + .resultOrPartial(LOG::error) .ifPresent(gNbt -> nbt.put("graph", gNbt)); return nbt; @@ -216,7 +219,7 @@ public CompoundTag save(@Nonnull CompoundTag nbt) { private record CompactMachineConnectionInfo(String roomCode, List machines) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING - .fieldOf("dev/compactmods/machines/api/room") + .fieldOf("room") .forGetter(CompactMachineConnectionInfo::roomCode), BlockPos.CODEC.listOf() diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java similarity index 56% rename from forge-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java rename to common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java index dc87844a..9b7d37e6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java @@ -1,14 +1,16 @@ package dev.compactmods.machines.machine.graph; import com.mojang.serialization.Codec; -import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import org.jetbrains.annotations.NotNull; -public record MachineRoomEdge() implements IGraphEdge { +public record MachineRoomEdge() implements IGraphEdge { - public static final Codec CODEC = Codec.unit(MachineRoomEdge::new); + public static final Codec CODEC = Codec.unit(MachineRoomEdge::new); + + public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); @Override public boolean equals(Object obj) { @@ -25,8 +27,9 @@ public String toString() { return "MachineRoomEdge[]"; } + @NotNull @Override - public @NotNull IGraphEdgeType getEdgeType() { - return GraphEdgeType.MACHINE_LINK; + public IGraphEdgeType getEdgeType() { + return EDGE_TYPE; } } diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java b/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java new file mode 100644 index 00000000..0a874053 --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java @@ -0,0 +1,24 @@ +package dev.compactmods.machines.machine.item; + +import dev.compactmods.machines.api.machine.MachineNbt; +import net.minecraft.world.item.ItemStack; + +public interface ICompactMachineItem { + + static ItemStack setColor(ItemStack stack, int color) { + var tag = stack.getOrCreateTag(); + tag.putInt(MachineNbt.NBT_COLOR, color); + return stack; + } + + static int getMachineColor(ItemStack stack) { + if (!stack.hasTag()) return 0xFFFFFFFF; + + final var tag = stack.getTag(); + if (tag == null || tag.isEmpty() || !tag.contains(MachineNbt.NBT_COLOR)) + return 0xFFFFFFFF; + + return tag.getInt(MachineNbt.NBT_COLOR); + } + +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java b/common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java rename to common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java b/common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java rename to common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java b/common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java rename to common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java rename to common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java b/common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java rename to common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java b/common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java rename to common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java index 0cb98581..d03623bf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java @@ -2,7 +2,6 @@ import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; @@ -13,7 +12,6 @@ import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.codec.NbtListCollector; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.MutableRoomRegistration; @@ -30,10 +28,11 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.saveddata.SavedData; import net.minecraft.world.phys.Vec2; -import net.minecraftforge.server.ServerLifecycleHooks; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -44,6 +43,8 @@ public class CompactRoomProvider extends SavedData implements IRoomLookup, IRoomOwnerLookup, IRoomSpawnLookup { + public static final Logger LOGS = LogManager.getLogger(); + public static final String DATA_NAME = Constants.MOD_ID + "_rooms"; public static final String NBT_NODE_ID_KEY = "node_id"; @@ -70,18 +71,6 @@ public static CompactRoomProvider empty() { return new CompactRoomProvider(); } - @Nullable - public static CompactRoomProvider instance() { - try { - final ServerLevel level = CompactDimension.forServer(ServerLifecycleHooks.getCurrentServer()); - return level.getDataStorage() - .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.fatal(e); - return null; - } - } - @Nullable public static CompactRoomProvider instance(MinecraftServer server) { try { @@ -89,17 +78,17 @@ public static CompactRoomProvider instance(MinecraftServer server) { return level.getDataStorage() .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); } catch (MissingDimensionException e) { - CompactMachines.LOGGER.fatal(e); + LOGS.fatal(e); return null; } } public static CompactRoomProvider instance(ServerLevel compactDim) { - return compactDim.getDataStorage() - .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); + return compactDim.getDataStorage() + .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); } - private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { + public static CompactRoomProvider fromDisk(CompoundTag compoundTag) { final var graph = new CompactRoomProvider(); final HashMap metaNodeIdMap = new HashMap<>(); @@ -110,7 +99,7 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { .forEach(roomNode -> { UUID id = roomNode.getUUID(NBT_NODE_ID_KEY); final var node = RoomMetadataNode.CODEC.parse(NbtOps.INSTANCE, roomNode) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, LOGS::fatal); metaNodeIdMap.put(id, node); graph.metadata.put(node.code(), node); @@ -131,7 +120,7 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { .forEach(ownerNode -> { UUID id = ownerNode.getUUID(NBT_NODE_ID_KEY); final var node = RoomOwnerNode.CODEC.parse(NbtOps.INSTANCE, ownerNode) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, LOGS::fatal); roomOwnerNodeMap.put(id, node); graph.owners.put(node.owner(), node); @@ -143,25 +132,25 @@ private static CompactRoomProvider fromDisk(CompoundTag compoundTag) { .stream() .map(CompoundTag.class::cast) .forEach(roomOwnerConn -> { - RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("dev/compactmods/machines/api/room")); + RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("room")); RoomOwnerNode owner = roomOwnerNodeMap.get(roomOwnerConn.getUUID("owner")); graph.graph.putEdgeValue(meta, owner, new RoomOwnerEdge()); }); } - CompactMachines.LOGGER.debug("Number of rooms loaded from disk: {}", metaNodeIdMap.size()); + LOGS.debug("Number of rooms loaded from disk: {}", metaNodeIdMap.size()); return graph; } - @Nonnull + @NotNull @Override - public CompoundTag save(@Nonnull CompoundTag tag) { + public CompoundTag save(@NotNull CompoundTag tag) { //region Room Metadata Nodes final HashMap metaNodeIdMap = new HashMap<>(); metadata.values().forEach(metaNode -> metaNodeIdMap.put(metaNode.code(), UUID.randomUUID())); ListTag meta = (ListTag) RoomMetadataNode.CODEC.listOf() .encodeStart(NbtOps.INSTANCE, List.copyOf(metadata.values())) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, LOGS::fatal); meta.stream() .filter(CompoundTag.class::isInstance) @@ -176,7 +165,7 @@ public CompoundTag save(@Nonnull CompoundTag tag) { owners.values().forEach(ownerNode -> ownerByUuidMap.put(ownerNode.owner(), UUID.randomUUID())); ListTag ownerList = (ListTag) RoomOwnerNode.CODEC.listOf() .encodeStart(NbtOps.INSTANCE, List.copyOf(owners.values())) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, LOGS::fatal); ownerList.stream().map(CompoundTag.class::cast) .forEach(oct -> oct.putUUID(NBT_NODE_ID_KEY, ownerByUuidMap.get(oct.getUUID("owner")))); @@ -197,7 +186,7 @@ public CompoundTag save(@Nonnull CompoundTag tag) { UUID roomId = metaNodeIdMap.get(roomNode.code()); UUID ownerId = ownerByUuidMap.get(roomOwner.owner()); CompoundTag connection = new CompoundTag(); - connection.putUUID("dev/compactmods/machines/api/room", roomId); + connection.putUUID("room", roomId); connection.putUUID("owner", ownerId); return connection; })) @@ -301,8 +290,7 @@ public IRoomRegistration registerNew(Function ne Vec3i location = MathUtil.getRegionPositionByIndex(metadata.size()); final var builder = newRoom.apply(new NewRoomBuilder(newRoomCode)); - BlockPos newCenter = MathUtil.getCenterWithY(location, ServerConfig.MACHINE_FLOOR_Y.get()) - .above(builder.yOffset()); + BlockPos newCenter = MathUtil.getCenterWithY(location, 40).above(builder.yOffset()); builder.setCenter(newCenter); diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java similarity index 69% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java index d3dcd5b7..97ea04a9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java @@ -2,15 +2,17 @@ import com.mojang.serialization.Codec; import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import org.jetbrains.annotations.NotNull; public record RoomChunkEdge() implements dev.compactmods.machines.graph.IGraphEdge { public static final Codec CODEC = Codec.unit(new RoomChunkEdge()); + public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); + @Override public @NotNull IGraphEdgeType getEdgeType() { - return Rooms.ROOM_CHUNK_EDGE.get(); + return EDGE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java index 827b562f..f7d2ba67 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java @@ -2,12 +2,12 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.IRoomLookup; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.world.level.ChunkPos; public record RoomChunkNode(ChunkPos chunk) implements IGraphNode { @@ -16,9 +16,11 @@ public record RoomChunkNode(ChunkPos chunk) implements IGraphNode CodecExtensions.CHUNKPOS.fieldOf("chunk").forGetter(RoomChunkNode::chunk) ).apply(i, RoomChunkNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public IGraphNodeType getType() { - return Rooms.ROOM_CHUNK_NODE.get(); + return NODE_TYPE; } public IRoomRegistration room(IRoomLookup lookup) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java index 2596946d..94055185 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.resources.ResourceLocation; @@ -38,6 +38,8 @@ public record RoomMetadataNode(String code, int color, Vec3i dimensions, Vec3 ce CodecExtensions.VEC2.fieldOf("spawnRot").forGetter(RoomMetadataNode::spawnRotation) ).apply(i, RoomMetadataNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public String toString() { return "Room Meta [id=%s]".formatted(code); @@ -45,7 +47,7 @@ public String toString() { @Override public IGraphNodeType getType() { - return Rooms.ROOM_META_NODE.get(); + return NODE_TYPE; } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java similarity index 72% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java index 92d03295..eba7eeba 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java @@ -3,14 +3,16 @@ import com.mojang.serialization.Codec; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import org.jetbrains.annotations.NotNull; public record RoomOwnerEdge() implements IGraphEdge { public static final Codec CODEC = Codec.unit(new RoomOwnerEdge()); + public static final IGraphEdgeType TYPE = SimpleGraphEdgeType.instance(CODEC); + @Override public @NotNull IGraphEdgeType getEdgeType() { - return Rooms.ROOM_OWNER_EDGE.get(); + return TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java similarity index 81% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java index 6b776d43..24efed16 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.core.UUIDUtil; import net.minecraft.resources.ResourceLocation; @@ -13,15 +13,17 @@ public record RoomOwnerNode(UUID owner) implements IGraphNode { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/room"); + private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "room"); public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( UUIDUtil.CODEC.fieldOf("owner").forGetter(RoomOwnerNode::owner), ResourceLocation.CODEC.fieldOf("type").forGetter(x -> RoomOwnerNode.TYPE) ).apply(i, (owner, type) -> new RoomOwnerNode(owner))); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public IGraphNodeType getType() { - return Rooms.ROOM_OWNER_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java index 4c28c58a..badea03c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java @@ -2,11 +2,11 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.graph.Graph; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.graph.SimpleGraphNodeType; /** * Represents the inside of a Compact Machine. @@ -17,6 +17,8 @@ public record RoomReferenceNode(String code) implements IGraphNode { Codec.STRING.fieldOf("code").forGetter(RoomReferenceNode::code) ).apply(i, RoomReferenceNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + public IRoomRegistration getFullInfo(IRoomLookup lookup) { return lookup.forRoom(code).orElseThrow(); } @@ -28,6 +30,6 @@ public String toString() { @Override public IGraphNodeType getType() { - return Graph.ROOM_REFERENCE_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java similarity index 81% rename from forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java index dd38fbfb..edd61bd9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; @@ -16,8 +16,10 @@ public record RoomSpawnNode(Vec3 position, Vec2 rotation) implements IGraphNode< CodecExtensions.VEC2.fieldOf("rotation").forGetter(RoomSpawnNode::rotation) ).apply(i, RoomSpawnNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public IGraphNodeType getType() { - return Rooms.SPAWN_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java b/common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java similarity index 89% rename from forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java rename to common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java index df6157b0..86141107 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java @@ -12,7 +12,7 @@ public record PlayerRoomHistoryItem(PreciseDimensionalPosition entry, LevelBlock public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( PreciseDimensionalPosition.CODEC.fieldOf("position").forGetter(PlayerRoomHistoryItem::entry), - LevelBlockPosition.CODEC.fieldOf("dev/compactmods/machines/api/machine").forGetter(PlayerRoomHistoryItem::machine) + LevelBlockPosition.CODEC.fieldOf("machine").forGetter(PlayerRoomHistoryItem::machine) ).apply(i, PlayerRoomHistoryItem::new)); @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java b/common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java similarity index 65% rename from forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java rename to common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java index 9260c96c..122514a0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java @@ -3,11 +3,11 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; import net.minecraft.core.Registry; -import net.minecraftforge.server.ServerLifecycleHooks; +import net.minecraft.server.MinecraftServer; public class RoomServerHelper { - public static Registry getTemplates() { - return ServerLifecycleHooks.getCurrentServer() + public static Registry getTemplates(MinecraftServer server) { + return server .registryAccess() .registryOrThrow(Rooms.TEMPLATE_REG_KEY); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java b/common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java rename to common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java index 52de0bef..863eea0e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgrade.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.room.upgrade; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java similarity index 61% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java rename to common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java index 0bee41bb..c3a04026 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeGraphNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java @@ -1,20 +1,22 @@ -package dev.compactmods.machines.upgrade.graph; +package dev.compactmods.machines.room.upgrade.graph; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.resources.ResourceLocation; public record RoomUpgradeGraphNode(ResourceLocation key) implements IGraphNode { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("dev/compactmods/machines/api/upgrade").forGetter(RoomUpgradeGraphNode::key) + ResourceLocation.CODEC.fieldOf("upgrade").forGetter(RoomUpgradeGraphNode::key) ).apply(i, RoomUpgradeGraphNode::new)); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public IGraphNodeType getType() { - return Graph.ROOM_UPGRADE_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java index 6c07ae7a..11e761e4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java @@ -16,6 +16,6 @@ public record BaseTunnelWallData(LevelBlockPosition connection, ResourceLocation ).apply(i, BaseTunnelWallData::new)); public TunnelDefinition tunnel() { - return Tunnels.getDefinition(tunnelType); + return TunnelHelper.getDefinition(tunnelType); } } diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java new file mode 100644 index 00000000..cb397f35 --- /dev/null +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java @@ -0,0 +1,24 @@ +package dev.compactmods.machines.tunnel; + +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + +import java.util.Optional; + +public interface ITunnelItem { + static Optional getDefinition(ItemStack stack) { + CompoundTag defTag = stack.getOrCreateTagElement("definition"); + if (defTag.isEmpty() || !defTag.contains("id")) + return Optional.empty(); + + ResourceLocation defId = new ResourceLocation(defTag.getString("id")); + var defRegistry = TunnelHelper.definitionRegistry(); + if (!defRegistry.containsKey(defId)) + return Optional.empty(); + + TunnelDefinition tunnelReg = defRegistry.get(defId); + return Optional.ofNullable(tunnelReg); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java similarity index 64% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java index f64b1895..ff5d97f7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java @@ -1,8 +1,13 @@ package dev.compactmods.machines.tunnel; +import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; import net.minecraft.core.Direction; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.Optional; import java.util.Set; @@ -10,7 +15,16 @@ public class TunnelHelper { - @Nonnull + public static Registry definitionRegistry() { + return RegistryAccess.builtinCopy().registryOrThrow(CMRegistries.TYPES_REG_KEY); + } + + public static TunnelDefinition getDefinition(ResourceLocation tunnelType) { + final var reg = definitionRegistry(); + return reg.get(tunnelType); + } + + @NotNull public static Direction getNextDirection(Direction in) { return switch (in) { case UP -> Direction.DOWN; @@ -33,4 +47,6 @@ public static Optional getNextDirection(Direction current, Set !used.contains(dir)).findFirst(); } + + } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java similarity index 81% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java index b247e796..ab57692b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.tunnel.client; +import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.TunnelWallEntity; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; @@ -11,7 +11,7 @@ public static void setTunnel(BlockPos position, TunnelDefinition type) { if(level == null) return; Minecraft.getInstance().tell(() -> { - if (level.getBlockEntity(position) instanceof TunnelWallEntity tun) { + if (level.getBlockEntity(position) instanceof ITunnelHolder tun) { try { tun.setTunnelType(type); } catch (Exception e) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java similarity index 53% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java index 2a5b2b03..cc80b785 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java @@ -1,26 +1,24 @@ package dev.compactmods.machines.tunnel.client; -import javax.annotation.Nullable; +import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.TunnelWallEntity; +import dev.compactmods.machines.tunnel.ITunnelItem; import net.minecraft.client.color.block.BlockColor; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.client.color.item.ItemColor; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -public class TunnelColors implements BlockColor { +import java.util.Optional; - @Override - public int getColor(BlockState state, @Nullable BlockAndTintGetter reader, @Nullable BlockPos position, int tintIndex) { +public class TunnelColors { + + public static final BlockColor BLOCK = (state, reader, position, tintIndex) -> { try { if(reader == null || position == null) return TunnelDefinition.NO_INDICATOR_COLOR; BlockEntity tile = reader.getBlockEntity(position); - if (tile instanceof TunnelWallEntity tunnel) { + if (tile instanceof ITunnelHolder tunnel) { TunnelDefinition type = tunnel.getTunnelType(); - switch(tintIndex) { case 0: return type.ringColor(); @@ -36,5 +34,18 @@ public int getColor(BlockState state, @Nullable BlockAndTintGetter reader, @Null catch(Exception ex) { return TunnelDefinition.NO_INDICATOR_COLOR; } - } + }; + + public static final ItemColor ITEM = (stack, tintIndex) -> { + Optional definition = ITunnelItem.getDefinition(stack); + if(definition.isEmpty()) + return 0; + + TunnelDefinition actualDef = definition.get(); + if (tintIndex == 0) { + return actualDef.ringColor(); + } + + return actualDef.indicatorColor(); + }; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java similarity index 79% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java index df858583..261fc938 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java @@ -3,16 +3,16 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; /** * Bridges connection between a tunnel and a given machine side. */ -public record TunnelMachineEdge(Direction side) implements IGraphEdge { +public record TunnelMachineEdge(Direction side) implements IGraphEdge { private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_machine"); public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( @@ -20,6 +20,8 @@ public record TunnelMachineEdge(Direction side) implements IGraphEdge { ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (side, t) -> new TunnelMachineEdge(side))); + public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); + @Override public String toString() { return "TunnelMachineEdge[" + @@ -27,7 +29,7 @@ public String toString() { } @Override - public IGraphEdgeType getEdgeType() { - return GraphEdgeType.TUNNEL_MACHINE; + public IGraphEdgeType getEdgeType() { + return EDGE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java similarity index 70% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java index b301ec01..a883de8d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java @@ -3,10 +3,10 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; @@ -22,6 +22,8 @@ public record TunnelNode(BlockPos position) implements IGraphNode { ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (bpos, type) -> new TunnelNode(bpos))); + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); + @Override public boolean equals(Object obj) { if (obj == this) return true; @@ -42,18 +44,10 @@ public String toString() { @Override public IGraphNodeType getType() { - return Tunnels.TUNNEL_NODE.get(); + return NODE_TYPE; } - public Optional getTunnelSide(TunnelConnectionGraph graph) { - final var g = graph.getGraph(); - return g.adjacentNodes(this).stream() - .filter(CompactMachineNode.class::isInstance) - .map(mn -> g.edgeValue(this, mn)) - .filter(Optional::isPresent) - .map(Optional::get) - .map(TunnelMachineEdge.class::cast) - .map(TunnelMachineEdge::side) - .findFirst(); + public Optional getTunnelSide(RoomTunnelConnections connections) { + return connections.getConnectedSide(position); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java similarity index 76% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java index 7a857752..dae7f2cd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java @@ -3,19 +3,21 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; -public final class TunnelTypeEdge implements IGraphEdge { +public final class TunnelTypeEdge implements IGraphEdge { private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (t) -> new TunnelTypeEdge())); + public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); + public TunnelTypeEdge() { } @@ -35,7 +37,7 @@ public String toString() { } @Override - public @NotNull IGraphEdgeType getEdgeType() { - return GraphEdgeType.TUNNEL_TYPE; + public @NotNull IGraphEdgeType getEdgeType() { + return EDGE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java similarity index 50% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java index 7d3ba372..43500885 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java @@ -5,58 +5,26 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.graph.SimpleGraphNodeType; import net.minecraft.resources.ResourceLocation; -import java.util.Objects; - -public final class TunnelTypeNode implements IGraphNodeType, IGraphNode { +public record TunnelTypeNode(ResourceLocation id) implements IGraphNodeType, IGraphNode { private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( ResourceLocation.CODEC.fieldOf("tunnel_type").forGetter(TunnelTypeNode::id), ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) ).apply(i, (tunn, type) -> new TunnelTypeNode(tunn))); - private final ResourceLocation id; - - public TunnelTypeNode() { - this.id = null; - } - public TunnelTypeNode(ResourceLocation id) { - this.id = id; - } + public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); @Override public Codec codec() { return CODEC; } - public ResourceLocation id() { - return id; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (TunnelTypeNode) obj; - return Objects.equals(this.id, that.id); - } - - @Override - public int hashCode() { - return Objects.hash(id); - } - - @Override - public String toString() { - return "TunnelTypeNode[" + - "id=" + id + ']'; - } - @Override public IGraphNodeType getType() { - return Tunnels.TUNNEL_TYPE_NODE.get(); + return NODE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md rename to common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java b/common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java rename to common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java index 895f56af..469b74db 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java +++ b/common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java @@ -1,6 +1,5 @@ package dev.compactmods.machines.util; -import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; @@ -9,6 +8,7 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -62,14 +62,13 @@ public static AABB getWallBounds(Vec3i size, Vec3 roomCenter, Direction wall) { * @param cubeCenter * @param wallDirection */ - public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Vec3 cubeCenter, Direction wallDirection) { - final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Vec3 cubeCenter, Direction wallDirection, BlockState block) { final var wallBounds = getWallBounds(dimensions, cubeCenter, wallDirection); BlockPos.betweenClosedStream(wallBounds) // .filter(world::isEmptyBlock) .map(BlockPos::immutable) - .forEach(p -> world.setBlock(p, unbreakableWall, 7)); + .forEach(p -> world.setBlock(p, block, 7)); } /** @@ -79,7 +78,7 @@ public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Ve * @param dimensions Internal dimensions of the room. * @param roomCenter */ - public static void generateRoom(LevelAccessor world, Vec3i dimensions, Vec3 roomCenter) { + public static void generateRoom(LevelAccessor world, Vec3i dimensions, Vec3 roomCenter, BlockState block) { AABB floorBlocks = getWallBounds(dimensions, roomCenter, Direction.DOWN); AABB machineInternal = floorBlocks .move(1, 1, 1) @@ -92,7 +91,7 @@ public static void generateRoom(LevelAccessor world, Vec3i dimensions, Vec3 room if (anyAir) { // Generate the walls for(final var dir : Direction.values()) - generateCompactWall(world, dimensions, roomCenter, dir); + generateCompactWall(world, dimensions, roomCenter, dir, block); // Clear out the inside of the room BlockPos.betweenClosedStream(machineInternal) diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java rename to common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java index c25d4c6c..0a75fc7d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java +++ b/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.util; import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.core.LoggingUtil; import net.minecraft.SharedConstants; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; @@ -18,7 +18,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelResource; import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraftforge.fml.loading.FMLEnvironment; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -29,10 +29,10 @@ public class DimensionUtil { + private static final Logger LOG = LoggingUtil.modLog(); + @SuppressWarnings("deprecation") // because we call the forge internal method server#markWorldsDirty public static void createAndRegisterWorldAndDimension(final MinecraftServer server) { - final var map = server.forgeGetWorldMap(); - // get everything we need to create the dimension and the dimension final ServerLevel overworld = server.getLevel(Level.OVERWORLD); @@ -42,7 +42,7 @@ public static void createAndRegisterWorldAndDimension(final MinecraftServer serv final var serverResources = server.getResourceManager(); // only back up dimension.dat in production - if (FMLEnvironment.production && !doLevelFileBackup(server)) return; + if (!doLevelFileBackup(server)) return; var reg = server.registryAccess(); var cmDimType = reg.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY) @@ -126,7 +126,7 @@ public static boolean doLevelFileBackup(MinecraftServer server) { try { Files.copy(levelFile, levelRoot.resolve(timestamp)); } catch (IOException e) { - CompactMachines.LOGGER.error("Failed to backup dimension.dat file before modification; canceling register dim attempt."); + LOG.error("Failed to backup dimension.dat file before modification; canceling register dim attempt."); return false; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/util/MathUtil.java rename to common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java similarity index 74% rename from forge-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java rename to common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java index 7308bf61..c2a9172f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java +++ b/common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.util; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.ICompactMachinesMod; import dev.compactmods.machines.codec.CodecExtensions; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; @@ -10,6 +10,6 @@ public class NbtUtil { public static ChunkPos readChunkPos(Tag tag) { return CodecExtensions.CHUNKPOS.parse(NbtOps.INSTANCE, tag) - .getOrThrow(false, CompactMachines.LOGGER::fatal); + .getOrThrow(false, ICompactMachinesMod.LOGGER::fatal); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java similarity index 57% rename from forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java rename to common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java index 96bab5c1..d7fb1dee 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ b/common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java @@ -3,22 +3,14 @@ import com.mojang.authlib.GameProfile; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.core.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.location.SimpleTeleporter; -import dev.compactmods.machines.room.RoomHelper; -import dev.compactmods.machines.room.network.SyncRoomMetadataPacket; -import net.minecraft.Util; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.network.PacketDistributor; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.Optional; import java.util.UUID; @@ -45,7 +37,7 @@ public static Optional getProfileByUUID(LevelAccessor world, UUID u return Optional.of(profile); } - public static void howDidYouGetThere(@Nonnull ServerPlayer serverPlayer) { + public static void howDidYouGetThere(@NotNull ServerPlayer serverPlayer) { AdvancementTriggers.HOW_DID_YOU_GET_HERE.trigger(serverPlayer); serverPlayer.displayClientMessage( @@ -54,22 +46,6 @@ public static void howDidYouGetThere(@Nonnull ServerPlayer serverPlayer) { ); } - public static void teleportPlayerToRespawnOrOverworld(MinecraftServer serv, @Nonnull ServerPlayer player) { - ServerLevel level = Optional.ofNullable(serv.getLevel(player.getRespawnDimension())).orElse(serv.overworld()); - Vec3 worldPos = Vec3.atCenterOf(level.getSharedSpawnPos()); - - if (player.getRespawnPosition() != null) - worldPos = Vec3.atCenterOf(player.getRespawnPosition()); - - player.changeDimension(level, SimpleTeleporter.to(worldPos)); - - player.getCapability(RoomHelper.CURRENT_ROOM_META).ifPresent(provider -> { - provider.clearCurrent(); - CompactMachinesNet.CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), - new SyncRoomMetadataPacket("", Util.NIL_UUID)); - }); - } - public static Vec2 getLookDirection(Player player) { return new Vec2(player.xRotO, player.yRotO); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java b/common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java similarity index 100% rename from forge-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java rename to common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java b/common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java similarity index 74% rename from forge-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java rename to common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java index a3e2e71f..0ca47201 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java +++ b/common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java @@ -2,8 +2,6 @@ import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour.Properties; - public class BreakableWallBlock extends Block { public BreakableWallBlock(Properties props) { super(props); diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java b/common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java rename to common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java index 2ca5e4e2..f967ba87 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java +++ b/common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.wall; +import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.ChatFormatting; @@ -11,8 +12,8 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; public class ItemBlockWall extends BlockItem { @@ -25,7 +26,7 @@ public ItemBlockWall(Block blockIn, Properties builder) { public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, worldIn, tooltip, flagIn); - if (stack.getItem() == Walls.ITEM_SOLID_WALL.get()) { + if (stack.is(CMTags.SOLID_WALL_ITEMS)) { MutableComponent text; if (Screen.hasShiftDown()) { text = TranslationUtil.tooltip(Tooltips.Details.SOLID_WALL) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 1add72bf..1cea409b 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -40,11 +40,10 @@ sourceSets.test { resources.srcDir("src/test/resources") } -project.evaluationDependsOn(project(":common-api").path) -project.evaluationDependsOn(project(":forge-api").path) repositories { mavenLocal() + mavenCentral() { content { includeGroup("com.aventrix.jnanoid") @@ -76,19 +75,35 @@ val jei_mc_version: String by extra val curios_version: String? by extra jarJar.enable() +val runDepends: List = listOf( + project(":common-api"), + project(":common-main"), + project(":forge-api"), + project(":forge-tunnels") +) + +runDepends.forEach { + project.evaluationDependsOn(it.path) +} dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - implementation(project(":common-api")) - testImplementation(project(":common-api")) + implementation(fg.deobf(project(":common-api"))) + testImplementation(fg.deobf(project(":common-api"))) implementation(project(":forge-api")) testImplementation(project(":forge-api")) + implementation(fg.deobf(project(":common-main"))) + testImplementation(fg.deobf(project(":common-main"))) + implementation(project(":forge-tunnels")) testImplementation(project(":forge-tunnels")) + minecraftLibrary("com.aventrix.jnanoid", "jnanoid", "2.0.0") + jarJar("com.aventrix.jnanoid", "jnanoid", "[2.0.0]") + // JEI if (project.extra.has("jei_version") && project.extra.has("jei_mc_version")) { compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}")) @@ -105,9 +120,6 @@ dependencies { compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")) } - minecraftLibrary("com.aventrix.jnanoid", "jnanoid", "2.0.0") - jarJar("com.aventrix.jnanoid", "jnanoid", "[2.0.0]") - val include_test_mods: String? by project.extra if (!System.getenv().containsKey("CI") && include_test_mods.equals("true")) { // Nicephore - Screenshots and Stuff @@ -152,16 +164,6 @@ dependencies { } } -val runDepends: List = listOf( - project(":common-api"), - project(":forge-api"), - project(":forge-tunnels") -) - -runDepends.forEach { - project.evaluationDependsOn(it.path) -} - minecraft { mappings("parchment", "${parchment_version}-${minecraft_version}") accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java index 630ed26e..75ef4552 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java @@ -1,6 +1,5 @@ -package dev.compactmods.machines.config; +package dev.compactmods.machines; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index d5ea103c..72221abb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -6,13 +6,8 @@ import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; -import dev.compactmods.machines.config.CommonConfig; -import dev.compactmods.machines.config.EnableVanillaRecipesConfigCondition; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.core.UIRegistration; +import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; import dev.compactmods.machines.dimension.Dimension; -import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.data.LootFunctions; @@ -24,15 +19,12 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; -import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.forgespi.language.ModFileScanData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; import org.objectweb.asm.Type; @@ -43,15 +35,13 @@ import java.util.stream.Collectors; @Mod(Constants.MOD_ID) -public class CompactMachines { +public class CompactMachines implements ICompactMachinesMod { /** * @deprecated Switch usages to use api Constants in 1.20, eliminate it here */ @Deprecated(forRemoval = true) public static final String MOD_ID = Constants.MOD_ID; - public static final Logger LOGGER = LogManager.getLogger(); - public static final Marker CONN_MARKER = MarkerManager.getMarker("cm_connections"); public static final Marker ADDON_LIFECYCLE = MarkerManager.getMarker("addons"); public static final CreativeModeTab COMPACT_MACHINES_ITEMS = new CreativeModeTab(Constants.MOD_ID) { @@ -74,8 +64,6 @@ public CompactMachines() { mlCtx.registerConfig(ModConfig.Type.COMMON, CommonConfig.CONFIG); mlCtx.registerConfig(ModConfig.Type.SERVER, ServerConfig.CONFIG); - CraftingHelper.register(EnableVanillaRecipesConfigCondition.Serializer.INSTANCE); - final var bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::registerCapabilities); } @@ -138,11 +126,11 @@ private static void preparePackages() { Tunnels.prepare(); Shrinking.prepare(); - UIRegistration.prepare(); + RoomUserInterfaceRegistration.prepare(); Dimension.prepare(); Rooms.prepare(); MachineRoomUpgrades.prepare(); - Graph.prepare(); + GraphCommon.prepare(); Commands.prepare(); LootFunctions.prepare(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java b/forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java new file mode 100644 index 00000000..6ab32782 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java @@ -0,0 +1,24 @@ +package dev.compactmods.machines; + +import dev.compactmods.machines.graph.DimensionGraphNode; +import dev.compactmods.machines.graph.SimpleGraphNodeType; +import dev.compactmods.machines.machine.graph.CompactMachineNode; +import dev.compactmods.machines.machine.graph.MachineRoomEdge; +import dev.compactmods.machines.room.graph.RoomReferenceNode; +import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; + +public class GraphCommon { + + static { + Registries.NODE_TYPES.register("machine", SimpleGraphNodeType.supplier(CompactMachineNode.CODEC)); + Registries.NODE_TYPES.register("dimension", SimpleGraphNodeType.supplier(DimensionGraphNode.CODEC)); + Registries.NODE_TYPES.register("room", SimpleGraphNodeType.supplier(RoomReferenceNode.CODEC)); + Registries.NODE_TYPES.register("room_upgrade", SimpleGraphNodeType.supplier(RoomUpgradeGraphNode.CODEC)); + + Registries.EDGE_TYPES.register("machine_link", () -> MachineRoomEdge.EDGE_TYPE); + } + + public static void prepare() { + + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java similarity index 63% rename from forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java rename to forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java index e249f4ff..d9a97a7f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ModBusEvents.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java @@ -1,9 +1,10 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.room.network.RoomNetworkHandler; +import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.network.CompactMachinesNet; +import dev.compactmods.machines.network.RoomNetworkHandler; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @@ -13,11 +14,13 @@ public class ModBusEvents { @SubscribeEvent public static void setup(final FMLCommonSetupEvent event) { - CompactMachines.LOGGER.trace("Initializing network handler."); + var logger = LoggingUtil.modLog(); + + logger.trace("Initializing network handler."); CompactMachinesNet.setupMessages(); RoomNetworkHandler.setupMessages(); - CompactMachines.LOGGER.trace("Registering advancement triggers."); + logger.trace("Registering advancement triggers."); AdvancementTriggers.init(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/Registries.java similarity index 89% rename from forge-main/src/main/java/dev/compactmods/machines/core/Registries.java rename to forge-main/src/main/java/dev/compactmods/machines/Registries.java index 6a157367..0ff4dc21 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/Registries.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines; import dev.compactmods.machines.api.core.CMRegistries; import dev.compactmods.machines.api.core.Constants; @@ -21,8 +21,12 @@ import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.RegistryBuilder; import org.jetbrains.annotations.ApiStatus; +import java.util.function.Supplier; + import static dev.compactmods.machines.api.core.Constants.MOD_ID; public class Registries { @@ -49,8 +53,12 @@ public class Registries { @ApiStatus.Internal public static final ResourceKey>> EDGES_REG_KEY = ResourceKey .createRegistryKey(new ResourceLocation(MOD_ID, "graph_edges")); + public static final DeferredRegister> NODE_TYPES = DeferredRegister.create(NODES_REG_KEY, MOD_ID); + public static final Supplier>> NODE_TYPE_REG = NODE_TYPES.makeRegistry(RegistryBuilder::new); + public static final DeferredRegister> EDGE_TYPES = DeferredRegister.create(EDGES_REG_KEY, MOD_ID); + public static final Supplier>> EDGE_TYPE_REG = EDGE_TYPES.makeRegistry(RegistryBuilder::new); // Commands public static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, MOD_ID); diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java b/forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java index 8623d19c..be29c5d8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.config; +package dev.compactmods.machines; import com.electronwill.nightconfig.core.EnumGetMethod; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; @@ -14,8 +14,6 @@ public class ServerConfig { public static ForgeConfigSpec.EnumValue MACHINE_PLAYER_BREAK_HANDLING; - public static ForgeConfigSpec.IntValue MACHINE_FLOOR_Y; - private static ForgeConfigSpec.IntValue REBIND_LEVEL; private static ForgeConfigSpec.IntValue GIVE_MACHINE; private static ForgeConfigSpec.IntValue CHANGE_SPAWN_LEVEL; @@ -49,10 +47,6 @@ private static void generateConfig() { EnumMachinePlayersBreakHandling.UNBREAKABLE, EnumGetMethod.NAME_IGNORECASE); - MACHINE_FLOOR_Y = builder - .comment("The Y-dimension to spawn machine floors at.") - .defineInRange("floor", 40, 10, 200); - ALLOWED_OUTSIDE_MACHINE = builder .comment("Specify if we want to damage player's that managed to escape the boundries") .comment("default: false") diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java index b3b53cca..89878e42 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/ServerEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java @@ -1,11 +1,12 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; +import dev.compactmods.machines.room.ForgeCompactRoomProvider; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.upgrade.RoomUpgradeManager; +import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; import net.minecraft.server.level.ServerLevel; @@ -27,8 +28,8 @@ public class ServerEventHandler { @SubscribeEvent public static void onServerStarted(final ServerStartedEvent started) { CompactMachines.getAddons().forEach(addon -> { - addon.acceptRoomSpawnLookup(CompactRoomProvider::instance); - addon.acceptRoomOwnerLookup(CompactRoomProvider::instance); + addon.acceptRoomSpawnLookup(ForgeCompactRoomProvider::instance); + addon.acceptRoomOwnerLookup(ForgeCompactRoomProvider::instance); }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java deleted file mode 100644 index 1384fa36..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java +++ /dev/null @@ -1,39 +0,0 @@ -package dev.compactmods.machines.advancement; - -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; -import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.core.Advancements; -import dev.compactmods.machines.api.room.RoomSize; -import net.minecraft.advancements.CriteriaTriggers; - -public class AdvancementTriggers { - - public static final BasicPlayerAdvTrigger RECURSIVE_ROOMS = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.RECURSIVE_ROOMS)); - - public static final HowDidYouGetHereTrigger HOW_DID_YOU_GET_HERE = CriteriaTriggers.register(new HowDidYouGetHereTrigger()); - - public static final BasicPlayerAdvTrigger CLAIMED_TINY = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_TINY_MACHINE)); - public static final BasicPlayerAdvTrigger CLAIMED_SMALL = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_SMALL_MACHINE)); - public static final BasicPlayerAdvTrigger CLAIMED_NORMAL = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_NORMAL_MACHINE)); - public static final BasicPlayerAdvTrigger CLAIMED_LARGE = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_LARGE_MACHINE)); - public static final BasicPlayerAdvTrigger CLAIMED_GIANT = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_GIANT_MACHINE)); - public static final BasicPlayerAdvTrigger CLAIMED_MAX = CriteriaTriggers.register(new BasicPlayerAdvTrigger(Advancements.CLAIMED_MAX_MACHINE)); - - public static void init() { - CompactMachines.LOGGER.trace("Registering advancement triggers."); - } - - public static BasicPlayerAdvTrigger getTriggerForMachineClaim(RoomSize machineSize) { - switch (machineSize) { - case TINY: return CLAIMED_TINY; - case SMALL: return CLAIMED_SMALL; - case NORMAL: return CLAIMED_NORMAL; - case LARGE: return CLAIMED_LARGE; - case GIANT: return CLAIMED_GIANT; - case MAXIMUM: return CLAIMED_MAX; - } - - return CLAIMED_TINY; - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java b/forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java rename to forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java index 00d48510..12195f67 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/shader/CM4Shaders.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.client.shader; +package dev.compactmods.machines.client; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import net.minecraft.client.renderer.ShaderInstance; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java index 03a12d8b..14c2a50e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java @@ -2,13 +2,12 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.compat.curios.CuriosCompat; -import dev.compactmods.machines.core.UIRegistration; -import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.client.MachineColors; -import dev.compactmods.machines.room.client.MachineRoomScreen; +import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; +import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.room.ui.MachineRoomScreen; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.client.TunnelColors; -import dev.compactmods.machines.tunnel.client.TunnelItemColor; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; @@ -23,20 +22,20 @@ public class ClientEventHandler { @SubscribeEvent public static void onItemColors(final RegisterColorHandlersEvent.Item colors) { - colors.register(new TunnelItemColor(), Tunnels.ITEM_TUNNEL.get()); + colors.register(TunnelColors.ITEM, Tunnels.ITEM_TUNNEL.get()); colors.register(MachineColors.ITEM, Machines.BOUND_MACHINE_BLOCK_ITEM.get()); colors.register(MachineColors.ITEM, Machines.UNBOUND_MACHINE_BLOCK_ITEM.get()); } @SubscribeEvent public static void onBlockColors(final RegisterColorHandlersEvent.Block colors) { - colors.register(new TunnelColors(), Tunnels.BLOCK_TUNNEL_WALL.get()); + colors.register(TunnelColors.BLOCK, Tunnels.BLOCK_TUNNEL_WALL.get()); colors.register(MachineColors.BLOCK, Machines.MACHINE_BLOCK.get()); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent client) { - MenuScreens.register(UIRegistration.MACHINE_MENU.get(), MachineRoomScreen::new); + MenuScreens.register(RoomUserInterfaceRegistration.MACHINE_MENU.get(), MachineRoomScreen::new); } @SubscribeEvent diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java index f542184d..3471bc15 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java @@ -1,7 +1,11 @@ package dev.compactmods.machines.client.level; import net.minecraft.client.Minecraft; -import net.minecraft.core.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.data.BuiltinRegistries; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; @@ -27,8 +31,8 @@ import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.ticks.BlackholeTickAccess; import net.minecraft.world.ticks.LevelTickAccess; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java index b96442fc..57aa4980 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java @@ -1,28 +1,19 @@ package dev.compactmods.machines.client.level; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.advancement.GenericAdvancementTriggerListener; import net.minecraft.core.BlockPos; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; -import net.minecraft.world.level.block.entity.TickingBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.EmptyLevelChunk; -import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.ticks.TickContainerAccess; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.function.Predicate; @@ -75,9 +66,9 @@ public void tick() { this.tickers.forEach((pos, ticker) -> ticker.tick(this.getLevel(), pos, getBlockState(pos), tiles.get(pos))); } - @Nonnull + @NotNull @Override - public BlockState getBlockState(@Nonnull BlockPos pos) { + public BlockState getBlockState(@NotNull BlockPos pos) { if (shouldShow.test(pos)) { var state = blocksInChunk.get(pos); if (state != null) @@ -87,16 +78,16 @@ public BlockState getBlockState(@Nonnull BlockPos pos) { return Blocks.VOID_AIR.defaultBlockState(); } - @Nonnull + @NotNull @Override - public FluidState getFluidState(@Nonnull BlockPos pos) { + public FluidState getFluidState(@NotNull BlockPos pos) { return getBlockState(pos).getFluidState(); } @Nullable @Override - public BlockEntity getBlockEntity(@Nonnull BlockPos pos, @Nonnull EntityCreationType creationMode) { + public BlockEntity getBlockEntity(@NotNull BlockPos pos, @NotNull EntityCreationType creationMode) { if (!shouldShow.test(pos)) return null; return tiles.get(pos); diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java index e7492524..17fa028a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java @@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.chunk.ChunkStatus; @@ -12,9 +11,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.lighting.LevelLightEngine; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -65,7 +63,7 @@ public Stream chunks() { @Nullable @Override - public ChunkAccess getChunk(int chunkX, int chunkZ, @Nonnull ChunkStatus requiredStatus, boolean load) + public ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus requiredStatus, boolean load) { return chunks.computeIfAbsent(new ChunkPos(chunkX, chunkZ), p -> { return new EmptyLevelChunk(world, p, world.getUncachedNoiseBiome(0, 0, 0)); @@ -77,7 +75,7 @@ public void tick(BooleanSupplier p_202162_, boolean p_202163_) { } - @Nonnull + @NotNull @Override public String gatherStats() { @@ -90,14 +88,14 @@ public int getLoadedChunksCount() return 0; } - @Nonnull + @NotNull @Override public LevelLightEngine getLightEngine() { return lightManager; } - @Nonnull + @NotNull @Override public BlockGetter getLevel() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java index ead7c6a7..2f4ce687 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java +++ b/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java @@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormatElement; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.shader.CM4Shaders; +import dev.compactmods.machines.client.CM4Shaders; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java b/forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java similarity index 56% rename from forge-main/src/main/java/dev/compactmods/machines/command/Commands.java rename to forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java index 80b497a3..bce5b7a0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/Commands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java @@ -1,55 +1,46 @@ package dev.compactmods.machines.command; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.command.data.CMDataSubcommand; import dev.compactmods.machines.command.subcommand.CMEjectSubcommand; import dev.compactmods.machines.command.subcommand.CMGiveMachineSubcommand; import dev.compactmods.machines.command.subcommand.CMReaddDimensionSubcommand; import dev.compactmods.machines.command.subcommand.CMRebindSubcommand; +import dev.compactmods.machines.command.subcommand.CMRoomUpgradeCommand; import dev.compactmods.machines.command.subcommand.CMRoomsSubcommand; import dev.compactmods.machines.command.subcommand.CMSummarySubcommand; import dev.compactmods.machines.command.subcommand.CMUnbindSubcommand; import dev.compactmods.machines.command.subcommand.SpawnSubcommand; -import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.upgrade.command.CMRoomUpgradeCommand; -import dev.compactmods.machines.upgrade.command.RoomUpgradeArgument; -import net.minecraft.commands.CommandSourceStack; +import dev.compactmods.machines.Registries; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.commands.synchronization.SingletonArgumentInfo; import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -@Mod.EventBusSubscriber(modid = Constants.MOD_ID) -public class Commands { +import static dev.compactmods.machines.command.Commands.CM_COMMAND_ROOT; - // TODO: /cm create - // TODO: /cm spawn set +@Mod.EventBusSubscriber(modid = Constants.MOD_ID) +public class ForgeCommands { static { Registries.COMMAND_ARGUMENT_TYPES.register("room_upgrade", () -> ArgumentTypeInfos.registerByClass(RoomUpgradeArgument.class, SingletonArgumentInfo.contextFree(RoomUpgradeArgument::upgrade))); + + CM_COMMAND_ROOT.then(CMEjectSubcommand.make()); + CM_COMMAND_ROOT.then(CMSummarySubcommand.make()); + CM_COMMAND_ROOT.then(CMRebindSubcommand.make()); + CM_COMMAND_ROOT.then(CMUnbindSubcommand.make()); + CM_COMMAND_ROOT.then(CMReaddDimensionSubcommand.make()); + CM_COMMAND_ROOT.then(CMRoomsSubcommand.make()); + CM_COMMAND_ROOT.then(CMDataSubcommand.make()); + CM_COMMAND_ROOT.then(CMGiveMachineSubcommand.make()); + CM_COMMAND_ROOT.then(SpawnSubcommand.make()); + CM_COMMAND_ROOT.then(CMRoomUpgradeCommand.make()); } @SubscribeEvent public static void onCommandsRegister(final RegisterCommandsEvent event) { - final LiteralArgumentBuilder root = LiteralArgumentBuilder.literal(Constants.MOD_ID); - root.then(CMEjectSubcommand.make()); - root.then(CMSummarySubcommand.make()); - root.then(CMRebindSubcommand.make()); - root.then(CMUnbindSubcommand.make()); - root.then(CMReaddDimensionSubcommand.make()); - root.then(CMRoomsSubcommand.make()); - root.then(CMDataSubcommand.make()); - root.then(CMGiveMachineSubcommand.make()); - root.then(SpawnSubcommand.make()); - root.then(CMRoomUpgradeCommand.make()); - - event.getDispatcher().register(root); - } - - public static void prepare() { - + event.getDispatcher().register(Commands.getRoot()); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java rename to forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java index 36fc1e21..08dd3d15 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade.command; +package dev.compactmods.machines.command; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -25,7 +25,7 @@ public class RoomUpgradeArgument extends ResourceKeyArgument { TranslationUtil.command(CMCommands.WRONG_DIMENSION)); private RoomUpgradeArgument() { - super(MachineRoomUpgrades.REGISTRY.get().getRegistryKey()); + super(Rooms.ROOM_UPGRADES_REG_KEY); } public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index 797c135d..b148c935 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -2,23 +2,26 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.util.CsvOutput; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; public class CMMachineDataExportCommand { + private static final Logger LOGGER = LoggingUtil.modLog(); + public static ArgumentBuilder makeMachineCsv() { return Commands.literal("machines") .requires(cs -> cs.hasPermission(2)) @@ -51,7 +54,7 @@ private static int execAll(CommandContext ctx) { writer.close(); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); return -1; } @@ -59,14 +62,14 @@ private static int execAll(CommandContext ctx) { return 0; } - @Nonnull + @NotNull private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { return CsvOutput.builder() .addColumn("dim") .addColumn("machine_x") .addColumn("machine_y") .addColumn("machine_z") - .addColumn("dev/compactmods/machines/api/room") + .addColumn("room") .build(writer); } @@ -82,7 +85,7 @@ private static void writeMachine(IDimensionalBlockPosition machine, String room, room ); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java index 986598da..0dc0f162 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java @@ -2,12 +2,12 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; @@ -15,14 +15,17 @@ import net.minecraft.core.Vec3i; import net.minecraft.util.CsvOutput; import net.minecraft.world.phys.Vec3; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; public class CMRoomDataExportCommand { + private static final Logger LOGGER = LoggingUtil.modLog(); + public static ArgumentBuilder makeRoomCsv() { return Commands.literal("rooms") .requires(cs -> cs.hasPermission(2)) @@ -47,7 +50,7 @@ private static int execAll(CommandContext ctx) { writer.close(); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); return -1; } @@ -55,10 +58,10 @@ private static int execAll(CommandContext ctx) { return 0; } - @Nonnull + @NotNull private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { return CsvOutput.builder() - .addColumn("dev/compactmods/machines/api/room") + .addColumn("room") .addColumn("owner_uuid") .addColumn("size_x") .addColumn("size_y") @@ -81,7 +84,7 @@ private static void writeRoom(CsvOutput builder, IRoomRegistration room, IRoomOw spawn.x, spawn.y, spawn.z ); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java index d4a9c93d..d1e67ec4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java @@ -4,11 +4,11 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; @@ -17,20 +17,23 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.CsvOutput; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; public class CMTunnelDataExportCommand { + private static final Logger LOGGER = LoggingUtil.modLog(); + public static ArgumentBuilder makeTunnelCsv() { var chunk = Commands - .argument("dev/compactmods/machines/api/room", StringArgumentType.string()) + .argument("room", StringArgumentType.string()) .executes(CMTunnelDataExportCommand::exec); - return Commands.literal("dev/compactmods/machines/api/tunnels") + return Commands.literal("tunnels") .requires(cs -> cs.hasPermission(Commands.LEVEL_GAMEMASTERS)) .executes(CMTunnelDataExportCommand::execAll) .then(chunk); @@ -57,13 +60,13 @@ private static int execAll(CommandContext ctx) { try { writeRoomTunnels(compactDim, room.code(), builder); } catch (MissingDimensionException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); } }); writer.close(); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); return -1; } @@ -78,7 +81,7 @@ public static int exec(CommandContext ctx) throws CommandSyn var src = ctx.getSource(); ServerPlayer player = src.getPlayerOrException(); - final var room = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); + final var room = StringArgumentType.getString(ctx, "room"); final var compactDim = src.getServer().getLevel(CompactDimension.LEVEL_KEY); var outdir = src.getServer().getFile(Constants.MOD_ID); @@ -95,17 +98,17 @@ public static int exec(CommandContext ctx) throws CommandSyn writer.close(); } catch (IOException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); return -1; } catch (MissingDimensionException e) { - CompactMachines.LOGGER.error(e); + LOGGER.error(e); } return 0; } - @Nonnull + @NotNull private static CsvOutput makeTunnelCsvOut(BufferedWriter writer) throws IOException { return CsvOutput.builder() .addColumn("type") @@ -127,7 +130,7 @@ private static void writeRoomTunnels(ServerLevel compactDim, String roomCode, Cs info.machine() ); } catch (IOException e) { - CompactMachines.LOGGER.warn("Error writing tunnel record.", e); + LOGGER.warn("Error writing tunnel record.", e); } }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java index 53abb877..428529a2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java @@ -4,9 +4,9 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.room.capability.RoomCapabilities; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.util.PlayerUtil; +import dev.compactmods.machines.util.ForgePlayerUtil; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; @@ -25,7 +25,7 @@ private static int execSpecificPlayer(CommandContext ctx) th Collection ent = EntityArgument.getPlayers(ctx, "player"); ent.forEach(player -> { player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(IRoomHistory::clear); - PlayerUtil.teleportPlayerToRespawnOrOverworld(ctx.getSource().getServer(), player); + ForgePlayerUtil.teleportPlayerToRespawnOrOverworld(ctx.getSource().getServer(), player); }); return 0; @@ -35,7 +35,7 @@ private static int execExecutingPlayer(CommandContext ctx) t final ServerPlayer player = ctx.getSource().getPlayerOrException(); player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(IRoomHistory::clear); - PlayerUtil.teleportPlayerToRespawnOrOverworld(ctx.getSource().getServer(), player); + ForgePlayerUtil.teleportPlayerToRespawnOrOverworld(ctx.getSource().getServer(), player); return 0; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java index a664afa0..f50ccd5c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java @@ -4,10 +4,10 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.room.graph.CompactRoomProvider; @@ -15,15 +15,18 @@ import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.world.item.ItemStack; +import org.apache.logging.log4j.Logger; public class CMGiveMachineSubcommand { + private static final Logger LOGGER = LoggingUtil.modLog(); + public static LiteralArgumentBuilder make() { final var subRoot = Commands.literal("give") .requires(cs -> cs.hasPermission(ServerConfig.giveMachineLevel())); subRoot.then(Commands.argument("player", EntityArgument.player()) - .then(Commands.argument("dev/compactmods/machines/api/room", StringArgumentType.string()) + .then(Commands.argument("room", StringArgumentType.string()) .executes(CMGiveMachineSubcommand::giveMachine))); return subRoot; @@ -32,7 +35,7 @@ public static LiteralArgumentBuilder make() { private static int giveMachine(CommandContext ctx) throws CommandSyntaxException { final var src = ctx.getSource(); final var player = EntityArgument.getPlayer(ctx, "player"); - final var roomCode = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); + final var roomCode = StringArgumentType.getString(ctx, "room"); var roomProvider = CompactRoomProvider.instance(src.getServer()); roomProvider.forRoom(roomCode).ifPresentOrElse(room -> { @@ -43,7 +46,7 @@ private static int giveMachine(CommandContext ctx) throws Co src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_GIVEN, player.getDisplayName()), true); } }, () -> { - CompactMachines.LOGGER.error("Error giving player a new machine block: room not found."); + LOGGER.error("Error giving player a new machine block: room not found."); src.sendFailure(TranslationUtil.message(Messages.UNKNOWN_ROOM_CHUNK, roomCode)); }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java index b2eeecb1..76d700c0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java similarity index 89% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java index cfff446b..976dd8f1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/command/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade.command; +package dev.compactmods.machines.command.subcommand; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; @@ -6,22 +6,24 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.command.RoomUpgradeArgument; +import dev.compactmods.machines.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.upgrade.RoomUpgradeManager; +import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; import net.minecraft.world.level.ChunkPos; public class CMRoomUpgradeCommand { + public static ArgumentBuilder make() { final var root = Commands.literal("upgrades") .requires(cs -> cs.hasPermission(ServerConfig.changeUpgrades())); final var addRoot = Commands.literal("add"); - final var addUpgRoot = Commands.argument("dev/compactmods/machines/api/upgrade", RoomUpgradeArgument.upgrade()) + final var addUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) .executes(CMRoomUpgradeCommand::addToCurrentRoom); @@ -31,7 +33,7 @@ public class CMRoomUpgradeCommand { root.then(addRoot); final var remRoot = Commands.literal("remove"); - final var remUpgRoot = Commands.argument("dev/compactmods/machines/api/upgrade", RoomUpgradeArgument.upgrade()) + final var remUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) .suggests(RoomUpgradeArgument.SUGGESTOR) .executes(CMRoomUpgradeCommand::removeFromCurrentRoom); @@ -51,7 +53,7 @@ private static int addToCurrentRoom(CommandContext ctx) thro if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; - final var upg = RoomUpgradeArgument.getUpgrade(ctx, "dev/compactmods/machines/api/upgrade"); + final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); if (upg.isEmpty()) return -1; @@ -99,7 +101,7 @@ private static int removeFromCurrentRoom(CommandContext ctx) if (!compactDim.dimension().equals(CompactDimension.LEVEL_KEY)) return -1; - final var upg = RoomUpgradeArgument.getUpgrade(ctx, "dev/compactmods/machines/api/upgrade"); + final var upg = RoomUpgradeArgument.getUpgrade(ctx, "upgrade"); if (upg.isEmpty()) return -1; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java index 7206cf51..2bec977a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java @@ -6,7 +6,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java index 1a9a4248..c1401560 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java @@ -7,7 +7,7 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; @@ -21,7 +21,7 @@ public class SpawnSubcommand { final var resetSpawn = Commands.literal("reset") .requires(cs -> cs.hasPermission(ServerConfig.changeRoomSpawn())) - .then(Commands.argument("dev/compactmods/machines/api/room", StringArgumentType.string()) + .then(Commands.argument("room", StringArgumentType.string()) .executes(SpawnSubcommand::resetRoomSpawn)); spawnRoot.then(resetSpawn); @@ -32,7 +32,7 @@ public class SpawnSubcommand { private static int resetRoomSpawn(CommandContext ctx) { final var src = ctx.getSource(); final var serv = src.getServer(); - final var roomCode = StringArgumentType.getString(ctx, "dev/compactmods/machines/api/room"); + final var roomCode = StringArgumentType.getString(ctx, "room"); try { final var compactDim = CompactDimension.forServer(serv); diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java index 74257e1c..c64f843c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java @@ -34,7 +34,7 @@ public class CompactMachineProvider implements IProbeInfoProvider { @Override public ResourceLocation getID() { - return new ResourceLocation(Constants.MOD_ID, "dev/compactmods/machines/api/machine"); + return new ResourceLocation(Constants.MOD_ID, "machine"); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java b/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java deleted file mode 100644 index 6e922b7c..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/config/EnableVanillaRecipesConfigCondition.java +++ /dev/null @@ -1,41 +0,0 @@ -package dev.compactmods.machines.config; - -import com.google.gson.JsonObject; -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import net.minecraftforge.common.crafting.conditions.IConditionSerializer; - -public class EnableVanillaRecipesConfigCondition implements ICondition { - - public static final ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "config_enable_vanilla_recipes"); - - @Override - public ResourceLocation getID() { - return ID; - } - - @Override - public boolean test(IContext ctx) { - return CommonConfig.ENABLE_VANILLA_RECIPES.get(); - } - - public static class Serializer implements IConditionSerializer { - - public static final Serializer INSTANCE = new Serializer(); - - @Override - public void write(JsonObject json, EnableVanillaRecipesConfigCondition value) { - } - - @Override - public EnableVanillaRecipesConfigCondition read(JsonObject json) { - return new EnableVanillaRecipesConfigCondition(); - } - - @Override - public ResourceLocation getID() { - return EnableVanillaRecipesConfigCondition.ID; - } - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java index 0387ce45..46f9d8ce 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java @@ -8,6 +8,7 @@ import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; @@ -23,6 +24,8 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.io.IOException; @@ -33,6 +36,8 @@ public class AdvancementGenerator implements DataProvider { + private static final Logger LOGGER = LoggingUtil.modLog(); + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final DataGenerator generator; @@ -41,7 +46,7 @@ public AdvancementGenerator(DataGenerator gen) { } @Override - public void run(@Nonnull CachedOutput cache) { + public void run(@NotNull CachedOutput cache) { Path path = this.generator.getOutputFolder(); Set set = Sets.newHashSet(); Consumer consumer = (adv) -> { @@ -53,7 +58,7 @@ public void run(@Nonnull CachedOutput cache) { try { DataProvider.saveStable(cache, adv.deconstruct().serializeToJson(), path1); } catch (IOException ioexception) { - CompactMachines.LOGGER.error("Couldn't save advancement {}", path1, ioexception); + LOGGER.error("Couldn't save advancement {}", path1, ioexception); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java index 652475a9..5a832d0c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java index c806b75e..69cb4455 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java @@ -2,7 +2,6 @@ import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Dynamic; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import net.minecraft.SharedConstants; import net.minecraft.Util; @@ -16,6 +15,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.storage.LevelStorageSource; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.io.IOException; import java.nio.file.Files; @@ -24,7 +25,7 @@ import java.util.Set; public class EarlyLevelDataFileReader { - + private final Logger LOG = LogManager.getLogger(); private final LevelStorageSource.LevelDirectory directory; private static final ImmutableSet> DEFAULT_LEVELS = ImmutableSet.of(Level.OVERWORLD, Level.NETHER, Level.END, CompactDimension.LEVEL_KEY); public EarlyLevelDataFileReader(LevelStorageSource.LevelDirectory directory) { @@ -52,7 +53,7 @@ private Path makeSafeFile(String backupName) throws IOException { } public Set> dimensions() { - CompactMachines.LOGGER.info("Starting dimension read from level files."); + LOG.info("Starting dimension read from level files."); try { final var tempFile = makeSafeFile("cm5_early_dimensions.dat"); final var dataFixer = DataFixers.getDataFixer(); @@ -64,15 +65,15 @@ public Set> dimensions() { final var updatedData = dataFixer.update(References.WORLD_GEN_SETTINGS, dynamic, savedLevelVersion, SharedConstants.getCurrentVersion().getWorldVersion()); final var levels = WorldGenSettings.CODEC.parse(updatedData) - .resultOrPartial(Util.prefix("CM5-EarlyLevelReader: ", CompactMachines.LOGGER::error)) + .resultOrPartial(Util.prefix("CM5-EarlyLevelReader: ", LOG::error)) .map(WorldGenSettings::levels) .orElse(DEFAULT_LEVELS); Files.deleteIfExists(tempFile); - CompactMachines.LOGGER.info("Completed dimension read from level files."); + LOG.info("Completed dimension read from level files."); return levels; } catch (IOException e) { - CompactMachines.LOGGER.fatal("Failed to make a safe level file backup to read dimension info!"); + LOG.fatal("Failed to make a safe level file backup to read dimension info!"); return DEFAULT_LEVELS; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java index 6f6ecf4c..35b9fa24 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java @@ -125,12 +125,12 @@ public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory level .forEach(machConnTag -> { // Loop machine-room connection info, replace room pos with room code if (machConnTag instanceof CompoundTag ct) { - final var oldChunk = ct.getIntArray("dev/compactmods/machines/api/room"); + final var oldChunk = ct.getIntArray("room"); final var oldRoomPos = new ChunkPos(oldChunk[0], oldChunk[1]); if (roomChunkLookup.containsKey(oldRoomPos)) { final var newCode = roomChunkLookup.get(oldRoomPos); - ct.remove("dev/compactmods/machines/api/room"); - ct.putString("dev/compactmods/machines/api/room", newCode); + ct.remove("room"); + ct.putString("room", newCode); UPDATER_LOGGER.debug(UPDATER, "Assigning new code to room {}; code: {}", oldRoomPos.toString(), newCode); } } @@ -144,7 +144,7 @@ public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory level public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDirectory, HashMap roomChunkLookup, Path backupDir) throws IOException { - Files.createDirectories(backupDir.resolve("dev/compactmods/machines/api/tunnels")); + Files.createDirectories(backupDir.resolve("tunnels")); final var dataStore = CompactDimension.getDataStorage(levelDirectory); for(final var room : roomChunkLookup.entrySet()) { @@ -153,7 +153,7 @@ public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDir final var newFile = dataStore.getDataFile(TunnelConnectionGraph.getDataFilename(room.getValue())); if(oldFile.exists()) { final var oldFilePath = oldFile.toPath(); - Files.copy(oldFilePath, backupDir.resolve("dev/compactmods/machines/api/tunnels").resolve(prevFilename + ".dat.backup")); + Files.copy(oldFilePath, backupDir.resolve("tunnels").resolve(prevFilename + ".dat.backup")); Files.copy(oldFilePath, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.delete(oldFilePath); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java index 8f915e9a..a5e629ad 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.dimension; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java rename to forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java index 5dc74a9f..4ad816b9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/location/SimpleTeleporter.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.location; +package dev.compactmods.machines.dimension; import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java index 26cfc4b0..51f7f77b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java @@ -1,8 +1,9 @@ package dev.compactmods.machines.dimension; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.room.capability.RoomCapabilities; +import dev.compactmods.machines.util.ForgePlayerUtil; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; @@ -42,7 +43,7 @@ public void entityInside(BlockState pState, Level pLevel, BlockPos pPos, Entity PlayerUtil.howDidYouGetThere(player); player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(IRoomHistory::clear); - PlayerUtil.teleportPlayerToRespawnOrOverworld(player.server, player); + ForgePlayerUtil.teleportPlayerToRespawnOrOverworld(player.server, player); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java b/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java deleted file mode 100644 index f8890a5b..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/Graph.java +++ /dev/null @@ -1,41 +0,0 @@ -package dev.compactmods.machines.graph; - -import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.room.graph.RoomReferenceNode; -import dev.compactmods.machines.upgrade.graph.RoomUpgradeGraphNode; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.RegistryBuilder; -import net.minecraftforge.registries.RegistryObject; - -import java.util.function.Supplier; - -public class Graph { - - public static final Supplier>> NODE_TYPE_REG = Registries.NODE_TYPES.makeRegistry(RegistryBuilder::new); - public static final Supplier>> EDGE_TYPE_REG = Registries.EDGE_TYPES.makeRegistry(RegistryBuilder::new); - - - public static final RegistryObject> MACH_NODE = Registries.NODE_TYPES - .register("dev/compactmods/machines/api/machine", SimpleGraphNodeType.instance(CompactMachineNode.CODEC)); - public static final RegistryObject> DIM_NODE = Registries.NODE_TYPES - .register("dev/compactmods/machines/api/dimension", SimpleGraphNodeType.instance(DimensionGraphNode.CODEC)); - public static final RegistryObject> ROOM_REFERENCE_NODE = Registries.NODE_TYPES - .register("dev/compactmods/machines/api/room", SimpleGraphNodeType.instance(RoomReferenceNode.CODEC)); - - public static final RegistryObject> ROOM_UPGRADE_NODE = Registries.NODE_TYPES - .register("room_upgrade", SimpleGraphNodeType.instance(RoomUpgradeGraphNode.CODEC)); - - - - - public static final RegistryObject> MACHINE_LINK = Registries.EDGE_TYPES.register("machine_link", () -> GraphEdgeType.MACHINE_LINK); - - // Tunnel edges - public static final RegistryObject> TUNNEL_TYPE = Registries.EDGE_TYPES.register("tunnel_type", () -> GraphEdgeType.TUNNEL_TYPE); - public static final RegistryObject> TUNNEL_MACHINE_LINK = Registries.EDGE_TYPES.register("tunnel_machine", () -> GraphEdgeType.TUNNEL_MACHINE); - - public static void prepare() { - - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java b/forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java deleted file mode 100644 index 73209160..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/graph/GraphEdgeType.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.machine.graph.MachineRoomEdge; -import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; -import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; -import dev.compactmods.machines.upgrade.graph.RoomUpgradeConnection; - -public enum GraphEdgeType implements IGraphEdgeType { - TUNNEL_TYPE(TunnelTypeEdge.CODEC), - MACHINE_LINK(MachineRoomEdge.CODEC), - TUNNEL_MACHINE(TunnelMachineEdge.CODEC), - ROOM_UPGRADE(RoomUpgradeConnection.CODEC); - - private final Codec codec; - - @SuppressWarnings("unchecked") - GraphEdgeType(Codec codec) { - this.codec = (Codec) codec; - } - - @Override - public Codec codec() { - return codec; - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java index 04f981f8..84be0be3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java @@ -1,8 +1,9 @@ package dev.compactmods.machines.machine; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.api.machine.MachineIds; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.machine.block.CompactMachineBlock; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; @@ -45,7 +46,7 @@ public class Machines { public static final RegistryObject MACHINE_BLOCK_MAXIMUM = Registries.BLOCKS.register("machine_maximum", () -> new LegacySizedCompactMachineBlock(RoomSize.MAXIMUM, MACHINE_BLOCK_PROPS)); - public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("dev/compactmods/machines/api/machine", () -> + public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("machine", () -> new CompactMachineBlock(MACHINE_BLOCK_PROPS)); public static final RegistryObject MACHINE_BLOCK_ITEM_TINY = Registries.ITEMS.register("machine_tiny", @@ -66,14 +67,14 @@ public class Machines { public static final RegistryObject MACHINE_BLOCK_ITEM_MAXIMUM = Registries.ITEMS.register("machine_maximum", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); - public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("dev/compactmods/machines/api/machine", + public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("machine", () -> new BoundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); public static final RegistryObject UNBOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("new_machine", () -> new UnboundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); - public static final RegistryObject> MACHINE_TILE_ENTITY = Registries.BLOCK_ENTITIES.register("compact_machine", () -> + public static final RegistryObject> MACHINE_TILE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.BLOCK_ENTITY.getPath(), () -> BlockEntityType.Builder.of(CompactMachineBlockEntity::new, MACHINE_BLOCK.get(), MACHINE_BLOCK_TINY.get(), MACHINE_BLOCK_SMALL.get(), MACHINE_BLOCK_NORMAL.get(), diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java index 94eb042a..4e173675 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java @@ -23,10 +23,9 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.stream.Collectors; /** @@ -47,7 +46,7 @@ public CompactMachineBlock(Properties props) { // client-side @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) { + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity be) { return be.basicRoomInfo() .map(BoundCompactMachineItem::createForRoom) @@ -64,7 +63,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder tabItems) { + public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList tabItems) { var reg = RoomHelper.getTemplates(); // todo - fix ordering tabItems.addAll(reg.entrySet() @@ -81,14 +80,14 @@ public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable L @Nullable @Override - public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { + public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { return new CompactMachineBlockEntity(pos, state); } - @Nonnull + @NotNull @Override @SuppressWarnings("deprecation") - public InteractionResult use(@Nonnull BlockState state, Level level, @Nonnull BlockPos pos, Player player, @Nonnull InteractionHand hand, @Nonnull BlockHitResult hitResult) { + public InteractionResult use(@NotNull BlockState state, Level level, @NotNull BlockPos pos, Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult hitResult) { MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java index f938b5e1..14d973c6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java @@ -3,6 +3,8 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.machine.IMachineBlockEntity; +import dev.compactmods.machines.api.machine.MachineEntityNbt; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; @@ -38,17 +40,17 @@ import java.util.UUID; import java.util.stream.Stream; -public class CompactMachineBlockEntity extends BlockEntity { +public class CompactMachineBlockEntity extends BlockEntity implements IMachineBlockEntity { /** * @deprecated Store a room code instead or use room lookup utils */ @Deprecated(forRemoval = true, since = "5.2.0") public static final String NBT_ROOM_POS = "room_pos"; - public static final String NBT_ROOM_CODE = "room_code"; - public static final String NBT_CUSTOM_COLOR = "machine_color"; - public static final String NBT_TEMPLATE_ID = "template_id"; - private static final String NBT_ROOM_COLOR = "room_color"; + private static final String NBT_ROOM_CODE = MachineEntityNbt.NBT_ROOM_CODE; + private static final String NBT_CUSTOM_COLOR = MachineEntityNbt.NBT_CUSTOM_COLOR; + private static final String NBT_TEMPLATE_ID = MachineEntityNbt.NBT_TEMPLATE_ID; + private static final String NBT_ROOM_COLOR = MachineEntityNbt.NBT_ROOM_COLOR; @Nullable private ResourceLocation roomTemplateId = null; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index 146407f7..f4e34d18 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.LegacySizedTemplates; @@ -19,12 +19,12 @@ import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.menu.MachineRoomMenu; +import dev.compactmods.machines.room.ui.MachineRoomMenu; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.upgrade.RoomUpgradeItem; -import dev.compactmods.machines.upgrade.RoomUpgradeManager; +import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -48,10 +48,9 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @SuppressWarnings("removal") @@ -127,8 +126,8 @@ public static Block getBySize(RoomSize size) { } @Override - public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) { - return MachineBlockUtil.getCloneItemStack(world, state, pos); + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { + return MachineBlockUtil.getCloneItemStack(level, state, pos); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index 588efbe2..ccbfd60a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.ServerConfig; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; @@ -14,6 +14,7 @@ import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.CompactStructureGenerator; +import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -76,7 +77,8 @@ static void createAndEnterRoom(ServerPlayer owner, MinecraftServer server, RoomT .setOwner(owner.getUUID())); // Generate a new machine room - CompactStructureGenerator.generateRoom(compactDim, template.dimensions(), newRoom.center()); + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(compactDim, template.dimensions(), newRoom.center(), unbreakableWall); // If template specified, prefill new room if (!template.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java b/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java deleted file mode 100644 index 11ba4e09..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/exceptions/InvalidMachineStateException.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.compactmods.machines.machine.exceptions; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.state.BlockState; -import org.antlr.v4.runtime.atn.BlockStartState; - -public class InvalidMachineStateException extends Throwable { - private final BlockPos machinePosition; - private final BlockState state; - - public InvalidMachineStateException(BlockPos machinePos, BlockState state) { - super("Invalid machine state."); - this.machinePosition = machinePos; - this.state = state; - } - - public InvalidMachineStateException(BlockPos machinePos, BlockState state, String s) { - super(s); - this.machinePosition = machinePos; - this.state = state; - } - - public BlockPos getMachinePosition() { - return machinePosition; - } - - public BlockState getState() { - return state; - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java index dcc705b7..ab71d6a9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java @@ -1,26 +1,35 @@ package dev.compactmods.machines.machine.item; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.Machines; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; import java.util.Optional; -public class BoundCompactMachineItem extends CompactMachineItem { +public class BoundCompactMachineItem extends BlockItem implements ICompactMachineItem { public static final String ROOM_NBT = "room_pos"; public static final String ROOM_DIMENSIONS_NBT = "room_dimensions"; + public static Holder REFERENCE_HOLDER = Holder.Reference.createStandAlone(Registry.ITEM, + ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine"))); + public BoundCompactMachineItem(Block blockIn, Properties builder) { super(blockIn, builder); } @@ -56,9 +65,9 @@ public static void setRoom(ItemStack stack, String room) { } public static ItemStack createForRoom(IBasicRoomInfo room) { - ItemStack item = new ItemStack(Machines.BOUND_MACHINE_BLOCK_ITEM.get()); + ItemStack item = new ItemStack(REFERENCE_HOLDER); setRoom(item, room.code()); - setColor(item, room.color()); + ICompactMachineItem.setColor(item, room.color()); return item; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java deleted file mode 100644 index 4d01d6ea..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/CompactMachineItem.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.compactmods.machines.machine.item; - -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Block; - -public class CompactMachineItem extends BlockItem { - public static final String NBT_COLOR = "machine_color"; - - public CompactMachineItem(Block blockIn, Properties builder) { - super(blockIn, builder); - } - - public static ItemStack setColor(ItemStack stack, int color) { - var tag = stack.getOrCreateTag(); - tag.putInt(NBT_COLOR, color); - return stack; - } - - public static int getMachineColor(ItemStack stack) { - if (!stack.hasTag()) return 0xFFFFFFFF; - - final var tag = stack.getTag(); - if (tag == null || tag.isEmpty() || !tag.contains(NBT_COLOR)) - return 0xFFFFFFFF; - - return tag.getInt(NBT_COLOR); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java index aa5d82cd..da6b846d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java @@ -3,24 +3,25 @@ import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.machine.Machines; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; @SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") -public class LegacyCompactMachineItem extends CompactMachineItem { +public class LegacyCompactMachineItem extends BlockItem implements ICompactMachineItem { public LegacyCompactMachineItem(Block blockIn, Properties builder) { super(blockIn, builder); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java index 717366c9..211e62b6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java @@ -1,25 +1,29 @@ package dev.compactmods.machines.machine.item; import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.machine.MachineIds; +import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.room.RoomHelper; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.Optional; @@ -27,18 +31,20 @@ * Represents a machine item that has not been bound to a room yet, * but has an assigned template to use. */ -public class UnboundCompactMachineItem extends CompactMachineItem { +public class UnboundCompactMachineItem extends BlockItem implements ICompactMachineItem { - public static final String NBT_TEMPLATE_ID = "template_id"; + public static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; + + public static Holder REFERENCE_HOLDER = Holder.Reference.createStandAlone(Registry.ITEM, MachineIds.UNBOUND_MACHINE_ITEM_KEY); public UnboundCompactMachineItem(Block blockIn, Properties builder) { super(blockIn, builder); } - @Nonnull + @NotNull @Override public String getDescriptionId(ItemStack stack) { - return Util.makeDescriptionId("dev/compactmods/machines/api/machine", getTemplateId(stack)); + return Util.makeDescriptionId("machine", getTemplateId(stack)); } @Override @@ -68,16 +74,16 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List getTemplates() { - return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> RoomServerHelper::getTemplates); + return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> { + final var serv = ServerLifecycleHooks.getCurrentServer(); + return () -> RoomServerHelper.getTemplates(serv); + }); } public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { @@ -147,11 +153,11 @@ public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull Serv PlayerUtil.howDidYouGetThere(serverPlayer); hist.clear(); - PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); + ForgePlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); } }, () -> { PlayerUtil.howDidYouGetThere(serverPlayer); - PlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); + ForgePlayerUtil.teleportPlayerToRespawnOrOverworld(serv, serverPlayer); }); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java b/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java index 47f3f1b1..36d8469e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java @@ -3,9 +3,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; @@ -24,7 +22,6 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryBuilder; -import net.minecraftforge.registries.RegistryObject; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -36,20 +33,15 @@ public class Rooms { .makeRegistry(() -> new RegistryBuilder() .dataPackRegistry(RoomTemplate.CODEC, RoomTemplate.CODEC)); - public static final RegistryObject> SPAWN_NODE = Registries.NODE_TYPES - .register("room_spawn", SimpleGraphNodeType.instance(RoomSpawnNode.CODEC)); - public static final RegistryObject> ROOM_OWNER_NODE = Registries.NODE_TYPES - .register("room_owner", SimpleGraphNodeType.instance(RoomOwnerNode.CODEC)); + static { + Registries.NODE_TYPES.register("room_spawn", SimpleGraphNodeType.supplier(RoomSpawnNode.CODEC)); + Registries.NODE_TYPES.register("room_owner", SimpleGraphNodeType.supplier(RoomOwnerNode.CODEC)); + Registries.NODE_TYPES.register("room_chunk", SimpleGraphNodeType.supplier(RoomChunkNode.CODEC)); + Registries.NODE_TYPES.register("room_meta", SimpleGraphNodeType.supplier(RoomMetadataNode.CODEC)); - public static final RegistryObject> ROOM_CHUNK_NODE = Registries.NODE_TYPES - .register("room_chunk", SimpleGraphNodeType.instance(RoomChunkNode.CODEC)); - - public static final RegistryObject> ROOM_META_NODE = Registries.NODE_TYPES - .register("room_meta", SimpleGraphNodeType.instance(RoomMetadataNode.CODEC)); - public static final RegistryObject> ROOM_OWNER_EDGE = Registries.EDGE_TYPES - .register("room_owner", SimpleGraphEdgeType.instance(RoomOwnerEdge.CODEC)); - public static final RegistryObject> ROOM_CHUNK_EDGE = Registries.EDGE_TYPES - .register("room_chunk", SimpleGraphEdgeType.instance(RoomChunkEdge.CODEC)); + Registries.EDGE_TYPES.register("room_owner", SimpleGraphEdgeType.supplier(RoomOwnerEdge.CODEC)); + Registries.EDGE_TYPES.register("room_chunk", SimpleGraphEdgeType.supplier(RoomChunkEdge.CODEC)); + } public static void prepare() { } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java index 86e3116d..4089b535 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java @@ -6,13 +6,12 @@ import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; -import net.minecraftforge.common.util.INBTSerializable; import java.util.ArrayDeque; import java.util.Deque; import java.util.Optional; -public class CMRoomHistory implements IRoomHistory, INBTSerializable { +public class CMRoomHistory implements IRoomHistory { private final Deque history; @@ -45,7 +44,6 @@ public void addHistory(PlayerRoomHistoryItem item) { history.add(item); } - @Override public ListTag serializeNBT() { return history.stream() .map(hi -> PlayerRoomHistoryItem.CODEC.encodeStart(NbtOps.INSTANCE, hi)) @@ -56,7 +54,6 @@ public ListTag serializeNBT() { .collect(NbtListCollector.toNbtList()); } - @Override public void deserializeNBT(ListTag nbt) { nbt.stream() .map(it -> PlayerRoomHistoryItem.CODEC.parse(NbtOps.INSTANCE, it)) diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java index 335e6ec5..0fde3e15 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java @@ -1,7 +1,6 @@ package dev.compactmods.machines.room.capability; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.room.RoomCapabilities; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java index 1b6bd212..8b58c4de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java @@ -43,7 +43,7 @@ private IPlayerRoomMetadataProvider getCurrentRoomMetadataProvider() { public CompoundTag serializeNBT() { final var tag = new CompoundTag(); provider.currentRoom().ifPresent(meta -> { - tag.putString("dev/compactmods/machines/api/room", meta.roomCode()); + tag.putString("room", meta.roomCode()); tag.putUUID("owner", meta.owner()); }); @@ -53,6 +53,6 @@ public CompoundTag serializeNBT() { @Override public void deserializeNBT(CompoundTag nbt) { if(nbt.isEmpty()) return; - provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(nbt.getString("dev/compactmods/machines/api/room"), nbt.getUUID("owner"))); + provider.setCurrent(new PlayerRoomMetadataProvider.CurrentRoomData(nbt.getString("room"), nbt.getUUID("owner"))); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java rename to forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java index 8eba0632..4e8d6ab8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomCapabilities.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.room.capability; import dev.compactmods.machines.api.room.IRoomHistory; import net.minecraftforge.common.capabilities.Capability; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java b/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java index 49fdb15a..3ebaae95 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.room.data; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraftforge.registries.RegistryObject; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java rename to forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java index 6cf8cc04..32b4c55c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/menu/MachineRoomMenu.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java @@ -1,10 +1,9 @@ -package dev.compactmods.machines.room.menu; +package dev.compactmods.machines.room.ui; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.core.UIRegistration; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; @@ -31,7 +30,7 @@ public class MachineRoomMenu extends AbstractContainerMenu { public boolean loadingBlocks; public MachineRoomMenu(int win, String room, LevelBlockPosition machine, String roomName) { - super(UIRegistration.MACHINE_MENU.get(), win); + super(RoomUserInterfaceRegistration.MACHINE_MENU.get(), win); this.room = room; this.roomName = roomName; this.roomBlocks = new StructureTemplate(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java b/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java rename to forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java index 164611e1..48c1aae1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/MachineRoomScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java @@ -1,20 +1,18 @@ -package dev.compactmods.machines.room.client; +package dev.compactmods.machines.room.ui; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.gui.widget.PSDIconButton; import dev.compactmods.machines.client.level.RenderingLevel; import dev.compactmods.machines.client.render.RenderTypes; import dev.compactmods.machines.client.render.SuperRenderTypeBuffer; import dev.compactmods.machines.client.util.TransformingVertexBuilder; import dev.compactmods.machines.compat.curios.CuriosCompat; import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.room.menu.MachineRoomMenu; -import dev.compactmods.machines.room.network.PlayerStartedRoomTrackingPacket; -import dev.compactmods.machines.room.network.RoomNetworkHandler; +import dev.compactmods.machines.network.PlayerStartedRoomTrackingPacket; +import dev.compactmods.machines.network.RoomNetworkHandler; import dev.compactmods.machines.shrinking.Shrinking; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; @@ -66,6 +64,7 @@ public void updateBlockRender() { } private boolean hasPsdItem() { + final var is = inv.contains(new ItemStack(Shrinking.psd)); final var inInv = inv.contains(new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get())); if (ModList.get().isLoaded("curios") && CuriosCompat.hasPsdCurio(inv.player)) return true; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java b/forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java similarity index 85% rename from forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java rename to forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java index 0d0f4fb4..d9ef93c0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/gui/widget/PSDIconButton.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java @@ -1,9 +1,8 @@ -package dev.compactmods.machines.client.gui.widget; +package dev.compactmods.machines.room.ui; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.core.CompactMachinesNet; -import dev.compactmods.machines.room.client.MachineRoomScreen; -import dev.compactmods.machines.room.network.PlayerRequestedTeleportPacket; +import dev.compactmods.machines.network.CompactMachinesNet; +import dev.compactmods.machines.network.PlayerRequestedTeleportPacket; import dev.compactmods.machines.shrinking.Shrinking; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java b/forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java similarity index 76% rename from forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java rename to forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java index fccf18af..1d4b17d9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/UIRegistration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java @@ -1,14 +1,14 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines.room.ui; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.room.menu.MachineRoomMenu; import net.minecraft.world.inventory.MenuType; import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.registries.RegistryObject; -public class UIRegistration { +public class RoomUserInterfaceRegistration { - public static final RegistryObject> MACHINE_MENU = Registries.CONTAINERS.register("dev/compactmods/machines/api/machine", () -> IForgeMenuType.create( + public static final RegistryObject> MACHINE_MENU = Registries.CONTAINERS.register("machine", () -> IForgeMenuType.create( ((windowId, inv, data) -> { data.readBlockPos(); final var mach = data.readWithCodec(LevelBlockPosition.CODEC); diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java b/forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java rename to forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java index ca06f1bc..8da83b47 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/client/overlay/RoomMetadataDebugOverlay.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.client.overlay; +package dev.compactmods.machines.room.ui.overlay; import com.mojang.blaze3d.vertex.PoseStack; import dev.compactmods.machines.api.dimension.CompactDimension; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java rename to forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java index 46a829bd..cc1b6fbc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.room.upgrade; import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; @@ -11,8 +11,9 @@ import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.graph.RoomReferenceNode; import dev.compactmods.machines.upgrade.graph.RoomUpgradeConnection; -import dev.compactmods.machines.upgrade.graph.RoomUpgradeGraphNode; +import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; import dev.compactmods.machines.upgrade.graph.UpgradeConnectionEntry; +import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java rename to forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java index b77b4e02..4ee9ed8d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbench.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java @@ -1,12 +1,11 @@ -package dev.compactmods.machines.upgrade.workbench; +package dev.compactmods.machines.room.upgrade; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class RoomUpgradeWorkbench extends Block implements EntityBlock { public RoomUpgradeWorkbench(Properties props) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java index 39478c68..c9411611 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/workbench/RoomUpgradeWorkbenchEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade.workbench; +package dev.compactmods.machines.room.upgrade; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java index 4ad29f99..393589b5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java @@ -22,8 +22,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.util.List; public class PersonalShrinkingDevice extends Item { diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java b/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java index 99b2db8b..c6f82471 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java +++ b/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java @@ -1,12 +1,21 @@ package dev.compactmods.machines.shrinking; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.Registries; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.registries.RegistryObject; public class Shrinking { + public static final Holder psd = Holder.Reference.createStandAlone(Registry.ITEM, ResourceKey.create( + Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "personal_shrinking_device") + )); + public static final RegistryObject PERSONAL_SHRINKING_DEVICE = Registries.ITEMS.register("personal_shrinking_device", () -> new PersonalShrinkingDevice(new Item.Properties() .tab(CompactMachines.COMPACT_MACHINES_ITEMS) diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java index 2db5fcd3..55b4a688 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java @@ -5,13 +5,13 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.core.CompactMachinesNet; -import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.network.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.RoomCapabilities; +import dev.compactmods.machines.room.capability.RoomCapabilities; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; @@ -47,7 +47,7 @@ import java.util.Optional; import java.util.stream.Collectors; -public class TunnelItem extends Item { +public class TunnelItem extends Item implements ITunnelItem { public TunnelItem(Properties properties) { super(properties); } @@ -66,7 +66,7 @@ public static ItemStack createStack(TunnelDefinition definition) { @Override public Component getName(ItemStack stack) { - String key = getDefinition(stack) + String key = ITunnelItem.getDefinition(stack) .map(def -> { ResourceLocation id = Tunnels.getRegistryId(def); return TranslationUtil.tunnelId(id); @@ -78,7 +78,7 @@ public Component getName(ItemStack stack) { @Override public void appendHoverText(@Nonnull ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - getDefinition(stack).ifPresent(tunnelDef -> { + ITunnelItem.getDefinition(stack).ifPresent(tunnelDef -> { if (Screen.hasShiftDown()) { MutableComponent type = Component.translatable("tooltip." + Constants.MOD_ID + ".tunnel_type", Tunnels.getRegistryId(tunnelDef)) .withStyle(ChatFormatting.GRAY) @@ -107,18 +107,7 @@ public void fillItemCategory(CreativeModeTab group, NonNullList items } } - public static Optional getDefinition(ItemStack stack) { - CompoundTag defTag = stack.getOrCreateTagElement("definition"); - if (defTag.isEmpty() || !defTag.contains("id")) - return Optional.empty(); - ResourceLocation defId = new ResourceLocation(defTag.getString("id")); - if (!Tunnels.isRegistered(defId)) - return Optional.empty(); - - TunnelDefinition tunnelReg = Tunnels.getDefinition(defId); - return Optional.ofNullable(tunnelReg); - } @Override public InteractionResult useOn(UseOnContext context) { @@ -131,7 +120,7 @@ public InteractionResult useOn(UseOnContext context) { if(level instanceof ServerLevel sl && sl.dimension().equals(CompactDimension.LEVEL_KEY)) { if (state.getBlock() instanceof SolidWallBlock && player != null) { - getDefinition(context.getItemInHand()).ifPresent(def -> { + ITunnelItem.getDefinition(context.getItemInHand()).ifPresent(def -> { try { boolean success = setupTunnelWall(sl, position, context.getClickedFace(), player, def); if (success && !player.isCreative()) diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java index 84752ebe..551029b8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java @@ -27,6 +27,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -43,7 +44,7 @@ public class TunnelWallBlock extends ProtectedWallBlock implements EntityBlock { public static final BooleanProperty REDSTONE = BooleanProperty.create("redstone"); - public TunnelWallBlock(Properties props) { + public TunnelWallBlock(BlockBehaviour.Properties props) { super(props); registerDefaultState(getStateDefinition().any() .setValue(CONNECTED_SIDE, Direction.UP) diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java index b7f55c9a..4acb1d83 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; @@ -33,9 +34,9 @@ import javax.annotation.Nullable; import java.lang.ref.WeakReference; -public class TunnelWallEntity extends BlockEntity { +public class TunnelWallEntity extends BlockEntity implements ITunnelHolder { - private static final String NBT_LEGACY_MACHINE_KEY = "dev/compactmods/machines/api/machine"; + private static final String NBT_LEGACY_MACHINE_KEY = "machine"; private LevelBlockPosition connectedMachine; private TunnelDefinition tunnelType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index ee0ed186..c12a27eb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -2,11 +2,13 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; +import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; @@ -29,9 +31,9 @@ public class Tunnels { public static final Supplier> TUNNEL_DEF_REGISTRY = Registries.TUNNEL_DEFINITIONS .makeRegistry(RegistryBuilder::new); public static final RegistryObject> TUNNEL_NODE = Registries.NODE_TYPES - .register("tunnel", SimpleGraphNodeType.instance(TunnelNode.CODEC)); + .register("tunnel", SimpleGraphNodeType.supplier(TunnelNode.CODEC)); public static final RegistryObject> TUNNEL_TYPE_NODE = Registries.NODE_TYPES - .register("tunnel_type", SimpleGraphNodeType.instance(TunnelTypeNode.CODEC)); + .register("tunnel_type", SimpleGraphNodeType.supplier(TunnelTypeNode.CODEC)); public static boolean isRegistered(ResourceLocation id) { return TUNNEL_DEF_REGISTRY.get().containsKey(id); @@ -43,6 +45,13 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { return Tunnels.UNKNOWN.get(); } + // Graph Objects + static { + // Tunnel edges + Registries.EDGE_TYPES.register("tunnel_type", () -> TunnelTypeEdge.EDGE_TYPE); + Registries.EDGE_TYPES.register("tunnel_machine", () -> TunnelMachineEdge.EDGE_TYPE); + } + // ================================================================================================================ // TUNNELS // ================================================================================================================ diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java deleted file mode 100644 index b66b256e..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelItemColor.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.compactmods.machines.tunnel.client; - -import java.util.Optional; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.TunnelItem; -import net.minecraft.client.color.item.ItemColor; -import net.minecraft.world.item.ItemStack; - -public class TunnelItemColor implements ItemColor { - @Override - public int getColor(ItemStack stack, int tintIndex) { - Optional definition = TunnelItem.getDefinition(stack); - if(!definition.isPresent()) - return 0; - - TunnelDefinition actualDef = definition.get(); - if (tintIndex == 0) { - return actualDef.ringColor(); - } - - return actualDef.indicatorColor(); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java index b6703719..5f5ce0f0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java @@ -5,13 +5,13 @@ import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; import dev.compactmods.machines.codec.NbtListCollector; -import dev.compactmods.machines.graph.Graph; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.IGraphNode; @@ -292,11 +292,11 @@ public CompoundTag serializeNBT() { HashMap nodeIds = new HashMap<>(); - final var nodeReg = Graph.NODE_TYPE_REG.get(); + final var nodeReg = Registries.NODE_TYPE_REG.get(); final Codec nodeRegCodec = nodeReg.getCodec() .dispatchStable(IGraphNode::getType, IGraphNodeType::codec); - final Codec edgeRegCodec = Graph.EDGE_TYPE_REG.get() + final Codec edgeRegCodec = Registries.EDGE_TYPE_REG.get() .getCodec() .dispatchStable(IGraphEdge::getEdgeType, IGraphEdgeType::codec); @@ -343,11 +343,11 @@ public void deserializeNBT(CompoundTag tag) { final var graphRoot = tag.getCompound("graph"); - final var nodeReg = Graph.NODE_TYPE_REG.get(); + final var nodeReg = Registries.NODE_TYPE_REG.get(); final var nodeRegCodec = nodeReg.getCodec() .dispatchStable(IGraphNode::getType, IGraphNodeType::codec); - final var edgeRegCodec = Graph.EDGE_TYPE_REG.get().getCodec() + final var edgeRegCodec = Registries.EDGE_TYPE_REG.get().getCodec() .dispatchStable(IGraphEdge::getEdgeType, IGraphEdgeType::codec); final var nodes = graphRoot.getList("nodes", Tag.TAG_COMPOUND); @@ -443,6 +443,19 @@ public Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Di })).map(TunnelNode::position); } + @Override + public Optional getConnectedSide(BlockPos position) { + var node = tunnels.get(position); + return graph.adjacentNodes(node).stream() + .filter(CompactMachineNode.class::isInstance) + .map(mn -> graph.edgeValue(node, mn)) + .filter(Optional::isPresent) + .map(Optional::get) + .map(TunnelMachineEdge.class::cast) + .map(TunnelMachineEdge::side) + .findFirst(); + } + public Stream getTunnelsSupporting(LevelBlockPosition machine, Direction side, Capability capability) { final var node = machines.get(machine); if (node == null) return Stream.empty(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java index e06800f5..0d2add22 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; +import dev.compactmods.machines.room.upgrade.ChunkloadUpgrade; import net.minecraft.core.NonNullList; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java index 58f8b40e..f331a8de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java @@ -2,9 +2,10 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.core.Registries; -import dev.compactmods.machines.upgrade.workbench.RoomUpgradeWorkbench; -import dev.compactmods.machines.upgrade.workbench.RoomUpgradeWorkbenchEntity; +import dev.compactmods.machines.Registries; +import dev.compactmods.machines.room.upgrade.ChunkloadUpgrade; +import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbench; +import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbenchEntity; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java index dbf6ebee..dc64d19e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java @@ -3,17 +3,19 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.graph.GraphEdgeType; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; +import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import org.jetbrains.annotations.NotNull; -public class RoomUpgradeConnection implements IGraphEdge { +public class RoomUpgradeConnection implements IGraphEdge> { public static final Codec> CODEC = RecordCodecBuilder.create(i -> i.group( MachineRoomUpgrades.REGISTRY.get().getCodec().fieldOf("data").forGetter(RoomUpgradeConnection::instance) ).apply(i, RoomUpgradeConnection::new)); + public static final IGraphEdgeType> EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); + private final T upgradeData; public RoomUpgradeConnection(final T instance) { @@ -25,7 +27,7 @@ public T instance() { } @Override - public @NotNull IGraphEdgeType getEdgeType() { - return GraphEdgeType.ROOM_UPGRADE; + public @NotNull IGraphEdgeType> getEdgeType() { + return EDGE_TYPE; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java index 8303a8f8..f2d19467 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java @@ -10,11 +10,11 @@ public record UpgradeConnectionEntry(String room, Resourc public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING - .fieldOf("dev/compactmods/machines/api/room") + .fieldOf("room") .forGetter(UpgradeConnectionEntry::room), ResourceKey.codec(RoomUpgrade.REG_KEY) - .fieldOf("dev/compactmods/machines/api/upgrade") + .fieldOf("upgrade") .forGetter(UpgradeConnectionEntry::upgradeKey), MachineRoomUpgrades.REGISTRY.get().getCodec() diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java new file mode 100644 index 00000000..76ae37f7 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java @@ -0,0 +1,33 @@ +package dev.compactmods.machines.util; + +import dev.compactmods.machines.network.CompactMachinesNet; +import dev.compactmods.machines.dimension.SimpleTeleporter; +import dev.compactmods.machines.network.SyncRoomMetadataPacket; +import dev.compactmods.machines.room.RoomHelper; +import net.minecraft.Util; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.phys.Vec3; +import net.minecraftforge.network.PacketDistributor; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; + +public class ForgePlayerUtil { + public static void teleportPlayerToRespawnOrOverworld(MinecraftServer serv, @NotNull ServerPlayer player) { + ServerLevel level = Optional.ofNullable(serv.getLevel(player.getRespawnDimension())).orElse(serv.overworld()); + Vec3 worldPos = Vec3.atCenterOf(level.getSharedSpawnPos()); + + if (player.getRespawnPosition() != null) + worldPos = Vec3.atCenterOf(player.getRespawnPosition()); + + player.changeDimension(level, SimpleTeleporter.to(worldPos)); + + player.getCapability(RoomHelper.CURRENT_ROOM_META).ifPresent(provider -> { + provider.clearCurrent(); + CompactMachinesNet.CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), + new SyncRoomMetadataPacket("", Util.NIL_UUID)); + }); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java index 55029c8a..a9b8bea2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java @@ -2,7 +2,7 @@ import com.google.common.collect.ImmutableSet; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; diff --git a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java similarity index 84% rename from forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java index 1ed5d81f..82119592 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/core/CommonEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java @@ -1,13 +1,12 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines.wall; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.wall.ProtectedWallBlock; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = Constants.MOD_ID) -public class CommonEventHandler { +public class ProtectedBlockHandler { @SubscribeEvent public static void onLeftClickBlock(final PlayerInteractEvent.LeftClickBlock evt) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java index 1402656f..0eee5b15 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java @@ -1,19 +1,12 @@ package dev.compactmods.machines.wall; -import dev.compactmods.machines.config.ServerConfig; -import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.SpawnPlacements; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.state.BlockState; - public class SolidWallBlock extends ProtectedWallBlock { public SolidWallBlock(Properties props) { super(props); } - @Override - public boolean isValidSpawn(BlockState state, BlockGetter world, BlockPos pos, SpawnPlacements.Type type, EntityType entityType) { - return pos.getY() == ServerConfig.MACHINE_FLOOR_Y.get(); - } +// @Override +// public boolean isValidSpawn(BlockState state, BlockGetter world, BlockPos pos, SpawnPlacements.Type type, EntityType entityType) { +// return pos.getY() == 40; +// } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java b/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java index 045670f9..0d6a873a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java +++ b/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.wall; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.core.Registries; +import dev.compactmods.machines.Registries; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java b/forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java index 7923a124..acb23aaa 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/TestBatches.java @@ -2,7 +2,7 @@ public final class TestBatches { - public static final String TUNNELS = "dev/compactmods/machines/api/tunnels"; + public static final String TUNNELS = "tunnels"; public static final String TUNNEL_DATA = "tunnel_data"; public static final String ROOM_GENERATION = "room_generation"; @@ -11,6 +11,6 @@ public final class TestBatches { public static final String CODEC_TESTS = "codecs"; public static final String MATH = "math"; public static final String MACHINE_DATA = "machine_data"; - public static final String DIMENSION = "dev/compactmods/machines/api/dimension"; + public static final String DIMENSION = "dimension"; public static final String MIGRATION = "migration"; } diff --git a/settings.gradle.kts b/settings.gradle.kts index 8efc0336..d8f6e73d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,5 +27,5 @@ pluginManagement { } rootProject.name = "Compact Machines" -include("common-api") -include("forge-api", "forge-main", "forge-tunnels") \ No newline at end of file +include("common-api", "common-main") +include("forge-api", "forge-main", "forge-tunnels") From 37d57a8e217742783977f0248c4024a84c861540 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Fri, 4 Nov 2022 01:40:38 -0400 Subject: [PATCH 36/85] Bit more cleanup --- .../api/core/{CMRegistries.java => CMRegistryKeys.java} | 2 +- .../java/dev/compactmods/machines/ICompactMachinesMod.java | 1 - .../java/dev/compactmods/machines/{core => }/LoggingUtil.java | 2 +- .../machines/machine/graph/DimensionMachineGraph.java | 2 +- .../java/dev/compactmods/machines/tunnel/TunnelHelper.java | 4 ++-- .../java/dev/compactmods/machines/util/DimensionUtil.java | 2 +- .../main/java/dev/compactmods/machines/CompactMachines.java | 2 ++ .../src/main/java/dev/compactmods/machines/ModBusEvents.java | 1 - .../src/main/java/dev/compactmods/machines/Registries.java | 4 ++-- .../machines/command/data/CMMachineDataExportCommand.java | 2 +- .../machines/command/data/CMRoomDataExportCommand.java | 2 +- .../machines/command/data/CMTunnelDataExportCommand.java | 2 +- .../machines/command/subcommand/CMGiveMachineSubcommand.java | 4 ++-- .../machines/command/subcommand/CMRebindSubcommand.java | 2 +- .../machines/command/subcommand/CMRoomUpgradeCommand.java | 2 +- .../machines/command/subcommand/CMUnbindSubcommand.java | 2 +- .../machines/command/subcommand/SpawnSubcommand.java | 2 +- .../dev/compactmods/machines/{ => config}/CommonConfig.java | 3 ++- .../dev/compactmods/machines/{ => config}/ServerConfig.java | 2 +- .../machines/data/generated/AdvancementGenerator.java | 4 +--- .../java/dev/compactmods/machines/dimension/VoidAirBlock.java | 2 +- .../compactmods/machines/machine/block/MachineBlockUtil.java | 2 +- .../java/dev/compactmods/machines/tunnel/BuiltinTunnels.java | 4 ++-- 23 files changed, 27 insertions(+), 28 deletions(-) rename common-api/src/main/java/dev/compactmods/machines/api/core/{CMRegistries.java => CMRegistryKeys.java} (92%) rename common-main/src/main/java/dev/compactmods/machines/{core => }/LoggingUtil.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => config}/CommonConfig.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => config}/ServerConfig.java (98%) diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java similarity index 92% rename from common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java rename to common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java index 50e73640..c8bee2d7 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistries.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java @@ -7,7 +7,7 @@ import static dev.compactmods.machines.api.core.Constants.MOD_ID; -public interface CMRegistries { +public interface CMRegistryKeys { ResourceKey> TYPES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); diff --git a/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java b/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java index 1e613923..b1d0081e 100644 --- a/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java +++ b/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java @@ -1,6 +1,5 @@ package dev.compactmods.machines; -import dev.compactmods.machines.core.LoggingUtil; import org.apache.logging.log4j.Logger; public interface ICompactMachinesMod { diff --git a/common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java b/common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java similarity index 87% rename from common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java rename to common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java index 20c615a8..6de675df 100644 --- a/common-main/src/main/java/dev/compactmods/machines/core/LoggingUtil.java +++ b/common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.core; +package dev.compactmods.machines; import dev.compactmods.machines.api.core.Constants; import org.apache.logging.log4j.LogManager; diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java index 59fab79e..c8f8df57 100644 --- a/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java +++ b/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java @@ -5,7 +5,7 @@ import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.graph.RoomReferenceNode; diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java index ff5d97f7..4d036504 100644 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java +++ b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.tunnel; -import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import net.minecraft.core.Direction; import net.minecraft.core.Registry; @@ -16,7 +16,7 @@ public class TunnelHelper { public static Registry definitionRegistry() { - return RegistryAccess.builtinCopy().registryOrThrow(CMRegistries.TYPES_REG_KEY); + return RegistryAccess.builtinCopy().registryOrThrow(CMRegistryKeys.TYPES_REG_KEY); } public static TunnelDefinition getDefinition(ResourceLocation tunnelType) { diff --git a/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java index 0a75fc7d..70b1e229 100644 --- a/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java +++ b/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java @@ -2,7 +2,7 @@ import com.mojang.serialization.JsonOps; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import net.minecraft.SharedConstants; import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index 72221abb..5c68eac8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -6,6 +6,8 @@ import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; +import dev.compactmods.machines.config.CommonConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; import dev.compactmods.machines.dimension.Dimension; import dev.compactmods.machines.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java index d9a97a7f..55570d79 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java @@ -2,7 +2,6 @@ import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.core.LoggingUtil; import dev.compactmods.machines.network.CompactMachinesNet; import dev.compactmods.machines.network.RoomNetworkHandler; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/Registries.java index 0ff4dc21..08505a4c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/Registries.java @@ -1,6 +1,6 @@ package dev.compactmods.machines; -import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; @@ -37,7 +37,7 @@ public class Registries { public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID); // Tunnels - public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(CMRegistries.TYPES_REG_KEY, MOD_ID); + public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, MOD_ID); // UIRegistration public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java index b148c935..5d780c42 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import net.minecraft.commands.CommandSourceStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java index 0dc0f162..fcae0e8f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java @@ -7,7 +7,7 @@ import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java index d1e67ec4..57a24468 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java index f50ccd5c..7101c778 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java @@ -6,8 +6,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.ServerConfig; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java index 76d700c0..b2eeecb1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java index 976dd8f1..00e2797d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java @@ -7,7 +7,7 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.command.RoomUpgradeArgument; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java index 2bec977a..7206cf51 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java @@ -6,7 +6,7 @@ import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java index c1401560..f6be02f3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java @@ -7,7 +7,7 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java index 75ef4552..630ed26e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CommonConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java @@ -1,5 +1,6 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.config; +import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java b/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java index be29c5d8..ed0d4599 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ServerConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.config; import com.electronwill.nightconfig.core.EnumGetMethod; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java index 46f9d8ce..4cd0895d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java @@ -3,12 +3,11 @@ import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.core.LoggingUtil; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.shrinking.Shrinking; @@ -27,7 +26,6 @@ import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.io.IOException; import java.nio.file.Path; import java.util.Set; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java index 51f7f77b..c8a47341 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.dimension; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.room.capability.RoomCapabilities; import dev.compactmods.machines.util.ForgePlayerUtil; import dev.compactmods.machines.util.PlayerUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java index ccbfd60a..15336003 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.ServerConfig; +import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java index 7345bd2f..75065d0a 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java @@ -2,7 +2,7 @@ import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.core.CMRegistries; +import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; @@ -22,7 +22,7 @@ public class BuiltinTunnels implements ICompactMachinesAddon { public static Supplier roomOwnerLookup; public static Supplier roomSpawnLookup; - public static DeferredRegister DR = DeferredRegister.create(CMRegistries.TYPES_REG_KEY, Constants.MOD_ID); + public static DeferredRegister DR = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, Constants.MOD_ID); // ================================================================================================================ // TUNNEL TYPE DEFINITIONS From 80739006f5596cd1c4b529d4f599dec9ae03f671 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 5 Nov 2022 00:46:47 -0400 Subject: [PATCH 37/85] Move datagen functions into generated package, fix setColor build error --- .../main/java/dev/compactmods/machines/CompactMachines.java | 2 +- .../machines/data/generated/BlockLootGenerator.java | 2 +- .../generated/functions}/CopyRoomBindingFunction.java | 5 +++-- .../data => data/generated/functions}/LootFunctions.java | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename forge-main/src/main/java/dev/compactmods/machines/{room/data => data/generated/functions}/CopyRoomBindingFunction.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{room/data => data/generated/functions}/LootFunctions.java (88%) diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index 5c68eac8..6b20ae24 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -12,7 +12,7 @@ import dev.compactmods.machines.dimension.Dimension; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.room.Rooms; -import dev.compactmods.machines.room.data.LootFunctions; +import dev.compactmods.machines.data.generated.functions.LootFunctions; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java index c4c20325..594095cd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java @@ -3,7 +3,7 @@ import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.room.data.CopyRoomBindingFunction; +import dev.compactmods.machines.data.generated.functions.CopyRoomBindingFunction; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.loot.BlockLoot; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java index ef2ed4e1..73211952 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/data/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.data; +package dev.compactmods.machines.data.generated.functions; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; @@ -6,6 +6,7 @@ import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction; @@ -30,7 +31,7 @@ protected ItemStack run(ItemStack stack, LootContext ctx) { var data = ctx.getParam(LootContextParams.BLOCK_ENTITY); if (data instanceof CompactMachineBlockEntity machine) { machine.basicRoomInfo().ifPresent(room -> { - BoundCompactMachineItem.setColor(stack, room.color()); + ICompactMachineItem.setColor(stack, room.color()); BoundCompactMachineItem.setRoom(stack, room.code()); }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java rename to forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java index 3ebaae95..b0550c22 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/data/LootFunctions.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.data; +package dev.compactmods.machines.data.generated.functions; import dev.compactmods.machines.Registries; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; From cbfcfb31df01b98d32902408f2362799ef5529f3 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 5 Nov 2022 00:57:01 -0400 Subject: [PATCH 38/85] Fix missed wall block changes in room generation tests --- .../machines/test/worldgen/RoomGenerationTests.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java index ec58a3db..134b1783 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java @@ -4,6 +4,7 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.util.CompactStructureGenerator; +import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.gametest.framework.GameTest; @@ -23,7 +24,8 @@ public static void checkRoomGeneratorColossal(final GameTestHelper test) { final var roomDims = new Vec3i(13, 13, 13); final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter, unbreakableWall); test.setBlock(new BlockPos(7, 8, 7), Blocks.GOLD_BLOCK.defaultBlockState()); CompactStructureGenerator.fillWithTemplate(test.getLevel(), @@ -38,7 +40,8 @@ public static void checkRoomGeneratorNormal(final GameTestHelper test) { final var roomDims = new Vec3i(9, 9, 9); final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter, unbreakableWall); test.setBlock(new BlockPos(7, 5, 7), Blocks.GOLD_BLOCK.defaultBlockState()); CompactStructureGenerator.fillWithTemplate(test.getLevel(), @@ -53,7 +56,8 @@ public static void checkRoomGeneratorSmall(final GameTestHelper test) { final var roomDims = new Vec3i(5, 5, 5); final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter, unbreakableWall); test.setBlock(new BlockPos(7, 4, 7), Blocks.GOLD_BLOCK.defaultBlockState()); CompactStructureGenerator.fillWithTemplate(test.getLevel(), @@ -68,7 +72,8 @@ public static void checkRoomGeneratorWeirdShape(final GameTestHelper test) { final var roomDims = new Vec3i(11, 2, 7); final var roomCenter = Vec3.atCenterOf(test.absolutePos(new BlockPos(7, 1, 7))); - CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter); + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(test.getLevel(), roomDims, roomCenter, unbreakableWall); // test.setBlock(new BlockPos(7, 3, 7), Blocks.GOLD_BLOCK.defaultBlockState()); From 6374ba7ed4cbceb84107bab6ddf153f6ff5ce7b2 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 27 Nov 2022 19:36:14 -0500 Subject: [PATCH 39/85] Temporarily removes upgrade application as system gets rewritten --- .../machines/api/ICompactMachinesAddon.java | 13 ----- .../machines/api/core/CMRegistryKeys.java | 3 +- .../machines/api/core/Tooltips.java | 1 + .../machines/api/inject/InjectField.java | 4 ++ .../api/resource/IResourceNetwork.java | 14 +++++ .../machines/api/resource/IResourceType.java | 7 +++ .../compactmods/machines/api/room/Rooms.java | 4 +- .../api/room/upgrade/RoomUpgrade.java | 35 ------------ .../api/room/upgrade/RoomUpgradeInstance.java | 3 - .../upgrade/ILevelLoadedUpgradeListener.java | 4 +- .../api/upgrade/IResourcefulUpgrade.java | 19 +++++++ .../api/upgrade/IUpgradeAppliedListener.java | 12 ++++ .../api/upgrade/IUpgradeRemovedListener.java | 12 ++++ .../api/upgrade/RoomUpgradeAction.java | 15 +++++ .../api/upgrade/RoomUpgradeHelper.java | 2 +- .../api/upgrade/RoomUpgradeInstance.java | 3 + .../requirement/IUpgradeRequirement.java | 4 ++ .../IUpgradeResourceRequirement.java | 8 +++ common-main/build.gradle.kts | 2 +- .../compactmods/machines/CompactMachines.java | 20 +++---- .../dev/compactmods/machines/Registries.java | 4 +- .../machines/ServerEventHandler.java | 29 ++++++++-- .../machines/command/RoomUpgradeArgument.java | 8 +-- .../subcommand/CMRoomUpgradeCommand.java | 10 +++- .../data/generated/ItemModelGenerator.java | 2 +- .../data/generated/RecipeGenerator.java | 8 +-- .../generated/lang/BaseLangGenerator.java | 13 ++++- .../generated/lang/EnglishLangGenerator.java | 14 ++--- .../data/generated/tags/ItemTagGenerator.java | 2 +- .../block/LegacySizedCompactMachineBlock.java | 57 ++++++++++--------- .../room/upgrade/RoomUpgradeManager.java | 16 +++--- .../room/upgrade/RoomUpgradeWorkbench.java | 14 +++++ .../compactmods/machines/tunnel/Tunnels.java | 2 +- .../upgrade/ChunkloadUpgradeItem.java | 28 --------- .../machines/upgrade/MachineRoomUpgrades.java | 8 +-- .../machines/upgrade/RoomUpgradeItem.java | 17 +----- .../upgrade/graph/RoomUpgradeConnection.java | 4 +- .../upgrade/graph/UpgradeConnectionEntry.java | 6 +- .../machines/util/AnnotationScanner.java | 54 ++++++++++++++++++ .../villager/VillagerTradesEventHandler.java | 20 +++---- .../machines/villager/Villagers.java | 27 +++------ .../compactmods/machines/CMBuiltInAddon.java | 37 ++++++++++++ .../machines/tunnel/BuiltInTunnels.java | 31 ++++++++++ .../machines/tunnel/BuiltinTunnels.java | 52 ----------------- .../upgrade/BuiltInUpgradeActions.java | 18 ++++++ .../machines/upgrade/ChunkloadAction.java | 33 ++++++----- .../compactmachines/upgrades/chunkloader.json | 25 ++++++++ 47 files changed, 434 insertions(+), 290 deletions(-) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java rename common-api/src/main/java/dev/compactmods/machines/api/{room => }/upgrade/ILevelLoadedUpgradeListener.java (90%) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java create mode 100644 forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java create mode 100644 forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java delete mode 100644 forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java create mode 100644 forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java rename common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java => forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java (50%) create mode 100644 forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json diff --git a/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java b/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java index e9a024c6..9422d824 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java @@ -1,10 +1,5 @@ package dev.compactmods.machines.api; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; - -import java.util.function.Supplier; - public interface ICompactMachinesAddon { default void prepare() { @@ -14,12 +9,4 @@ default void prepare() { default void afterRegistration() { // no-op } - - default void acceptRoomOwnerLookup(Supplier ownerLookup) { - // Implement and store supplier for room owner lookups - } - - default void acceptRoomSpawnLookup(Supplier spawnLookup) { - // Implement and store supplier for spawn lookups - } } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java index c8bee2d7..c20f795e 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.api.core; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; @@ -11,5 +12,5 @@ public interface CMRegistryKeys { ResourceKey> TYPES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); - + ResourceKey> UPGRADE_ACTIONS = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "upgrade_actions")); } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java index 9e5533fa..85d5e408 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java @@ -11,6 +11,7 @@ public interface Tooltips { ResourceLocation ROOM_UPGRADE_TYPE = new ResourceLocation(Constants.MOD_ID, "room_upgrade_type"); ResourceLocation TUTORIAL_APPLY_ROOM_UPGRADE = new ResourceLocation(Constants.MOD_ID, "tutorial_apply_room_upgrade"); ResourceLocation CRAFT_TO_UPGRADE = new ResourceLocation(Constants.MOD_ID, "craft_machine_to_upgrade"); + ResourceLocation NOT_YET_IMPLEMENTED = new ResourceLocation(Constants.MOD_ID, "not_yet_implemented"); interface Machines { ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id"); diff --git a/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java b/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java new file mode 100644 index 00000000..19e7b824 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.api.inject; + +public @interface InjectField { +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java new file mode 100644 index 00000000..223460fd --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.api.resource; + +import dev.compactmods.machines.api.location.IDimensionalBlockPosition; + +import java.util.stream.Stream; + +public interface IResourceNetwork { + + IResourceType resourceType(); + + Stream getInputs(); + Stream getOutputs(); + +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java new file mode 100644 index 00000000..95bbfcc3 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java @@ -0,0 +1,7 @@ +package dev.compactmods.machines.api.resource; + +/** + * Represents a resource that can be moved and stored in a {@link IResourceNetwork}. + */ +public interface IResourceType { +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java index 3100354c..89c36356 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.api.room; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -12,7 +12,7 @@ public class Rooms { public static final ResourceKey> TEMPLATE_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); - public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); + public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); public static Registry getTemplates(MinecraftServer server) { final var regAccess = server.registryAccess(); diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java deleted file mode 100644 index 9bb46183..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgrade.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.compactmods.machines.api.room.upgrade; - -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.item.ItemStack; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public interface RoomUpgrade { - - ResourceKey> REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrade")); - - String UNNAMED_TRANS_KEY = "item." + MOD_ID + ".upgrades.unnamed"; - - default String getTranslationKey() { - return UNNAMED_TRANS_KEY; - } - - default String getTranslationKey(ItemStack stack) { - return getTranslationKey(); - } - - /** - * Called when an upgrade is first applied to a room. - */ - default void onAdded(ServerLevel level, IRoomRegistration room) {} - - /** - * Called when an update is removed from a room. - */ - default void onRemoved(ServerLevel level, IRoomRegistration room) {} -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java deleted file mode 100644 index 4f353089..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/RoomUpgradeInstance.java +++ /dev/null @@ -1,3 +0,0 @@ -package dev.compactmods.machines.api.room.upgrade; - -public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java similarity index 90% rename from common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java rename to common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java index 4b690cc8..50290f61 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/upgrade/ILevelLoadedUpgradeListener.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.api.room.upgrade; +package dev.compactmods.machines.api.upgrade; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.server.level.ServerLevel; -public interface ILevelLoadedUpgradeListener extends RoomUpgrade { +public interface ILevelLoadedUpgradeListener extends RoomUpgradeAction { /** * Called when a level is loaded, typically when the server first boots up. diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java new file mode 100644 index 00000000..93cbdd51 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java @@ -0,0 +1,19 @@ +package dev.compactmods.machines.api.upgrade; + +import dev.compactmods.machines.api.resource.IResourceType; +import dev.compactmods.machines.api.upgrade.requirement.IUpgradeRequirement; + +import java.util.Collections; +import java.util.Set; + +/** + * An upgrade that deals with a resource in the room's resource networks. + */ +public interface IResourcefulUpgrade { + + IResourceType resourceType(); + + default Set requirements() { + return Collections.emptySet(); + } +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java new file mode 100644 index 00000000..a0429d13 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java @@ -0,0 +1,12 @@ +package dev.compactmods.machines.api.upgrade; + +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import net.minecraft.server.level.ServerLevel; + +public interface IUpgradeAppliedListener extends RoomUpgradeAction { + + /** + * Called when an upgrade is first applied to a room. + */ + default void onAdded(ServerLevel level, IRoomRegistration room) {} +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java new file mode 100644 index 00000000..8168a885 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java @@ -0,0 +1,12 @@ +package dev.compactmods.machines.api.upgrade; + +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import net.minecraft.server.level.ServerLevel; + +public interface IUpgradeRemovedListener extends RoomUpgradeAction { + + /** + * Called when an update is removed from a room. + */ + default void onRemoved(ServerLevel level, IRoomRegistration room) {} +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java new file mode 100644 index 00000000..4c996fef --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java @@ -0,0 +1,15 @@ +package dev.compactmods.machines.api.upgrade; + +import com.mojang.serialization.Codec; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; + +import static dev.compactmods.machines.api.core.Constants.MOD_ID; + +public interface RoomUpgradeAction { + + ResourceKey> REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "upgrade_actions")); + + Codec codec(); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java index c76115f0..75e2af68 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java @@ -11,7 +11,7 @@ public abstract class RoomUpgradeHelper { public static final String NBT_UPGRADE_NODE = "upgrade_info"; public static final String NBT_UPGRADE_ID = "key"; - public static Optional getTypeFrom(@NotNull ItemStack stack) { + public static Optional getUpgradeId(@NotNull ItemStack stack) { if(!stack.hasTag()) return Optional.empty(); final var tag = stack.getTag(); if(!tag.contains(NBT_UPGRADE_NODE)) return Optional.empty(); diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java new file mode 100644 index 00000000..02c767d5 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java @@ -0,0 +1,3 @@ +package dev.compactmods.machines.api.upgrade; + +public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java new file mode 100644 index 00000000..296dad66 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.api.upgrade.requirement; + +public interface IUpgradeRequirement { +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java new file mode 100644 index 00000000..567a7030 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.api.upgrade.requirement; + +import dev.compactmods.machines.api.resource.IResourceType; + +public interface IUpgradeResourceRequirement extends IUpgradeRequirement { + + IResourceType resourceType(); +} diff --git a/common-main/build.gradle.kts b/common-main/build.gradle.kts index b2a7f08c..01aeb83e 100644 --- a/common-main/build.gradle.kts +++ b/common-main/build.gradle.kts @@ -67,7 +67,7 @@ dependencies { parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") }) - compileOnly(project(":common-api")) + implementation(project(":common-api")) compileOnly("com.aventrix.jnanoid", "jnanoid", "2.0.0") } diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java index 6b20ae24..3a1d0704 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java @@ -8,20 +8,20 @@ import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.config.CommonConfig; import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; +import dev.compactmods.machines.data.generated.functions.LootFunctions; import dev.compactmods.machines.dimension.Dimension; import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.room.Rooms; -import dev.compactmods.machines.data.generated.functions.LootFunctions; +import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.Tunnels; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.util.AnnotationScanner; import dev.compactmods.machines.villager.Villagers; import dev.compactmods.machines.wall.Walls; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; -import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -29,7 +29,6 @@ import net.minecraftforge.forgespi.language.ModFileScanData; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; -import org.objectweb.asm.Type; import javax.annotation.Nonnull; import java.util.Objects; @@ -92,16 +91,11 @@ private static void doRegistration() { Registries.EDGE_TYPES.register(bus); Registries.COMMAND_ARGUMENT_TYPES.register(bus); Registries.LOOT_FUNCS.register(bus); - Registries.VILLAGERS.register(bus); - Villagers.TRADES.register(bus); + // Registries.VILLAGERS.register(bus); + // Villagers.TRADES.register(bus); Registries.POINTS_OF_INTEREST.register(bus); - CompactMachines.loadedAddons = ModList.get() - .getAllScanData() - .stream() - .flatMap(scans -> scans.getAnnotations() - .stream() - .filter(ad -> ad.annotationType().equals(Type.getType(CompactMachinesAddon.class))) + CompactMachines.loadedAddons = AnnotationScanner.scanModList(CompactMachinesAddon.class) .map(ModFileScanData.AnnotationData::memberName) .map(cmAddonClass -> { try { @@ -112,7 +106,7 @@ private static void doRegistration() { return null; } }) - .filter(Objects::nonNull)) + .filter(Objects::nonNull) .collect(Collectors.toSet()); CompactMachines.loadedAddons.forEach(addon -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/Registries.java index 08505a4c..4fab4742 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/Registries.java @@ -4,7 +4,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.IGraphNodeType; @@ -43,7 +43,7 @@ public class Registries { public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); // MachineRoomUpgrades - public static final DeferredRegister UPGRADES = DeferredRegister.create(Rooms.ROOM_UPGRADES_REG_KEY, MOD_ID); + public static final DeferredRegister UPGRADES = DeferredRegister.create(Rooms.ROOM_UPGRADES_REG_KEY, MOD_ID); // Graph @ApiStatus.Internal diff --git a/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java index 89878e42..7190c1c0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java @@ -1,12 +1,15 @@ package dev.compactmods.machines; -import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; +import dev.compactmods.machines.api.inject.InjectField; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.api.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.room.ForgeCompactRoomProvider; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; +import dev.compactmods.machines.util.AnnotationScanner; import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; import net.minecraft.server.level.ServerLevel; @@ -15,21 +18,35 @@ import net.minecraft.world.level.border.WorldBorder; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.level.LevelEvent; -import net.minecraftforge.event.server.ServerStartedEvent; +import net.minecraftforge.event.server.ServerAboutToStartEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.network.PacketDistributor; +import java.util.function.Supplier; import java.util.stream.Collectors; @Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class ServerEventHandler { @SubscribeEvent - public static void onServerStarted(final ServerStartedEvent started) { + public static void onServerAboutToStart(final ServerAboutToStartEvent server) { + final var modLog = LoggingUtil.modLog(); + + modLog.debug("Starting addon scan and injection for server startup."); CompactMachines.getAddons().forEach(addon -> { - addon.acceptRoomSpawnLookup(ForgeCompactRoomProvider::instance); - addon.acceptRoomOwnerLookup(ForgeCompactRoomProvider::instance); + final Supplier ownerLookup = ForgeCompactRoomProvider::instance; + final Supplier spawnLookup = ForgeCompactRoomProvider::instance; + + final var injectableFields = AnnotationScanner.scanFields(addon, InjectField.class) + .filter(field -> field.canAccess(addon)) + .collect(Collectors.toSet()); + + if(injectableFields.isEmpty()) return; + + modLog.debug("Injecting lookup data into addon {} ...", addon.getClass()); + AnnotationScanner.injectFields(addon, ownerLookup, injectableFields); + AnnotationScanner.injectFields(addon, spawnLookup, injectableFields); }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java index 08dd3d15..3f01512f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java @@ -6,7 +6,7 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.commands.CommandSourceStack; @@ -16,7 +16,7 @@ import java.util.Optional; -public class RoomUpgradeArgument extends ResourceKeyArgument { +public class RoomUpgradeArgument extends ResourceKeyArgument { public static final SuggestionProvider SUGGESTOR = (ctx, builder) -> SharedSuggestionProvider.suggestResource(MachineRoomUpgrades.REGISTRY.get().getKeys(), builder); @@ -28,9 +28,9 @@ private RoomUpgradeArgument() { super(Rooms.ROOM_UPGRADES_REG_KEY); } - public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { + public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { final var UPGRADES = MachineRoomUpgrades.REGISTRY.get(); - ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); + ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); return Optional.ofNullable(UPGRADES.getValue(resourcekey.location())); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java index 00e2797d..93baf6e6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java @@ -6,6 +6,8 @@ import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.upgrade.IUpgradeAppliedListener; +import dev.compactmods.machines.api.upgrade.IUpgradeRemovedListener; import dev.compactmods.machines.command.RoomUpgradeArgument; import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; @@ -78,7 +80,9 @@ private static int addToCurrentRoom(CommandContext ctx) thro final var added = manager.addUpgrade(upgrade, room.code()); if (added) { - upgrade.onAdded(compactDim, room); + if(upgrade instanceof IUpgradeAppliedListener applied) + applied.onAdded(compactDim, room); + src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_APPLIED), true); } else { src.sendFailure(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED)); @@ -126,7 +130,9 @@ private static int removeFromCurrentRoom(CommandContext ctx) final var removed = manager.removeUpgrade(upgrade, room.code()); if (removed) { - upgrade.onRemoved(compactDim, room); + if(upgrade instanceof IUpgradeRemovedListener rem) + rem.onRemoved(compactDim, room); + src.sendSuccess(TranslationUtil.message(Messages.UPGRADE_REMOVED), true); } else { src.sendFailure(TranslationUtil.message(Messages.UPGRADE_REM_FAILED)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java index 73bafcf0..2a48f291 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java @@ -31,7 +31,7 @@ protected void registerModels() { withExistingParent("tunnel", mcLoc("item/generated")) .texture("layer0", modLoc("item/tunnel")); - withExistingParent(MachineRoomUpgrades.CHUNKLOADER.getId().toString(), mcLoc("item/generated")) + withExistingParent(MachineRoomUpgrades.ROOM_UPGRADE.getId().toString(), mcLoc("item/generated")) .texture("layer0", modLoc("upgrades/chunkloader")); withExistingParent(MachineRoomUpgrades.WORKBENCH_ITEM.getId().getPath(), modLoc("block/workbench")); diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java index 4550efdd..8d67d053 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.machine.Machines; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.BuiltinTunnels; +import dev.compactmods.machines.tunnel.BuiltInTunnels; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.recipes.FinishedRecipe; @@ -52,7 +52,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("picked_up_ender_eye", has(Items.ENDER_EYE)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.ITEM_TUNNEL_DEF.getId(), 2) + TunnelRecipeBuilder.tunnel(BuiltInTunnels.ITEM_TUNNEL_DEF.getId(), 2) .requires(Ingredient.of(Tags.Items.CHESTS)) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -60,7 +60,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.FLUID_TUNNEL_DEF.getId(), 2) + TunnelRecipeBuilder.tunnel(BuiltInTunnels.FLUID_TUNNEL_DEF.getId(), 2) .requires(Items.BUCKET) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) @@ -68,7 +68,7 @@ protected void buildCraftingRecipes(@NotNull Consumer consumer) .unlockedBy("observer", has(Items.OBSERVER)) .save(consumer); - TunnelRecipeBuilder.tunnel(BuiltinTunnels.FORGE_ENERGY.getId(), 2) + TunnelRecipeBuilder.tunnel(BuiltInTunnels.FORGE_ENERGY.getId(), 2) .requires(Items.GLOWSTONE_DUST) .requires(Items.ENDER_PEARL) .requires(Items.REDSTONE) diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java index a4f3117c..78907344 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java @@ -3,16 +3,19 @@ import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.data.generated.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import net.minecraft.Util; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.data.LanguageProvider; +import net.minecraftforge.registries.IForgeRegistry; import java.util.function.Supplier; @@ -22,9 +25,12 @@ public abstract class BaseLangGenerator extends LanguageProvider { private final String locale; + private final IForgeRegistry ACTIONS_REG; + public BaseLangGenerator(DataGenerator gen, String locale) { super(gen, Constants.MOD_ID, locale); this.locale = locale; + ACTIONS_REG = MachineRoomUpgrades.REGISTRY.get(); } protected abstract String getSizeTranslation(RoomSize size); @@ -61,10 +67,11 @@ protected void addTunnel(Supplier tunnel, String name) { add(TranslationUtil.tunnelId(Tunnels.getRegistryId(tunnel.get())), name); } - void addUpgradeItem(Supplier upgrade, String translation) { + void add(Supplier upgrade, String translation) { final var u = upgrade.get(); + final var id = ACTIONS_REG.getKey(u); if(u != null) - add(u.getTranslationKey(), translation); + add(Util.makeDescriptionId("upgrade.action", id), translation); } protected void addAdvancementTranslations() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java index 906c9448..54f0be02 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java @@ -5,11 +5,11 @@ import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.dimension.VoidAirBlock; import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.BuiltinTunnels; +import dev.compactmods.machines.tunnel.BuiltInTunnels; import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.upgrade.BuiltInUpgradeActions; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; @@ -72,11 +72,9 @@ protected void addTranslations() { add(Constants.MOD_ID + ".direction.side", "Side: %s"); add(Constants.MOD_ID + ".connected_block", "Connected: %s"); - add(RoomUpgrade.UNNAMED_TRANS_KEY, "Unnamed Room Upgrade"); - - addTunnel(BuiltinTunnels.ITEM_TUNNEL_DEF, "Item Tunnel"); - addTunnel(BuiltinTunnels.FLUID_TUNNEL_DEF, "Fluid Tunnel"); - addTunnel(BuiltinTunnels.FORGE_ENERGY, "Energy Tunnel"); + addTunnel(BuiltInTunnels.ITEM_TUNNEL_DEF, "Item Tunnel"); + addTunnel(BuiltInTunnels.FLUID_TUNNEL_DEF, "Fluid Tunnel"); + addTunnel(BuiltInTunnels.FORGE_ENERGY, "Energy Tunnel"); // addTunnel(Tunnels.REDSTONE_IN_DEF.get(), "Redstone Tunnel (In)"); // addTunnel(Tunnels.REDSTONE_OUT_DEF.get(), "Redstone Tunnel (Out)"); @@ -97,7 +95,7 @@ protected void addTranslations() { addTooltip(Tooltips.ROOM_NAME, "Bound to room: %s"); //region Upgrades - addUpgradeItem(MachineRoomUpgrades.CHUNKLOAD, "Chunkloader Upgrade"); + add(BuiltInUpgradeActions.CHUNKLOAD, "Chunkloader Upgrade"); addMessage(Messages.ALREADY_HAS_UPGRADE, "Upgrade has already been applied to room."); addMessage(Messages.UPGRADE_NOT_PRESENT, "Upgrade is not applied to the room."); diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java index 5a832d0c..32df97c6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java @@ -41,7 +41,7 @@ protected void addTags() { machinesTag.add(boundMachineItem); machinesTag.add(unboundMachineItem); - upgradeTag.add(MachineRoomUpgrades.CHUNKLOADER.get()); + upgradeTag.add(MachineRoomUpgrades.ROOM_UPGRADE.get()); final var psd = Shrinking.PERSONAL_SHRINKING_DEVICE.get(); final var curiosPsdTag = tag(TagKey.create(Registries.ITEMS.getRegistryKey(), new ResourceLocation("curios", "psd"))); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java index f4e34d18..353e0c0b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.machine.block; import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.Registries; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; @@ -9,7 +10,6 @@ import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.Registries; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.LegacySizedTemplates; @@ -24,8 +24,6 @@ import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.upgrade.RoomUpgradeItem; -import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; -import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -197,35 +195,38 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var reg = MachineRoomUpgrades.REGISTRY.get(); if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.roomInfo().ifPresent(room -> { - final var ownerId = room.owner(roomData); - if (!player.getUUID().equals(ownerId)) { - final var ownerName = server.getPlayerList().getPlayer(ownerId).getName(); - player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, ownerName), true); - return; - } - - final var upg = upItem.getUpgradeType(); - final var manager = RoomUpgradeManager.get(compactDim); - - if (manager.hasUpgrade(room.code(), upg)) { - player.displayClientMessage(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE), true); - } else { - final var added = manager.addUpgrade(upg, room.code()); - - if (added) { - player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_APPLIED) - .withStyle(ChatFormatting.DARK_GREEN), true); - } else { - player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED) - .withStyle(ChatFormatting.DARK_RED), true); - } - } - }); + // TODO +// tile.roomInfo().ifPresent(room -> { +// final var ownerId = room.owner(roomData); +// if (!player.getUUID().equals(ownerId)) { +// final var ownerName = server.getPlayerList().getPlayer(ownerId).getName(); +// player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, ownerName), true); +// return; +// } +// +// final var upg = RoomUpgradeHelper.getUpgradeId(mainItem); +// final var manager = RoomUpgradeManager.get(compactDim); +// +// if (manager.hasUpgrade(room.code(), upg)) { +// player.displayClientMessage(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE), true); +// } else { +// final var added = manager.addUpgrade(upg, room.code()); +// +// if (added) { +// player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_APPLIED) +// .withStyle(ChatFormatting.DARK_GREEN), true); +// } else { +// player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED) +// .withStyle(ChatFormatting.DARK_RED), true); +// } +// } +// }); } } } + + // All other items, open preview screen if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { if (state.getBlock() instanceof LegacySizedCompactMachineBlock cmBlock) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java index cc1b6fbc..306f907f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java @@ -5,8 +5,8 @@ import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.api.room.upgrade.RoomUpgradeInstance; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.graph.RoomReferenceNode; @@ -85,7 +85,7 @@ public CompoundTag save(CompoundTag tag) { final var id = upg.key(); final var upgradeInst = upgReg.getValue(id); - final var uKey = ResourceKey.create(RoomUpgrade.REG_KEY, id); + final var uKey = ResourceKey.create(RoomUpgradeAction.REG_KEY, id); this.roomsWith(uKey).forEach(room -> { upgradeList.add(new UpgradeConnectionEntry(room, uKey, upgradeInst)); @@ -104,7 +104,7 @@ public CompoundTag save(CompoundTag tag) { return tag; } - public boolean addUpgrade(T upgrade, String room) { + public boolean addUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); final var upgradeNode = upgradeNodes.computeIfAbsent(upgRegistry.getKey(upgrade), rl -> { @@ -126,7 +126,7 @@ public boolean addUpgrade(T upgrade, String room) { return true; } - public boolean removeUpgrade(T upgrade, String room) { + public boolean removeUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; @@ -144,7 +144,7 @@ public boolean removeUpgrade(T upgrade, String room) { return true; } - public Stream roomsWith(ResourceKey upgradeKey) { + public Stream roomsWith(ResourceKey upgradeKey) { if (!upgradeNodes.containsKey(upgradeKey.location())) return Stream.empty(); @@ -156,7 +156,7 @@ public Stream roomsWith(ResourceKey upgradeKey) { .map(RoomReferenceNode::code); } - public Stream> implementing(Class inter) { + public Stream> implementing(Class inter) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); // Find all applicable upgrades in registry @@ -189,7 +189,7 @@ public Stream> implementing(Class return instances.stream(); } - public boolean hasUpgrade(String room, RoomUpgrade upgrade) { + public boolean hasUpgrade(String room, RoomUpgradeAction upgrade) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java index 4ee9ed8d..9b67b4ca 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java @@ -1,17 +1,31 @@ package dev.compactmods.machines.room.upgrade; +import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.i18n.TranslationUtil; +import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; +import java.util.List; + public class RoomUpgradeWorkbench extends Block implements EntityBlock { public RoomUpgradeWorkbench(Properties props) { super(props); } + @Override + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + tooltip.add(TranslationUtil.tooltip(Tooltips.NOT_YET_IMPLEMENTED).withStyle(ChatFormatting.DARK_RED)); + } + @Nullable @Override public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java index c12a27eb..26e2b4ef 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.tunnel; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.Registries; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java deleted file mode 100644 index 0d2add22..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/ChunkloadUpgradeItem.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.compactmods.machines.upgrade; - -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; -import dev.compactmods.machines.room.upgrade.ChunkloadUpgrade; -import net.minecraft.core.NonNullList; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.ItemStack; - -public class ChunkloadUpgradeItem extends RoomUpgradeItem { - public ChunkloadUpgradeItem(Properties props) { - super(props); - } - @Override - public void fillItemCategory(CreativeModeTab tab, NonNullList stacks) { - if(!allowedIn(tab)) return; - - final var stack = new ItemStack(MachineRoomUpgrades.CHUNKLOADER.get(), 1); - final var info = stack.getOrCreateTagElement(RoomUpgradeHelper.NBT_UPGRADE_NODE); - info.putString(RoomUpgradeHelper.NBT_UPGRADE_ID, ChunkloadUpgrade.REG_ID.toString()); - - stacks.add(stack); - } - @Override - public RoomUpgrade getUpgradeType() { - return MachineRoomUpgrades.CHUNKLOAD.get(); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java index f331a8de..e9a9d892 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java @@ -1,9 +1,8 @@ package dev.compactmods.machines.upgrade; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.Registries; -import dev.compactmods.machines.room.upgrade.ChunkloadUpgrade; import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbench; import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbenchEntity; import net.minecraft.world.item.BlockItem; @@ -20,12 +19,11 @@ public class MachineRoomUpgrades { - public static final Supplier> REGISTRY = Registries.UPGRADES.makeRegistry(RegistryBuilder::new); + public static final Supplier> REGISTRY = Registries.UPGRADES.makeRegistry(RegistryBuilder::new); // ================================================================================================================ - public static final RegistryObject CHUNKLOAD = Registries.UPGRADES.register(ChunkloadUpgrade.REG_ID.getPath(), ChunkloadUpgrade::new); - public static final RegistryObject CHUNKLOADER = Registries.ITEMS.register("chunkloader_upgrade", () -> new ChunkloadUpgradeItem(new Item.Properties() + public static final RegistryObject ROOM_UPGRADE = Registries.ITEMS.register("room_upgrade", () -> new RoomUpgradeItem(new Item.Properties() .tab(CompactMachines.COMPACT_MACHINES_ITEMS) .stacksTo(1))); diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java index 73a3fb59..9a1f65d7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java @@ -1,7 +1,6 @@ package dev.compactmods.machines.upgrade; import dev.compactmods.machines.api.core.Tooltips; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.ChatFormatting; @@ -15,24 +14,12 @@ import java.util.List; -public abstract class RoomUpgradeItem extends Item { +public class RoomUpgradeItem extends Item { public RoomUpgradeItem(Properties props) { super(props); } - public abstract RoomUpgrade getUpgradeType(); - - @Override - public Component getName(ItemStack stack) { - String key = RoomUpgradeHelper.getTypeFrom(stack) - .map(rl -> MachineRoomUpgrades.REGISTRY.get().getValue(rl)) - .map(def -> def.getTranslationKey(stack)) - .orElse(RoomUpgrade.UNNAMED_TRANS_KEY); - - return Component.translatable(key); - } - @Override public void appendHoverText(ItemStack stack, @Nullable Level level, List info, TooltipFlag flag) { if (Screen.hasShiftDown()) { @@ -43,7 +30,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List { + RoomUpgradeHelper.getUpgradeId(stack).ifPresent(upgType -> { info.add(TranslationUtil.tooltip(Tooltips.ROOM_UPGRADE_TYPE, upgType).withStyle(ChatFormatting.DARK_GRAY)); }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java index dc64d19e..8f32fe9e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java @@ -2,14 +2,14 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import org.jetbrains.annotations.NotNull; -public class RoomUpgradeConnection implements IGraphEdge> { +public class RoomUpgradeConnection implements IGraphEdge> { public static final Codec> CODEC = RecordCodecBuilder.create(i -> i.group( MachineRoomUpgrades.REGISTRY.get().getCodec().fieldOf("data").forGetter(RoomUpgradeConnection::instance) ).apply(i, RoomUpgradeConnection::new)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java index f2d19467..fc0d3fd6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java @@ -2,18 +2,18 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; -public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { +public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING .fieldOf("room") .forGetter(UpgradeConnectionEntry::room), - ResourceKey.codec(RoomUpgrade.REG_KEY) + ResourceKey.codec(RoomUpgradeAction.REG_KEY) .fieldOf("upgrade") .forGetter(UpgradeConnectionEntry::upgradeKey), diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java b/forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java new file mode 100644 index 00000000..e327b494 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java @@ -0,0 +1,54 @@ +package dev.compactmods.machines.util; + +import net.minecraftforge.fml.ModList; +import net.minecraftforge.forgespi.language.ModFileScanData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.objectweb.asm.Type; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Stream; + +public class AnnotationScanner { + + private static final Logger SCANNER_LOG = LogManager.getLogger(); + + public static Stream scanModList(Class type) { + return ModList.get() + .getAllScanData() + .stream() + .flatMap(scans -> scans.getAnnotations() + .stream() + .filter(ad -> ad.annotationType().equals(Type.getType(type))) + ); + } + + public static Stream scanFields(T instance, Class annotationType) { + var parent = instance.getClass(); + return Arrays.stream(parent.getDeclaredFields()) + .filter(field -> field.isAnnotationPresent(annotationType)); + } + + public static Stream scanMethods(T instance, Class annotationType) { + var parent = instance.getClass(); + return Arrays.stream(parent.getDeclaredMethods()) + .filter(meth -> meth.isAnnotationPresent(annotationType)); + } + + public static void injectFields(Target target, Value val, Set injectableFields) { + injectableFields.stream() + .filter(field -> field.getType().isAssignableFrom(val.getClass())) + .forEach(field -> { + try { + field.set(target, val); + } catch (IllegalAccessException e) { + SCANNER_LOG.error("Failed to inject lookup data {} into addon {}", field.getName(), target.getClass().getName()); + SCANNER_LOG.error(e); + } + }); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java index dde33f82..a9112e95 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java @@ -1,20 +1,18 @@ package dev.compactmods.machines.villager; import dev.compactmods.machines.api.core.Constants; -import net.minecraftforge.event.village.VillagerTradesEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = Constants.MOD_ID) public class VillagerTradesEventHandler { - @SubscribeEvent - public static void onVillagerTrades(final VillagerTradesEvent trades) { - final var tinkerer = Villagers.TINKERER.get(); - if(!trades.getType().equals(tinkerer)) - return; - - final var tradeList = trades.getTrades(); - tradeList.get(1).add(Villagers.TEST_TRADE.get()); - } +// @SubscribeEvent +// public static void onVillagerTrades(final VillagerTradesEvent trades) { +// final var tinkerer = Villagers.TINKERER.get(); +// if(!trades.getType().equals(tinkerer)) +// return; +// +// final var tradeList = trades.getTrades(); +// tradeList.get(1).add(Villagers.TEST_TRADE.get()); +// } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java index a9b8bea2..9cb0bdfe 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java @@ -1,26 +1,17 @@ package dev.compactmods.machines.villager; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.Registries; -import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.entity.npc.VillagerTrades; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.BasicItemListing; -import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.RegistryBuilder; import net.minecraftforge.registries.RegistryObject; -import java.util.function.Supplier; - public class Villagers { public static final ResourceLocation TINKERER_ID = new ResourceLocation(Constants.MOD_ID, "tinkerer"); @@ -37,16 +28,16 @@ public class Villagers { SoundEvents.VILLAGER_WORK_TOOLSMITH )); - public static final DeferredRegister TRADES = DeferredRegister.create( - new ResourceLocation(Constants.MOD_ID, "tinkerer_trades"), - Constants.MOD_ID - ); +// public static final DeferredRegister TRADES = DeferredRegister.create( +// new ResourceLocation(Constants.MOD_ID, "tinkerer_trades"), +// Constants.MOD_ID +// ); - public static final Supplier> TRADES_REG = TRADES - .makeRegistry(RegistryBuilder::new); +// public static final Supplier> TRADES_REG = TRADES +// .makeRegistry(RegistryBuilder::new); - public static final RegistryObject TEST_TRADE = TRADES.register("test", - () -> new BasicItemListing(1, new ItemStack(Machines.MACHINE_BLOCK_ITEM_TINY.get()), 5, 100)); +// public static final RegistryObject TEST_TRADE = TRADES.register("test", +// () -> new BasicItemListing(1, new ItemStack(Machines.MACHINE_BLOCK_ITEM_TINY.get()), 5, 100)); static { Registries.POINTS_OF_INTEREST.register("tinkerer", () -> new PoiType( diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java b/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java new file mode 100644 index 00000000..bf35055f --- /dev/null +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java @@ -0,0 +1,37 @@ +package dev.compactmods.machines; + +import dev.compactmods.machines.api.CompactMachinesAddon; +import dev.compactmods.machines.api.ICompactMachinesAddon; +import dev.compactmods.machines.api.inject.InjectField; +import dev.compactmods.machines.api.room.IRoomOwnerLookup; +import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; +import dev.compactmods.machines.tunnel.BuiltInTunnels; +import dev.compactmods.machines.upgrade.BuiltInUpgradeActions; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +import java.util.function.Supplier; + +@CompactMachinesAddon +public class CMBuiltInAddon implements ICompactMachinesAddon { + + @InjectField + public Supplier roomOwnerLookup; + + @InjectField + public Supplier roomSpawnLookup; + + private static CMBuiltInAddon INSTANCE; + + public CMBuiltInAddon() { + INSTANCE = this; + BuiltInTunnels.prepare(); + BuiltInUpgradeActions.prepare(); + } + + @Override + public void afterRegistration() { + var bus = FMLJavaModLoadingContext.get().getModEventBus(); + BuiltInTunnels.REGISTRATION.register(bus); + BuiltInUpgradeActions.REGISTRATION.register(bus); + } +} diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java new file mode 100644 index 00000000..53c9f1b7 --- /dev/null +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java @@ -0,0 +1,31 @@ +package dev.compactmods.machines.tunnel; + +import dev.compactmods.machines.api.core.CMRegistryKeys; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; +import dev.compactmods.machines.tunnel.definitions.FluidTunnel; +import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; +import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +public class BuiltInTunnels { + + public static DeferredRegister REGISTRATION = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, Constants.MOD_ID); + + // ================================================================================================================ + // TUNNEL TYPE DEFINITIONS + // ================================================================================================================ + public static final RegistryObject ITEM_TUNNEL_DEF = REGISTRATION.register("item", BufferedItemTunnel::new); + + public static final RegistryObject FLUID_TUNNEL_DEF = REGISTRATION.register("fluid", FluidTunnel::new); + + public static final RegistryObject FORGE_ENERGY = REGISTRATION.register("energy", ForgeEnergyTunnel::new); + + public static final RegistryObject REDSTONE_IN = REGISTRATION.register("redstone_in", RedstoneInTunnelDefinition::new); + + public static void prepare() { + + } +} diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java b/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java deleted file mode 100644 index 75065d0a..00000000 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltinTunnels.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import dev.compactmods.machines.api.CompactMachinesAddon; -import dev.compactmods.machines.api.ICompactMachinesAddon; -import dev.compactmods.machines.api.core.CMRegistryKeys; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; -import dev.compactmods.machines.tunnel.definitions.FluidTunnel; -import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; -import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.RegistryObject; - -import java.util.function.Supplier; - -@CompactMachinesAddon -public class BuiltinTunnels implements ICompactMachinesAddon { - public static Supplier roomOwnerLookup; - public static Supplier roomSpawnLookup; - - public static DeferredRegister DR = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, Constants.MOD_ID); - - // ================================================================================================================ - // TUNNEL TYPE DEFINITIONS - // ================================================================================================================ - public static final RegistryObject ITEM_TUNNEL_DEF = DR.register("item", BufferedItemTunnel::new); - - public static final RegistryObject FLUID_TUNNEL_DEF = DR.register("fluid", FluidTunnel::new); - - public static final RegistryObject FORGE_ENERGY = DR.register("energy", ForgeEnergyTunnel::new); - - public static final RegistryObject REDSTONE_IN = DR.register("redstone_in", RedstoneInTunnelDefinition::new); - - @Override - public void afterRegistration() { - var bus = FMLJavaModLoadingContext.get().getModEventBus(); - DR.register(bus); - } - - public void acceptRoomOwnerLookup(Supplier ownerLookup) { - roomOwnerLookup = ownerLookup; - } - - @Override - public void acceptRoomSpawnLookup(Supplier spawnLookup) { - roomSpawnLookup = spawnLookup; - } -} diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java new file mode 100644 index 00000000..482de79a --- /dev/null +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java @@ -0,0 +1,18 @@ +package dev.compactmods.machines.upgrade; + +import dev.compactmods.machines.api.core.CMRegistryKeys; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +public class BuiltInUpgradeActions { + + public static DeferredRegister REGISTRATION = + DeferredRegister.create(CMRegistryKeys.UPGRADE_ACTIONS, Constants.MOD_ID); + + public static final RegistryObject CHUNKLOAD = + REGISTRATION.register("chunkload", ChunkloadAction::new); + + public static void prepare() {} +} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java similarity index 50% rename from common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java index 863eea0e..99415df6 100644 --- a/common-main/src/main/java/dev/compactmods/machines/room/upgrade/ChunkloadUpgrade.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java @@ -1,30 +1,29 @@ -package dev.compactmods.machines.room.upgrade; +package dev.compactmods.machines.upgrade; import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.room.upgrade.ILevelLoadedUpgradeListener; -import dev.compactmods.machines.api.room.upgrade.RoomUpgrade; -import net.minecraft.resources.ResourceLocation; +import dev.compactmods.machines.api.upgrade.ILevelLoadedUpgradeListener; +import dev.compactmods.machines.api.upgrade.IUpgradeAppliedListener; +import dev.compactmods.machines.api.upgrade.IUpgradeRemovedListener; +import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.TicketType; import net.minecraft.world.level.ChunkPos; import java.util.Comparator; -public class ChunkloadUpgrade implements RoomUpgrade, ILevelLoadedUpgradeListener { +public class ChunkloadAction implements RoomUpgradeAction, + IUpgradeAppliedListener, IUpgradeRemovedListener, + ILevelLoadedUpgradeListener { - public static final ResourceLocation REG_ID = new ResourceLocation(Constants.MOD_ID, "chunkloader"); - private static final TicketType CM4_LOAD_TYPE = TicketType.create(Constants.MOD_ID + ":rooms", Comparator.comparingLong(ChunkPos::toLong)); + private static final TicketType CHUNKLOAD_LOAD_TYPE = TicketType.create(Constants.MOD_ID + ":rooms", Comparator.comparingLong(ChunkPos::toLong)); - private static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> REG_ID) - ).apply(i, t -> new ChunkloadUpgrade())); + private static final Codec CODEC = Codec.unit(new ChunkloadAction()); @Override - public String getTranslationKey() { - return "item." + REG_ID.getNamespace() + ".upgrades." + REG_ID.getPath(); + public Codec codec() { + return CODEC; } @Override @@ -47,21 +46,21 @@ public void onLevelUnloaded(ServerLevel level, IRoomRegistration room) { normalLoad(level, room); } - private void forceLoad(ServerLevel level, IRoomRegistration room) { + private static void forceLoad(ServerLevel level, IRoomRegistration room) { final var chunks = level.getChunkSource(); room.chunks().forEach(chunk -> { level.setChunkForced(chunk.x, chunk.z, true); - chunks.addRegionTicket(CM4_LOAD_TYPE, chunk, 2, chunk); + chunks.addRegionTicket(CHUNKLOAD_LOAD_TYPE, chunk, 2, chunk); }); chunks.save(false); } - private void normalLoad(ServerLevel level, IRoomRegistration room) { + private static void normalLoad(ServerLevel level, IRoomRegistration room) { final var chunks = level.getChunkSource(); room.chunks().forEach(chunk -> { level.setChunkForced(chunk.x, chunk.z, false); - chunks.removeRegionTicket(CM4_LOAD_TYPE, chunk, 2, chunk); + chunks.removeRegionTicket(CHUNKLOAD_LOAD_TYPE, chunk, 2, chunk); }); chunks.save(false); diff --git a/forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json b/forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json new file mode 100644 index 00000000..1b3be6e4 --- /dev/null +++ b/forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json @@ -0,0 +1,25 @@ +{ + "max_allowed": 1, + "apply_conditions": [ + { "type": "compactmachines:room_owner" } + ], + "actions": [ + { "type": "compactmachines:chunkload" }, + { + "type": "compactmachines:generate_item_fixed", + "cooldown": 20, + "count": 16, + "item": { + "item": "minecraft:cobblestone" + } + }, + { + "type": "compactmachines:generate_item_scaled", + "cooldown": 20, + "scale_factor": 4, + "item": { + "item": "minecraft:iron_ore" + } + } + ] +} \ No newline at end of file From 25b2e108e33fe8103b4a16db2b285b19cfcef0c9 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 29 Jan 2023 03:41:43 -0500 Subject: [PATCH 40/85] Create announce-latest-nightly.yml --- .github/workflows/announce-latest-nightly.yml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/announce-latest-nightly.yml diff --git a/.github/workflows/announce-latest-nightly.yml b/.github/workflows/announce-latest-nightly.yml new file mode 100644 index 00000000..647b2ffd --- /dev/null +++ b/.github/workflows/announce-latest-nightly.yml @@ -0,0 +1,99 @@ +name: Announce Latest Nightly to Discord + +on: + workflow_dispatch: + inputs: + diagnostic_mode: + description: Diagnostic Mode + type: boolean + default: false + required: true + +jobs: + vars: + name: Get Variables + runs-on: ubuntu-22.04 + outputs: + mcVersion: ${{steps.gradle_props.outputs.minecraft_version}} + forgeVersion: ${{steps.gradle_props.outputs.forge_version}} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Read MC and Forge versions + id: gradle_props + uses: christian-draeger/read-properties@1.1.0 + with: + path: "gradle.properties" + properties: "minecraft_version forge_version" + + get-package-info: + name: Get Latest Package Info + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.download-info.outputs.version }} + steps: + - name: Download Package Info + id: download-info + uses: compactmods/dl-package-info@1.0.2 + env: + GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + owner: compactmods + repo: compactmachines + group: dev.compactmods + filter: "^compactmachines-(?:[\\d\\.]+)-nightly.jar$" + outputFile: compactmachines-nightly.json + + - name: Debug output + run: | + echo "Version: ${{ steps.download-info.outputs.version }}" + cat compactmachines-nightly.json + + - name: Read info into variable [latest] + id: info + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT + + - name: Download JAR and prepare artifacts + run: | + mkdir release + curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}" + mv compactmachines-nightly.json release/compactmachines-nightly.json + + - name: Add Artifact + uses: actions/upload-artifact@v3 + with: + name: release + path: release + + announce: + name: Discord Announcement + needs: [ vars, get-package-info ] + runs-on: ubuntu-22.04 + steps: + - name: Grab JAR and Info + uses: actions/download-artifact@v3 + with: + name: release + path: . + + - name: Read info into variable [latest] + id: info + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT + + - name: Announce Release + uses: compactmods/discord-releaser@0.1.5 + env: + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} + with: + filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}} + channel: ${{ secrets.NIGHTLY_CHANNEL_ID }} + modName: Compact Machines + modVersion: ${{ needs.get-package-info.outputs.version }} + thumbnail: https://media.forgecdn.net/avatars/10/602/635460270800375500.png + + forgeVersion: ${{ needs.vars.outputs.forgeVersion }} + mcVersion: ${{ needs.vars.outputs.mcVersion }} From 4dbed600ec073927086400d0aa996e0653b8b0ed Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 21 Feb 2023 01:00:07 -0500 Subject: [PATCH 41/85] Fix upgrade naming and resource keys --- common-api/build.gradle.kts | 2 ++ .../machines/api/core/CMRegistryKeys.java | 4 ++-- .../dev/compactmods/machines/api/room/Rooms.java | 4 ++-- .../api/upgrade/ILevelLoadedUpgradeListener.java | 2 +- .../api/upgrade/IUpgradeAppliedListener.java | 2 +- .../api/upgrade/IUpgradeRemovedListener.java | 2 +- .../machines/api/upgrade/RoomUpgrade.java | 13 +++++++++++++ .../machines/api/upgrade/RoomUpgradeAction.java | 15 --------------- .../machines/api/upgrade/RoomUpgradeInstance.java | 2 +- common-main/build.gradle.kts | 2 ++ .../java/dev/compactmods/machines/Registries.java | 4 ++-- .../machines/command/RoomUpgradeArgument.java | 8 ++++---- .../data/generated/lang/BaseLangGenerator.java | 6 +++--- .../data/generated/lang/EnglishLangGenerator.java | 4 ++-- .../machines/room/upgrade/RoomUpgradeManager.java | 14 +++++++------- .../machines/upgrade/MachineRoomUpgrades.java | 4 ++-- .../upgrade/graph/RoomUpgradeConnection.java | 4 ++-- .../upgrade/graph/UpgradeConnectionEntry.java | 6 +++--- .../dev/compactmods/machines/CMBuiltInAddon.java | 6 +++--- ...InUpgradeActions.java => BuiltInUpgrades.java} | 10 +++++----- .../machines/upgrade/ChunkloadAction.java | 6 +++--- 21 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java rename forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/{BuiltInUpgradeActions.java => BuiltInUpgrades.java} (53%) diff --git a/common-api/build.gradle.kts b/common-api/build.gradle.kts index 2cf059de..31af750b 100644 --- a/common-api/build.gradle.kts +++ b/common-api/build.gradle.kts @@ -59,6 +59,8 @@ tasks.withType { options.compilerArgs.add("-proc:none") } +tasks.create("prepareWorkspace") {} + publishing { publications.register("commonApi") { artifactId = "compactmachines" diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java index c20f795e..dafef35a 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.api.core; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; @@ -12,5 +12,5 @@ public interface CMRegistryKeys { ResourceKey> TYPES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); - ResourceKey> UPGRADE_ACTIONS = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "upgrade_actions")); + ResourceKey> UPGRADES = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); } diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java index 89c36356..1fab7b33 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.api.room; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -12,7 +12,7 @@ public class Rooms { public static final ResourceKey> TEMPLATE_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); - public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); + public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); public static Registry getTemplates(MinecraftServer server) { final var regAccess = server.registryAccess(); diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java index 50290f61..3b2bee89 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.server.level.ServerLevel; -public interface ILevelLoadedUpgradeListener extends RoomUpgradeAction { +public interface ILevelLoadedUpgradeListener extends RoomUpgrade { /** * Called when a level is loaded, typically when the server first boots up. diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java index a0429d13..5ce5daa0 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.server.level.ServerLevel; -public interface IUpgradeAppliedListener extends RoomUpgradeAction { +public interface IUpgradeAppliedListener extends RoomUpgrade { /** * Called when an upgrade is first applied to a room. diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java index 8168a885..247b8abf 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.room.registration.IRoomRegistration; import net.minecraft.server.level.ServerLevel; -public interface IUpgradeRemovedListener extends RoomUpgradeAction { +public interface IUpgradeRemovedListener extends RoomUpgrade { /** * Called when an update is removed from a room. diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java new file mode 100644 index 00000000..aab66ff0 --- /dev/null +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java @@ -0,0 +1,13 @@ +package dev.compactmods.machines.api.upgrade; + +import com.mojang.serialization.Codec; +import dev.compactmods.machines.api.core.CMRegistryKeys; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; + +public interface RoomUpgrade { + + ResourceKey> REG_KEY = CMRegistryKeys.UPGRADES; + + Codec codec(); +} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java deleted file mode 100644 index 4c996fef..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeAction.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import com.mojang.serialization.Codec; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public interface RoomUpgradeAction { - - ResourceKey> REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "upgrade_actions")); - - Codec codec(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java index 02c767d5..f12aaeca 100644 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java +++ b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java @@ -1,3 +1,3 @@ package dev.compactmods.machines.api.upgrade; -public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file +public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file diff --git a/common-main/build.gradle.kts b/common-main/build.gradle.kts index 01aeb83e..c7d0c812 100644 --- a/common-main/build.gradle.kts +++ b/common-main/build.gradle.kts @@ -76,6 +76,8 @@ tasks.withType { options.compilerArgs.add("-proc:none") } +tasks.create("prepareWorkspace") {} + publishing { publications.register("common") { artifactId = "compactmachines" diff --git a/forge-main/src/main/java/dev/compactmods/machines/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/Registries.java index 4fab4742..9a2a55da 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/Registries.java @@ -4,7 +4,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.IGraphNodeType; @@ -43,7 +43,7 @@ public class Registries { public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); // MachineRoomUpgrades - public static final DeferredRegister UPGRADES = DeferredRegister.create(Rooms.ROOM_UPGRADES_REG_KEY, MOD_ID); + public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistryKeys.UPGRADES, MOD_ID); // Graph @ApiStatus.Internal diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java index 3f01512f..834ec04e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java @@ -6,7 +6,7 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.commands.CommandSourceStack; @@ -16,7 +16,7 @@ import java.util.Optional; -public class RoomUpgradeArgument extends ResourceKeyArgument { +public class RoomUpgradeArgument extends ResourceKeyArgument { public static final SuggestionProvider SUGGESTOR = (ctx, builder) -> SharedSuggestionProvider.suggestResource(MachineRoomUpgrades.REGISTRY.get().getKeys(), builder); @@ -28,9 +28,9 @@ private RoomUpgradeArgument() { super(Rooms.ROOM_UPGRADES_REG_KEY); } - public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { + public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { final var UPGRADES = MachineRoomUpgrades.REGISTRY.get(); - ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); + ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); return Optional.ofNullable(UPGRADES.getValue(resourcekey.location())); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java index 78907344..b3084d55 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java @@ -3,7 +3,7 @@ import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.data.generated.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; @@ -25,7 +25,7 @@ public abstract class BaseLangGenerator extends LanguageProvider { private final String locale; - private final IForgeRegistry ACTIONS_REG; + private final IForgeRegistry ACTIONS_REG; public BaseLangGenerator(DataGenerator gen, String locale) { super(gen, Constants.MOD_ID, locale); @@ -67,7 +67,7 @@ protected void addTunnel(Supplier tunnel, String name) { add(TranslationUtil.tunnelId(Tunnels.getRegistryId(tunnel.get())), name); } - void add(Supplier upgrade, String translation) { + void add(Supplier upgrade, String translation) { final var u = upgrade.get(); final var id = ACTIONS_REG.getKey(u); if(u != null) diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java index 54f0be02..372dfbca 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.shrinking.Shrinking; import dev.compactmods.machines.tunnel.BuiltInTunnels; import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.upgrade.BuiltInUpgradeActions; +import dev.compactmods.machines.upgrade.BuiltInUpgrades; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; @@ -95,7 +95,7 @@ protected void addTranslations() { addTooltip(Tooltips.ROOM_NAME, "Bound to room: %s"); //region Upgrades - add(BuiltInUpgradeActions.CHUNKLOAD, "Chunkloader Upgrade"); + add(BuiltInUpgrades.CHUNKLOAD, "Chunkloader Upgrade"); addMessage(Messages.ALREADY_HAS_UPGRADE, "Upgrade has already been applied to room."); addMessage(Messages.UPGRADE_NOT_PRESENT, "Upgrade is not applied to the room."); diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java index 306f907f..8ed7c860 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java @@ -5,7 +5,7 @@ import com.mojang.serialization.Codec; import dev.compactmods.machines.CompactMachines; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; @@ -85,7 +85,7 @@ public CompoundTag save(CompoundTag tag) { final var id = upg.key(); final var upgradeInst = upgReg.getValue(id); - final var uKey = ResourceKey.create(RoomUpgradeAction.REG_KEY, id); + final var uKey = ResourceKey.create(RoomUpgrade.REG_KEY, id); this.roomsWith(uKey).forEach(room -> { upgradeList.add(new UpgradeConnectionEntry(room, uKey, upgradeInst)); @@ -104,7 +104,7 @@ public CompoundTag save(CompoundTag tag) { return tag; } - public boolean addUpgrade(T upgrade, String room) { + public boolean addUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); final var upgradeNode = upgradeNodes.computeIfAbsent(upgRegistry.getKey(upgrade), rl -> { @@ -126,7 +126,7 @@ public boolean addUpgrade(T upgrade, String room) return true; } - public boolean removeUpgrade(T upgrade, String room) { + public boolean removeUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; @@ -144,7 +144,7 @@ public boolean removeUpgrade(T upgrade, String roo return true; } - public Stream roomsWith(ResourceKey upgradeKey) { + public Stream roomsWith(ResourceKey upgradeKey) { if (!upgradeNodes.containsKey(upgradeKey.location())) return Stream.empty(); @@ -156,7 +156,7 @@ public Stream roomsWith(ResourceKey upgradeKey) { .map(RoomReferenceNode::code); } - public Stream> implementing(Class inter) { + public Stream> implementing(Class inter) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); // Find all applicable upgrades in registry @@ -189,7 +189,7 @@ public Stream> implementing return instances.stream(); } - public boolean hasUpgrade(String room, RoomUpgradeAction upgrade) { + public boolean hasUpgrade(String room, RoomUpgrade upgrade) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); if(!upgRegistry.containsValue(upgrade)) return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java index e9a9d892..47f4df3b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.upgrade; import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.Registries; import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbench; import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbenchEntity; @@ -19,7 +19,7 @@ public class MachineRoomUpgrades { - public static final Supplier> REGISTRY = Registries.UPGRADES.makeRegistry(RegistryBuilder::new); + public static final Supplier> REGISTRY = Registries.UPGRADES.makeRegistry(RegistryBuilder::new); // ================================================================================================================ diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java index 8f32fe9e..e7a563d5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java @@ -2,14 +2,14 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import org.jetbrains.annotations.NotNull; -public class RoomUpgradeConnection implements IGraphEdge> { +public class RoomUpgradeConnection implements IGraphEdge> { public static final Codec> CODEC = RecordCodecBuilder.create(i -> i.group( MachineRoomUpgrades.REGISTRY.get().getCodec().fieldOf("data").forGetter(RoomUpgradeConnection::instance) ).apply(i, RoomUpgradeConnection::new)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java index fc0d3fd6..2ddcf3ec 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java @@ -2,18 +2,18 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; -public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { +public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( Codec.STRING .fieldOf("room") .forGetter(UpgradeConnectionEntry::room), - ResourceKey.codec(RoomUpgradeAction.REG_KEY) + ResourceKey.codec(RoomUpgrade.REG_KEY) .fieldOf("upgrade") .forGetter(UpgradeConnectionEntry::upgradeKey), diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java b/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java index bf35055f..f39e561b 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java @@ -6,7 +6,7 @@ import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.tunnel.BuiltInTunnels; -import dev.compactmods.machines.upgrade.BuiltInUpgradeActions; +import dev.compactmods.machines.upgrade.BuiltInUpgrades; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import java.util.function.Supplier; @@ -25,13 +25,13 @@ public class CMBuiltInAddon implements ICompactMachinesAddon { public CMBuiltInAddon() { INSTANCE = this; BuiltInTunnels.prepare(); - BuiltInUpgradeActions.prepare(); + BuiltInUpgrades.prepare(); } @Override public void afterRegistration() { var bus = FMLJavaModLoadingContext.get().getModEventBus(); BuiltInTunnels.REGISTRATION.register(bus); - BuiltInUpgradeActions.REGISTRATION.register(bus); + BuiltInUpgrades.REGISTRATION.register(bus); } } diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java similarity index 53% rename from forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java rename to forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java index 482de79a..08eeee5a 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgradeActions.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java @@ -2,16 +2,16 @@ import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; -public class BuiltInUpgradeActions { +public class BuiltInUpgrades { - public static DeferredRegister REGISTRATION = - DeferredRegister.create(CMRegistryKeys.UPGRADE_ACTIONS, Constants.MOD_ID); + public static DeferredRegister REGISTRATION = + DeferredRegister.create(CMRegistryKeys.UPGRADES, Constants.MOD_ID); - public static final RegistryObject CHUNKLOAD = + public static final RegistryObject CHUNKLOAD = REGISTRATION.register("chunkload", ChunkloadAction::new); public static void prepare() {} diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java index 99415df6..e5e96748 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java +++ b/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java @@ -6,14 +6,14 @@ import dev.compactmods.machines.api.upgrade.ILevelLoadedUpgradeListener; import dev.compactmods.machines.api.upgrade.IUpgradeAppliedListener; import dev.compactmods.machines.api.upgrade.IUpgradeRemovedListener; -import dev.compactmods.machines.api.upgrade.RoomUpgradeAction; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.TicketType; import net.minecraft.world.level.ChunkPos; import java.util.Comparator; -public class ChunkloadAction implements RoomUpgradeAction, +public class ChunkloadAction implements RoomUpgrade, IUpgradeAppliedListener, IUpgradeRemovedListener, ILevelLoadedUpgradeListener { @@ -22,7 +22,7 @@ public class ChunkloadAction implements RoomUpgradeAction, private static final Codec CODEC = Codec.unit(new ChunkloadAction()); @Override - public Codec codec() { + public Codec codec() { return CODEC; } From 6d16a7df1a9692a958e7230938e8806d4c8f79e0 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 12 Mar 2023 00:48:39 -0400 Subject: [PATCH 42/85] Remove many uses of IDimBlockPos, prep for multi-jar --- build.gradle.kts | 52 --- common-api/build.gradle.kts | 85 ----- .../machines/api/CompactMachinesAddon.java | 7 - .../machines/api/ICompactMachinesAddon.java | 12 - .../machines/api/core/Advancements.java | 20 -- .../machines/api/core/CMCommands.java | 38 -- .../machines/api/core/CMRegistryKeys.java | 16 - .../compactmods/machines/api/core/CMTags.java | 16 - .../machines/api/core/Constants.java | 6 - .../machines/api/core/JeiInfo.java | 9 - .../machines/api/core/Messages.java | 42 --- .../machines/api/core/Tooltips.java | 31 -- .../api/dimension/CompactDimension.java | 46 --- .../dimension/MissingDimensionException.java | 11 - .../machines/api/inject/InjectField.java | 4 - .../location/IDimensionalBlockPosition.java | 19 - .../api/location/IDimensionalPosition.java | 20 -- .../api/machine/IMachineBlockEntity.java | 5 - .../api/machine/MachineEntityNbt.java | 8 - .../machines/api/machine/MachineIds.java | 14 - .../machines/api/machine/MachineNbt.java | 9 - .../machines/api/machine/MachineTags.java | 15 - .../api/recipe/ItemWithNbtRecipeBuilder.java | 83 ----- .../recipe/ShapedWithNbtRecipeBuilder.java | 191 ---------- .../recipe/ShapelessRecipeWithNbtResult.java | 83 ----- .../api/resource/IResourceNetwork.java | 14 - .../machines/api/resource/IResourceType.java | 7 - .../api/room/IPlayerRoomMetadata.java | 13 - .../api/room/IPlayerRoomMetadataProvider.java | 12 - .../machines/api/room/IRoomHistory.java | 13 - .../machines/api/room/IRoomLookup.java | 26 -- .../machines/api/room/IRoomOwnerLookup.java | 9 - .../machines/api/room/RoomSize.java | 69 ---- .../machines/api/room/RoomTemplate.java | 46 --- .../compactmods/machines/api/room/Rooms.java | 21 -- .../api/room/history/IRoomHistoryItem.java | 11 - .../api/room/registration/IBasicRoomInfo.java | 7 - .../IMutableRoomRegistration.java | 9 - .../room/registration/IRoomRegistration.java | 34 -- .../room/registration/IRoomSpawnLookup.java | 4 - .../machines/api/shrinking/PSDTags.java | 11 - .../machines/api/tunnels/ITunnelHolder.java | 8 - .../api/tunnels/TunnelDefinition.java | 42 --- .../machines/api/tunnels/TunnelPosition.java | 15 - .../connection/RoomTunnelConnections.java | 21 -- .../tunnels/lifecycle/InstancedTunnel.java | 15 - .../api/tunnels/lifecycle/TunnelInstance.java | 7 - .../lifecycle/TunnelTeardownHandler.java | 48 --- .../tunnels/recipe/TunnelRecipeBuilder.java | 45 --- .../tunnels/recipe/TunnelRecipeHelper.java | 10 - .../redstone/RedstoneReaderTunnel.java | 11 - .../api/tunnels/redstone/RedstoneTunnel.java | 4 - .../redstone/RedstoneWriterTunnel.java | 4 - .../upgrade/ILevelLoadedUpgradeListener.java | 18 - .../api/upgrade/IResourcefulUpgrade.java | 19 - .../api/upgrade/IUpgradeAppliedListener.java | 12 - .../api/upgrade/IUpgradeRemovedListener.java | 12 - .../machines/api/upgrade/RoomUpgrade.java | 13 - .../api/upgrade/RoomUpgradeHelper.java | 25 -- .../api/upgrade/RoomUpgradeInstance.java | 3 - .../requirement/IUpgradeRequirement.java | 4 - .../IUpgradeResourceRequirement.java | 8 - common-main/build.gradle.kts | 102 ------ .../machines/ICompactMachinesMod.java | 11 - .../dev/compactmods/machines/LoggingUtil.java | 12 - .../advancement/AdvancementTriggers.java | 24 -- .../GenericAdvancementTriggerListener.java | 33 -- ...GenericAdvancementTriggerListenerList.java | 38 -- .../trigger/BaseAdvancementTrigger.java | 33 -- .../trigger/BasicPlayerAdvTrigger.java | 37 -- .../trigger/HowDidYouGetHereTrigger.java | 32 -- .../machines/client/PlayerFaceRenderer.java | 21 -- .../machines/client/Resources.java | 12 - .../machines/client/gui/GuiIds.java | 7 - .../gui/PersonalShrinkingDeviceScreen.java | 107 ------ .../machines/client/gui/guide/GuidePage.java | 70 ---- .../client/gui/guide/GuideSection.java | 48 --- .../gui/widget/AbstractCMGuiWidget.java | 27 -- .../widget/ScrollableWrappedTextWidget.java | 71 ---- .../client/level/EmptyLevelEntityGetter.java | 45 --- .../machines/client/level/FakeSpawnInfo.java | 120 ------- .../client/render/SuperRenderTypeBuffer.java | 97 ----- .../util/TransformingVertexBuilder.java | 225 ------------ .../machines/codec/CodecExtensions.java | 52 --- .../codec/DoubleStreamExtensions.java | 50 --- .../machines/codec/NbtListCollector.java | 54 --- .../machines/command/Commands.java | 23 -- .../machines/graph/DimensionGraphNode.java | 26 -- .../machines/graph/IGraphEdge.java | 7 - .../machines/graph/IGraphEdgeType.java | 7 - .../machines/graph/IGraphNode.java | 5 - .../machines/graph/IGraphNodeType.java | 8 - .../machines/graph/SimpleGraphEdgeType.java | 26 -- .../machines/graph/SimpleGraphNodeType.java | 27 -- .../machines/i18n/TranslationUtil.java | 69 ---- .../machines/location/LevelBlockPosition.java | 106 ------ .../location/PreciseDimensionalPosition.java | 70 ---- .../machines/machine/BasicRoomInfo.java | 6 - .../EnumMachinePlayersBreakHandling.java | 23 -- .../machine/LegacySizedTemplates.java | 36 -- .../machine/client/MachineColors.java | 25 -- .../machine/data/MachineDataTagBuilder.java | 90 ----- .../NonexistentMachineException.java | 13 - .../machine/graph/CompactMachineNode.java | 44 --- .../machine/graph/DimensionMachineGraph.java | 231 ------------ .../machine/graph/MachineRoomEdge.java | 35 -- .../machine/item/ICompactMachineItem.java | 24 -- .../room/MutableRoomRegistration.java | 92 ----- .../machines/room/RoomCodeGenerator.java | 16 - .../room/client/ClientRoomMetadata.java | 9 - .../room/client/RoomClientHelper.java | 12 - .../machines/room/data/RoomPreview.java | 14 - .../exceptions/NonexistentRoomException.java | 14 - .../room/graph/CompactRoomProvider.java | 336 ------------------ .../machines/room/graph/NewRoomBuilder.java | 67 ---- .../machines/room/graph/RoomChunkEdge.java | 18 - .../machines/room/graph/RoomChunkNode.java | 29 -- .../machines/room/graph/RoomMetadataNode.java | 95 ----- .../machines/room/graph/RoomOwnerEdge.java | 18 - .../machines/room/graph/RoomOwnerNode.java | 29 -- .../room/graph/RoomReferenceNode.java | 35 -- .../machines/room/graph/RoomSpawnNode.java | 25 -- .../room/history/PlayerRoomHistoryItem.java | 27 -- .../room/server/RoomServerHelper.java | 14 - .../upgrade/graph/RoomUpgradeGraphNode.java | 22 -- .../machines/tunnel/BaseTunnelWallData.java | 21 -- .../machines/tunnel/ITunnelItem.java | 24 -- .../machines/tunnel/SidedPosition.java | 7 - .../machines/tunnel/TunnelHelper.java | 52 --- .../machines/tunnel/TunnelNetwork.java | 18 - .../tunnel/client/ClientTunnelHandler.java | 23 -- .../tunnel/definitions/UnknownTunnel.java | 12 - .../tunnel/graph/TunnelMachineEdge.java | 35 -- .../tunnel/graph/TunnelMachineInfo.java | 9 - .../machines/tunnel/graph/TunnelNode.java | 53 --- .../machines/tunnel/graph/TunnelTypeEdge.java | 43 --- .../machines/tunnel/graph/TunnelTypeNode.java | 30 -- .../machines/tunnel/graph/readme.md | 35 -- .../util/CompactStructureGenerator.java | 119 ------- .../machines/util/DimensionUtil.java | 160 --------- .../compactmods/machines/util/MathUtil.java | 77 ---- .../compactmods/machines/util/NbtUtil.java | 15 - .../compactmods/machines/util/PlayerUtil.java | 52 --- .../machines/util/SavedDataHelper.java | 22 -- .../machines/wall/BreakableWallBlock.java | 9 - .../machines/wall/ItemBlockWall.java | 44 --- forge-builtin/build.gradle.kts | 47 +++ .../forgebuiltin}/CMBuiltInAddon.java | 6 +- .../forgebuiltin}/tunnel/BuiltInTunnels.java | 13 +- .../definitions/BufferedItemTunnel.java | 2 +- .../tunnel/definitions/FluidTunnel.java | 2 +- .../tunnel/definitions/ForgeEnergyTunnel.java | 2 +- .../tunnel/definitions/SmartItemTunnel.java | 15 +- .../redstone/RedstoneInTunnelDefinition.java | 13 +- .../upgrade/BuiltInUpgrades.java | 4 +- .../upgrade/ChunkloadAction.java | 2 +- .../compactmachines/upgrades/chunkloader.json | 0 forge-main/build.gradle.kts | 52 ++- .../machines/command/ForgeCommands.java | 46 --- .../data/generated/VillagerTrades.java | 4 - .../machines/{ => forge}/CompactMachines.java | 29 +- .../machines/{ => forge}/GraphCommon.java | 2 +- .../machines/{ => forge}/ModBusEvents.java | 7 +- .../machines/{ => forge}/ModDataUpgrader.java | 6 +- .../machines/{ => forge}/Registries.java | 6 +- .../{ => forge}/ServerEventHandler.java | 9 +- .../{ => forge}/client/CM4Shaders.java | 2 +- .../client/ClientEventHandler.java | 14 +- .../client/level/RenderingLevel.java | 4 +- .../client/level/TemplateChunk.java | 2 +- .../client/level/TemplateChunkProvider.java | 2 +- .../client/render/RenderTypes.java | 4 +- .../machines/forge/command/ForgeCommands.java | 47 +++ .../command/RoomUpgradeArgument.java | 4 +- .../command/data/CMDataSubcommand.java | 2 +- .../data/CMMachineDataExportCommand.java | 10 +- .../command/data/CMRoomDataExportCommand.java | 2 +- .../data/CMTunnelDataExportCommand.java | 4 +- .../command/subcommand/CMEjectSubcommand.java | 6 +- .../subcommand/CMGiveMachineSubcommand.java | 6 +- .../CMReaddDimensionSubcommand.java | 2 +- .../subcommand/CMRebindSubcommand.java | 10 +- .../subcommand/CMRoomUpgradeCommand.java | 8 +- .../command/subcommand/CMRoomsSubcommand.java | 4 +- .../subcommand/CMSummarySubcommand.java | 2 +- .../subcommand/CMUnbindSubcommand.java | 10 +- .../command/subcommand/SpawnSubcommand.java | 4 +- .../{ => forge}/compat/InterModCompat.java | 8 +- .../compat/carryon/CarryOnCompat.java | 6 +- .../compat/curios/CuriosCompat.java | 2 +- .../compat/jei/CompactMachinesJeiPlugin.java | 10 +- .../compat/theoneprobe/TheOneProbeCompat.java | 2 +- .../compat/theoneprobe/TheOneProbeMain.java | 10 +- .../elements/MachineTunnelElement.java | 2 +- .../elements/PlayerFaceElement.java | 2 +- .../overrides/CompactMachineNameOverride.java | 6 +- .../providers/CompactMachineProvider.java | 10 +- .../theoneprobe/providers/TunnelProvider.java | 14 +- .../{ => forge}/config/CommonConfig.java | 4 +- .../{ => forge}/config/ServerConfig.java | 2 +- .../data/generated/AdvancementGenerator.java | 8 +- .../generated/AdvancementLangBuilder.java | 4 +- .../data/generated/BlockLootGenerator.java | 8 +- .../data/generated/DataGenUtil.java | 4 +- .../data/generated/DataGeneration.java | 14 +- .../data/generated/DimensionTypeBuilder.java | 2 +- .../data/generated/ItemModelGenerator.java | 6 +- .../data/generated/LevelBiomeGenerator.java | 6 +- .../data/generated/RecipeGenerator.java | 10 +- .../data/generated/StateGenerator.java | 10 +- .../generated/TunnelWallStateGenerator.java | 6 +- .../forge/data/generated/VillagerTrades.java | 4 + .../functions/CopyRoomBindingFunction.java | 6 +- .../generated/functions/LootFunctions.java | 4 +- .../generated/lang/BaseLangGenerator.java | 10 +- .../generated/lang/EnglishLangGenerator.java | 16 +- .../generated/lang/RussianLangGenerator.java | 8 +- .../data/generated/room/RoomTemplates.java | 2 +- .../generated/tags/BlockTagGenerator.java | 8 +- .../data/generated/tags/ItemTagGenerator.java | 10 +- .../tags/PointOfInterestTagGenerator.java | 4 +- .../migration/EarlyLevelDataFileReader.java | 2 +- .../migration/Pre520RoomDataMigrator.java | 6 +- .../{ => forge}/dimension/Dimension.java | 4 +- .../dimension/SimpleTeleporter.java | 2 +- .../{ => forge}/dimension/VoidAirBlock.java | 8 +- .../{ => forge}/machine/Machines.java | 20 +- .../machine/block/CompactMachineBlock.java | 8 +- .../block/CompactMachineBlockEntity.java | 16 +- .../block/LegacySizedCompactMachineBlock.java | 26 +- .../machine/block/MachineBlockUtil.java | 16 +- .../machine/item/BoundCompactMachineItem.java | 3 +- .../item/LegacyCompactMachineItem.java | 7 +- .../item/UnboundCompactMachineItem.java | 5 +- .../network/ClientRoomNetworkHandler.java | 6 +- .../network/CompactMachinesNet.java | 8 +- .../network/InitialRoomBlockDataPacket.java | 2 +- .../PlayerRequestedTeleportPacket.java | 14 +- .../PlayerStartedRoomTrackingPacket.java | 4 +- .../network/RoomNetworkHandler.java | 4 +- .../network/SyncRoomMetadataPacket.java | 2 +- .../room/ForgeCompactRoomProvider.java | 2 +- .../room/PlayerRoomMetadataProvider.java | 2 +- .../room/RoomClientEventHandler.java | 4 +- .../{ => forge}/room/RoomEventHandler.java | 6 +- .../machines/{ => forge}/room/RoomHelper.java | 22 +- .../machines/{ => forge}/room/Rooms.java | 4 +- .../room/capability/CMRoomHistory.java | 2 +- .../capability/PlayerRoomHistoryProvider.java | 2 +- .../PlayerRoomMetadataProviderProvider.java | 4 +- .../room/capability/RoomCapEventHandler.java | 2 +- .../room/capability/RoomCapabilities.java | 2 +- .../{ => forge}/room/ui/MachineRoomMenu.java | 16 +- .../room/ui/MachineRoomScreen.java | 18 +- .../{ => forge}/room/ui/PSDIconButton.java | 8 +- .../ui/RoomUserInterfaceRegistration.java | 8 +- .../ui/overlay/RoomMetadataDebugOverlay.java | 2 +- .../room/upgrade/RoomUpgradeManager.java | 10 +- .../room/upgrade/RoomUpgradeWorkbench.java | 2 +- .../upgrade/RoomUpgradeWorkbenchEntity.java | 4 +- .../shrinking/PersonalShrinkingDevice.java | 4 +- .../{ => forge}/shrinking/Shrinking.java | 6 +- .../{ => forge}/tunnel/TunnelItem.java | 26 +- .../{ => forge}/tunnel/TunnelWallBlock.java | 17 +- .../{ => forge}/tunnel/TunnelWallEntity.java | 35 +- .../machines/{ => forge}/tunnel/Tunnels.java | 6 +- .../forge}/tunnel/client/TunnelColors.java | 9 +- .../tunnel/graph/TunnelConnectionGraph.java | 46 +-- .../tunnel/network/TunnelAddedPacket.java | 4 +- .../upgrade/MachineRoomUpgrades.java | 10 +- .../{ => forge}/upgrade/RoomUpgradeItem.java | 2 +- .../upgrade/graph/RoomUpgradeConnection.java | 4 +- .../upgrade/graph/UpgradeConnectionEntry.java | 4 +- .../{ => forge}/util/AnnotationScanner.java | 2 +- .../{ => forge}/util/ForgePlayerUtil.java | 10 +- .../{ => forge}/util/VersionUtil.java | 2 +- .../villager/VillagerTradesEventHandler.java | 2 +- .../forge/villager/VillagerUpgradeTrade.java | 4 + .../{ => forge}/villager/Villagers.java | 6 +- .../wall/ProtectedBlockHandler.java | 2 +- .../{ => forge}/wall/ProtectedWallBlock.java | 2 +- .../{ => forge}/wall/SolidWallBlock.java | 2 +- .../machines/{ => forge}/wall/Walls.java | 8 +- .../villager/VillagerUpgradeTrade.java | 4 - .../machines/test/ServerEvents.java | 2 +- .../test/core/CompactMachinesTests.java | 2 +- .../machines/test/crossmod/Mekanism.java | 2 +- .../test/migrators/EarlyFileLoaderTests.java | 2 +- .../RoomInfoPre520MigratorTests.java | 2 +- .../test/worldgen/RoomGenerationTests.java | 2 +- {forge-api => forge-tunnels-api}/.gitignore | 0 .../build.gradle.kts | 26 +- .../capability/CapabilityLookupTunnel.java | 4 +- .../tunnels/capability/CapabilityTunnel.java | 0 forge-tunnels/build.gradle.kts | 34 -- gradle.properties | 2 + settings.gradle.kts | 17 +- 297 files changed, 642 insertions(+), 6050 deletions(-) delete mode 100644 build.gradle.kts delete mode 100644 common-api/build.gradle.kts delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java delete mode 100644 common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java delete mode 100644 common-main/build.gradle.kts delete mode 100644 common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/Resources.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/command/Commands.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java delete mode 100644 common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java create mode 100644 forge-builtin/build.gradle.kts rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/CMBuiltInAddon.java (84%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/BuiltInTunnels.java (71%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/definitions/BufferedItemTunnel.java (98%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/definitions/FluidTunnel.java (97%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/definitions/ForgeEnergyTunnel.java (97%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/definitions/SmartItemTunnel.java (67%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java (60%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/upgrade/BuiltInUpgrades.java (79%) rename {forge-tunnels/src/main/java/dev/compactmods/machines => forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin}/upgrade/ChunkloadAction.java (97%) rename {forge-tunnels => forge-builtin}/src/main/resources/compactmachines/upgrades/chunkloader.json (100%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/CompactMachines.java (84%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/GraphCommon.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/ModBusEvents.java (78%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/ModDataUpgrader.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/Registries.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/ServerEventHandler.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/CM4Shaders.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/ClientEventHandler.java (79%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/level/RenderingLevel.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/level/TemplateChunk.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/level/TemplateChunkProvider.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/client/render/RenderTypes.java (93%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/RoomUpgradeArgument.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/data/CMDataSubcommand.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/data/CMMachineDataExportCommand.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/data/CMRoomDataExportCommand.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/data/CMTunnelDataExportCommand.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMEjectSubcommand.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMGiveMachineSubcommand.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMReaddDimensionSubcommand.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMRebindSubcommand.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMRoomUpgradeCommand.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMRoomsSubcommand.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMSummarySubcommand.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/CMUnbindSubcommand.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/command/subcommand/SpawnSubcommand.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/InterModCompat.java (74%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/carryon/CarryOnCompat.java (83%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/curios/CuriosCompat.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/jei/CompactMachinesJeiPlugin.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/TheOneProbeCompat.java (77%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/TheOneProbeMain.java (71%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/elements/MachineTunnelElement.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/elements/PlayerFaceElement.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/overrides/CompactMachineNameOverride.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/providers/CompactMachineProvider.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/compat/theoneprobe/providers/TunnelProvider.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/config/CommonConfig.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/config/ServerConfig.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/AdvancementGenerator.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/AdvancementLangBuilder.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/BlockLootGenerator.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/DataGenUtil.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/DataGeneration.java (76%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/DimensionTypeBuilder.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/ItemModelGenerator.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/LevelBiomeGenerator.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/RecipeGenerator.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/StateGenerator.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/TunnelWallStateGenerator.java (94%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/functions/CopyRoomBindingFunction.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/functions/LootFunctions.java (78%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/lang/BaseLangGenerator.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/lang/EnglishLangGenerator.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/lang/RussianLangGenerator.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/room/RoomTemplates.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/tags/BlockTagGenerator.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/tags/ItemTagGenerator.java (86%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/generated/tags/PointOfInterestTagGenerator.java (86%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/migration/EarlyLevelDataFileReader.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/data/migration/Pre520RoomDataMigrator.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/dimension/Dimension.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/dimension/SimpleTeleporter.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/dimension/VoidAirBlock.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/Machines.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/block/CompactMachineBlock.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/block/CompactMachineBlockEntity.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/block/LegacySizedCompactMachineBlock.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/block/MachineBlockUtil.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/item/BoundCompactMachineItem.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/item/LegacyCompactMachineItem.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/machine/item/UnboundCompactMachineItem.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/ClientRoomNetworkHandler.java (83%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/CompactMachinesNet.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/InitialRoomBlockDataPacket.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/PlayerRequestedTeleportPacket.java (76%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/PlayerStartedRoomTrackingPacket.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/RoomNetworkHandler.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/network/SyncRoomMetadataPacket.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ForgeCompactRoomProvider.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/PlayerRoomMetadataProvider.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/RoomClientEventHandler.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/RoomEventHandler.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/RoomHelper.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/Rooms.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/capability/CMRoomHistory.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/capability/PlayerRoomHistoryProvider.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/capability/PlayerRoomMetadataProviderProvider.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/capability/RoomCapEventHandler.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/capability/RoomCapabilities.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ui/MachineRoomMenu.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ui/MachineRoomScreen.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ui/PSDIconButton.java (84%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ui/RoomUserInterfaceRegistration.java (77%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/ui/overlay/RoomMetadataDebugOverlay.java (98%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/upgrade/RoomUpgradeManager.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/upgrade/RoomUpgradeWorkbench.java (95%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/room/upgrade/RoomUpgradeWorkbenchEntity.java (83%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/shrinking/PersonalShrinkingDevice.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/shrinking/Shrinking.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/TunnelItem.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/TunnelWallBlock.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/TunnelWallEntity.java (87%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/Tunnels.java (96%) rename {common-main/src/main/java/dev/compactmods/machines => forge-main/src/main/java/dev/compactmods/machines/forge}/tunnel/client/TunnelColors.java (85%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/graph/TunnelConnectionGraph.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/tunnel/network/TunnelAddedPacket.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/upgrade/MachineRoomUpgrades.java (86%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/upgrade/RoomUpgradeItem.java (96%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/upgrade/graph/RoomUpgradeConnection.java (90%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/upgrade/graph/UpgradeConnectionEntry.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/util/AnnotationScanner.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/util/ForgePlayerUtil.java (79%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/util/VersionUtil.java (91%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/villager/VillagerTradesEventHandler.java (91%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerUpgradeTrade.java rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/villager/Villagers.java (92%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/wall/ProtectedBlockHandler.java (94%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/wall/ProtectedWallBlock.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/wall/SolidWallBlock.java (88%) rename forge-main/src/main/java/dev/compactmods/machines/{ => forge}/wall/Walls.java (86%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java rename {forge-api => forge-tunnels-api}/.gitignore (100%) rename {forge-api => forge-tunnels-api}/build.gradle.kts (80%) rename {forge-api => forge-tunnels-api}/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java (76%) rename {forge-api => forge-tunnels-api}/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java (100%) delete mode 100644 forge-tunnels/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 8fe7797e..00000000 --- a/build.gradle.kts +++ /dev/null @@ -1,52 +0,0 @@ -val mod_id: String by extra -val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}.${buildNumber}-nightly" -val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) -val modVersion = if (isRelease) semver else nightlyVersion - -plugins { - id("maven-publish") -} - -tasks.create("getBuildInfo") { - doFirst { - this.logger.info("Mod ID: ${mod_id}") - this.logger.info("Version: ${modVersion}") - this.logger.info("Semver Version: ${semver}") - this.logger.info("Nightly Build: ${nightlyVersion}") - } -} - -val deps = listOf( - project(":forge-api"), - project(":forge-main") -) - -deps.forEach { - project.evaluationDependsOn(it.path) -} - -publishing { - publications.register("allLibs") { - artifactId = mod_id - groupId = "dev.compactmods" - version = modVersion - - this.artifact(project(":forge-api").tasks.named("jar").get()) - this.artifact(project(":forge-api").tasks.named("sourcesJar").get()) - this.artifact(project(":forge-main").tasks.named("jar").get()) - this.artifact(project(":forge-main").tasks.named("jarJar").get()) - } - - repositories { - // GitHub Packages - maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { - name = "GitHubPackages" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/common-api/build.gradle.kts b/common-api/build.gradle.kts deleted file mode 100644 index 31af750b..00000000 --- a/common-api/build.gradle.kts +++ /dev/null @@ -1,85 +0,0 @@ -val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}.${buildNumber}-nightly" -val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) - -var mod_id: String by extra - -repositories { - maven("https://maven.parchmentmc.org") { - name = "ParchmentMC" - } -} - -plugins { - id("fabric-loom") - id("maven-publish") -} - -base { - archivesName.set(mod_id) - group = "dev.compactmods" - version = if(isRelease) semver else nightlyVersion -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) -} - -sourceSets { - named("main") { - resources { - //The API has no resources - setSrcDirs(emptyList()) - } - } - - named("test") { - resources { - //The test module has no resources - setSrcDirs(emptyList()) - } - } -} - -val minecraft_version: String by rootProject.extra -val parchment_version: String by rootProject.extra - -dependencies { - minecraft("net.minecraft", "minecraft", minecraft_version) - - mappings(loom.layered { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) -} - -tasks.withType { - options.encoding = "UTF-8" - options.compilerArgs.add("-proc:none") -} - -tasks.create("prepareWorkspace") {} - -publishing { - publications.register("commonApi") { - artifactId = "compactmachines" - groupId = "dev.compactmods" - - artifacts { - artifact(tasks.jar.get()) - // artifact(tasks.named("sourcesJar").get()) - } - } - - repositories { - // GitHub Packages - maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { - name = "GitHubPackages" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java b/common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java deleted file mode 100644 index 4613a482..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/CompactMachinesAddon.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.api; - -/** - * Registers an instance of {@link ICompactMachinesAddon} for use in getting api interfaces. - */ -public @interface CompactMachinesAddon { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java b/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java deleted file mode 100644 index 9422d824..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/ICompactMachinesAddon.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.api; - -public interface ICompactMachinesAddon { - - default void prepare() { - // no-op - } - - default void afterRegistration() { - // no-op - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java deleted file mode 100644 index f9d892ad..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/Advancements.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public interface Advancements { - ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); - ResourceLocation ROOT = new ResourceLocation(Constants.MOD_ID, "root"); - ResourceLocation FOUNDATIONS = new ResourceLocation(Constants.MOD_ID, "foundations"); - - ResourceLocation GOT_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "got_shrinking_device"); - - ResourceLocation CLAIMED_TINY_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_tiny"); - ResourceLocation CLAIMED_SMALL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_small"); - ResourceLocation CLAIMED_NORMAL_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_normal"); - ResourceLocation CLAIMED_LARGE_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_large"); - ResourceLocation CLAIMED_GIANT_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_giant"); - ResourceLocation CLAIMED_MAX_MACHINE = new ResourceLocation(Constants.MOD_ID, "claimed_machine_max"); - - ResourceLocation RECURSIVE_ROOMS = new ResourceLocation(Constants.MOD_ID, "recursion"); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java deleted file mode 100644 index 9dbab4eb..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMCommands.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public interface CMCommands { - ResourceLocation LEVEL_REGISTERED = new ResourceLocation(MOD_ID, "level_registered"); - ResourceLocation LEVEL_NOT_FOUND = new ResourceLocation(MOD_ID, "level_not_found"); - - ResourceLocation ROOM_NOT_FOUND = new ResourceLocation(MOD_ID, "room_not_found"); - - /** - * Used for displaying the number of registered machines via summary commands. - */ - ResourceLocation MACHINE_REG_DIM = new ResourceLocation(MOD_ID, "summary.machines.dimension"); - ResourceLocation MACHINE_REG_TOTAL = new ResourceLocation(MOD_ID, "summary.machines.total"); - - /** - * Used for displaying the number of registered rooms via summary commands. - */ - ResourceLocation ROOM_REG_COUNT = new ResourceLocation(MOD_ID, "room_reg_count"); - ResourceLocation NOT_A_MACHINE_BLOCK = new ResourceLocation(MOD_ID, "not_a_machine_block"); - - /** - * Shows a machine is not bound. Takes in a single param, the machine position in world. - */ - ResourceLocation MACHINE_NOT_BOUND = new ResourceLocation(MOD_ID, "machine_not_bound"); - - ResourceLocation WRONG_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dimension"); - ResourceLocation NOT_IN_COMPACT_DIMENSION = new ResourceLocation(MOD_ID, "not_in_compact_dim"); - ResourceLocation FAILED_CMD_FILE_ERROR = new ResourceLocation(MOD_ID, "failed_command_file_error"); - - ResourceLocation CANNOT_GIVE_MACHINE = new ResourceLocation(MOD_ID, "cannot_give_machine_item"); - ResourceLocation MACHINE_GIVEN = new ResourceLocation(MOD_ID, "machine_given_successfully"); - ResourceLocation NO_REBIND_TUNNEL_PRESENT = new ResourceLocation(MOD_ID, "cannot_rebind_tunnel_present"); - ResourceLocation SPAWN_CHANGED_SUCCESSFULLY = new ResourceLocation(MOD_ID, "spawn_changed_successfully"); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java deleted file mode 100644 index dafef35a..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMRegistryKeys.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.compactmods.machines.api.core; - -import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public interface CMRegistryKeys { - - ResourceKey> TYPES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "tunnel_types")); - - ResourceKey> UPGRADES = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java b/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java deleted file mode 100644 index 221f3b3c..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/CMTags.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; - -public interface CMTags { - TagKey ROOM_UPGRADE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "room_upgrade")); - TagKey MACHINE_ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); - TagKey MACHINE_BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); - - TagKey SOLID_WALL_ITEMS = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "solid_walls")); - TagKey SOLID_WALL_BLOCKS = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "solid_walls")); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java deleted file mode 100644 index 68578915..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/Constants.java +++ /dev/null @@ -1,6 +0,0 @@ -package dev.compactmods.machines.api.core; - -public interface Constants { - String MOD_ID = "compactmachines"; - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java b/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java deleted file mode 100644 index 3a2b998c..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/JeiInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public interface JeiInfo { - ResourceLocation MACHINE = new ResourceLocation(Constants.MOD_ID, "machines"); - - ResourceLocation SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "shrinking_device"); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java deleted file mode 100644 index 80612fd5..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/Messages.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public interface Messages { - ResourceLocation CANNOT_ENTER_MACHINE = new ResourceLocation(Constants.MOD_ID, "cannot_enter"); - ResourceLocation NO_MACHINE_DATA = new ResourceLocation(Constants.MOD_ID, "no_machine_data"); - ResourceLocation ROOM_SPAWNPOINT_SET = new ResourceLocation(Constants.MOD_ID, "spawnpoint_set"); - ResourceLocation TELEPORT_OUT_OF_BOUNDS = new ResourceLocation(Constants.MOD_ID, "teleport_oob"); - ResourceLocation HOW_DID_YOU_GET_HERE = new ResourceLocation(Constants.MOD_ID, "how_did_you_get_here"); - ResourceLocation UNKNOWN_TUNNEL = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); - ResourceLocation NO_TUNNEL_SIDE = new ResourceLocation(Constants.MOD_ID, "no_available_sides"); - ResourceLocation UNKNOWN_ROOM_CHUNK = new ResourceLocation(Constants.MOD_ID, "unknown_room_chunk"); - ResourceLocation UNREGISTERED_CM_DIM = new ResourceLocation(Constants.MOD_ID, "dimension_not_registered"); - ResourceLocation NEW_MACHINE = new ResourceLocation(Constants.MOD_ID, "new_machine"); - - /** - * Used to show information about a player inside a Compact room. - */ - ResourceLocation PLAYER_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "player_room_info"); - - /** - * Used to show information about a room, accessed via a bound machine. - */ - ResourceLocation MACHINE_ROOM_INFO = new ResourceLocation(Constants.MOD_ID, "machine_room_info"); - - /** - * Shown when a non-owner tries to rename a room. Takes the owner's display name. - */ - ResourceLocation CANNOT_RENAME_NOT_OWNER = new ResourceLocation(Constants.MOD_ID, "cannot_rename_not_owner"); - - /** - * Shown to players when they try to interact with a room they do not own. Provides the owner's display name. - */ - ResourceLocation NOT_ROOM_OWNER = new ResourceLocation(Constants.MOD_ID, "not_the_room_owner"); - ResourceLocation UPGRADE_APPLIED = new ResourceLocation(Constants.MOD_ID, "upgrade_applied"); - ResourceLocation UPGRADE_ADD_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_add_failed"); - ResourceLocation UPGRADE_REMOVED = new ResourceLocation(Constants.MOD_ID, "upgrade_removed"); - ResourceLocation UPGRADE_REM_FAILED = new ResourceLocation(Constants.MOD_ID, "upgrade_remove_failed"); - ResourceLocation ALREADY_HAS_UPGRADE = new ResourceLocation(Constants.MOD_ID, "upgrade_already_present"); - ResourceLocation UPGRADE_NOT_PRESENT = new ResourceLocation(Constants.MOD_ID, "upgrade_not_present"); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java b/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java deleted file mode 100644 index 85d5e408..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/core/Tooltips.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.compactmods.machines.api.core; - -import net.minecraft.resources.ResourceLocation; - -public interface Tooltips { - - ResourceLocation UNKNOWN_PLAYER_NAME = new ResourceLocation(Constants.MOD_ID, "unknown_player"); - ResourceLocation TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); - ResourceLocation UNKNOWN_TUNNEL_TYPE = new ResourceLocation(Constants.MOD_ID, "unknown_tunnel_type"); - ResourceLocation ROOM_NAME = new ResourceLocation(Constants.MOD_ID, "room_name"); - ResourceLocation ROOM_UPGRADE_TYPE = new ResourceLocation(Constants.MOD_ID, "room_upgrade_type"); - ResourceLocation TUTORIAL_APPLY_ROOM_UPGRADE = new ResourceLocation(Constants.MOD_ID, "tutorial_apply_room_upgrade"); - ResourceLocation CRAFT_TO_UPGRADE = new ResourceLocation(Constants.MOD_ID, "craft_machine_to_upgrade"); - ResourceLocation NOT_YET_IMPLEMENTED = new ResourceLocation(Constants.MOD_ID, "not_yet_implemented"); - - interface Machines { - ResourceLocation ID = new ResourceLocation(Constants.MOD_ID, "machine.id"); - ResourceLocation OWNER = new ResourceLocation(Constants.MOD_ID, "machine.owner"); - ResourceLocation SIZE = new ResourceLocation(Constants.MOD_ID, "machine.size"); - ResourceLocation BOUND_TO = new ResourceLocation(Constants.MOD_ID, "machine.bound_to"); - } - - //#region Hints and Details - ResourceLocation HINT_HOLD_SHIFT = new ResourceLocation(Constants.MOD_ID, "hint.hold_shift"); - - interface Details { - ResourceLocation PERSONAL_SHRINKING_DEVICE = new ResourceLocation(Constants.MOD_ID, "details.psd"); - ResourceLocation SOLID_WALL = new ResourceLocation(Constants.MOD_ID, "details.solid_wall"); - } - //#endregion -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java b/common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java deleted file mode 100644 index e7f8fe73..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/dimension/CompactDimension.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.compactmods.machines.api.dimension; - -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.datafix.DataFixers; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.storage.DimensionDataStorage; -import net.minecraft.world.level.storage.LevelStorageSource; -import org.jetbrains.annotations.NotNull; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public abstract class CompactDimension { - public static final ResourceKey LEVEL_KEY = ResourceKey - .create(Registry.DIMENSION_REGISTRY, new ResourceLocation(MOD_ID, "compact_world")); - - public static final ResourceKey DIM_TYPE_KEY = ResourceKey - .create(Registry.DIMENSION_TYPE_REGISTRY, new ResourceLocation(MOD_ID, "compact_world")); - - private CompactDimension() {} - - @NotNull - public static ServerLevel forServer(MinecraftServer server) throws MissingDimensionException { - final var level = server.getLevel(LEVEL_KEY); - if(level == null) - throw new MissingDimensionException(); - - return level; - } - - @NotNull - public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.LevelDirectory levelDir) { - final var dimPath = DimensionType.getStorageFolder(CompactDimension.LEVEL_KEY, levelDir.path()); - final var fixer = DataFixers.getDataFixer(); - return new DimensionDataStorage(dimPath.resolve("data").toFile(), fixer); - } - - @NotNull - public static boolean isLevelCompact(Level level) { - return level.dimension().equals(LEVEL_KEY); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java b/common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java deleted file mode 100644 index 99e4f311..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/dimension/MissingDimensionException.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.compactmods.machines.api.dimension; - -public class MissingDimensionException extends Throwable { - public MissingDimensionException() { - super("Could not find compact machine dimension. This is likely a bug; please report it."); - } - - public MissingDimensionException(String msg) { - super(msg); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java b/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java deleted file mode 100644 index 19e7b824..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/inject/InjectField.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.api.inject; - -public @interface InjectField { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java deleted file mode 100644 index 78c38b9e..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalBlockPosition.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.compactmods.machines.api.location; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; - -import java.util.Optional; - -public interface IDimensionalBlockPosition extends IDimensionalPosition { - BlockPos getBlockPosition(); - - Optional getBlockEntity(MinecraftServer server); - - BlockState state(MinecraftServer server); - - IDimensionalBlockPosition relative(Direction direction); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java deleted file mode 100644 index 0eafb422..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/location/IDimensionalPosition.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.compactmods.machines.api.location; - -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec3; - -public interface IDimensionalPosition { - - Vec3 position(); - - ResourceKey dimension(); - ServerLevel level(MinecraftServer server); - - boolean isLoaded(MinecraftServer serv); - - ChunkPos chunkPos(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java deleted file mode 100644 index e19964c4..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/IMachineBlockEntity.java +++ /dev/null @@ -1,5 +0,0 @@ -package dev.compactmods.machines.api.machine; - -public interface IMachineBlockEntity { - int getColor(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java deleted file mode 100644 index 2a3616e4..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineEntityNbt.java +++ /dev/null @@ -1,8 +0,0 @@ -package dev.compactmods.machines.api.machine; - -public interface MachineEntityNbt { - String NBT_ROOM_CODE = "room_code"; - String NBT_CUSTOM_COLOR = "machine_color"; - String NBT_TEMPLATE_ID = "template_id"; - String NBT_ROOM_COLOR = "room_color"; -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java deleted file mode 100644 index 25db4519..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineIds.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.compactmods.machines.api.machine; - -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; - -public interface MachineIds { - ResourceLocation BLOCK_ENTITY = new ResourceLocation(Constants.MOD_ID, "compact_machine"); - - ResourceLocation UNBOUND_MACHINE_ITEM_ID = new ResourceLocation(Constants.MOD_ID, "new_machine"); - ResourceKey UNBOUND_MACHINE_ITEM_KEY = ResourceKey.create(Registry.ITEM_REGISTRY, UNBOUND_MACHINE_ITEM_ID); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java deleted file mode 100644 index 432f36a2..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineNbt.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.api.machine; - -public abstract class MachineNbt { - public static final String OWNER = "owner"; - public static final String ID = "machine_id"; - - public static final String NBT_TEMPLATE_ID = "template_id"; - public static final String NBT_COLOR = "machine_color"; -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java b/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java deleted file mode 100644 index d1e07dcd..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/machine/MachineTags.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.api.machine; - -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; - -public interface MachineTags { - - TagKey BLOCK = TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); - TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine")); - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java deleted file mode 100644 index d1b46d77..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ItemWithNbtRecipeBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -package dev.compactmods.machines.api.recipe; - -import com.google.common.collect.Lists; -import com.google.gson.JsonObject; -import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeHelper; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; -import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.ItemLike; - -import java.util.List; -import java.util.function.Consumer; - -public abstract class ItemWithNbtRecipeBuilder { - protected ResourceLocation recipeId; - protected final List ingredients = Lists.newArrayList(); - protected final Advancement.Builder advancement = Advancement.Builder.advancement(); - protected String group; - protected int count; - - public T requires(ItemLike item) { - return this.requires(Ingredient.of(item)); - } - - public T requires(Ingredient ingredient) { - this.ingredients.add(ingredient); - return (T) this; - } - - public T unlockedBy(String criterionName, CriterionTriggerInstance crit) { - this.advancement.addCriterion(criterionName, crit); - return (T) this; - } - - public T group(String groupName) { - this.group = groupName; - return (T) this; - } - - protected abstract void addExtraData(JsonObject root); - - public void save(Consumer consumer) { - this.ensureValid(recipeId); - this.advancement - .parent(new ResourceLocation("recipes/root")) - .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(TunnelRecipeHelper.getRecipeId(recipeId))) - .rewards(AdvancementRewards.Builder.recipe(recipeId)) - .requirements(RequirementsStrategy.OR); - - consumer.accept(new ShapelessRecipeWithNbtResult( - (T) this, - this.advancement, - new ResourceLocation(recipeId.getNamespace(), "recipes/" + recipeId.getPath()), - this::addExtraData - )); - } - - private void ensureValid(ResourceLocation recipeId) { - if (this.advancement.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + recipeId); - } - } - - public abstract ResourceLocation outputItemId(); - public abstract ResourceLocation outputRecipeId(); - - public int count() { - return this.count; - } - - public String group() { - return this.group; - } - - public List ingredients() { - return this.ingredients; - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java deleted file mode 100644 index 1f750ba0..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapedWithNbtRecipeBuilder.java +++ /dev/null @@ -1,191 +0,0 @@ -package dev.compactmods.machines.api.recipe; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; -import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.core.Registry; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeBuilder; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - -public class ShapedWithNbtRecipeBuilder implements RecipeBuilder { - private final Item result; - private String group; - private final int count; - private final List rows = Lists.newArrayList(); - private final Map keyMap = Maps.newLinkedHashMap(); - private Advancement.Builder advancement; - - private final List> additionalNbtWriters = Lists.newArrayList(); - - public ShapedWithNbtRecipeBuilder(ItemLike pResult, int pCount) { - this.result = pResult.asItem(); - this.count = pCount; - this.advancement = Advancement.Builder.advancement(); - } - - public static ShapedWithNbtRecipeBuilder shaped(ItemLike out) { - return new ShapedWithNbtRecipeBuilder(out, 1); - } - - public ShapedWithNbtRecipeBuilder advancement(Advancement.Builder adv) { - this.advancement = adv; - return this; - } - - public ShapedWithNbtRecipeBuilder addWriter(Consumer writer) { - this.additionalNbtWriters.add(writer); - return this; - } - - protected void addResultNbt(JsonObject itemTag) { - additionalNbtWriters.forEach(c -> c.accept(itemTag)); - } - - @Override - public RecipeBuilder unlockedBy(String criterion, CriterionTriggerInstance trigger) { - return this; - } - - @Override - public RecipeBuilder group(@Nullable String newGroup) { - this.group = newGroup; - return this; - } - - public ShapedWithNbtRecipeBuilder define(Character pSymbol, TagKey pTag) { - return this.define(pSymbol, Ingredient.of(pTag)); - } - - public ShapedWithNbtRecipeBuilder define(Character pSymbol, ItemLike pItem) { - return this.define(pSymbol, Ingredient.of(pItem)); - } - - public ShapedWithNbtRecipeBuilder define(Character pSymbol, Ingredient pIngredient) { - if (this.keyMap.containsKey(pSymbol)) { - throw new IllegalArgumentException("Symbol '" + pSymbol + "' is already defined!"); - } else if (pSymbol == ' ') { - throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); - } else { - this.keyMap.put(pSymbol, pIngredient); - return this; - } - } - - public ShapedWithNbtRecipeBuilder pattern(String pPattern) { - if (!this.rows.isEmpty() && pPattern.length() != this.rows.get(0).length()) { - throw new IllegalArgumentException("Pattern must be the same width on every line!"); - } else { - this.rows.add(pPattern); - return this; - } - } - - @Override - public Item getResult() { - return this.result; - } - - @Override - public void save(Consumer pFinishedRecipeConsumer, ResourceLocation pRecipeId) { - this.advancement.addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(pRecipeId)) - .rewards(AdvancementRewards.Builder.recipe(pRecipeId)) - .requirements(RequirementsStrategy.OR); - - pFinishedRecipeConsumer.accept(new ShapedWithNbtRecipeBuilder.Result(this, pRecipeId, - new ResourceLocation(pRecipeId.getNamespace(), "recipes/" + - this.result.getItemCategory().getRecipeFolderName() + "/" + pRecipeId.getPath()))); - } - - public static class Result implements FinishedRecipe { - - private final ShapedWithNbtRecipeBuilder builder; - private final ResourceLocation id; - private final Item result; - private final int count; - private final String group; - private final List pattern; - private final Map key; - private final Advancement.Builder advancement; - private final ResourceLocation advancementId; - - public Result(ShapedWithNbtRecipeBuilder builder, ResourceLocation pId, ResourceLocation advancementId) { - this.id = pId; - this.result = builder.result; - this.count = builder.count; - this.group = builder.group; - this.pattern = builder.rows; - this.key = builder.keyMap; - this.advancement = builder.advancement; - this.advancementId = advancementId; - this.builder = builder; - } - - @Override - public void serializeRecipeData(JsonObject json) { - if (this.group != null && !this.group.isEmpty()) { - json.addProperty("group", this.group); - } - - JsonArray pattern = new JsonArray(); - for(var i : this.pattern) - pattern.add(i); - - json.add("pattern", pattern); - - - JsonObject keyMap = new JsonObject(); - for (var keyEntry : this.key.entrySet()) { - keyMap.add(String.valueOf(keyEntry.getKey()), keyEntry.getValue().toJson()); - } - json.add("key", keyMap); - - JsonObject result = new JsonObject(); - result.addProperty("item", Registry.ITEM.getKey(this.result).toString()); - if (this.count > 1) { - result.addProperty("count", this.count); - } - - this.builder.addResultNbt(result); - json.add("result", result); - } - - @Override - public ResourceLocation getId() { - return this.id; - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.SHAPED_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return advancement.serializeToJson(); - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return advancementId; - } - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java b/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java deleted file mode 100644 index a44b3d90..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/recipe/ShapelessRecipeWithNbtResult.java +++ /dev/null @@ -1,83 +0,0 @@ -package dev.compactmods.machines.api.recipe; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import net.minecraft.advancements.Advancement; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.function.Consumer; - -public class ShapelessRecipeWithNbtResult implements FinishedRecipe { - private final int count; - private final String group; - private final List ingredients; - private final Advancement.Builder advancement; - private final ResourceLocation advancementId; - private final Consumer additionalNbtProvider; - private final T builder; - - public ShapelessRecipeWithNbtResult(T builder, Advancement.Builder adv, ResourceLocation advId, - Consumer additionalNbtProvider) { - this.builder = builder; - this.count = builder.count(); - this.group = builder.group() != null ? builder.group() : ""; - this.ingredients = builder.ingredients(); - this.advancement = adv; - this.advancementId = advId; - this.additionalNbtProvider = additionalNbtProvider; - } - - @Override - public void serializeRecipeData(JsonObject output) { - if (this.group != null && !this.group.isEmpty()) { - output.addProperty("group", this.group); - } - - JsonArray jsonarray = new JsonArray(); - - for (Ingredient ingredient : this.ingredients) { - jsonarray.add(ingredient.toJson()); - } - - output.add("ingredients", jsonarray); - - JsonObject result = new JsonObject(); - result.addProperty("item", builder.outputItemId().toString()); - if (this.count > 1) { - result.addProperty("count", this.count); - } - - JsonObject nbt = new JsonObject(); - additionalNbtProvider.accept(nbt); - result.add("nbt", nbt); - - output.add("result", result); - } - - @Override - public ResourceLocation getId() { - return builder.outputRecipeId(); - } - - @Override - public RecipeSerializer getType() { - return RecipeSerializer.SHAPELESS_RECIPE; - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return this.advancement.serializeToJson(); - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return this.advancementId; - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java deleted file mode 100644 index 223460fd..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceNetwork.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.compactmods.machines.api.resource; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; - -import java.util.stream.Stream; - -public interface IResourceNetwork { - - IResourceType resourceType(); - - Stream getInputs(); - Stream getOutputs(); - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java b/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java deleted file mode 100644 index 95bbfcc3..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/resource/IResourceType.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.api.resource; - -/** - * Represents a resource that can be moved and stored in a {@link IResourceNetwork}. - */ -public interface IResourceType { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java deleted file mode 100644 index 1e52e8ee..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadata.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.compactmods.machines.api.room; - -import org.jetbrains.annotations.NotNull; - -import java.util.UUID; - -public interface IPlayerRoomMetadata { - @NotNull - String roomCode(); - - @NotNull - UUID owner(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java deleted file mode 100644 index 8c83e940..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/IPlayerRoomMetadataProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.api.room; - -import java.util.Optional; -import java.util.UUID; - -public interface IPlayerRoomMetadataProvider { - Optional currentRoom(); - Optional roomCode(); - Optional owner(); - void clearCurrent(); - void setCurrent(IPlayerRoomMetadata current); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java deleted file mode 100644 index 45a6d7e1..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomHistory.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.compactmods.machines.api.room; - -import dev.compactmods.machines.api.room.history.IRoomHistoryItem; - -public interface IRoomHistory { - - void clear(); - boolean hasHistory(); - T peek(); - T pop(); - - void addHistory(T item); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java deleted file mode 100644 index 31d1c893..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomLookup.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.compactmods.machines.api.room; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import net.minecraft.world.level.ChunkPos; - -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -public interface IRoomLookup { - - Stream findByOwner(UUID owner); - - Optional findByMachine(IDimensionalBlockPosition machine); - - Optional forRoom(String room); - - Optional findByChunk(ChunkPos chunk); - - boolean isRoomChunk(ChunkPos chunk); - - long count(); - - Stream allRooms(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java deleted file mode 100644 index c8757e6e..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/IRoomOwnerLookup.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.api.room; - -import java.util.Optional; -import java.util.UUID; - -public interface IRoomOwnerLookup { - - Optional getRoomOwner(String roomCode); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java b/common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java deleted file mode 100644 index 101857dc..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/RoomSize.java +++ /dev/null @@ -1,69 +0,0 @@ -package dev.compactmods.machines.api.room; - -import com.mojang.serialization.Codec; -import net.minecraft.core.Vec3i; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.phys.AABB; -import net.minecraft.core.BlockPos; - -/** - * Planning on removing in 1.20. Will be replaced by a registry to allow for custom room templates. - */ -@Deprecated -public enum RoomSize implements StringRepresentable { - TINY ("tiny", 3), - SMALL ("small", 5), - NORMAL ("normal", 7), - LARGE ("large", 9), - GIANT ("giant", 11), - MAXIMUM ("maximum", 13); - - private final String name; - private final int internalSize; - - public static final Codec CODEC = StringRepresentable.fromEnum(RoomSize::values); - - RoomSize(String name, int internalSize) { - this.name = name; - this.internalSize = internalSize; - } - - public static RoomSize maximum() { - return MAXIMUM; - } - - public String getName() { - return this.name; - } - - public AABB getBounds(BlockPos center) { - AABB bounds = new AABB(center); - return bounds.inflate(Math.floorDiv(internalSize, 2)); - } - - public int getInternalSize() { - return this.internalSize; - } - - public static RoomSize getFromSize(String size) { - switch (size.toLowerCase()) { - case "tiny": return TINY; - case "small": return SMALL; - case "normal": return NORMAL; - case "large": return LARGE; - case "giant": return GIANT; - case "maximum": return MAXIMUM; - } - - return TINY; - } - - @Override - public String getSerializedName() { - return this.name; - } - - public Vec3i toVec3() { - return new Vec3i(internalSize, internalSize, internalSize); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java b/common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java deleted file mode 100644 index 92956886..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/RoomTemplate.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.compactmods.machines.api.room; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.core.Vec3i; -import net.minecraft.resources.ResourceLocation; - -import java.util.Objects; - -/** - * Template structure for creating a new Compact Machine room. These can be added and removed from the registry - * at any point, so persistent data must be stored outside these instances. - * - * @param dimensions The internal dimensions of the room when it is created. - * @param color The color of the machine blocks created for this template. - * @param prefillTemplate A template (structure) file reference, if specified this will fill the new room post-generation - */ -public record RoomTemplate(Vec3i dimensions, int color, ResourceLocation prefillTemplate) { - - public static final ResourceLocation NO_TEMPLATE = new ResourceLocation(Constants.MOD_ID, "empty"); - public static final RoomTemplate INVALID_TEMPLATE = new RoomTemplate(0, 0); - - public static Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Vec3i.CODEC.fieldOf("dimensions").forGetter(RoomTemplate::dimensions), - Codec.INT.fieldOf("color").forGetter(RoomTemplate::color), - ResourceLocation.CODEC.optionalFieldOf("template", NO_TEMPLATE).forGetter(RoomTemplate::prefillTemplate) - ).apply(i, RoomTemplate::new)); - - public RoomTemplate(int cubicSize, int color) { - this(new Vec3i(cubicSize, cubicSize, cubicSize), color, NO_TEMPLATE); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RoomTemplate that = (RoomTemplate) o; - return color == that.color && Objects.equals(dimensions, that.dimensions); - } - - @Override - public int hashCode() { - return Objects.hash(dimensions, color); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java b/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java deleted file mode 100644 index 1fab7b33..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/Rooms.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.api.room; - -import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; - -import static dev.compactmods.machines.api.core.Constants.MOD_ID; - -public class Rooms { - - public static final ResourceKey> TEMPLATE_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_templates")); - - public static final ResourceKey> ROOM_UPGRADES_REG_KEY = ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, "room_upgrades")); - - public static Registry getTemplates(MinecraftServer server) { - final var regAccess = server.registryAccess(); - return regAccess.registryOrThrow(TEMPLATE_REG_KEY); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java b/common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java deleted file mode 100644 index 57b536ae..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/history/IRoomHistoryItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.compactmods.machines.api.room.history; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.location.IDimensionalPosition; - -public interface IRoomHistoryItem { - - IDimensionalPosition getEntryLocation(); - - IDimensionalBlockPosition getMachine(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java deleted file mode 100644 index 82fee69d..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IBasicRoomInfo.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.api.room.registration; - -public interface IBasicRoomInfo { - String code(); - - int color(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java deleted file mode 100644 index 61687806..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IMutableRoomRegistration.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.api.room.registration; - -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -public interface IMutableRoomRegistration extends IRoomRegistration { - IMutableRoomRegistration setSpawnPosition(Vec3 spawnPosition); - IMutableRoomRegistration setSpawnRotation(Vec2 spawnRotation); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java deleted file mode 100644 index c3ab2029..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomRegistration.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.compactmods.machines.api.room.registration; - -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import net.minecraft.core.Vec3i; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -public interface IRoomRegistration extends IBasicRoomInfo { - - Vec3i dimensions(); - - UUID owner(IRoomOwnerLookup lookup); - - Vec3 center(); - - AABB innerBounds(); - - AABB outerBounds(); - - Vec3 spawnPosition(IRoomSpawnLookup spawns); - - Vec2 spawnRotation(IRoomSpawnLookup spawns); - - Optional getTemplate(); - - Stream chunks(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java b/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java deleted file mode 100644 index 3431bc59..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/room/registration/IRoomSpawnLookup.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.api.room.registration; - -public interface IRoomSpawnLookup { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java b/common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java deleted file mode 100644 index 74a4c923..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/shrinking/PSDTags.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.compactmods.machines.api.shrinking; - -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; - -public interface PSDTags { - TagKey ITEM = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "shrinking_device")); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java deleted file mode 100644 index 5c637e2a..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/ITunnelHolder.java +++ /dev/null @@ -1,8 +0,0 @@ -package dev.compactmods.machines.api.tunnels; - -public interface ITunnelHolder { - - TunnelDefinition getTunnelType(); - - void setTunnelType(TunnelDefinition type); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java deleted file mode 100644 index 06acee32..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelDefinition.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.compactmods.machines.api.tunnels; - -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.resources.ResourceLocation; - -public interface TunnelDefinition { - /** - * The color of a non-indicator (the same color as the wall) - */ - int NO_INDICATOR_COLOR = 3751749; - - /** - * Constant value used to indicate that a tunnel is receiving a resource from - * outside a machine room. - */ - int IMPORT_COLOR = 0xff2462cd; - - /** - * Constant value used to indicate that a tunnel is pushing a resource out of - * a machine room. - */ - int EXPORT_COLOR = 0xffe6a709; - ResourceLocation TUNNEL_ID = new ResourceLocation(Constants.MOD_ID, "tunnel"); - - /** - * The central ring color of the tunnel. Shown in the tunnel item and on blocks. - * - * @return An AARRGGBB-formatted integer indicating color. - */ - int ringColor(); - - /** - * Gets the color for the indicator at the top-right of the block texture. - * For import- and export-style tunnels, see {@link #IMPORT_COLOR} and {@link #EXPORT_COLOR}. - * - * @return An AARRGGBB-formatted integer indicating color. - */ - default int indicatorColor() { - return NO_INDICATOR_COLOR; - } - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java deleted file mode 100644 index 7d7dc435..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/TunnelPosition.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.api.tunnels; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; - -/** - * Tunnel position information, for the tunnel placed inside a machine room. - * - * @param pos Absolute position inside the Compact dimension. - * @param wallSide Side of the wall the tunnel is on. - * @param machineSide Side of the machine the tunnel connects to. - */ -public record TunnelPosition(BlockPos pos, Direction wallSide, Direction machineSide) { - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java deleted file mode 100644 index e0cbf585..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/connection/RoomTunnelConnections.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.api.tunnels.connection; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; - -import java.util.Optional; -import java.util.stream.Stream; - -public interface RoomTunnelConnections { - /** - * Fetches sided redstone tunnel locations inside a machine room, based on connected machine - * location and the side the tunnel is pointed to. - * @param machine The connected machine (non-compact level) - * @param facing The side the tunnels are queried for - * @return - */ - Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction facing); - - Optional getConnectedSide(BlockPos position); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java deleted file mode 100644 index c6e6c45b..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/InstancedTunnel.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.api.tunnels.lifecycle; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; - -public interface InstancedTunnel { - - /** - * Handle initialization tasks for the tunnel's data here. - * - * @param position The location of the new tunnel being created. - * @param side The side of the wall the tunnel is being added to. - */ - T newInstance(BlockPos position, Direction side); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java deleted file mode 100644 index a7c9d1a3..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelInstance.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.api.tunnels.lifecycle; - -/** - * Marker interface for signaling that the class is a tunnel instance. - */ -public interface TunnelInstance { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java deleted file mode 100644 index 84e2c79b..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/lifecycle/TunnelTeardownHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -package dev.compactmods.machines.api.tunnels.lifecycle; - -import dev.compactmods.machines.api.tunnels.TunnelPosition; -import net.minecraft.core.Direction; -import net.minecraft.server.MinecraftServer; - -/** - * Indicates that a tunnel has teardown tasks that are performed whenever a tunnel - * is removed from a machine room's wall, or rotated in-place. - */ -public interface TunnelTeardownHandler extends InstancedTunnel { - - /** - * @deprecated Swap to the version that takes the current MC server. - */ - @Deprecated(since = "5.2.0") - default void onRotated(TunnelPosition position, Instance instance, Direction oldSide, Direction newSide) { - } - - /** - * Handle tasks when a tunnel is being rotated on a machine room wall. - * - * @param server Current server instance. - * @param position The position of the tunnel being rotated. - * @param instance The tunnel instance being rotated. - * @param oldSide The previous side of the machine the tunnel was connected to. - * @param newSide The upcoming side of the machine the tunnel will connect to. - */ - default void onRotated(MinecraftServer server, TunnelPosition position, Instance instance, Direction oldSide, Direction newSide) { - onRotated(position, instance, oldSide, newSide); - } - - /** - * @deprecated Switch to the version that takes the current Minecraft server. - */ - @Deprecated(since = "5.2.0") - default void onRemoved(TunnelPosition position, Instance instance) { - } - - /** - * Handle tasks when a tunnel is fully removed from a machine room wall. - * - * @param instance The tunnel instance being removed. - */ - default void onRemoved(MinecraftServer server, TunnelPosition position, Instance instance) { - onRemoved(position, instance); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java deleted file mode 100644 index 2e44ade0..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -package dev.compactmods.machines.api.tunnels.recipe; - -import com.google.gson.JsonObject; -import dev.compactmods.machines.api.recipe.ItemWithNbtRecipeBuilder; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.resources.ResourceLocation; - -public class TunnelRecipeBuilder extends ItemWithNbtRecipeBuilder { - - private TunnelRecipeBuilder(ResourceLocation id, int count) { - this.recipeId = id; - this.count = count; - } - - public static TunnelRecipeBuilder tunnel(ResourceLocation id) { - return new TunnelRecipeBuilder(id, 1); - } - - public static TunnelRecipeBuilder tunnel(ResourceLocation id, int count) { - return new TunnelRecipeBuilder(id, count); - } - - @Override - public ResourceLocation outputItemId() { - return TunnelDefinition.TUNNEL_ID; - } - - @Override - public ResourceLocation outputRecipeId() { - return TunnelRecipeHelper.getRecipeId(this.recipeId); - } - - public TunnelRecipeBuilder setType(ResourceLocation id) { - this.recipeId = id; - return this; - } - - @Override - protected void addExtraData(JsonObject root) { - JsonObject definition = new JsonObject(); - definition.addProperty("id", this.recipeId.toString()); - root.add("definition", definition); - } - -} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java deleted file mode 100644 index 6f346d31..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/recipe/TunnelRecipeHelper.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.compactmods.machines.api.tunnels.recipe; - -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; - -public abstract class TunnelRecipeHelper { - public static ResourceLocation getRecipeId(@NotNull ResourceLocation tunnelType) { - return new ResourceLocation(tunnelType.getNamespace(), "tunnels/" + tunnelType.getPath()); - } -} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java deleted file mode 100644 index cc5533c2..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneReaderTunnel.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.compactmods.machines.api.tunnels.redstone; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.tunnels.TunnelPosition; -import net.minecraft.server.MinecraftServer; - -public interface RedstoneReaderTunnel extends RedstoneTunnel { - - int powerLevel(MinecraftServer server, IDimensionalBlockPosition machine, TunnelPosition tunnel); - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java deleted file mode 100644 index a48e337a..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneTunnel.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.api.tunnels.redstone; - -public interface RedstoneTunnel { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java b/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java deleted file mode 100644 index d80bc440..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/tunnels/redstone/RedstoneWriterTunnel.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.api.tunnels.redstone; - -public interface RedstoneWriterTunnel extends RedstoneTunnel { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java deleted file mode 100644 index 3b2bee89..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/ILevelLoadedUpgradeListener.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import net.minecraft.server.level.ServerLevel; - -public interface ILevelLoadedUpgradeListener extends RoomUpgrade { - - /** - * Called when a level is loaded, typically when the server first boots up. - */ - default void onLevelLoaded(ServerLevel level, IRoomRegistration room) {} - - /** - * Called when a level is unloaded. - */ - default void onLevelUnloaded(ServerLevel level, IRoomRegistration room) {} - -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java deleted file mode 100644 index 93cbdd51..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IResourcefulUpgrade.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import dev.compactmods.machines.api.resource.IResourceType; -import dev.compactmods.machines.api.upgrade.requirement.IUpgradeRequirement; - -import java.util.Collections; -import java.util.Set; - -/** - * An upgrade that deals with a resource in the room's resource networks. - */ -public interface IResourcefulUpgrade { - - IResourceType resourceType(); - - default Set requirements() { - return Collections.emptySet(); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java deleted file mode 100644 index 5ce5daa0..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeAppliedListener.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import net.minecraft.server.level.ServerLevel; - -public interface IUpgradeAppliedListener extends RoomUpgrade { - - /** - * Called when an upgrade is first applied to a room. - */ - default void onAdded(ServerLevel level, IRoomRegistration room) {} -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java deleted file mode 100644 index 247b8abf..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/IUpgradeRemovedListener.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import net.minecraft.server.level.ServerLevel; - -public interface IUpgradeRemovedListener extends RoomUpgrade { - - /** - * Called when an update is removed from a room. - */ - default void onRemoved(ServerLevel level, IRoomRegistration room) {} -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java deleted file mode 100644 index aab66ff0..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgrade.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.api.core.CMRegistryKeys; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; - -public interface RoomUpgrade { - - ResourceKey> REG_KEY = CMRegistryKeys.UPGRADES; - - Codec codec(); -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java deleted file mode 100644 index 75e2af68..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Optional; - -public abstract class RoomUpgradeHelper { - - public static final String NBT_UPGRADE_NODE = "upgrade_info"; - public static final String NBT_UPGRADE_ID = "key"; - - public static Optional getUpgradeId(@NotNull ItemStack stack) { - if(!stack.hasTag()) return Optional.empty(); - final var tag = stack.getTag(); - if(!tag.contains(NBT_UPGRADE_NODE)) return Optional.empty(); - - final var upg = tag.getCompound(NBT_UPGRADE_NODE); - if(!upg.contains(NBT_UPGRADE_ID)) return Optional.empty(); - - final var upg2 = new ResourceLocation(upg.getString(NBT_UPGRADE_ID)); - return Optional.of(upg2); - } -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java deleted file mode 100644 index f12aaeca..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/RoomUpgradeInstance.java +++ /dev/null @@ -1,3 +0,0 @@ -package dev.compactmods.machines.api.upgrade; - -public record RoomUpgradeInstance(T upgrade, String room) {} \ No newline at end of file diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java deleted file mode 100644 index 296dad66..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeRequirement.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.api.upgrade.requirement; - -public interface IUpgradeRequirement { -} diff --git a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java b/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java deleted file mode 100644 index 567a7030..00000000 --- a/common-api/src/main/java/dev/compactmods/machines/api/upgrade/requirement/IUpgradeResourceRequirement.java +++ /dev/null @@ -1,8 +0,0 @@ -package dev.compactmods.machines.api.upgrade.requirement; - -import dev.compactmods.machines.api.resource.IResourceType; - -public interface IUpgradeResourceRequirement extends IUpgradeRequirement { - - IResourceType resourceType(); -} diff --git a/common-main/build.gradle.kts b/common-main/build.gradle.kts deleted file mode 100644 index c7d0c812..00000000 --- a/common-main/build.gradle.kts +++ /dev/null @@ -1,102 +0,0 @@ -val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}.${buildNumber}-nightly" -val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) - -var mod_id: String by extra - -repositories { - mavenCentral() { - content { - includeGroup("com.aventrix.jnanoid") - } - } - - maven("https://maven.parchmentmc.org") { - name = "ParchmentMC" - } -} - -plugins { - id("fabric-loom") - id("maven-publish") -} - -base { - archivesName.set(mod_id) - group = "dev.compactmods" - version = if(isRelease) semver else nightlyVersion -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) -} - -sourceSets { - named("main") { - resources { - //The API has no resources - setSrcDirs(emptyList()) - } - } - - named("test") { - resources { - //The test module has no resources - setSrcDirs(emptyList()) - } - } -} - -val minecraft_version: String by rootProject.extra -val parchment_version: String by rootProject.extra - -val runDepends: List = listOf( - project(":common-api") -) - -runDepends.forEach { - project.evaluationDependsOn(it.path) -} - -dependencies { - minecraft("net.minecraft", "minecraft", minecraft_version) - - mappings(loom.layered { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - - implementation(project(":common-api")) - compileOnly("com.aventrix.jnanoid", "jnanoid", "2.0.0") -} - -tasks.withType { - options.encoding = "UTF-8" - options.compilerArgs.add("-proc:none") -} - -tasks.create("prepareWorkspace") {} - -publishing { - publications.register("common") { - artifactId = "compactmachines" - groupId = "dev.compactmods" - - artifacts { - artifact(tasks.jar.get()) - // artifact(tasks.named("sourcesJar").get()) - } - } - - repositories { - // GitHub Packages - maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { - name = "GitHubPackages" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java b/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java deleted file mode 100644 index b1d0081e..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/ICompactMachinesMod.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.compactmods.machines; - -import org.apache.logging.log4j.Logger; - -public interface ICompactMachinesMod { - /** - * @deprecated Use {@link LoggingUtil#modLog} instead - */ - @Deprecated(forRemoval = true) - Logger LOGGER = LoggingUtil.modLog(); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java b/common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java deleted file mode 100644 index 6de675df..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/LoggingUtil.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines; - -import dev.compactmods.machines.api.core.Constants; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class LoggingUtil { - - public static Logger modLog() { - return LogManager.getLogger(Constants.MOD_ID); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java b/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java deleted file mode 100644 index c7295841..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/AdvancementTriggers.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.compactmods.machines.advancement; - -import dev.compactmods.machines.ICompactMachinesMod; -import dev.compactmods.machines.advancement.trigger.BasicPlayerAdvTrigger; -import dev.compactmods.machines.advancement.trigger.HowDidYouGetHereTrigger; -import dev.compactmods.machines.api.core.Advancements; - -public class AdvancementTriggers { - - public static final BasicPlayerAdvTrigger RECURSIVE_ROOMS = new BasicPlayerAdvTrigger(Advancements.RECURSIVE_ROOMS); - - public static final HowDidYouGetHereTrigger HOW_DID_YOU_GET_HERE = new HowDidYouGetHereTrigger(); - - public static final BasicPlayerAdvTrigger CLAIMED_TINY = new BasicPlayerAdvTrigger(Advancements.CLAIMED_TINY_MACHINE); - public static final BasicPlayerAdvTrigger CLAIMED_SMALL = new BasicPlayerAdvTrigger(Advancements.CLAIMED_SMALL_MACHINE); - public static final BasicPlayerAdvTrigger CLAIMED_NORMAL = new BasicPlayerAdvTrigger(Advancements.CLAIMED_NORMAL_MACHINE); - public static final BasicPlayerAdvTrigger CLAIMED_LARGE = new BasicPlayerAdvTrigger(Advancements.CLAIMED_LARGE_MACHINE); - public static final BasicPlayerAdvTrigger CLAIMED_GIANT = new BasicPlayerAdvTrigger(Advancements.CLAIMED_GIANT_MACHINE); - public static final BasicPlayerAdvTrigger CLAIMED_MAX = new BasicPlayerAdvTrigger(Advancements.CLAIMED_MAX_MACHINE); - - public static void init() { - ICompactMachinesMod.LOGGER.trace("Registering advancement triggers."); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java b/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java deleted file mode 100644 index c36b04a5..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListener.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.compactmods.machines.advancement; - -import java.util.Set; -import com.google.common.collect.Sets; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.server.PlayerAdvancements; - -public class GenericAdvancementTriggerListener { - - private final PlayerAdvancements advancements; - private final Set> listeners = Sets.newHashSet(); - - public GenericAdvancementTriggerListener(PlayerAdvancements advancements) { - this.advancements = advancements; - } - - public void add(CriterionTrigger.Listener listener) { - listeners.add(listener); - } - - public void remove(CriterionTrigger.Listener listener) { - listeners.remove(listener); - } - - public boolean empty() { - return listeners.isEmpty(); - } - - public void trigger() { - listeners.forEach(a -> a.run(advancements)); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java b/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java deleted file mode 100644 index 273e5d35..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/GenericAdvancementTriggerListenerList.java +++ /dev/null @@ -1,38 +0,0 @@ -package dev.compactmods.machines.advancement; - -import com.google.common.collect.Maps; -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.server.PlayerAdvancements; -import net.minecraft.server.level.ServerPlayer; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; - -public class GenericAdvancementTriggerListenerList { - private final Map> listeners = Maps.newHashMap(); - - public void addPlayerListener(PlayerAdvancements advancements, CriterionTrigger.Listener listener) { - GenericAdvancementTriggerListener listeners = this.listeners.computeIfAbsent(advancements, GenericAdvancementTriggerListener::new); - listeners.add(listener); - } - - public void removePlayerListener(PlayerAdvancements advancements, CriterionTrigger.Listener listener) { - GenericAdvancementTriggerListener listeners = this.listeners.get(advancements); - if (listeners != null) { - listeners.remove(listener); - if (listeners.empty()) { - this.listeners.remove(advancements); - } - } - } - - public void removePlayerListeners(PlayerAdvancements advancements) { - this.listeners.remove(advancements); - } - - @Nullable - public GenericAdvancementTriggerListener getListeners(ServerPlayer player) { - return listeners.get(player.getAdvancements()); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java deleted file mode 100644 index b0e51063..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BaseAdvancementTrigger.java +++ /dev/null @@ -1,33 +0,0 @@ -package dev.compactmods.machines.advancement.trigger; - -import dev.compactmods.machines.advancement.GenericAdvancementTriggerListenerList; -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance; -import net.minecraft.server.PlayerAdvancements; -import net.minecraft.server.level.ServerPlayer; - -public abstract class BaseAdvancementTrigger implements CriterionTrigger { - - private final GenericAdvancementTriggerListenerList listeners = new GenericAdvancementTriggerListenerList<>(); - - @Override - public void addPlayerListener(PlayerAdvancements advancements, Listener list) { - listeners.addPlayerListener(advancements, list); - } - - @Override - public void removePlayerListener(PlayerAdvancements advancements, Listener list) { - listeners.removePlayerListener(advancements, list); - } - - @Override - public void removePlayerListeners(PlayerAdvancements advancements) { - listeners.removePlayerListeners(advancements); - } - - public void trigger(ServerPlayer player) { - final var listeners = this.listeners.getListeners(player); - if(listeners != null) - listeners.trigger(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java deleted file mode 100644 index 34a8ef2b..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/BasicPlayerAdvTrigger.java +++ /dev/null @@ -1,37 +0,0 @@ -package dev.compactmods.machines.advancement.trigger; - -import com.google.gson.JsonObject; -import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance; -import net.minecraft.advancements.critereon.DeserializationContext; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.resources.ResourceLocation; - -public class BasicPlayerAdvTrigger extends BaseAdvancementTrigger { - - private final ResourceLocation advancementId; - - public BasicPlayerAdvTrigger(ResourceLocation advancementId) { - this.advancementId = advancementId; - } - - @Override - public ResourceLocation getId() { - return advancementId; - } - - @Override - public Instance createInstance(JsonObject json, DeserializationContext conditions) { - return new Instance(this.advancementId, EntityPredicate.Composite.fromJson(json, "player", conditions)); - } - - public static class Instance extends AbstractCriterionTriggerInstance { - - public Instance(ResourceLocation advId, EntityPredicate.Composite player) { - super(advId, player); - } - - public static Instance create(ResourceLocation advancement) { - return new Instance(advancement, EntityPredicate.Composite.ANY); - } - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java b/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java deleted file mode 100644 index 6407bcf7..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/advancement/trigger/HowDidYouGetHereTrigger.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.compactmods.machines.advancement.trigger; - -import com.google.gson.JsonObject; -import dev.compactmods.machines.api.core.Advancements; -import net.minecraft.advancements.critereon.AbstractCriterionTriggerInstance; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.advancements.critereon.DeserializationContext; -import net.minecraft.resources.ResourceLocation; - -public class HowDidYouGetHereTrigger extends BaseAdvancementTrigger { - - @Override - public ResourceLocation getId() { - return Advancements.HOW_DID_YOU_GET_HERE; - } - - @Override - public Instance createInstance(JsonObject json, DeserializationContext conditions) { - return new Instance(EntityPredicate.Composite.fromJson(json, "player", conditions)); - } - - public static class Instance extends AbstractCriterionTriggerInstance { - - public Instance(EntityPredicate.Composite player) { - super(Advancements.HOW_DID_YOU_GET_HERE, player); - } - - public static Instance create() { - return new Instance(EntityPredicate.Composite.ANY); - } - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java b/common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java deleted file mode 100644 index 65b31845..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/PlayerFaceRenderer.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.client; - -import com.mojang.authlib.GameProfile; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.Util; -import net.minecraft.client.Minecraft; - -public class PlayerFaceRenderer { - public static final GameProfile EMPTY_PROFILE = new GameProfile(Util.NIL_UUID, "Empty Player"); - - public static void render(GameProfile profile, PoseStack poseStack, int x, int y) { - final var skins = Minecraft.getInstance().getSkinManager(); - final var playerSkin = skins.getInsecureSkinLocation(profile); - - RenderSystem.setShaderTexture(0, playerSkin); - - // pose, x, y, ???, hatLayer, upsideDown - net.minecraft.client.gui.components.PlayerFaceRenderer.draw(poseStack, x, y, 12, false, false); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/Resources.java b/common-main/src/main/java/dev/compactmods/machines/client/Resources.java deleted file mode 100644 index 149d77d9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/Resources.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.client; - -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.resources.ResourceLocation; - -public class Resources { - public static final class Gui { - private static final String path = "textures/gui/"; - - public static final ResourceLocation PSD_SCREEN = new ResourceLocation(Constants.MOD_ID, path + "psd_screen.png"); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java deleted file mode 100644 index dd100634..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/GuiIds.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.client.gui; - -public enum GuiIds { - PSD_GUIDE, - MACHINE_VIEW, - MACHINE_ADMIN -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java deleted file mode 100644 index 60d343be..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/PersonalShrinkingDeviceScreen.java +++ /dev/null @@ -1,107 +0,0 @@ -package dev.compactmods.machines.client.gui; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.gui.guide.GuideSection; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -public class PersonalShrinkingDeviceScreen extends Screen { - private final ResourceLocation GUI = new ResourceLocation(Constants.MOD_ID, "textures/gui/psd_screen.png"); - private static final int WIDTH = 256; - private static final int HEIGHT = 201; - - private final Map sections; - private final ResourceLocation emptySection = new ResourceLocation(Constants.MOD_ID, "empty"); - - @Nullable - private final GuideSection currentSection; - - protected PersonalShrinkingDeviceScreen() { - super(Component.translatable(Constants.MOD_ID + ".gui.psd.title")); - this.sections = new HashMap<>(); - - GuideSection root = new GuideSection(); - sections.put(new ResourceLocation(Constants.MOD_ID, "root"), root); - this.currentSection = root; - } - - @Override - public void mouseMoved(double mouseX, double mouseY) { - if(currentSection != null) - currentSection.mouseMoved(mouseX, mouseY); - } - - @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) { - int relX = (this.width - WIDTH) / 2; - - // relY = relative position, places screen against bottom edge of screen - int relY = (this.height - HEIGHT); - - if(currentSection != null) - return currentSection.mouseScrolled(mouseX - relX - 15, mouseY - relY - 14, delta); - - return false; - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - super.mouseClicked(mouseX, mouseY, button); - - int relX = (this.width - WIDTH) / 2; - - // relY = relative position, places screen against bottom edge of screen - int relY = (this.height - HEIGHT); - - if(currentSection != null) - return currentSection.mouseClicked(mouseX - relX - 15, mouseY - relY - 14, button); - - return false; - } - - @Override - public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(matrixStack); - - RenderSystem.clearColor(1, 1, 1, 1); - int relX = (this.width - WIDTH) / 2; - - // relY = relative position, places screen against bottom edge of screen - int relY = (this.height - HEIGHT); - - matrixStack.pushPose(); - matrixStack.translate(relX, relY, 0); - - RenderSystem.setShaderTexture(0, GUI); - this.blit(matrixStack, 0, 0, 0, 0, WIDTH, HEIGHT); - matrixStack.popPose(); - - matrixStack.pushPose(); - matrixStack.translate(relX + 15, relY + 14, 10); - - if(currentSection != null) { - currentSection.render(matrixStack, mouseX - relX - 15, mouseY - relY - 14, partialTicks); - } - - matrixStack.popPose(); - - super.render(matrixStack, mouseX, mouseY, partialTicks); - } - - @Override - public boolean isPauseScreen() { - return false; - } - - public static void show() { - Minecraft.getInstance().setScreen(new PersonalShrinkingDeviceScreen()); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java deleted file mode 100644 index 16819d5b..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuidePage.java +++ /dev/null @@ -1,70 +0,0 @@ -package dev.compactmods.machines.client.gui.guide; - -import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.gui.widget.AbstractCMGuiWidget; -import dev.compactmods.machines.client.gui.widget.ScrollableWrappedTextWidget; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; -import net.minecraft.client.gui.components.Widget; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.network.chat.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -public class GuidePage implements Widget, GuiEventListener { - - protected final List widgets; - - public GuidePage() { - widgets = new ArrayList<>(); - - ScrollableWrappedTextWidget sc = new ScrollableWrappedTextWidget(Constants.MOD_ID + ".psd.pages.machines", 2, 18, 222, 160); - widgets.add(sc); - } - - @Override - public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) { - Font fr = Minecraft.getInstance().font; - GuiComponent.drawString(ms, fr, - Component.translatable(Constants.MOD_ID + ".psd.pages.machines.title") - .withStyle(ChatFormatting.GOLD), - 2, 2, 0); - - for(Widget comp : widgets) - comp.render(ms, mouseX, mouseY, partialTicks); - } - - public Optional getWidgetByPosition(double mouseX, double mouseY) { - for(AbstractCMGuiWidget wid : widgets) { - if(wid.isMouseOver(mouseX, mouseY)) - return Optional.of(wid); - } - - return Optional.empty(); - } - - @Override - public void mouseMoved(double mouseX, double mouseY) { - getWidgetByPosition(mouseX, mouseY) - .ifPresent(c -> c.mouseMoved(mouseX, mouseY)); - } - - @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) { - return getWidgetByPosition(mouseX, mouseY) - .map(c -> c.mouseScrolled(mouseX, mouseY, delta)) - .orElse(false); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - return getWidgetByPosition(mouseX, mouseY) - .map(c -> c.mouseClicked(mouseX, mouseY, button)) - .orElse(false); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java deleted file mode 100644 index dab2ea68..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/guide/GuideSection.java +++ /dev/null @@ -1,48 +0,0 @@ -package dev.compactmods.machines.client.gui.guide; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.gui.components.Widget; - -import java.util.ArrayList; -import java.util.List; - -public class GuideSection implements Widget, GuiEventListener { - private final List pages; - private final int currentPageIndex = 0; - private final GuidePage currentPage; - - public GuideSection() { - this.pages = new ArrayList<>(); - this.currentPage = new GuidePage(); - this.pages.add(currentPage); - } - - @Override - public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { - if(this.currentPage != null) - currentPage.render(matrixStack, mouseX, mouseY, partialTicks); - } - - @Override - public void mouseMoved(double mouseX, double mouseY) { - if(this.currentPage != null) - currentPage.mouseMoved(mouseX, mouseY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if(this.currentPage != null) - return currentPage.mouseClicked(mouseX, mouseY, button); - - return false; - } - - @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) { - if(this.currentPage != null) - return currentPage.mouseScrolled(mouseX, mouseY, delta); - - return false; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java deleted file mode 100644 index 344e1492..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/AbstractCMGuiWidget.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.compactmods.machines.client.gui.widget; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.gui.components.Widget; - -public class AbstractCMGuiWidget implements Widget, GuiEventListener { - - protected final int x, y, width, height; - - protected AbstractCMGuiWidget(int x, int y, int width, int height) { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - } - - @Override - public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { - - } - - @Override - public boolean isMouseOver(double mouseX, double mouseY) { - return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java b/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java deleted file mode 100644 index 22f9a197..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/gui/widget/ScrollableWrappedTextWidget.java +++ /dev/null @@ -1,71 +0,0 @@ -package dev.compactmods.machines.client.gui.widget; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.resources.language.I18n; -import net.minecraft.network.chat.Component; -import net.minecraft.util.FormattedCharSequence; -import net.minecraft.util.Mth; - -import java.util.List; - -public class ScrollableWrappedTextWidget extends AbstractCMGuiWidget { - - private final String localeKey; - private double yScroll = 0; - private final Font fontRenderer; - - private int maxLinesToShow; - private int lineIndexStart; - private List lines; - private int charSize; - - public ScrollableWrappedTextWidget(String key, int x, int y, int width, int height) { - super(x, y, width, height); - this.localeKey = key; - this.fontRenderer = Minecraft.getInstance().font; - - this.recalculate(); - } - - @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) { - double temp = yScroll - delta; - yScroll = Mth.clamp(temp, 0, lines.size() - maxLinesToShow - 1); - recalculate(); - return true; - } - - private void recalculate() { - String t = I18n.get(localeKey); - lines = fontRenderer.split(Component.literal(t), width); - - charSize = fontRenderer.width("M"); - int maxOnScreen = height / (charSize + 4); - maxLinesToShow = Math.min(lines.size(), maxOnScreen); - - // startClamp - either the current line scroll, or the max allowed line - int startClamp = Math.min((int) Math.floor(yScroll), lines.size()); - lineIndexStart = Mth.clamp(0, startClamp, lines.size() - 1); - } - - @Override - public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { - matrixStack.pushPose(); - matrixStack.translate(x, y, 10); - - Font fr = Minecraft.getInstance().font; - - try { - for (int y = lineIndexStart; y <= lineIndexStart + maxLinesToShow; y++) { - FormattedCharSequence s = lines.get(y); - fr.drawShadow(matrixStack, s, 0, (y - lineIndexStart) * (charSize + 4), 0xFFFFFF); - } - } - - catch(Exception ex1) {} - - matrixStack.popPose(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java b/common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java deleted file mode 100644 index a0c39462..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/level/EmptyLevelEntityGetter.java +++ /dev/null @@ -1,45 +0,0 @@ -package dev.compactmods.machines.client.level; - -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.entity.EntityTypeTest; -import net.minecraft.world.level.entity.LevelEntityGetter; -import net.minecraft.world.phys.AABB; -import org.jetbrains.annotations.Nullable; - -import java.util.Collections; -import java.util.UUID; -import java.util.function.Consumer; - -public class EmptyLevelEntityGetter implements LevelEntityGetter { - @Nullable - @Override - public Entity get(int p_156931_) { - return null; - } - - @Nullable - @Override - public Entity get(UUID p_156939_) { - return null; - } - - @Override - public Iterable getAll() { - return Collections.emptySet(); - } - - @Override - public void get(EntityTypeTest p_156935_, Consumer p_156936_) { - - } - - @Override - public void get(AABB p_156937_, Consumer p_156938_) { - - } - - @Override - public void get(EntityTypeTest p_156932_, AABB p_156933_, Consumer p_156934_) { - - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java b/common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java deleted file mode 100644 index f7ad3847..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/level/FakeSpawnInfo.java +++ /dev/null @@ -1,120 +0,0 @@ -package dev.compactmods.machines.client.level; - -import net.minecraft.world.Difficulty; -import net.minecraft.world.level.GameRules; -import net.minecraft.world.level.storage.WritableLevelData; - -/** - * Credits to Immersive Engineering manual code for a baseline in 1.18.x. - * Source: https://github.com/BluSunrize/ImmersiveEngineering/blob/1.18.2/src/main/java/blusunrize/immersiveengineering/common/util/fakeworld/FakeSpawnInfo.java - */ -public class FakeSpawnInfo implements WritableLevelData { - private static final GameRules RULES = new GameRules(); - - private int spawnX; - private int spawnY; - private int spawnZ; - private float spawnAngle; - - @Override - public void setXSpawn(int x) - { - spawnX = x; - } - - @Override - public void setYSpawn(int y) - { - spawnY = y; - } - - @Override - public void setZSpawn(int z) - { - spawnZ = z; - } - - @Override - public void setSpawnAngle(float angle) - { - spawnAngle = angle; - } - - @Override - public int getXSpawn() - { - return spawnX; - } - - @Override - public int getYSpawn() - { - return spawnY; - } - - @Override - public int getZSpawn() - { - return spawnZ; - } - - @Override - public float getSpawnAngle() - { - return spawnAngle; - } - - @Override - public long getGameTime() - { - return 0; - } - - @Override - public long getDayTime() - { - return 0; - } - - @Override - public boolean isThundering() - { - return false; - } - - @Override - public boolean isRaining() - { - return false; - } - - @Override - public void setRaining(boolean isRaining) - { - - } - - @Override - public boolean isHardcore() - { - return false; - } - - @Override - public GameRules getGameRules() - { - return RULES; - } - - @Override - public Difficulty getDifficulty() - { - return Difficulty.PEACEFUL; - } - - @Override - public boolean isDifficultyLocked() - { - return false; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java b/common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java deleted file mode 100644 index 33c10d56..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/render/SuperRenderTypeBuffer.java +++ /dev/null @@ -1,97 +0,0 @@ -package dev.compactmods.machines.client.render; - -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.VertexConsumer; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import net.minecraft.Util; -import net.minecraft.client.renderer.ChunkBufferBuilderPack; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Sheets; -import net.minecraft.client.resources.model.ModelBakery; - -import java.util.SortedMap; - -/** - * Copied from Create's ponder rendering code. Stripping this down for now, WIP - */ -public class SuperRenderTypeBuffer implements MultiBufferSource { - - private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer(); - - public static SuperRenderTypeBuffer getInstance() { - return INSTANCE; - } - - private SuperRenderTypeBufferPhase earlyBuffer; - private SuperRenderTypeBufferPhase defaultBuffer; - private SuperRenderTypeBufferPhase lateBuffer; - - public SuperRenderTypeBuffer() { - earlyBuffer = new SuperRenderTypeBufferPhase(); - defaultBuffer = new SuperRenderTypeBufferPhase(); - lateBuffer = new SuperRenderTypeBufferPhase(); - } - - public VertexConsumer getEarlyBuffer(RenderType type) { - return earlyBuffer.bufferSource.getBuffer(type); - } - - @Override - public VertexConsumer getBuffer(RenderType type) { - return defaultBuffer.bufferSource.getBuffer(type); - } - - public VertexConsumer getLateBuffer(RenderType type) { - return lateBuffer.bufferSource.getBuffer(type); - } - - public void draw() { - earlyBuffer.bufferSource.endBatch(); - defaultBuffer.bufferSource.endBatch(); - lateBuffer.bufferSource.endBatch(); - } - - public void draw(RenderType type) { - earlyBuffer.bufferSource.endBatch(type); - defaultBuffer.bufferSource.endBatch(type); - lateBuffer.bufferSource.endBatch(type); - } - - private static class SuperRenderTypeBufferPhase { - - // Visible clones from RenderBuffers - private final ChunkBufferBuilderPack fixedBufferPack = new ChunkBufferBuilderPack(); - private final SortedMap fixedBuffers = Util.make(new Object2ObjectLinkedOpenHashMap<>(), map -> { - map.put(Sheets.solidBlockSheet(), fixedBufferPack.builder(RenderType.solid())); - map.put(Sheets.cutoutBlockSheet(), fixedBufferPack.builder(RenderType.cutout())); - map.put(Sheets.bannerSheet(), fixedBufferPack.builder(RenderType.cutoutMipped())); - map.put(Sheets.translucentCullBlockSheet(), fixedBufferPack.builder(RenderType.translucent())); - put(map, Sheets.shieldSheet()); - put(map, Sheets.bedSheet()); - put(map, Sheets.shulkerBoxSheet()); - put(map, Sheets.signSheet()); - put(map, Sheets.chestSheet()); - put(map, RenderType.translucentNoCrumbling()); - put(map, RenderType.armorGlint()); - put(map, RenderType.armorEntityGlint()); - put(map, RenderType.glint()); - put(map, RenderType.glintDirect()); - put(map, RenderType.glintTranslucent()); - put(map, RenderType.entityGlint()); - put(map, RenderType.entityGlintDirect()); - put(map, RenderType.waterMask()); - ModelBakery.DESTROY_TYPES.forEach((p_173062_) -> { - put(map, p_173062_); - }); - }); - private final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediateWithBuffers(fixedBuffers, new BufferBuilder(256)); - - private static void put(Object2ObjectLinkedOpenHashMap map, RenderType type) { - map.put(type, new BufferBuilder(type.bufferSize())); - } - - } - -} - diff --git a/common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java b/common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java deleted file mode 100644 index 16ac7aa9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/client/util/TransformingVertexBuilder.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * BluSunrize - * Copyright (c) 2020 - * - * This code is licensed under "Blu's License of Common Sense" - * - * Source: https://github.com/BluSunrize/ImmersiveEngineering/blob/1.18.2/src/main/java/blusunrize/immersiveengineering/client/utils/TransformingVertexBuilder.java - */ - -package dev.compactmods.machines.client.util; - -import com.google.common.base.Preconditions; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.blaze3d.vertex.VertexFormatElement; -import com.mojang.math.Vector3f; -import com.mojang.math.Vector4f; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -import static com.mojang.blaze3d.vertex.DefaultVertexFormat.*; - -public class TransformingVertexBuilder implements VertexConsumer -{ - private final VertexConsumer base; - private final PoseStack transform; - private final List> allObjects = new ArrayList<>(); - private final ObjectWithGlobal uv = new ObjectWithGlobal<>(this); - private final ObjectWithGlobal pos = new ObjectWithGlobal<>(this); - private final ObjectWithGlobal overlay = new ObjectWithGlobal<>(this); - private final ObjectWithGlobal lightmap = new ObjectWithGlobal<>(this); - private final ObjectWithGlobal normal = new ObjectWithGlobal<>(this); - private final ObjectWithGlobal color = new ObjectWithGlobal<>(this); - private final VertexFormat format; - - public TransformingVertexBuilder(VertexConsumer base, PoseStack transform, VertexFormat format) - { - this.base = base; - this.transform = transform; - this.format = format; - } - - public TransformingVertexBuilder(VertexConsumer base, VertexFormat format) - { - this(base, new PoseStack(), format); - } - - public TransformingVertexBuilder(MultiBufferSource buffer, RenderType type, PoseStack transform) - { - this(buffer.getBuffer(type), transform, type.format()); - } - - public TransformingVertexBuilder(MultiBufferSource buffer, RenderType type) - { - this(buffer, type, new PoseStack()); - } - - @NotNull - @Override - public VertexConsumer vertex(double x, double y, double z) - { - pos.putData(new Vec3(x, y, z)); - return this; - } - - @NotNull - @Override - public VertexConsumer color(int red, int green, int blue, int alpha) - { - color.putData(new Vector4f(red/255f, green/255f, blue/255f, alpha/255f)); - return this; - } - - @NotNull - @Override - public VertexConsumer uv(float u, float v) - { - uv.putData(new Vec2(u, v)); - return this; - } - - @NotNull - @Override - public VertexConsumer overlayCoords(int u, int v) - { - overlay.putData(new Vec2i(u, v)); - return this; - } - - @NotNull - @Override - public VertexConsumer uv2(int u, int v) - { - lightmap.putData(new Vec2i(u, v)); - return this; - } - - @NotNull - @Override - public VertexConsumer normal(float x, float y, float z) - { - normal.putData(new Vector3f(x, y, z)); - return this; - } - - @Override - public void endVertex() - { - for(VertexFormatElement element : format.getElements()) - { - if(element==ELEMENT_POSITION) - pos.ifPresent(pos -> base.vertex(transform.last().pose(), (float)pos.x, (float)pos.y, (float)pos.z)); - else if(element==ELEMENT_COLOR) - color.ifPresent(c -> base.color(c.x(), c.y(), c.z(), c.w())); - else if(element==ELEMENT_UV0) - uv.ifPresent(uv -> base.uv(uv.x, uv.y)); - else if(element==ELEMENT_UV1) - overlay.ifPresent(overlay -> base.overlayCoords(overlay.x, overlay.y)); - else if(element==ELEMENT_UV2) - lightmap.ifPresent(lightmap -> base.uv2(lightmap.x, lightmap.y)); - else if(element==ELEMENT_NORMAL) - normal.ifPresent( - normal -> base.normal(transform.last().normal(), normal.x(), normal.y(), normal.z()) - ); - } - base.endVertex(); - allObjects.forEach(ObjectWithGlobal::clear); - } - - public void defaultColor(float r, float g, float b, float a) - { - color.setGlobal(new Vector4f(r, g, b, a)); - } - - @Override - public void defaultColor(int r, int g, int b, int a) - { - defaultColor(r/255f, g/255f, b/255f, a/255f); - } - - @Override - public void unsetDefaultColor() - { - color.setGlobal(null); - } - - public void setLight(int light) - { - lightmap.setGlobal(new Vec2i(light&255, light >> 16)); - } - - public void setNormal(float x, float y, float z) - { - Vector3f vec = new Vector3f(x, y, z); - vec.normalize(); - normal.setGlobal(vec); - } - - public void setOverlay(int packedOverlayIn) - { - overlay.setGlobal(new Vec2i(packedOverlayIn&0xffff, packedOverlayIn >> 16)); - } - - private record Vec2i(int x, int y) - { - } - - private static class ObjectWithGlobal - { - @Nullable - private T obj; - private boolean isGlobal; - - public ObjectWithGlobal(TransformingVertexBuilder builder) - { - builder.allObjects.add(this); - } - - public void putData(T newVal) - { - Preconditions.checkState(obj==null||(isGlobal&&obj.equals(newVal))); - obj = newVal; - } - - public void setGlobal(@Nullable T obj) - { - this.obj = obj; - isGlobal = obj!=null; - } - - public T read() - { - T ret = Preconditions.checkNotNull(obj); - if(!isGlobal) - obj = null; - return ret; - } - - public boolean hasValue() - { - return obj!=null; - } - - public void ifPresent(Consumer out) - { - if(hasValue()) - out.accept(read()); - } - - public void clear() - { - if(!isGlobal) - obj = null; - } - } -} \ No newline at end of file diff --git a/common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java b/common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java deleted file mode 100644 index 0df07ea8..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/codec/CodecExtensions.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.compactmods.machines.codec; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import dev.compactmods.machines.ICompactMachinesMod; -import net.minecraft.Util; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.List; -import java.util.UUID; -import java.util.stream.DoubleStream; -import java.util.stream.IntStream; - -public abstract class CodecExtensions { - public static final Codec VECTOR3D = DoubleStreamExtensions.CODEC - .comapFlatMap(i -> DoubleStreamExtensions.fixedDoubleSize(i, 3) - .map(out -> new Vec3(out[0], out[1], out[2])), vec -> DoubleStream.of(vec.x, vec.y, vec.z)); - - public static final Codec VEC2 = Codec.FLOAT.listOf() - .comapFlatMap((vec) -> Util.fixedSize(vec, 2).map( - (res) -> new Vec2(res.get(0), res.get(1))), - (vec) -> List.of(vec.x, vec.y)); - - public static final Codec CHUNKPOS = Codec.INT_STREAM - .comapFlatMap(i -> Util.fixedSize(i, 2) - .map(arr -> new ChunkPos(arr[0], arr[1])), pos -> IntStream.of(pos.x, pos.z)); - - @Deprecated(forRemoval = true, since = "5.2.0") - public static final Codec UUID_STRING = Codec.STRING.comapFlatMap((s) -> { - try { - return DataResult.success(UUID.fromString(s)); - } catch (Exception ex) { - return DataResult.error("Not a valid UUID: " + s + " (" + ex.getMessage() + ")"); - } - }, UUID::toString).stable(); - - public static CompoundTag writeIntoTag(Codec codec, T instance, CompoundTag tag) { - - final var encoded = codec - .encodeStart(NbtOps.INSTANCE, instance) - .getOrThrow(false, ICompactMachinesMod.LOGGER::fatal); - - if (encoded instanceof CompoundTag ect) - tag.merge(ect); - - return tag; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java b/common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java deleted file mode 100644 index 04a0a8fc..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/codec/DoubleStreamExtensions.java +++ /dev/null @@ -1,50 +0,0 @@ -package dev.compactmods.machines.codec; - -import com.mojang.serialization.DataResult; -import com.mojang.serialization.DynamicOps; -import com.mojang.serialization.codecs.PrimitiveCodec; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.DoubleStream; - -public class DoubleStreamExtensions { - - public static final PrimitiveCodec CODEC = new PrimitiveCodec() { - @Override - public DataResult read(final DynamicOps ops, final T input) { - return getDoubleStream(ops, input); - } - - @Override - public T write(final DynamicOps ops, final DoubleStream value) { - return ops.createList(value.mapToObj(ops::createDouble)); - } - - @Override - public String toString() { - return "DoubleStream"; - } - }; - - public static DataResult fixedDoubleSize(DoubleStream stream, int limit) { - double[] limited = stream.limit(limit + 1).toArray(); - if (limited.length != limit) { - String s = "Input is not a list of " + limit + " doubles"; - return limited.length >= limit ? DataResult.error(s, Arrays.copyOf(limited, limit)) : DataResult.error(s); - } else { - return DataResult.success(limited); - } - } - - public static DataResult getDoubleStream(final DynamicOps ops, final T input) { - return ops.getStream(input).flatMap(stream -> { - final List list = stream.collect(Collectors.toList()); - if (list.stream().allMatch(element -> ops.getNumberValue(element).result().isPresent())) { - return DataResult.success(list.stream().mapToDouble(element -> ops.getNumberValue(element).result().get().doubleValue())); - } - return DataResult.error("Some elements are not doubles: " + input); - }); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java b/common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java deleted file mode 100644 index 44640c0f..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/codec/NbtListCollector.java +++ /dev/null @@ -1,54 +0,0 @@ -package dev.compactmods.machines.codec; - -import com.google.common.collect.ImmutableSet; -import net.minecraft.nbt.Tag; -import net.minecraft.nbt.ListTag; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.function.BiConsumer; -import java.util.function.BinaryOperator; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collector; - -public class NbtListCollector implements Collector, ListTag> { - - @Override - public Supplier> supplier() { - return ArrayList::new; - } - - @Override - public BiConsumer, Tag> accumulator() { - return List::add; - } - - @Override - public BinaryOperator> combiner() { - return (res1, res2) -> { - res1.addAll(res2); - return res1; - }; - } - - @Override - public Function, ListTag> finisher() { - return (items) -> { - ListTag list = new ListTag(); - list.addAll(items); - return list; - }; - } - - @Override - public Set characteristics() { - return ImmutableSet.of(Collector.Characteristics.CONCURRENT, - Collector.Characteristics.UNORDERED); - } - - public static NbtListCollector toNbtList() { - return new NbtListCollector(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/command/Commands.java b/common-main/src/main/java/dev/compactmods/machines/command/Commands.java deleted file mode 100644 index ee53ed3b..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/command/Commands.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.compactmods.machines.command; - -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import dev.compactmods.machines.api.core.Constants; -import net.minecraft.commands.CommandSourceStack; - - -public class Commands { - - // TODO: /cm create - // TODO: /cm spawn set - - static final LiteralArgumentBuilder CM_COMMAND_ROOT - = LiteralArgumentBuilder.literal(Constants.MOD_ID); - - public static void prepare() { - - } - - public static LiteralArgumentBuilder getRoot() { - return CM_COMMAND_ROOT; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java deleted file mode 100644 index 6880a4c6..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/DimensionGraphNode.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; - -public record DimensionGraphNode(ResourceKey dimension) implements IGraphNode { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(DimensionGraphNode::dimension) - ).apply(i, DimensionGraphNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public String toString() { - return "DimensionGraphNode[%s]".formatted(dimension); - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java deleted file mode 100644 index b424dbf0..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdge.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.graph; - -import org.jetbrains.annotations.NotNull; - -public interface IGraphEdge> { - @NotNull IGraphEdgeType getEdgeType(); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java deleted file mode 100644 index cd7e7cf1..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphEdgeType.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; - -public interface IGraphEdgeType { - Codec codec(); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java deleted file mode 100644 index ab134f30..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNode.java +++ /dev/null @@ -1,5 +0,0 @@ -package dev.compactmods.machines.graph; - -public interface IGraphNode> { - IGraphNodeType getType(); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java deleted file mode 100644 index e7e3d631..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/IGraphNodeType.java +++ /dev/null @@ -1,8 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; - -public interface IGraphNodeType { - - Codec codec(); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java deleted file mode 100644 index e4e22c70..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphEdgeType.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; - -import java.util.function.Supplier; - -public class SimpleGraphEdgeType implements IGraphEdgeType { - private final Codec codec; - - private SimpleGraphEdgeType(Codec codec) { - this.codec = codec; - } - - public static SimpleGraphEdgeType instance(Codec codec) { - return new SimpleGraphEdgeType(codec); - } - - public static Supplier> supplier(Codec codec) { - return () -> instance(codec); - } - - @Override - public Codec codec() { - return codec; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java b/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java deleted file mode 100644 index 018ee467..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/graph/SimpleGraphNodeType.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.compactmods.machines.graph; - -import com.mojang.serialization.Codec; - -import java.util.function.Supplier; - -public class SimpleGraphNodeType implements IGraphNodeType { - - private final Codec codec; - - private SimpleGraphNodeType(Codec codec) { - this.codec = codec; - } - - public static SimpleGraphNodeType instance(Codec codec) { - return new SimpleGraphNodeType(codec); - } - - public static Supplier> supplier(Codec codec) { - return () -> instance(codec); - } - - @Override - public Codec codec() { - return codec; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java b/common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java deleted file mode 100644 index fd41b1e0..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/i18n/TranslationUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -package dev.compactmods.machines.i18n; - -import net.minecraft.Util; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; - -public abstract class TranslationUtil { - - public static String messageId(ResourceLocation message) { - return Util.makeDescriptionId("message", message); - } - - public static MutableComponent message(ResourceLocation message) { - return Component.translatable(messageId(message)); - } - - public static MutableComponent message(ResourceLocation message, Object... params) { - return Component.translatable(messageId(message), params); - } - - public static String tooltipId(ResourceLocation tooltip) { - return Util.makeDescriptionId("tooltip", tooltip); - } - - public static MutableComponent tooltip(ResourceLocation tooltip) { - return Component.translatable(tooltipId(tooltip)); - } - - public static MutableComponent tooltip(ResourceLocation tooltip, Object... params) { - return Component.translatable(tooltipId(tooltip), params); - } - - public static String advId(ResourceLocation tooltip) { - return Util.makeDescriptionId("advancement", tooltip); - } - - public static MutableComponent advancement(ResourceLocation advancement) { - return Component.translatable(advId(advancement)); - } - - public static MutableComponent advancementTitle(ResourceLocation advancement) { - return advancement(advancement); - } - - public static MutableComponent advancementDesc(ResourceLocation advancement) { - return Component.translatable(Util.makeDescriptionId("advancement", advancement) + ".desc"); - } - - public static MutableComponent jeiInfo(ResourceLocation jei) { - return Component.translatable(Util.makeDescriptionId("jei", jei)); - } - - public static String commandId(ResourceLocation s) { - return Util.makeDescriptionId("command", s); - } - - public static MutableComponent command(ResourceLocation s) { - return Component.translatable(commandId(s)); - } - - public static MutableComponent command(ResourceLocation s, Object... params) { - return Component.translatable(commandId(s), params); - } - - public static String tunnelId(ResourceLocation id) { - return "item." + id.getNamespace() + ".tunnels." + id.getPath().replace('/', '.'); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java b/common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java deleted file mode 100644 index 4fe07c1c..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/location/LevelBlockPosition.java +++ /dev/null @@ -1,106 +0,0 @@ -package dev.compactmods.machines.location; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.Registry; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; -import org.apache.logging.log4j.LogManager; -import org.jetbrains.annotations.NotNull; - -import java.util.Objects; -import java.util.Optional; - -public record LevelBlockPosition(ResourceKey dimension, BlockPos blockPos) - implements IDimensionalBlockPosition { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(LevelBlockPosition::dimension), - BlockPos.CODEC.fieldOf("pos").forGetter(LevelBlockPosition::blockPos) - ).apply(i, LevelBlockPosition::new)); - - public LevelBlockPosition(IDimensionalBlockPosition machine) { - this(machine.dimension(), machine.getBlockPosition()); - } - - @Override - public Vec3 position() { - return Vec3.atCenterOf(blockPos); - } - - public ServerLevel level(@NotNull MinecraftServer server) { - return server.getLevel(this.dimension); - } - - public BlockState state(MinecraftServer server) { - final var level = level(server); - return level.getBlockState(getBlockPosition()); - } - - @Override - public IDimensionalBlockPosition relative(Direction direction) { - return new LevelBlockPosition(this.dimension, this.blockPos.relative(direction, 1)); - } - - public boolean isLoaded(MinecraftServer server) { - final var level = level(server); - return level.isLoaded(blockPos); - } - - @Override - public ChunkPos chunkPos() { - return new ChunkPos(blockPos); - } - - public static LevelBlockPosition fromNBT(CompoundTag nbt) { - return CODEC.parse(NbtOps.INSTANCE, nbt).getOrThrow(false, e -> LogManager.getLogger().error(e)); - } - - public BlockPos getBlockPosition() { - return blockPos.immutable(); - } - - @Override - public Optional getBlockEntity(MinecraftServer server) { - if(!state(server).hasBlockEntity()) - return Optional.empty(); - - return Optional.ofNullable(level(server).getBlockEntity(blockPos)); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - LevelBlockPosition that = (LevelBlockPosition) o; - if (!dimension.equals(that.dimension)) - return false; - - return blockPos.equals(that.blockPos); - } - - @Override - public int hashCode() { - return Objects.hash(dimension, blockPos); - } - - @Override - public String toString() { - return "LevelBlockPosition{d=%s, p=%s}".formatted(dimension, blockPos); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java b/common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java deleted file mode 100644 index 6128fb91..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/location/PreciseDimensionalPosition.java +++ /dev/null @@ -1,70 +0,0 @@ -package dev.compactmods.machines.location; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.location.IDimensionalPosition; -import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.util.MathUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.Objects; - -public record PreciseDimensionalPosition(ResourceKey dimension, Vec3 position, Vec2 rotation) - implements IDimensionalPosition { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceKey.codec(Registry.DIMENSION_REGISTRY).fieldOf("dim").forGetter(PreciseDimensionalPosition::dimension), - CodecExtensions.VECTOR3D.fieldOf("pos").forGetter(PreciseDimensionalPosition::position), - CodecExtensions.VEC2.optionalFieldOf("rot", Vec2.ZERO).forGetter(x -> x.rotation) - ).apply(i, PreciseDimensionalPosition::new)); - - public static PreciseDimensionalPosition fromPlayer(Player player) { - return new PreciseDimensionalPosition(player.level.dimension(), player.position(), new Vec2(player.xRotO, player.yRotO)); - } - - @Override - public ServerLevel level(MinecraftServer server) { - return server.getLevel(dimension); - } - - @Override - public boolean isLoaded(MinecraftServer serv) { - return level(serv).isLoaded(new BlockPos(position)); - } - - @Override - public ChunkPos chunkPos() { - return MathUtil.getChunkPos(this.position); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (PreciseDimensionalPosition) obj; - return Objects.equals(this.dimension, that.dimension) && - Objects.equals(this.position, that.position); - } - - @Override - public int hashCode() { - return Objects.hash(dimension, position); - } - - @Override - public String toString() { - return "PreciseDimensionalPosition[" + - "dimension=" + dimension + ", " + - "position=" + position + ']'; - } - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java b/common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java deleted file mode 100644 index 7027b0ce..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/BasicRoomInfo.java +++ /dev/null @@ -1,6 +0,0 @@ -package dev.compactmods.machines.machine; - -import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; - -public record BasicRoomInfo(String code, int color) implements IBasicRoomInfo { -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java b/common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java deleted file mode 100644 index 9df6cee9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/EnumMachinePlayersBreakHandling.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.compactmods.machines.machine; - -public enum EnumMachinePlayersBreakHandling { - UNBREAKABLE("unbreakable", "Nobody can break while players are inside."), - OWNER("owner", "Only the owner can break while players are inside."), - ANYONE("anyone", "Anyone can break while players are inside."); - - private final String configValue; - private final String configDesc; - - EnumMachinePlayersBreakHandling(String configValue, String configDesc) { - this.configValue = configValue; - this.configDesc = configDesc; - } - - public String configName() { - return configValue; - } - - public String configDesc() { - return configDesc; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java b/common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java deleted file mode 100644 index ff32e038..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/LegacySizedTemplates.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.compactmods.machines.machine; - -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.room.RoomTemplate; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.FastColor; - -/** - * @deprecated These templates will be removed in 1.20, and the system will become fully data controlled. - * Do not assume these are valid at any point! - */ -@Deprecated(forRemoval = true, since = "5.2.0") -public enum LegacySizedTemplates { - EMPTY_TINY("tiny", 3, FastColor.ARGB32.color(255, 201, 91, 19)), - EMPTY_SMALL("small", 5, FastColor.ARGB32.color(255, 212, 210, 210)), - EMPTY_NORMAL("normal", 7, FastColor.ARGB32.color(255, 251, 242, 54)), - EMPTY_LARGE("large", 9, FastColor.ARGB32.color(255, 33, 27, 46)), - EMPTY_GIANT("giant", 11, FastColor.ARGB32.color(255, 67, 214, 205)), - EMPTY_COLOSSAL("colossal", 13, FastColor.ARGB32.color(255, 66, 63, 66)); - - private final ResourceLocation id; - private final RoomTemplate template; - - LegacySizedTemplates(String id, int size, int color) { - this.id = new ResourceLocation(Constants.MOD_ID, id); - this.template = new RoomTemplate(size, color); - } - - public RoomTemplate template() { - return template; - } - - public ResourceLocation id() { - return id; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java b/common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java deleted file mode 100644 index 4272720a..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/client/MachineColors.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.compactmods.machines.machine.client; - -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.machine.IMachineBlockEntity; -import dev.compactmods.machines.machine.item.ICompactMachineItem; -import net.minecraft.client.color.block.BlockColor; -import net.minecraft.client.color.item.ItemColor; - -public class MachineColors { - - public static final ItemColor ITEM = (stack, pTintIndex) -> { - if(!stack.is(CMTags.MACHINE_ITEM)) return 0xFFFFFFFF; - return pTintIndex == 0 ? ICompactMachineItem.getMachineColor(stack) : 0xFFFFFFFF; - }; - - public static final BlockColor BLOCK = (state, level, pos, tintIndex) -> { - if(!state.is(CMTags.MACHINE_BLOCK) || level == null || pos == null) - return 0xFFFFFFFF; - - if(!(level.getBlockEntity(pos) instanceof IMachineBlockEntity machineData)) - return 0xFFFFFFFF; - - return tintIndex == 0 ? machineData.getColor() : 0xFFFFFFFF; - }; -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java b/common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java deleted file mode 100644 index e510d1a2..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/data/MachineDataTagBuilder.java +++ /dev/null @@ -1,90 +0,0 @@ -package dev.compactmods.machines.machine.data; - -import com.google.gson.JsonObject; -import dev.compactmods.machines.api.machine.MachineEntityNbt; -import dev.compactmods.machines.api.machine.MachineIds; -import dev.compactmods.machines.api.machine.MachineNbt; -import dev.compactmods.machines.api.room.RoomTemplate; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemStack; - -/** - * Used for setting up data that a Compact Machine block entity can - * read during its data loading process. - */ -public class MachineDataTagBuilder { - - private ResourceLocation templateId; - private int color; - - private MachineDataTagBuilder() { - this.templateId = RoomTemplate.NO_TEMPLATE; - this.color = RoomTemplate.INVALID_TEMPLATE.color(); - } - - public static MachineDataTagBuilder empty() { - return new MachineDataTagBuilder(); - } - - public static MachineDataTagBuilder forTemplate(ResourceLocation templateId, RoomTemplate template) { - return new MachineDataTagBuilder() - .template(templateId) - .color(template.color()); - } - - public MachineDataTagBuilder color(int color) { - this.color = color; - return this; - } - - public MachineDataTagBuilder template(ResourceLocation templateId) { - this.templateId = templateId; - return this; - } - - public MachineDataTagBuilder writeToItem(ItemStack stack) { - final var tag = stack.getOrCreateTag(); - tag.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, color); - tag.putString(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); - return this; - } - - public MachineDataTagBuilder writeToItemJson(JsonObject json) { - json.addProperty(MachineNbt.NBT_TEMPLATE_ID, templateId.toString()); - json.addProperty(MachineNbt.NBT_COLOR, color); - return this; - } - - public MachineDataTagBuilder writeToBlockData(ItemStack stack) { - final var data = writeBlockDataTag(); - data.putString("id", MachineIds.BLOCK_ENTITY.toString()); - stack.addTagElement("BlockEntityTag", data); - return this; - } - - public MachineDataTagBuilder writeToBlockDataJson(JsonObject json) { - if(json.has("BlockEntityTag")) - json.remove("BlockEntityTag"); - - json.add("BlockEntityTag", writeBlockDataJson()); - return this; - } - - private CompoundTag writeBlockDataTag() { - final var tag = new CompoundTag(); - tag.putString(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); - tag.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, color); - return tag; - } - - private JsonObject writeBlockDataJson() { - final var tag = new JsonObject(); - tag.addProperty("id", MachineIds.BLOCK_ENTITY.toString()); - tag.addProperty(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); - tag.addProperty(MachineEntityNbt.NBT_CUSTOM_COLOR, color); - return tag; - } - - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java b/common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java deleted file mode 100644 index 7e41a6dd..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/exceptions/NonexistentMachineException.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.compactmods.machines.machine.exceptions; - -public class NonexistentMachineException extends Throwable { - private final int machine; - - public NonexistentMachineException(int machine) { - this.machine = machine; - } - - public int getMachine() { - return machine; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java deleted file mode 100644 index 91830d9c..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/graph/CompactMachineNode.java +++ /dev/null @@ -1,44 +0,0 @@ -package dev.compactmods.machines.machine.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import dev.compactmods.machines.location.LevelBlockPosition; -import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.Level; - -/** - * Represents a machine's external point. This can be either inside a machine or in a dimension somewhere. - */ -public record CompactMachineNode(ResourceKey dimension, BlockPos position) - implements IGraphNode { - - public static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "machine"); - - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Level.RESOURCE_KEY_CODEC.fieldOf("dimension").forGetter(CompactMachineNode::dimension), - BlockPos.CODEC.fieldOf("position").forGetter(CompactMachineNode::position), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (dim, pos, type) -> new CompactMachineNode(dim, pos))); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - public String toString() { - return "Compact Machine {%s}".formatted(position); - } - - public LevelBlockPosition dimpos() { - return new LevelBlockPosition(dimension, position); - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java deleted file mode 100644 index c8f8df57..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/graph/DimensionMachineGraph.java +++ /dev/null @@ -1,231 +0,0 @@ -package dev.compactmods.machines.machine.graph; - -import com.google.common.collect.ImmutableList; -import com.google.common.graph.MutableValueGraph; -import com.google.common.graph.ValueGraphBuilder; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.LoggingUtil; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.room.graph.RoomReferenceNode; -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.saveddata.SavedData; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * Stores information on how external machines connect to the rooms in the compact machine - * dimension. Per-dimension since 4.3.0. - */ -public class DimensionMachineGraph extends SavedData { - - private static final Logger LOG = LoggingUtil.modLog(); - - private final ResourceKey level; - private final MutableValueGraph graph; - private final Map machines; - private final Map rooms; - - public static final String DATA_KEY = "machine_connections"; - private final Codec> CONN_CODEC = CompactMachineConnectionInfo.CODEC - .listOf() - .fieldOf("connections") - .codec(); - - private DimensionMachineGraph(ResourceKey level) { - this.level = level; - graph = ValueGraphBuilder - .directed() - .build(); - - machines = new HashMap<>(); - rooms = new HashMap<>(); - } - - public DimensionMachineGraph(ResourceKey level, @NotNull CompoundTag nbt) { - this(level); - - if (nbt.contains("graph")) { - CompoundTag graphNbt = nbt.getCompound("graph"); - - final var connectionData = CONN_CODEC.parse(NbtOps.INSTANCE, graphNbt) - .resultOrPartial(LOG::error) - .orElseThrow(); - - loadConnections(connectionData); - } - } - - private void loadConnections(List connectionInfo) { - for (CompactMachineConnectionInfo i : connectionInfo) { - addRoom(i.roomCode); - for (var connectedMachine : i.machines()) { - addMachine(connectedMachine); - connectMachineToRoom(connectedMachine, i.roomCode); - } - } - } - - public static DimensionMachineGraph forDimension(ServerLevel dimension) { - final var dimStore = dimension.getDataStorage(); - return dimStore.computeIfAbsent(tag -> new DimensionMachineGraph(dimension.dimension(), tag), - () -> new DimensionMachineGraph(dimension.dimension()), DATA_KEY); - } - - private List buildConnections() { - List result = new ArrayList<>(); - this.rooms.forEach((roomCode, node) -> { - final var machines = this.getMachinesFor(roomCode); - CompactMachineConnectionInfo roomInfo = new CompactMachineConnectionInfo(roomCode, ImmutableList.copyOf(machines)); - result.add(roomInfo); - }); - - return result; - } - - public void addMachine(BlockPos machine) { - if (this.machines.containsKey(machine)) - return; - - CompactMachineNode node = new CompactMachineNode(this.level, machine); - graph.addNode(node); - machines.put(machine, node); - - - this.setDirty(); - } - - public void addRoom(String roomCode) { - if (this.rooms.containsKey(roomCode)) - return; - - var node = new RoomReferenceNode(roomCode); - graph.addNode(node); - rooms.put(roomCode, node); - - this.setDirty(); - } - - public void connectMachineToRoom(BlockPos machine, String room) { - if (!machines.containsKey(machine)) - addMachine(machine); - - if (!rooms.containsKey(room)) - addRoom(room); - - var machineNode = machines.get(machine); - var roomNode = rooms.get(room); - - graph.putEdgeValue(machineNode, roomNode, new MachineRoomEdge()); - - this.setDirty(); - } - - public Set getMachinesFor(String room) { - if(!rooms.containsKey(room)) - return Collections.emptySet(); - - var node = this.rooms.get(room); - var inbound = graph.predecessors(node); - - return inbound.stream() - .filter(CompactMachineNode.class::isInstance) - .map(CompactMachineNode.class::cast) - .map(CompactMachineNode::position) - .collect(Collectors.toSet()); - } - - public Optional getConnectedRoom(BlockPos machinePos) { - if (!this.machines.containsKey(machinePos)) - return Optional.empty(); - - var node = this.machines.get(machinePos); - var connected = this.graph.successors(node); - return connected.stream() - .filter(n -> n instanceof RoomReferenceNode) - .map(n -> (RoomReferenceNode) n) - .map(RoomReferenceNode::code) - .findFirst(); - } - - public Stream getMachines() { - return this.machines.values().stream(); - } - - public void disconnectAndUnregister(int machine) { - if (!machines.containsKey(machine)) - return; - - final var node = machines.get(machine); - graph.removeNode(node); - machines.remove(machine); - } - - public void removeRoom(String room) { - if (!this.rooms.containsKey(room)) - return; - - graph.removeNode(rooms.get(room)); - rooms.remove(room); - } - - public void disconnect(BlockPos machine) { - if (!machines.containsKey(machine)) - return; - - final var node = machines.get(machine); - graph.successors(node).stream() - .filter(cn -> cn instanceof RoomReferenceNode) - .forEach(room -> graph.removeEdge(node, room)); - - setDirty(); - } - - public Optional getMachineNode(BlockPos worldPosition) { - return Optional.ofNullable(machines.get(worldPosition)); - } - - @NotNull - @Override - public CompoundTag save(@NotNull CompoundTag nbt) { - final var connData = buildConnections(); - - CONN_CODEC.encodeStart(NbtOps.INSTANCE, connData) - .resultOrPartial(LOG::error) - .ifPresent(gNbt -> nbt.put("graph", gNbt)); - - return nbt; - } - - /** - * Data structure for serialization. Do not use directly. - */ - private record CompactMachineConnectionInfo(String roomCode, List machines) { - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Codec.STRING - .fieldOf("room") - .forGetter(CompactMachineConnectionInfo::roomCode), - - BlockPos.CODEC.listOf() - .fieldOf("machines") - .forGetter(CompactMachineConnectionInfo::machines) - ).apply(i, CompactMachineConnectionInfo::new)); - - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java b/common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java deleted file mode 100644 index 9b7d37e6..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/graph/MachineRoomEdge.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.compactmods.machines.machine.graph; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import org.jetbrains.annotations.NotNull; - -public record MachineRoomEdge() implements IGraphEdge { - - public static final Codec CODEC = Codec.unit(MachineRoomEdge::new); - - public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); - - @Override - public boolean equals(Object obj) { - return obj == this || obj != null && obj.getClass() == this.getClass(); - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public String toString() { - return "MachineRoomEdge[]"; - } - - @NotNull - @Override - public IGraphEdgeType getEdgeType() { - return EDGE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java b/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java deleted file mode 100644 index 0a874053..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/machine/item/ICompactMachineItem.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.compactmods.machines.machine.item; - -import dev.compactmods.machines.api.machine.MachineNbt; -import net.minecraft.world.item.ItemStack; - -public interface ICompactMachineItem { - - static ItemStack setColor(ItemStack stack, int color) { - var tag = stack.getOrCreateTag(); - tag.putInt(MachineNbt.NBT_COLOR, color); - return stack; - } - - static int getMachineColor(ItemStack stack) { - if (!stack.hasTag()) return 0xFFFFFFFF; - - final var tag = stack.getTag(); - if (tag == null || tag.isEmpty() || !tag.contains(MachineNbt.NBT_COLOR)) - return 0xFFFFFFFF; - - return tag.getInt(MachineNbt.NBT_COLOR); - } - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java b/common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java deleted file mode 100644 index 8378efbc..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/MutableRoomRegistration.java +++ /dev/null @@ -1,92 +0,0 @@ -package dev.compactmods.machines.room; - -import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import net.minecraft.core.Vec3i; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -public class MutableRoomRegistration implements IMutableRoomRegistration { - private final IRoomLookup lookup; - private final IRoomRegistration currentData; - - public MutableRoomRegistration(IRoomLookup lookup, IRoomRegistration currentRoomData) { - this.lookup = lookup; - this.currentData = currentRoomData; - } - - @Override - public IMutableRoomRegistration setSpawnPosition(Vec3 spawnPosition) { - return this; - } - - @Override - public IMutableRoomRegistration setSpawnRotation(Vec2 spawnRotation) { - return this; - } - - @Override - public String code() { - return currentData.code(); - } - - @Override - public Vec3i dimensions() { - return currentData.dimensions(); - } - - @Override - public UUID owner(IRoomOwnerLookup lookup) { - return lookup.getRoomOwner(currentData.code()).orElseThrow(); - } - - @Override - public Vec3 center() { - return currentData.center(); - } - - @Override - public AABB innerBounds() { - return currentData.innerBounds(); - } - - @Override - public AABB outerBounds() { - return currentData.outerBounds(); - } - - @Override - public Vec3 spawnPosition(IRoomSpawnLookup spawns) { - return currentData.spawnPosition(spawns); - } - - @Override - public Vec2 spawnRotation(IRoomSpawnLookup spawns) { - return currentData.spawnRotation(spawns); - } - - @Override - public Optional getTemplate() { - return currentData.getTemplate(); - } - - @Override - public Stream chunks() { - return null; - } - - @Override - public int color() { - return currentData.color(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java b/common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java deleted file mode 100644 index d5ab8b87..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/RoomCodeGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.compactmods.machines.room; - -import com.aventrix.jnanoid.jnanoid.NanoIdUtils; - -import java.util.Random; - -public class RoomCodeGenerator { - private static final String REPLACE_REGEX = "([A-Z0-9]{4})([A-Z0-9]{4})([A-Z0-9]{4})"; - private static final char[] ALPHABET = "0123456789ABDFGHJKLMNPQRSTVWXYZ".toCharArray(); - private static final Random RANDOM = new Random(); - - public static String generateRoomId() { - final var id = NanoIdUtils.randomNanoId(RANDOM, ALPHABET, 12); - return id.replaceAll(REPLACE_REGEX, "$1-$2-$3"); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java b/common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java deleted file mode 100644 index 46f467d9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/client/ClientRoomMetadata.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.room.client; - -import dev.compactmods.machines.api.room.IPlayerRoomMetadata; - -import java.util.UUID; - -public record ClientRoomMetadata(String roomCode, UUID owner) - implements IPlayerRoomMetadata { -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java b/common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java deleted file mode 100644 index 2500dca2..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/client/RoomClientHelper.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.room.client; - -import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.api.room.Rooms; -import net.minecraft.client.Minecraft; -import net.minecraft.core.Registry; - -public class RoomClientHelper { - public static Registry getTemplates() { - return Minecraft.getInstance().level.registryAccess().registryOrThrow(Rooms.TEMPLATE_REG_KEY); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java b/common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java deleted file mode 100644 index f2949a0c..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/data/RoomPreview.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.compactmods.machines.room.data; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.api.room.RoomSize; -import net.minecraft.world.level.ChunkPos; - -public record RoomPreview(ChunkPos chunk, RoomSize size) { - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.CHUNKPOS.fieldOf("pos").forGetter(RoomPreview::chunk), - RoomSize.CODEC.fieldOf("size").forGetter(RoomPreview::size) - ).apply(i, RoomPreview::new)); -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java b/common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java deleted file mode 100644 index 8a2ec787..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/exceptions/NonexistentRoomException.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.compactmods.machines.room.exceptions; - -public class NonexistentRoomException extends Throwable { - private final String room; - - public NonexistentRoomException(String room) { - super("The requested room could not be found."); - this.room = room; - } - - public String getRoom() { - return room; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java deleted file mode 100644 index d03623bf..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/CompactRoomProvider.java +++ /dev/null @@ -1,336 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.google.common.graph.MutableValueGraph; -import com.google.common.graph.ValueGraphBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.codec.NbtListCollector; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.room.MutableRoomRegistration; -import dev.compactmods.machines.room.RoomCodeGenerator; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.util.MathUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.saveddata.SavedData; -import net.minecraft.world.phys.Vec2; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.function.Function; -import java.util.stream.Stream; - -public class CompactRoomProvider extends SavedData implements IRoomLookup, IRoomOwnerLookup, IRoomSpawnLookup { - - public static final Logger LOGS = LogManager.getLogger(); - - public static final String DATA_NAME = Constants.MOD_ID + "_rooms"; - public static final String NBT_NODE_ID_KEY = "node_id"; - - private final Map metadata; - - private final Map roomSpawns; - - private final Map chunks; - private final Map owners; - - private final MutableValueGraph, IGraphEdge> graph; - - private CompactRoomProvider() { - this.metadata = new HashMap<>(); - this.roomSpawns = new HashMap<>(); - this.chunks = new HashMap<>(); - this.owners = new HashMap<>(); - this.graph = ValueGraphBuilder - .directed() - .build(); - } - - public static CompactRoomProvider empty() { - return new CompactRoomProvider(); - } - - @Nullable - public static CompactRoomProvider instance(MinecraftServer server) { - try { - final ServerLevel level = CompactDimension.forServer(server); - return level.getDataStorage() - .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); - } catch (MissingDimensionException e) { - LOGS.fatal(e); - return null; - } - } - - public static CompactRoomProvider instance(ServerLevel compactDim) { - return compactDim.getDataStorage() - .computeIfAbsent(CompactRoomProvider::fromDisk, CompactRoomProvider::empty, DATA_NAME); - } - - public static CompactRoomProvider fromDisk(CompoundTag compoundTag) { - final var graph = new CompactRoomProvider(); - - final HashMap metaNodeIdMap = new HashMap<>(); - if (compoundTag.contains("rooms")) { - compoundTag.getList("rooms", ListTag.TAG_COMPOUND) - .stream() - .map(CompoundTag.class::cast) - .forEach(roomNode -> { - UUID id = roomNode.getUUID(NBT_NODE_ID_KEY); - final var node = RoomMetadataNode.CODEC.parse(NbtOps.INSTANCE, roomNode) - .getOrThrow(false, LOGS::fatal); - - metaNodeIdMap.put(id, node); - graph.metadata.put(node.code(), node); - - node.chunks().forEach(chunk -> { - RoomChunkNode chunkNode = new RoomChunkNode(chunk); - graph.graph.putEdgeValue(node, chunkNode, new RoomChunkEdge()); - graph.chunks.put(chunk, chunkNode); - }); - }); - } - - final HashMap roomOwnerNodeMap = new HashMap<>(); - if (compoundTag.contains("owners")) { - compoundTag.getList("owners", ListTag.TAG_COMPOUND) - .stream() - .map(CompoundTag.class::cast) - .forEach(ownerNode -> { - UUID id = ownerNode.getUUID(NBT_NODE_ID_KEY); - final var node = RoomOwnerNode.CODEC.parse(NbtOps.INSTANCE, ownerNode) - .getOrThrow(false, LOGS::fatal); - - roomOwnerNodeMap.put(id, node); - graph.owners.put(node.owner(), node); - }); - } - - if (compoundTag.contains("roomOwners")) { - compoundTag.getList("roomOwners", ListTag.TAG_COMPOUND) - .stream() - .map(CompoundTag.class::cast) - .forEach(roomOwnerConn -> { - RoomMetadataNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("room")); - RoomOwnerNode owner = roomOwnerNodeMap.get(roomOwnerConn.getUUID("owner")); - graph.graph.putEdgeValue(meta, owner, new RoomOwnerEdge()); - }); - } - - LOGS.debug("Number of rooms loaded from disk: {}", metaNodeIdMap.size()); - return graph; - } - - @NotNull - @Override - public CompoundTag save(@NotNull CompoundTag tag) { - //region Room Metadata Nodes - final HashMap metaNodeIdMap = new HashMap<>(); - metadata.values().forEach(metaNode -> metaNodeIdMap.put(metaNode.code(), UUID.randomUUID())); - ListTag meta = (ListTag) RoomMetadataNode.CODEC.listOf() - .encodeStart(NbtOps.INSTANCE, List.copyOf(metadata.values())) - .getOrThrow(false, LOGS::fatal); - - meta.stream() - .filter(CompoundTag.class::isInstance) - .map(CompoundTag.class::cast) - .forEach(mct -> mct.putUUID(NBT_NODE_ID_KEY, metaNodeIdMap.get(mct.getString("code")))); - - tag.put("rooms", meta); - //endregion - - //region Room Owner nodes - final HashMap ownerByUuidMap = new HashMap<>(); - owners.values().forEach(ownerNode -> ownerByUuidMap.put(ownerNode.owner(), UUID.randomUUID())); - ListTag ownerList = (ListTag) RoomOwnerNode.CODEC.listOf() - .encodeStart(NbtOps.INSTANCE, List.copyOf(owners.values())) - .getOrThrow(false, LOGS::fatal); - - ownerList.stream().map(CompoundTag.class::cast) - .forEach(oct -> oct.putUUID(NBT_NODE_ID_KEY, ownerByUuidMap.get(oct.getUUID("owner")))); - - tag.put("owners", ownerList); - //endregion - - //region Room-Owner connections - if (!metadata.isEmpty() && !owners.isEmpty()) { - final ListTag roomOwnerConnections = metadata.values() - .stream() - .map(roomNode -> graph.adjacentNodes(roomNode) - .stream() - .filter(RoomOwnerNode.class::isInstance) - .map(RoomOwnerNode.class::cast) - .findFirst() - .map(roomOwner -> { - UUID roomId = metaNodeIdMap.get(roomNode.code()); - UUID ownerId = ownerByUuidMap.get(roomOwner.owner()); - CompoundTag connection = new CompoundTag(); - connection.putUUID("room", roomId); - connection.putUUID("owner", ownerId); - return connection; - })) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(NbtListCollector.toNbtList()); - - tag.put("roomOwners", roomOwnerConnections); - } - //endregion - - return tag; - } - - @Override - public Stream allRooms() { - return metadata.values().stream() - .map(mn -> mn); - } - - @Override - public Stream findByOwner(UUID owner) { - if (!owners.containsKey(owner)) - return Stream.empty(); - - return graph.adjacentNodes(owners.get(owner)).stream() - .filter(RoomMetadataNode.class::isInstance) - .map(RoomMetadataNode.class::cast); - } - - @Override - public Optional findByMachine(IDimensionalBlockPosition machine) { - return Optional.empty(); - } - - @Override - public Optional forRoom(String room) { - return Optional.ofNullable(metadata.get(room)); - } - - @Override - public Optional findByChunk(ChunkPos chunk) { - if (!isRoomChunk(chunk)) return Optional.empty(); - final var chunkNode = chunks.get(chunk); - - return graph.predecessors(chunkNode).stream() - .filter(RoomMetadataNode.class::isInstance) - .map(RoomMetadataNode.class::cast) - .map(IRoomRegistration.class::cast) - .findFirst(); - } - - @Override - public boolean isRoomChunk(ChunkPos chunk) { - return chunks.containsKey(chunk); - } - - @Override - public long count() { - return metadata.size(); - } - - private IRoomRegistration finalizeNew(String code, RoomMetadataNode roomNode, UUID owner) { - this.metadata.put(code, roomNode); - this.owners.computeIfAbsent(owner, RoomOwnerNode::new); - final var ownerNode = owners.get(owner); - - graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); - - // calculate chunks - roomNode.chunks().forEach(c -> { - final var roomChunkNode = new RoomChunkNode(c); - chunks.put(c, roomChunkNode); - graph.putEdgeValue(roomNode, roomChunkNode, new RoomChunkEdge()); - }); - - setDirty(); - - return roomNode; - } - - /** - * Registers a new room with a specified room code and data from the builder. - * This assumes that data is coming from a previous source such as a migrator, and - * will take all values from the returned builder. - * - * @param code - * @param newRoom - * @return - */ - public IRoomRegistration registerNew(String code, Function newRoom) { - final var builder = newRoom.apply(new NewRoomBuilder(code)); - - final var roomNode = builder.build(); - return finalizeNew(code, roomNode, builder.owner); - } - - public IRoomRegistration registerNew(Function newRoom) { - final var newRoomCode = RoomCodeGenerator.generateRoomId(); - - Vec3i location = MathUtil.getRegionPositionByIndex(metadata.size()); - - final var builder = newRoom.apply(new NewRoomBuilder(newRoomCode)); - BlockPos newCenter = MathUtil.getCenterWithY(location, 40).above(builder.yOffset()); - - builder.setCenter(newCenter); - - final var roomNode = builder.build(); - return finalizeNew(newRoomCode, roomNode, builder.owner); - } - - public IMutableRoomRegistration edit(String room) { - return new MutableRoomRegistration(this, this.metadata.get(room)); - } - - public void resetSpawn(String room) throws NonexistentRoomException { - if (!metadata.containsKey(room)) - throw new NonexistentRoomException(room); - - final var meta = metadata.get(room); - final var newSpawn = meta.center().subtract(0, (meta.dimensions().getY() / 2f), 0); - final var newSpawnNode = new RoomSpawnNode(newSpawn, Vec2.ZERO); - - // TODO - Graph data - if (!roomSpawns.containsKey(room)) { - // make new spawn data - roomSpawns.put(room, newSpawnNode); - } else { - // reset spawn data - roomSpawns.put(room, newSpawnNode); - } - } - - @Override - public Optional getRoomOwner(String roomCode) { - // TODO - Graph data - if (!metadata.containsKey(roomCode)) - return Optional.empty(); - - final var roomNode = metadata.get(roomCode); - return graph.adjacentNodes(roomNode).stream() - .filter(RoomOwnerNode.class::isInstance) - .map(RoomOwnerNode.class::cast) - .map(RoomOwnerNode::owner) - .findFirst(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java deleted file mode 100644 index c609d743..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/NewRoomBuilder.java +++ /dev/null @@ -1,67 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.UUID; - -public class NewRoomBuilder { - private final String code; - private int color = 0; - private Vec3i dimensions = Vec3i.ZERO; - private Vec3 center = Vec3.ZERO; - private Vec3 centerOffset = Vec3.ZERO; - private Vec3 spawn = Vec3.ZERO; - private Vec2 spawnRotation = Vec2.ZERO; - UUID owner; - - NewRoomBuilder(String newRoomCode) { - this.code = newRoomCode; - } - - public NewRoomBuilder setDimensions(Vec3i dimensions) { - this.dimensions = dimensions; - return this; - } - - public NewRoomBuilder offsetCenter(Vec3 offset) { - this.centerOffset = offset; - return this; - } - - public NewRoomBuilder setOwner(UUID owner) { - this.owner = owner; - return this; - } - - public NewRoomBuilder setColor(int color) { - this.color = color; - return this; - } - - int yOffset() { - return Math.floorDiv(dimensions.getY(), 2); - } - - public NewRoomBuilder setCenter(BlockPos newCenter) { - this.center = Vec3.atCenterOf(newCenter); - this.spawn = Vec3.atCenterOf(newCenter); - this.spawnRotation = Vec2.ZERO; - return this; - } - - public NewRoomBuilder setSpawn(Vec3 spawn, Vec2 spawnRotation) { - this.spawn = spawn; - this.spawnRotation = spawnRotation; - return this; - } - - RoomMetadataNode build() { - return new RoomMetadataNode(code, color, dimensions, - center.add(centerOffset), - spawn, - spawnRotation); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java deleted file mode 100644 index 97ea04a9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkEdge.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import org.jetbrains.annotations.NotNull; - -public record RoomChunkEdge() implements dev.compactmods.machines.graph.IGraphEdge { - - public static final Codec CODEC = Codec.unit(new RoomChunkEdge()); - - public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); - - @Override - public @NotNull IGraphEdgeType getEdgeType() { - return EDGE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java deleted file mode 100644 index f7d2ba67..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomChunkNode.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.world.level.ChunkPos; - -public record RoomChunkNode(ChunkPos chunk) implements IGraphNode { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - CodecExtensions.CHUNKPOS.fieldOf("chunk").forGetter(RoomChunkNode::chunk) - ).apply(i, RoomChunkNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } - - public IRoomRegistration room(IRoomLookup lookup) { - return lookup.findByChunk(chunk).orElseThrow(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java deleted file mode 100644 index 94055185..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomMetadataNode.java +++ /dev/null @@ -1,95 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -import java.util.Optional; -import java.util.UUID; -import java.util.stream.Stream; - -/** - * Hosts core information about a machine room, such as how large it is and its code. - * @param code - * @param dimensions - */ -public record RoomMetadataNode(String code, int color, Vec3i dimensions, Vec3 center, Vec3 spawnPosition, Vec2 spawnRotation) - implements IGraphNode, IRoomRegistration { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Codec.STRING.fieldOf("code").forGetter(RoomMetadataNode::code), - Codec.INT.fieldOf("color").forGetter(RoomMetadataNode::color), - Vec3i.CODEC.fieldOf("dimensions").forGetter(RoomMetadataNode::dimensions), - Vec3.CODEC.fieldOf("center").forGetter(RoomMetadataNode::center), - Vec3.CODEC.fieldOf("spawnPos").forGetter(RoomMetadataNode::spawnPosition), - CodecExtensions.VEC2.fieldOf("spawnRot").forGetter(RoomMetadataNode::spawnRotation) - ).apply(i, RoomMetadataNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public String toString() { - return "Room Meta [id=%s]".formatted(code); - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } - - @Override - public UUID owner(IRoomOwnerLookup lookup) { - return lookup.getRoomOwner(code).orElseThrow(); - } - - @Override - public AABB innerBounds() { - return AABB.ofSize(center, dimensions.getX() - 2, dimensions.getY() - 2, dimensions.getZ() - 2); - } - - @Override - public AABB outerBounds() { - return AABB.ofSize(center, dimensions.getX(), dimensions.getY(), dimensions.getZ()); - } - - @Override - public Vec3 spawnPosition(IRoomSpawnLookup spawns) { - return spawnPosition; - } - - @Override - public Vec2 spawnRotation(IRoomSpawnLookup spawns) { - return spawnRotation; - } - - @Override - public Optional getTemplate() { - return Optional.empty(); - } - - @Override - public Stream chunks() { - AABB outerBounds = outerBounds(); - BlockPos min = new BlockPos(outerBounds.minX, outerBounds.minY, outerBounds.minZ); - BlockPos max = new BlockPos(outerBounds.maxX, outerBounds.maxY, outerBounds.maxZ); - - return ChunkPos.rangeClosed(new ChunkPos(min), new ChunkPos(max)); - } - - public Codec codec() { - return CODEC; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java deleted file mode 100644 index eba7eeba..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerEdge.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import org.jetbrains.annotations.NotNull; - -public record RoomOwnerEdge() implements IGraphEdge { - public static final Codec CODEC = Codec.unit(new RoomOwnerEdge()); - - public static final IGraphEdgeType TYPE = SimpleGraphEdgeType.instance(CODEC); - - @Override - public @NotNull IGraphEdgeType getEdgeType() { - return TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java deleted file mode 100644 index 24efed16..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomOwnerNode.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.core.UUIDUtil; -import net.minecraft.resources.ResourceLocation; - -import java.util.UUID; - -public record RoomOwnerNode(UUID owner) implements IGraphNode { - - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "room"); - - public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( - UUIDUtil.CODEC.fieldOf("owner").forGetter(RoomOwnerNode::owner), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> RoomOwnerNode.TYPE) - ).apply(i, (owner, type) -> new RoomOwnerNode(owner))); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java deleted file mode 100644 index badea03c..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomReferenceNode.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.room.IRoomLookup; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; - -/** - * Represents the inside of a Compact Machine. - */ -public record RoomReferenceNode(String code) implements IGraphNode { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Codec.STRING.fieldOf("code").forGetter(RoomReferenceNode::code) - ).apply(i, RoomReferenceNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - public IRoomRegistration getFullInfo(IRoomLookup lookup) { - return lookup.forRoom(code).orElseThrow(); - } - - @Override - public String toString() { - return "RoomReference[id=%s]".formatted(code); - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java b/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java deleted file mode 100644 index edd61bd9..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/graph/RoomSpawnNode.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.compactmods.machines.room.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; - -public record RoomSpawnNode(Vec3 position, Vec2 rotation) implements IGraphNode { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Vec3.CODEC.fieldOf("position").forGetter(RoomSpawnNode::position), - CodecExtensions.VEC2.fieldOf("rotation").forGetter(RoomSpawnNode::rotation) - ).apply(i, RoomSpawnNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java b/common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java deleted file mode 100644 index 86141107..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/history/PlayerRoomHistoryItem.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.compactmods.machines.room.history; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import dev.compactmods.machines.api.location.IDimensionalPosition; -import dev.compactmods.machines.api.room.history.IRoomHistoryItem; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.location.PreciseDimensionalPosition; - -public record PlayerRoomHistoryItem(PreciseDimensionalPosition entry, LevelBlockPosition machine) implements IRoomHistoryItem { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - PreciseDimensionalPosition.CODEC.fieldOf("position").forGetter(PlayerRoomHistoryItem::entry), - LevelBlockPosition.CODEC.fieldOf("machine").forGetter(PlayerRoomHistoryItem::machine) - ).apply(i, PlayerRoomHistoryItem::new)); - - @Override - public IDimensionalPosition getEntryLocation() { - return entry; - } - - @Override - public IDimensionalBlockPosition getMachine() { - return machine; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java b/common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java deleted file mode 100644 index 122514a0..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/server/RoomServerHelper.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.compactmods.machines.room.server; - -import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.api.room.Rooms; -import net.minecraft.core.Registry; -import net.minecraft.server.MinecraftServer; - -public class RoomServerHelper { - public static Registry getTemplates(MinecraftServer server) { - return server - .registryAccess() - .registryOrThrow(Rooms.TEMPLATE_REG_KEY); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java b/common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java deleted file mode 100644 index c3a04026..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/room/upgrade/graph/RoomUpgradeGraphNode.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.compactmods.machines.room.upgrade.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.resources.ResourceLocation; - -public record RoomUpgradeGraphNode(ResourceLocation key) implements IGraphNode { - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("upgrade").forGetter(RoomUpgradeGraphNode::key) - ).apply(i, RoomUpgradeGraphNode::new)); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java deleted file mode 100644 index 11e761e4..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/BaseTunnelWallData.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.location.LevelBlockPosition; -import net.minecraft.resources.ResourceLocation; - -public record BaseTunnelWallData(LevelBlockPosition connection, ResourceLocation tunnelType) { - public static final String KEY_CONNECTION = "connection"; - public static final String KEY_TUNNEL_TYPE = "tunnel_type"; - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - LevelBlockPosition.CODEC.fieldOf(KEY_CONNECTION).forGetter(BaseTunnelWallData::connection), - ResourceLocation.CODEC.fieldOf(KEY_TUNNEL_TYPE).forGetter(BaseTunnelWallData::tunnelType) - ).apply(i, BaseTunnelWallData::new)); - - public TunnelDefinition tunnel() { - return TunnelHelper.getDefinition(tunnelType); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java deleted file mode 100644 index cb397f35..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/ITunnelItem.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemStack; - -import java.util.Optional; - -public interface ITunnelItem { - static Optional getDefinition(ItemStack stack) { - CompoundTag defTag = stack.getOrCreateTagElement("definition"); - if (defTag.isEmpty() || !defTag.contains("id")) - return Optional.empty(); - - ResourceLocation defId = new ResourceLocation(defTag.getString("id")); - var defRegistry = TunnelHelper.definitionRegistry(); - if (!defRegistry.containsKey(defId)) - return Optional.empty(); - - TunnelDefinition tunnelReg = defRegistry.get(defId); - return Optional.ofNullable(tunnelReg); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java deleted file mode 100644 index 37fddfc5..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/SidedPosition.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; - -public record SidedPosition(BlockPos pos, Direction side) { -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java deleted file mode 100644 index 4d036504..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import dev.compactmods.machines.api.core.CMRegistryKeys; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.core.Direction; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Stream; - -public class TunnelHelper { - - public static Registry definitionRegistry() { - return RegistryAccess.builtinCopy().registryOrThrow(CMRegistryKeys.TYPES_REG_KEY); - } - - public static TunnelDefinition getDefinition(ResourceLocation tunnelType) { - final var reg = definitionRegistry(); - return reg.get(tunnelType); - } - - @NotNull - public static Direction getNextDirection(Direction in) { - return switch (in) { - case UP -> Direction.DOWN; - case DOWN -> Direction.NORTH; - case NORTH -> Direction.SOUTH; - case SOUTH -> Direction.WEST; - case WEST -> Direction.EAST; - case EAST -> Direction.UP; - }; - } - - public static Stream getOrderedSides() { - return Stream.of(Direction.UP, Direction.DOWN, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST); - } - - public static Optional getNextDirection(Direction current, Set used) { - final var ordered = getOrderedSides().toList(); - final var found = ordered.indexOf(current); - final var stream = Stream.generate(() -> ordered).flatMap(Collection::stream); - - return stream.skip(found + 1).filter(dir -> !used.contains(dir)).findFirst(); - } - - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java deleted file mode 100644 index b1ddeedc..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/TunnelNetwork.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.compactmods.machines.tunnel; - -import net.minecraft.resources.ResourceLocation; - -// TODO: Implementation - -/** - * A tunnel network helps to abstract storage and implementation details for both - * tunnels and upgrades, away from individual blocks and systems. - * For example, a pump upgrade for a machine may require insertion of fluids - * into a room's fluid storage. - */ -public class TunnelNetwork { - - public static TunnelNetwork forRoomAndType(String room, ResourceLocation networkType) { - return null; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java deleted file mode 100644 index ab57692b..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/client/ClientTunnelHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.compactmods.machines.tunnel.client; - -import dev.compactmods.machines.api.tunnels.ITunnelHolder; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import net.minecraft.client.Minecraft; -import net.minecraft.core.BlockPos; - -public class ClientTunnelHandler { - public static void setTunnel(BlockPos position, TunnelDefinition type) { - var level = Minecraft.getInstance().level; - if(level == null) return; - - Minecraft.getInstance().tell(() -> { - if (level.getBlockEntity(position) instanceof ITunnelHolder tun) { - try { - tun.setTunnelType(type); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java deleted file mode 100644 index 46b60710..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/definitions/UnknownTunnel.java +++ /dev/null @@ -1,12 +0,0 @@ -package dev.compactmods.machines.tunnel.definitions; - -import dev.compactmods.machines.api.tunnels.TunnelDefinition; - -public class UnknownTunnel implements TunnelDefinition { - - @Override - public int ringColor() { - return NO_INDICATOR_COLOR; - } - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java deleted file mode 100644 index 261fc938..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineEdge.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.compactmods.machines.tunnel.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; - -/** - * Bridges connection between a tunnel and a given machine side. - */ -public record TunnelMachineEdge(Direction side) implements IGraphEdge { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_machine"); - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - Direction.CODEC.fieldOf("side").forGetter(TunnelMachineEdge::side), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (side, t) -> new TunnelMachineEdge(side))); - - public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); - - @Override - public String toString() { - return "TunnelMachineEdge[" + - "side=" + side + ']'; - } - - @Override - public IGraphEdgeType getEdgeType() { - return EDGE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java deleted file mode 100644 index a7334c2a..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelMachineInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.tunnel.graph; - -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; - -public record TunnelMachineInfo(BlockPos location, ResourceLocation type, IDimensionalBlockPosition machine, Direction side) { -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java deleted file mode 100644 index a883de8d..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelNode.java +++ /dev/null @@ -1,53 +0,0 @@ -package dev.compactmods.machines.tunnel.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; - -import java.util.Objects; -import java.util.Optional; - -public record TunnelNode(BlockPos position) implements IGraphNode { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel"); - - public static final Codec CODEC = RecordCodecBuilder.create((i) -> i.group( - BlockPos.CODEC.fieldOf("pos").forGetter(TunnelNode::position), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (bpos, type) -> new TunnelNode(bpos))); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (TunnelNode) obj; - return Objects.equals(this.position, that.position); - } - - @Override - public int hashCode() { - return Objects.hash(position); - } - - @Override - public String toString() { - return "TunnelNode[position=%s]".formatted(position); - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } - - public Optional getTunnelSide(RoomTunnelConnections connections) { - return connections.getConnectedSide(position); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java deleted file mode 100644 index dae7f2cd..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeEdge.java +++ /dev/null @@ -1,43 +0,0 @@ -package dev.compactmods.machines.tunnel.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.NotNull; - -public final class TunnelTypeEdge implements IGraphEdge { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (t) -> new TunnelTypeEdge())); - - public static final IGraphEdgeType EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); - - public TunnelTypeEdge() { - } - - @Override - public boolean equals(Object obj) { - return obj == this || obj != null && obj.getClass() == this.getClass(); - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public String toString() { - return "TunnelTypeEdge[]"; - } - - @Override - public @NotNull IGraphEdgeType getEdgeType() { - return EDGE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java deleted file mode 100644 index 43500885..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelTypeNode.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.compactmods.machines.tunnel.graph; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import net.minecraft.resources.ResourceLocation; - -public record TunnelTypeNode(ResourceLocation id) implements IGraphNodeType, IGraphNode { - private static final ResourceLocation TYPE = new ResourceLocation(Constants.MOD_ID, "tunnel_type"); - - public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( - ResourceLocation.CODEC.fieldOf("tunnel_type").forGetter(TunnelTypeNode::id), - ResourceLocation.CODEC.fieldOf("type").forGetter(x -> TYPE) - ).apply(i, (tunn, type) -> new TunnelTypeNode(tunn))); - - public static final IGraphNodeType NODE_TYPE = SimpleGraphNodeType.instance(CODEC); - - @Override - public Codec codec() { - return CODEC; - } - - @Override - public IGraphNodeType getType() { - return NODE_TYPE; - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md b/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md deleted file mode 100644 index 36b6f6c4..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/graph/readme.md +++ /dev/null @@ -1,35 +0,0 @@ -# Tunnel Connection Graph - -## Structure - -File: `tunnel_graph_0_0.nbt` (inside `data` block) -```json5 -{ - "nodes": [ - { - "type": "compactmachines:tunnel", - "pos": [0, 0, 0] - }, - { - "type": "compactmachines:tunnel_type", - "tunnel_type": "compactmachines:unknown" - }, - { - "type": "compactmachines:machine", - "machine": 1 - } - ], - "edges": [ - { - "type": "compactmachines:tunnel_type", - "from": "[[tunnel]]", - "to": "[[tunnel type]]" - }, - { - "type": "compactmachines:tunnel_machine_link", - "from": "[[tunnel]]", - "to": "[[machine]]" - } - ] -} -``` \ No newline at end of file diff --git a/common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java b/common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java deleted file mode 100644 index 469b74db..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/CompactStructureGenerator.java +++ /dev/null @@ -1,119 +0,0 @@ -package dev.compactmods.machines.util; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.Vec3i; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; - -public class CompactStructureGenerator { - - public static AABB getWallBounds(Vec3i size, Vec3 roomCenter, Direction wall) { - BlockPos cubeFloor = new BlockPos(roomCenter).below(Math.floorDiv(size.getY(), 2)); - BlockPos start; - - switch (wall) { - case NORTH, SOUTH -> { - int offsetNorthSouth = (int) Math.ceil(size.getZ() / 2f); - start = cubeFloor.relative(wall, offsetNorthSouth); - - return new AABB(start, start) - .expandTowards(0, size.getY(), 0) - .inflate(Math.ceil(size.getX() / 2f), 0, 0); - } - - case WEST, EAST -> { - final var offsetWestEast = (int) Math.ceil(size.getX() / 2f); - start = cubeFloor.relative(wall, offsetWestEast); - - return new AABB(start, start) - .expandTowards(0, size.getY(), 0) - .inflate(0, 0, Math.ceil(size.getZ() / 2f)); - } - - case UP, DOWN -> { - start = wall == Direction.DOWN ? cubeFloor : cubeFloor.relative(wall, size.getY()); - var aabb = new AABB(start, start) - .inflate(Math.ceil(size.getX() / 2f), 0, Math.ceil(size.getZ() / 2f)); - - if(wall == Direction.UP) - aabb = aabb.inflate(0, 1, 0); - - return aabb; - } - } - - // catch-all - return AABB.ofSize(Vec3.ZERO, 0, 0, 0); - } - - /** - * Generates a wall or platform in a given direction. - * - * @param world - * @param dimensions - * @param cubeCenter - * @param wallDirection - */ - public static void generateCompactWall(LevelAccessor world, Vec3i dimensions, Vec3 cubeCenter, Direction wallDirection, BlockState block) { - final var wallBounds = getWallBounds(dimensions, cubeCenter, wallDirection); - - BlockPos.betweenClosedStream(wallBounds) - // .filter(world::isEmptyBlock) - .map(BlockPos::immutable) - .forEach(p -> world.setBlock(p, block, 7)); - } - - /** - * Generates a machine "internal" structure in a world via a machine size and a central point. - * - * @param world - * @param dimensions Internal dimensions of the room. - * @param roomCenter - */ - public static void generateRoom(LevelAccessor world, Vec3i dimensions, Vec3 roomCenter, BlockState block) { - AABB floorBlocks = getWallBounds(dimensions, roomCenter, Direction.DOWN); - AABB machineInternal = floorBlocks - .move(1, 1, 1) - .contract(2, 0, 2) - .expandTowards(0, dimensions.getY() - 1, 0); - - - boolean anyAir = BlockPos.betweenClosedStream(floorBlocks).anyMatch(world::isEmptyBlock); - - if (anyAir) { - // Generate the walls - for(final var dir : Direction.values()) - generateCompactWall(world, dimensions, roomCenter, dir, block); - - // Clear out the inside of the room - BlockPos.betweenClosedStream(machineInternal) - .forEach(p -> world.setBlock(p, Blocks.AIR.defaultBlockState(), 7)); - - } - } - - public static BlockPos cornerFromSize(Vec3i dimensions, Vec3 center) { - Vec3 offset = new Vec3( - Math.floor(dimensions.getX() / 2f), - Math.floor(dimensions.getY() / 2f), - Math.floor(dimensions.getZ() / 2f) - ); - - return new BlockPos(center.subtract(offset)); - } - - public static void fillWithTemplate(ServerLevel level, ResourceLocation template, Vec3i dimensions, Vec3 center) { - level.getStructureManager().get(template).ifPresent(tem -> { - BlockPos placeAt = cornerFromSize(dimensions, center); - tem.placeInWorld(level, placeAt, placeAt, new StructurePlaceSettings(), level.random, Block.UPDATE_ALL); - }); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java deleted file mode 100644 index 70b1e229..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/DimensionUtil.java +++ /dev/null @@ -1,160 +0,0 @@ -package dev.compactmods.machines.util; - -import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.LoggingUtil; -import net.minecraft.SharedConstants; -import net.minecraft.core.Registry; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.RegistryOps; -import net.minecraft.resources.RegistryResourceAccess; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.util.datafix.DataFixers; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.storage.DimensionDataStorage; -import net.minecraft.world.level.storage.LevelResource; -import net.minecraft.world.level.storage.LevelStorageSource; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -public class DimensionUtil { - - private static final Logger LOG = LoggingUtil.modLog(); - - @SuppressWarnings("deprecation") // because we call the forge internal method server#markWorldsDirty - public static void createAndRegisterWorldAndDimension(final MinecraftServer server) { - // get everything we need to create the dimension and the dimension - final ServerLevel overworld = server.getLevel(Level.OVERWORLD); - - // dimension keys have a 1:1 relationship with dimension keys, they have the same IDs as well - final ResourceKey dimensionKey = ResourceKey.create(Registry.LEVEL_STEM_REGISTRY, CompactDimension.LEVEL_KEY.location()); - - final var serverResources = server.getResourceManager(); - - // only back up dimension.dat in production - if (!doLevelFileBackup(server)) return; - - var reg = server.registryAccess(); - var cmDimType = reg.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY) - .get(CompactDimension.DIM_TYPE_KEY); - - var ops = RegistryOps.create(JsonOps.INSTANCE, reg); - - var resourceAccess = RegistryResourceAccess.forResourceManager(serverResources); - var dims = resourceAccess.listResources(Registry.DIMENSION_REGISTRY); - - // TODO - Revisit -// resourceAccess.getResource(Registration.COMPACT_DIMENSION).ifPresent(lev -> { -// var parsed = lev.parseElement(JsonOps.INSTANCE, LevelStem.CODEC); -// -// var stem = parsed.result().orElseThrow().value(); -// -// // the int in create() here is radius of chunks to watch, 11 is what the server uses when it initializes worlds -// final ChunkProgressListener chunkProgressListener = server.progressListenerFactory.create(11); -// final Executor executor = server.executor; -// final LevelStorageSource.LevelStorageAccess anvilConverter = server.storageSource; -// final WorldData worldData = server.getWorldData(); -// final WorldGenSettings worldGenSettings = worldData.worldGenSettings(); -// final DerivedLevelData derivedLevelData = new DerivedLevelData(worldData, worldData.overworldData()); -// -// // now we have everything we need to create the dimension and the dimension -// // this is the same order server init creates levels: -// // the dimensions are already registered when levels are created, we'll do that first -// // then instantiate dimension, add border listener, add to map, fire world load event -// -// // register the actual dimension -// if (worldGenSettings.dimensions() instanceof MappedRegistry stems) { -// stems.unfreeze(); -// Registry.register(stems, dimensionKey, stem); -// stems.freeze(); -// } else { -// CompactMachines.LOGGER.fatal("Failed to re-register compact machines dimension; registry was not the expected class type."); -// return; -// } -// -// // create the world instance -// final ServerLevel newWorld = new ServerLevel( -// server, -// executor, -// anvilConverter, -// derivedLevelData, -// Registration.COMPACT_DIMENSION, -// Holder.direct(cmDimType), -// chunkProgressListener, -// stem.generator(), -// worldGenSettings.isDebug(), -// net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldGenSettings.seed()), -// ImmutableList.of(), // "special spawn list" -// false // "tick time", true for overworld, always false for nether, end, and json dimensions -// ); -// -// /* -// add world border listener, for parity with json dimensions -// the vanilla behaviour is that world borders exist in every dimension simultaneously with the same size and position -// these border listeners are automatically added to the overworld as worlds are loaded, so we should do that here too -// TODO if world-specific world borders are ever added, change it here too -// */ -// overworld.getWorldBorder().addListener(new BorderChangeListener.DelegateBorderChangeListener(newWorld.getWorldBorder())); -// -// // register dimension -// map.put(Registration.COMPACT_DIMENSION, newWorld); -// -// // update forge's world cache so the new dimension can be ticked -// server.markWorldsDirty(); -// -// // fire world load event -// MinecraftForge.EVENT_BUS.post(new LevelEvent.Load(newWorld)); -// }); - } - - public static boolean doLevelFileBackup(MinecraftServer server) { - var levelRoot = server.getWorldPath(LevelResource.ROOT); - var levelFile = server.getWorldPath(LevelResource.LEVEL_DATA_FILE); - - var formatter = DateTimeFormatter.ofPattern("'cm4-dimension-'yyyyMMdd-HHmmss'.dat'"); - var timestamp = formatter.format(ZonedDateTime.now()); - try { - Files.copy(levelFile, levelRoot.resolve(timestamp)); - } catch (IOException e) { - LOG.error("Failed to backup dimension.dat file before modification; canceling register dim attempt."); - return false; - } - - return true; - } - - @NotNull - public static Path getDataFolder(@NotNull Path rootDir, ResourceKey key) { - final var dimPath = DimensionType.getStorageFolder(key, rootDir); - return dimPath.resolve("data"); - } - - @NotNull - public static Path getDataFolder(@NotNull LevelStorageSource.LevelDirectory levelDir, ResourceKey key) { - final var dimPath = DimensionType.getStorageFolder(key, levelDir.path()); - return dimPath.resolve("data"); - } - - @NotNull - public static DimensionDataStorage getDataStorage(@NotNull LevelStorageSource.LevelDirectory levelDir, ResourceKey key) { - final var folder = getDataFolder(levelDir, key).toFile(); - final var fixer = DataFixers.getDataFixer(); - return new DimensionDataStorage(folder, fixer); - } - - public static CompoundTag readSavedFile(@NotNull DimensionDataStorage storage, String dataKey) throws IOException { - final var currVersion = SharedConstants.getCurrentVersion().getWorldVersion(); - final var nbt = storage.readTagFromDisk(dataKey, currVersion); - return nbt.getCompound("data"); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java deleted file mode 100644 index 2efa27fa..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/MathUtil.java +++ /dev/null @@ -1,77 +0,0 @@ -package dev.compactmods.machines.util; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.SectionPos; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.core.Vec3i; -import net.minecraft.world.phys.Vec3; - -public class MathUtil { - public static ChunkPos getChunkPos(Vec3 precise) { - final var x = SectionPos.blockToSectionCoord(precise.x); - final var z = SectionPos.blockToSectionCoord(precise.z); - return new ChunkPos(x, z); - } - - public static int volumeOf(Vec3i dimensions) { - return dimensions.getX() * dimensions.getY() * dimensions.getZ(); - } - - /** - * - * @param i - * @return - */ - public static Vec3i getRegionPositionByIndex(int i) { - // From SO, https://stackoverflow.com/a/41141648 - int index = i + 1; - // wth - int s = (int) Math.ceil(Math.sqrt(index)) + (int) ((Math.ceil(Math.sqrt(index)) % 2 + 1) % 2); - int ringIndex = 0; - int p = 1; - if (s > 1) { - ringIndex = i - (s - 2) * (s - 2); - p = s * s - (s - 2) * (s - 2); - } - - int ri = (ringIndex + (s / 2)) % p; - - int x = 0; - if (s > 1) { - if (ri < (p / 4)) x = ri; - else { - if (ri <= (p / 4 * 2 - 1)) x = p / 4; - else { - if (ri <= (p / 4 * 3)) x = (p / 4 * 3) - ri; - else x = 0; - } - } - } - - int y = 0; - if (s > 1) - y = ri < (p / 4) ? 0 : - (ri <= (p / 4 * 2 - 1) ? (ri - (p / 4)) : - (ri <= (p / 4 * 3) ? (p / 4) : - (p - ri))); - - x -= s / 2; - y -= s / 2; - - return new Vec3i(x, 0, y); - } - - public static BlockPos getCenterWithY(ChunkPos chunk, int y) { - return chunk.getWorldPosition() - .offset(new BlockPos(8, y, 8)); - } - - public static BlockPos getCenterWithY(Vec3i regionIndex, int y) { - ChunkPos chunk = new ChunkPos( - regionIndex.getX() * 64, - regionIndex.getZ() * 64); - - return getCenterWithY(chunk, y); - } - -} diff --git a/common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java deleted file mode 100644 index c2a9172f..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/NbtUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.compactmods.machines.util; - -import dev.compactmods.machines.ICompactMachinesMod; -import dev.compactmods.machines.codec.CodecExtensions; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; -import net.minecraft.world.level.ChunkPos; - -public class NbtUtil { - - public static ChunkPos readChunkPos(Tag tag) { - return CodecExtensions.CHUNKPOS.parse(NbtOps.INSTANCE, tag) - .getOrThrow(false, ICompactMachinesMod.LOGGER::fatal); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java b/common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java deleted file mode 100644 index d7fb1dee..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/PlayerUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.compactmods.machines.util; - -import com.mojang.authlib.GameProfile; -import dev.compactmods.machines.advancement.AdvancementTriggers; -import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.i18n.TranslationUtil; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec2; -import org.jetbrains.annotations.NotNull; - -import java.util.Optional; -import java.util.UUID; - -public abstract class PlayerUtil { - - public static Optional getProfileByUUID(MinecraftServer server, UUID uuid) { - final var player = server.getPlayerList().getPlayer(uuid); - if (player == null) { - var profile = new GameProfile(uuid, "Unknown"); - var p2 = server.getSessionService().fillProfileProperties(profile, false); - return Optional.ofNullable(p2); - } - - GameProfile profile = player.getGameProfile(); - return Optional.of(profile); - } - - public static Optional getProfileByUUID(LevelAccessor world, UUID uuid) { - final var player = world.getPlayerByUUID(uuid); - if (player == null) - return Optional.empty(); - - GameProfile profile = player.getGameProfile(); - return Optional.of(profile); - } - - public static void howDidYouGetThere(@NotNull ServerPlayer serverPlayer) { - AdvancementTriggers.HOW_DID_YOU_GET_HERE.trigger(serverPlayer); - - serverPlayer.displayClientMessage( - TranslationUtil.message(Messages.HOW_DID_YOU_GET_HERE), - true - ); - } - - public static Vec2 getLookDirection(Player player) { - return new Vec2(player.xRotO, player.yRotO); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java b/common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java deleted file mode 100644 index 0d5d0852..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/util/SavedDataHelper.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.compactmods.machines.util; - -import net.minecraft.SharedConstants; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.saveddata.SavedData; -import net.minecraft.world.level.storage.DimensionDataStorage; - -import java.io.IOException; -import java.util.function.Consumer; - -public class SavedDataHelper { - - public static void processFile(DimensionDataStorage storage, String dataName, Consumer parser) throws IOException { - CompoundTag compoundtag = storage.readTagFromDisk(dataName, SharedConstants.getCurrentVersion().getWorldVersion()); - parser.accept(compoundtag.getCompound("data")); - } - - public static void saveFile(DimensionDataStorage storage, String dataName, T instance) { - storage.set(dataName, instance); - storage.save(); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java b/common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java deleted file mode 100644 index 0ca47201..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/wall/BreakableWallBlock.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.wall; - -import net.minecraft.world.level.block.Block; - -public class BreakableWallBlock extends Block { - public BreakableWallBlock(Properties props) { - super(props); - } -} diff --git a/common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java b/common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java deleted file mode 100644 index f967ba87..00000000 --- a/common-main/src/main/java/dev/compactmods/machines/wall/ItemBlockWall.java +++ /dev/null @@ -1,44 +0,0 @@ -package dev.compactmods.machines.wall; - -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Tooltips; -import dev.compactmods.machines.i18n.TranslationUtil; -import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -public class ItemBlockWall extends BlockItem { - - public ItemBlockWall(Block blockIn, Properties builder) { - super(blockIn, builder); - } - - @Override - public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - super.appendHoverText(stack, worldIn, tooltip, flagIn); - - if (stack.is(CMTags.SOLID_WALL_ITEMS)) { - MutableComponent text; - if (Screen.hasShiftDown()) { - text = TranslationUtil.tooltip(Tooltips.Details.SOLID_WALL) - .withStyle(ChatFormatting.DARK_RED); - } else { - text = TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) - .withStyle(ChatFormatting.DARK_GRAY) - .withStyle(ChatFormatting.ITALIC); - } - - tooltip.add(text); - } - - } -} diff --git a/forge-builtin/build.gradle.kts b/forge-builtin/build.gradle.kts new file mode 100644 index 00000000..99544b39 --- /dev/null +++ b/forge-builtin/build.gradle.kts @@ -0,0 +1,47 @@ +val coreVersion: String = property("core_version") as String +val tunnelsApiVersion: String = property("tunnels_version") as String + +plugins { + id("net.minecraftforge.gradle") version("5.1.+") + id("org.parchmentmc.librarian.forgegradle") version("1.+") +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) + withSourcesJar() +} + +var minecraft_version: String by extra +var forge_version: String by extra +var parchment_version: String by extra + +project.evaluationDependsOn(project(":forge-tunnels-api").path) + +repositories { + maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + } + } +} + + +dependencies { + minecraft (group = "net.minecraftforge", name = "forge", version = "${minecraft_version}-${forge_version}") + + implementation(project(":forge-tunnels-api")) + + implementation("dev.compactmods.compactmachines", "core-api", coreVersion) { + isTransitive = false + } + + implementation("dev.compactmods.compactmachines", "tunnels-api", tunnelsApiVersion) { + isTransitive = false + } +} + +minecraft { + mappings("parchment", "${parchment_version}-${minecraft_version}") + accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) +} \ No newline at end of file diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/CMBuiltInAddon.java similarity index 84% rename from forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/CMBuiltInAddon.java index f39e561b..79ccc235 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/CMBuiltInAddon.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/CMBuiltInAddon.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forgebuiltin; import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; import dev.compactmods.machines.api.inject.InjectField; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.tunnel.BuiltInTunnels; -import dev.compactmods.machines.upgrade.BuiltInUpgrades; +import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; +import dev.compactmods.machines.forgebuiltin.upgrade.BuiltInUpgrades; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import java.util.function.Supplier; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java similarity index 71% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java index 53c9f1b7..e3e0815e 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/BuiltInTunnels.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java @@ -1,18 +1,17 @@ -package dev.compactmods.machines.tunnel; +package dev.compactmods.machines.forgebuiltin.tunnel; -import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.definitions.BufferedItemTunnel; -import dev.compactmods.machines.tunnel.definitions.FluidTunnel; -import dev.compactmods.machines.tunnel.definitions.ForgeEnergyTunnel; -import dev.compactmods.machines.tunnel.definitions.redstone.RedstoneInTunnelDefinition; +import dev.compactmods.machines.forgebuiltin.tunnel.definitions.BufferedItemTunnel; +import dev.compactmods.machines.forgebuiltin.tunnel.definitions.FluidTunnel; +import dev.compactmods.machines.forgebuiltin.tunnel.definitions.ForgeEnergyTunnel; +import dev.compactmods.machines.forgebuiltin.tunnel.definitions.redstone.RedstoneInTunnelDefinition; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; public class BuiltInTunnels { - public static DeferredRegister REGISTRATION = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, Constants.MOD_ID); + public static DeferredRegister REGISTRATION = DeferredRegister.create(TunnelDefinition.REGISTRY_KEY, Constants.MOD_ID); // ================================================================================================================ // TUNNEL TYPE DEFINITIONS diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java similarity index 98% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java index 941755f6..2fd8475d 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/BufferedItemTunnel.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.tunnel.definitions; +package dev.compactmods.machines.forgebuiltin.tunnel.definitions; import com.google.common.collect.ImmutableSet; import dev.compactmods.machines.api.dimension.CompactDimension; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/FluidTunnel.java similarity index 97% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/FluidTunnel.java index 05cfb0e2..0acd12c7 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/FluidTunnel.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/FluidTunnel.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.tunnel.definitions; +package dev.compactmods.machines.forgebuiltin.tunnel.definitions; import com.google.common.collect.ImmutableSet; import dev.compactmods.machines.api.tunnels.TunnelDefinition; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/ForgeEnergyTunnel.java similarity index 97% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/ForgeEnergyTunnel.java index ace1ef37..c9adb85e 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/ForgeEnergyTunnel.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/ForgeEnergyTunnel.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.tunnel.definitions; +package dev.compactmods.machines.forgebuiltin.tunnel.definitions; import com.google.common.collect.ImmutableSet; import dev.compactmods.machines.api.tunnels.TunnelDefinition; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java similarity index 67% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java index 28d4d905..6315e548 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/SmartItemTunnel.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.tunnel.definitions; +package dev.compactmods.machines.forgebuiltin.tunnel.definitions; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.capability.CapabilityLookupTunnel; +import net.minecraft.core.GlobalPos; import net.minecraft.server.MinecraftServer; import net.minecraft.util.FastColor; import net.minecraftforge.common.capabilities.Capability; @@ -25,15 +25,14 @@ public ImmutableSet> getSupportedCapabilities() { public > LazyOptional findCapability( MinecraftServer server, TunnelPosition tunnelPosition, - IDimensionalBlockPosition targetPosition) { - final var lev = targetPosition.level(server); - if(!lev.isLoaded(targetPosition.getBlockPosition())) { + GlobalPos targetPosition) { + final var lev = server.getLevel(targetPosition.dimension()); + if(!lev.isLoaded(targetPosition.pos())) { return LazyOptional.empty(); } - return targetPosition.getBlockEntity(server) - .map(be -> be.getCapability(ForgeCapabilities.ITEM_HANDLER, tunnelPosition.machineSide().getOpposite())) - .orElse(LazyOptional.empty()) + return lev.getBlockEntity(targetPosition.pos()) + .getCapability(ForgeCapabilities.ITEM_HANDLER, tunnelPosition.machineSide().getOpposite()) .cast(); } diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java similarity index 60% rename from forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java index a9f677b0..8c9f2a57 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/redstone/RedstoneInTunnelDefinition.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.tunnel.definitions.redstone; +package dev.compactmods.machines.forgebuiltin.tunnel.definitions.redstone; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; +import net.minecraft.core.GlobalPos; import net.minecraft.server.MinecraftServer; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; @@ -24,11 +24,12 @@ public int indicatorColor() { } @Override - public int powerLevel(MinecraftServer server, IDimensionalBlockPosition machine, TunnelPosition tunnel) { - LevelReader connectedWorld = machine.level(server); + public int powerLevel(MinecraftServer server, GlobalPos machine, TunnelPosition tunnel) { + LevelReader connectedWorld = server.getLevel(machine.dimension()); if (connectedWorld != null) { - BlockState state = machine.state(server); - return state.getSignal(connectedWorld, machine.getBlockPosition(), tunnel.machineSide()); + final var relPos = machine.pos().relative(tunnel.machineSide()).immutable(); + BlockState state = connectedWorld.getBlockState(relPos); + return state.getSignal(connectedWorld, relPos, tunnel.machineSide()); } return 0; diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/BuiltInUpgrades.java similarity index 79% rename from forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/BuiltInUpgrades.java index 08eeee5a..43efafd8 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/BuiltInUpgrades.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/BuiltInUpgrades.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.forgebuiltin.upgrade; import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; @@ -9,7 +9,7 @@ public class BuiltInUpgrades { public static DeferredRegister REGISTRATION = - DeferredRegister.create(CMRegistryKeys.UPGRADES, Constants.MOD_ID); + DeferredRegister.create(CMRegistryKeys.ROOM_UPGRADES, Constants.MOD_ID); public static final RegistryObject CHUNKLOAD = REGISTRATION.register("chunkload", ChunkloadAction::new); diff --git a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/ChunkloadAction.java similarity index 97% rename from forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java rename to forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/ChunkloadAction.java index e5e96748..592695f7 100644 --- a/forge-tunnels/src/main/java/dev/compactmods/machines/upgrade/ChunkloadAction.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/upgrade/ChunkloadAction.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.forgebuiltin.upgrade; import com.mojang.serialization.Codec; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json b/forge-builtin/src/main/resources/compactmachines/upgrades/chunkloader.json similarity index 100% rename from forge-tunnels/src/main/resources/compactmachines/upgrades/chunkloader.json rename to forge-builtin/src/main/resources/compactmachines/upgrades/chunkloader.json diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 1cea409b..16a131c3 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -7,6 +7,9 @@ val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" val nightlyVersion: String = "${semver}.${buildNumber}-nightly" val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) +val coreVersion: String = property("core_version") as String +val tunnelsApiVersion: String = property("tunnels_version") as String + var mod_id: String by extra var minecraft_version: String by extra var forge_version: String by extra @@ -45,29 +48,40 @@ repositories { mavenLocal() mavenCentral() { + name = "Central" content { includeGroup("com.aventrix.jnanoid") } } maven("https://www.cursemaven.com") { + name = "Curse Maven" content { includeGroup("curse.maven") } } // location of the maven that hosts JEI files - maven("https://dvs1.progwml6.com/files/maven") { + maven("https://maven.blamejared.com") { content { includeGroup("mezz.jei") } } maven("https://maven.theillusivec4.top/") { + name = "Illusive" content { includeGroup("top.theillusivec4.curios") } } + + maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { + name = "Github PKG Core" + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + } + } } val jei_version: String? by extra @@ -76,10 +90,8 @@ val curios_version: String? by extra jarJar.enable() val runDepends: List = listOf( - project(":common-api"), - project(":common-main"), - project(":forge-api"), - project(":forge-tunnels") + project(":forge-tunnels-api"), + project(":forge-builtin") ) runDepends.forEach { @@ -89,17 +101,19 @@ runDepends.forEach { dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - implementation(fg.deobf(project(":common-api"))) - testImplementation(fg.deobf(project(":common-api"))) + minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:core-api:$coreVersion")) + minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:core:$coreVersion")) + minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion")) - implementation(project(":forge-api")) - testImplementation(project(":forge-api")) + jarJar("dev.compactmods.compactmachines", "core-api", coreVersion) + jarJar("dev.compactmods.compactmachines", "core", coreVersion) + jarJar("dev.compactmods.compactmachines", "tunnels-api", tunnelsApiVersion) - implementation(fg.deobf(project(":common-main"))) - testImplementation(fg.deobf(project(":common-main"))) + implementation(project(":forge-tunnels-api")) + testImplementation(project(":forge-tunnels-api")) - implementation(project(":forge-tunnels")) - testImplementation(project(":forge-tunnels")) + implementation(project(":forge-builtin")) + testImplementation(project(":forge-builtin")) minecraftLibrary("com.aventrix.jnanoid", "jnanoid", "2.0.0") jarJar("com.aventrix.jnanoid", "jnanoid", "[2.0.0]") @@ -247,12 +261,12 @@ tasks.withType { this.exclude("dev/compactmods/machines/datagen/**") this.exclude(".cache/**") - // TODO - Switch to API jar when JarInJar supports it better - val api = project(":forge-api").tasks.jar.get().archiveFile; - from(api.map { zipTree(it) }) - - val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; - from(tunnels.map { zipTree(it) }) +// // TODO - Switch to API jar when JarInJar supports it better +// val api = project(":forge-api").tasks.jar.get().archiveFile; +// from(api.map { zipTree(it) }) +// +// val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; +// from(tunnels.map { zipTree(it) }) manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java b/forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java deleted file mode 100644 index bce5b7a0..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/command/ForgeCommands.java +++ /dev/null @@ -1,46 +0,0 @@ -package dev.compactmods.machines.command; - -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.command.data.CMDataSubcommand; -import dev.compactmods.machines.command.subcommand.CMEjectSubcommand; -import dev.compactmods.machines.command.subcommand.CMGiveMachineSubcommand; -import dev.compactmods.machines.command.subcommand.CMReaddDimensionSubcommand; -import dev.compactmods.machines.command.subcommand.CMRebindSubcommand; -import dev.compactmods.machines.command.subcommand.CMRoomUpgradeCommand; -import dev.compactmods.machines.command.subcommand.CMRoomsSubcommand; -import dev.compactmods.machines.command.subcommand.CMSummarySubcommand; -import dev.compactmods.machines.command.subcommand.CMUnbindSubcommand; -import dev.compactmods.machines.command.subcommand.SpawnSubcommand; -import dev.compactmods.machines.Registries; -import net.minecraft.commands.synchronization.ArgumentTypeInfos; -import net.minecraft.commands.synchronization.SingletonArgumentInfo; -import net.minecraftforge.event.RegisterCommandsEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -import static dev.compactmods.machines.command.Commands.CM_COMMAND_ROOT; - -@Mod.EventBusSubscriber(modid = Constants.MOD_ID) -public class ForgeCommands { - - static { - Registries.COMMAND_ARGUMENT_TYPES.register("room_upgrade", - () -> ArgumentTypeInfos.registerByClass(RoomUpgradeArgument.class, SingletonArgumentInfo.contextFree(RoomUpgradeArgument::upgrade))); - - CM_COMMAND_ROOT.then(CMEjectSubcommand.make()); - CM_COMMAND_ROOT.then(CMSummarySubcommand.make()); - CM_COMMAND_ROOT.then(CMRebindSubcommand.make()); - CM_COMMAND_ROOT.then(CMUnbindSubcommand.make()); - CM_COMMAND_ROOT.then(CMReaddDimensionSubcommand.make()); - CM_COMMAND_ROOT.then(CMRoomsSubcommand.make()); - CM_COMMAND_ROOT.then(CMDataSubcommand.make()); - CM_COMMAND_ROOT.then(CMGiveMachineSubcommand.make()); - CM_COMMAND_ROOT.then(SpawnSubcommand.make()); - CM_COMMAND_ROOT.then(CMRoomUpgradeCommand.make()); - } - - @SubscribeEvent - public static void onCommandsRegister(final RegisterCommandsEvent event) { - event.getDispatcher().register(Commands.getRoot()); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java b/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java deleted file mode 100644 index 35d3930a..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/VillagerTrades.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.data.generated; - -public class VillagerTrades { -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java similarity index 84% rename from forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index 3a1d0704..c49212d7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -1,24 +1,25 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; +import dev.compactmods.machines.ICompactMachinesMod; import dev.compactmods.machines.api.CompactMachinesAddon; import dev.compactmods.machines.api.ICompactMachinesAddon; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; -import dev.compactmods.machines.config.CommonConfig; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.data.generated.functions.LootFunctions; -import dev.compactmods.machines.dimension.Dimension; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.room.Rooms; -import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; -import dev.compactmods.machines.util.AnnotationScanner; -import dev.compactmods.machines.villager.Villagers; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.config.CommonConfig; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.data.generated.functions.LootFunctions; +import dev.compactmods.machines.forge.dimension.Dimension; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.room.Rooms; +import dev.compactmods.machines.forge.room.ui.RoomUserInterfaceRegistration; +import dev.compactmods.machines.forge.shrinking.Shrinking; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.util.AnnotationScanner; +import dev.compactmods.machines.forge.villager.Villagers; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java b/forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java index 6ab32782..ac4dd9e0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/GraphCommon.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; import dev.compactmods.machines.graph.DimensionGraphNode; import dev.compactmods.machines.graph.SimpleGraphNodeType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java b/forge-main/src/main/java/dev/compactmods/machines/forge/ModBusEvents.java similarity index 78% rename from forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/ModBusEvents.java index 55570d79..6e9f820c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ModBusEvents.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/ModBusEvents.java @@ -1,9 +1,10 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.network.CompactMachinesNet; -import dev.compactmods.machines.network.RoomNetworkHandler; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.RoomNetworkHandler; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java b/forge-main/src/main/java/dev/compactmods/machines/forge/ModDataUpgrader.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/ModDataUpgrader.java index 5a67ecdf..d60a6bb2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ModDataUpgrader.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/ModDataUpgrader.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; -import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; +import dev.compactmods.machines.forge.data.migration.EarlyLevelDataFileReader; +import dev.compactmods.machines.forge.data.migration.Pre520RoomDataMigrator; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraftforge.event.ModMismatchEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/Registries.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java index 9a2a55da..5c5e3ff3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; @@ -37,13 +37,13 @@ public class Registries { public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID); // Tunnels - public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(CMRegistryKeys.TYPES_REG_KEY, MOD_ID); + public static final DeferredRegister TUNNEL_DEFINITIONS = DeferredRegister.create(TunnelDefinition.REGISTRY_KEY, MOD_ID); // UIRegistration public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MOD_ID); // MachineRoomUpgrades - public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistryKeys.UPGRADES, MOD_ID); + public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistryKeys.ROOM_UPGRADES, MOD_ID); // Graph @ApiStatus.Internal diff --git a/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/ServerEventHandler.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/ServerEventHandler.java index 7190c1c0..f84f439b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/ServerEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/ServerEventHandler.java @@ -1,15 +1,16 @@ -package dev.compactmods.machines; +package dev.compactmods.machines.forge; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.inject.InjectField; import dev.compactmods.machines.api.room.IRoomOwnerLookup; import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; import dev.compactmods.machines.api.upgrade.ILevelLoadedUpgradeListener; -import dev.compactmods.machines.room.ForgeCompactRoomProvider; +import dev.compactmods.machines.forge.room.ForgeCompactRoomProvider; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; -import dev.compactmods.machines.util.AnnotationScanner; +import dev.compactmods.machines.forge.room.upgrade.RoomUpgradeManager; +import dev.compactmods.machines.forge.util.AnnotationScanner; import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket; import net.minecraft.network.protocol.game.ClientboundSetBorderSizePacket; import net.minecraft.server.level.ServerLevel; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/CM4Shaders.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/CM4Shaders.java index 12195f67..50511ceb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/CM4Shaders.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/CM4Shaders.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.client; +package dev.compactmods.machines.forge.client; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import net.minecraft.client.renderer.ShaderInstance; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java similarity index 79% rename from forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java index 14c2a50e..ea4e8dea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java @@ -1,13 +1,13 @@ -package dev.compactmods.machines.client; +package dev.compactmods.machines.forge.client; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.compat.curios.CuriosCompat; +import dev.compactmods.machines.forge.compat.curios.CuriosCompat; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.machine.client.MachineColors; -import dev.compactmods.machines.room.ui.RoomUserInterfaceRegistration; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.room.ui.MachineRoomScreen; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.tunnel.client.TunnelColors; +import dev.compactmods.machines.forge.room.ui.MachineRoomScreen; +import dev.compactmods.machines.forge.room.ui.RoomUserInterfaceRegistration; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.client.TunnelColors; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/RenderingLevel.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/level/RenderingLevel.java index 3471bc15..9732d097 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/RenderingLevel.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/RenderingLevel.java @@ -1,5 +1,7 @@ -package dev.compactmods.machines.client.level; +package dev.compactmods.machines.forge.client.level; +import dev.compactmods.machines.client.level.EmptyLevelEntityGetter; +import dev.compactmods.machines.client.level.FakeSpawnInfo; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunk.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunk.java index 57aa4980..57b94fa1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunk.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunk.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.client.level; +package dev.compactmods.machines.forge.client.level; import net.minecraft.core.BlockPos; import net.minecraft.world.level.ChunkPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunkProvider.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunkProvider.java index 17fa028a..71516ecc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/level/TemplateChunkProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/level/TemplateChunkProvider.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.client.level; +package dev.compactmods.machines.forge.client.level; import com.mojang.datafixers.util.Pair; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/render/RenderTypes.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/render/RenderTypes.java index 2f4ce687..0c96b041 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/client/render/RenderTypes.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/render/RenderTypes.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.client.render; +package dev.compactmods.machines.forge.client.render; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormatElement; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.CM4Shaders; +import dev.compactmods.machines.forge.client.CM4Shaders; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java new file mode 100644 index 00000000..326564d1 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java @@ -0,0 +1,47 @@ +package dev.compactmods.machines.forge.command; + +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.command.data.CMDataSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMEjectSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMGiveMachineSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMReaddDimensionSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMRebindSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMRoomUpgradeCommand; +import dev.compactmods.machines.forge.command.subcommand.CMRoomsSubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMSummarySubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMUnbindSubcommand; +import dev.compactmods.machines.forge.command.subcommand.SpawnSubcommand; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.command.Commands; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; +import net.minecraft.commands.synchronization.SingletonArgumentInfo; +import net.minecraftforge.event.RegisterCommandsEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID) +public class ForgeCommands { + + static { + Registries.COMMAND_ARGUMENT_TYPES.register("room_upgrade", + () -> ArgumentTypeInfos.registerByClass(RoomUpgradeArgument.class, SingletonArgumentInfo.contextFree(RoomUpgradeArgument::upgrade))); + + var cm = Commands.getRoot(); + + cm.then(CMEjectSubcommand.make()); + cm.then(CMSummarySubcommand.make()); + cm.then(CMRebindSubcommand.make()); + cm.then(CMUnbindSubcommand.make()); + cm.then(CMReaddDimensionSubcommand.make()); + cm.then(CMRoomsSubcommand.make()); + cm.then(CMDataSubcommand.make()); + cm.then(CMGiveMachineSubcommand.make()); + cm.then(SpawnSubcommand.make()); + cm.then(CMRoomUpgradeCommand.make()); + } + + @SubscribeEvent + public static void onCommandsRegister(final RegisterCommandsEvent event) { + event.getDispatcher().register(Commands.getRoot()); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java index 834ec04e..bd02ca98 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java @@ -1,14 +1,14 @@ -package dev.compactmods.machines.command; +package dev.compactmods.machines.forge.command; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; import com.mojang.brigadier.suggestion.SuggestionProvider; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.ResourceKeyArgument; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java index 2aaef861..406eaa16 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMDataSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.command.data; +package dev.compactmods.machines.forge.command.data; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java index 5d780c42..1b287f55 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMMachineDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java @@ -1,15 +1,15 @@ -package dev.compactmods.machines.command.data; +package dev.compactmods.machines.forge.command.data; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.core.GlobalPos; import net.minecraft.util.CsvOutput; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -47,7 +47,7 @@ private static int execAll(CommandContext ctx) { final var graph = DimensionMachineGraph.forDimension(dim); graph.getMachines().forEach(machNode -> { final var m = machNode.dimpos(); - final var r = graph.getConnectedRoom(m.getBlockPosition()); + final var r = graph.getConnectedRoom(m.pos()); r.ifPresent(room -> writeMachine(m, room, builder)); }); } @@ -73,9 +73,9 @@ private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { .build(writer); } - private static void writeMachine(IDimensionalBlockPosition machine, String room, CsvOutput builder) { + private static void writeMachine(GlobalPos machine, String room, CsvOutput builder) { try { - var placedAt = machine.getBlockPosition(); + var placedAt = machine.pos(); builder.writeRow( machine.dimension().location().toString(), diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java index fcae0e8f..9ba5e338 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMRoomDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.command.data; +package dev.compactmods.machines.forge.command.data; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java index 57a24468..bfb2be7f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java @@ -1,9 +1,10 @@ -package dev.compactmods.machines.command.data; +package dev.compactmods.machines.forge.command.data; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; @@ -11,7 +12,6 @@ import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.server.level.ServerLevel; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMEjectSubcommand.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMEjectSubcommand.java index 428529a2..d34766eb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMEjectSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMEjectSubcommand.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import java.util.Collection; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.util.ForgePlayerUtil; +import dev.compactmods.machines.forge.room.capability.RoomCapabilities; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.util.ForgePlayerUtil; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java index 7101c778..bf1ffa39 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java @@ -1,15 +1,15 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMReaddDimensionSubcommand.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMReaddDimensionSubcommand.java index 2e41b7c2..2579dba4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMReaddDimensionSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMReaddDimensionSubcommand.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java index b2eeecb1..40aa7029 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java @@ -1,18 +1,18 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java index 93baf6e6..3d7bd714 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java @@ -1,18 +1,18 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.room.upgrade.RoomUpgradeManager; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.upgrade.IUpgradeAppliedListener; import dev.compactmods.machines.api.upgrade.IUpgradeRemovedListener; -import dev.compactmods.machines.command.RoomUpgradeArgument; -import dev.compactmods.machines.config.ServerConfig; +import dev.compactmods.machines.forge.command.RoomUpgradeArgument; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.upgrade.RoomUpgradeManager; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java index c39a42d1..56f31553 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMRoomsSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java @@ -1,14 +1,14 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.machine.MachineTags; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java index 8b7baddf..30f90649 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMSummarySubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java index 7206cf51..ae4b2dc0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java @@ -1,15 +1,15 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; diff --git a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/SpawnSubcommand.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/SpawnSubcommand.java index f6be02f3..c2ffc53d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/command/subcommand/SpawnSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/SpawnSubcommand.java @@ -1,13 +1,13 @@ -package dev.compactmods.machines.command.subcommand; +package dev.compactmods.machines.forge.command.subcommand; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; +import dev.compactmods.machines.forge.config.ServerConfig; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/InterModCompat.java similarity index 74% rename from forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/InterModCompat.java index 1881fc08..6595725b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/InterModCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/InterModCompat.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.compat; +package dev.compactmods.machines.forge.compat; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.compat.carryon.CarryOnCompat; -import dev.compactmods.machines.compat.curios.CuriosCompat; -import dev.compactmods.machines.compat.theoneprobe.TheOneProbeCompat; +import dev.compactmods.machines.forge.compat.carryon.CarryOnCompat; +import dev.compactmods.machines.forge.compat.curios.CuriosCompat; +import dev.compactmods.machines.forge.compat.theoneprobe.TheOneProbeCompat; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/carryon/CarryOnCompat.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/carryon/CarryOnCompat.java index a4bbdacf..b0965937 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/carryon/CarryOnCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/carryon/CarryOnCompat.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.compat.carryon; +package dev.compactmods.machines.forge.compat.carryon; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.machine.Machines; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.registries.ForgeRegistries; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java index d4d1dbe3..f74a1d3c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/curios/CuriosCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.compat.curios; +package dev.compactmods.machines.forge.compat.curios; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java index 6f1af433..276fcda4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/jei/CompactMachinesJeiPlugin.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java @@ -1,13 +1,13 @@ -package dev.compactmods.machines.compat.jei; +package dev.compactmods.machines.forge.compat.jei; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.JeiInfo; import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.forge.shrinking.Shrinking; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.VanillaTypes; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeCompat.java similarity index 77% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeCompat.java index 841c3ed7..327747c3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeCompat.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.compat.theoneprobe; +package dev.compactmods.machines.forge.compat.theoneprobe; import net.minecraftforge.fml.InterModComms; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeMain.java similarity index 71% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeMain.java index 2b7507b2..0876b0f5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/TheOneProbeMain.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/TheOneProbeMain.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.compat.theoneprobe; +package dev.compactmods.machines.forge.compat.theoneprobe; -import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; -import dev.compactmods.machines.compat.theoneprobe.overrides.CompactMachineNameOverride; -import dev.compactmods.machines.compat.theoneprobe.providers.CompactMachineProvider; -import dev.compactmods.machines.compat.theoneprobe.providers.TunnelProvider; +import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; +import dev.compactmods.machines.forge.compat.theoneprobe.overrides.CompactMachineNameOverride; +import dev.compactmods.machines.forge.compat.theoneprobe.providers.CompactMachineProvider; +import dev.compactmods.machines.forge.compat.theoneprobe.providers.TunnelProvider; import mcjty.theoneprobe.api.IElement; import mcjty.theoneprobe.api.IElementFactory; import mcjty.theoneprobe.api.ITheOneProbe; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/MachineTunnelElement.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/MachineTunnelElement.java index 395e951c..8da5eed6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/MachineTunnelElement.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/MachineTunnelElement.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.compat.theoneprobe.elements; +package dev.compactmods.machines.forge.compat.theoneprobe.elements; import com.mojang.blaze3d.vertex.PoseStack; import mcjty.theoneprobe.api.IElement; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/PlayerFaceElement.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/PlayerFaceElement.java index 5602a27d..c62a2cdc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/elements/PlayerFaceElement.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/elements/PlayerFaceElement.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.compat.theoneprobe.elements; +package dev.compactmods.machines.forge.compat.theoneprobe.elements; import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java index 27c308be..df547d04 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.compat.theoneprobe.overrides; +package dev.compactmods.machines.forge.compat.theoneprobe.overrides; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import mcjty.theoneprobe.Tools; import mcjty.theoneprobe.api.CompoundText; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java index c64f843c..96aefd87 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java @@ -1,16 +1,16 @@ -package dev.compactmods.machines.compat.theoneprobe.providers; +package dev.compactmods.machines.forge.compat.theoneprobe.providers; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.tunnel.TunnelItem; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.compat.theoneprobe.elements.PlayerFaceElement; +import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.TunnelItem; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.util.PlayerUtil; import mcjty.theoneprobe.api.ElementAlignment; import mcjty.theoneprobe.api.IProbeHitData; diff --git a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java index e05442de..4abf5753 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/compat/theoneprobe/providers/TunnelProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.compat.theoneprobe.providers; +package dev.compactmods.machines.forge.compat.theoneprobe.providers; +import dev.compactmods.machines.forge.tunnel.TunnelWallBlock; +import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; +import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.TunnelWallBlock; -import dev.compactmods.machines.tunnel.TunnelWallEntity; -import dev.compactmods.machines.tunnel.Tunnels; import mcjty.theoneprobe.api.*; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; @@ -62,13 +62,13 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player playerEnti .text(Component.translatable(sideTranslated)); final var connectedMachinePos = tile.getConnectedPosition(); - final var connectedPos = connectedMachinePos.relative(tile.getConnectedSide()); + final var connectedPos = connectedMachinePos.pos().relative(tile.getConnectedSide()); ServerLevel connectedWorld = (ServerLevel) level; - BlockPos outPosBlock = connectedMachinePos.getBlockPosition(); + BlockPos outPosBlock = connectedMachinePos.pos(); try { - final var state = connectedPos.state(level.getServer()); + final var state = connectedWorld.getBlockState(connectedPos); // If connected block isn't air, show a connected block line if (!state.isAir()) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java b/forge-main/src/main/java/dev/compactmods/machines/forge/config/CommonConfig.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/config/CommonConfig.java index 630ed26e..4c3733c4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/CommonConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/config/CommonConfig.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.config; +package dev.compactmods.machines.forge.config; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java b/forge-main/src/main/java/dev/compactmods/machines/forge/config/ServerConfig.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/config/ServerConfig.java index ed0d4599..e2ffcb73 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/config/ServerConfig.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/config/ServerConfig.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.config; +package dev.compactmods.machines.forge.config; import com.electronwill.nightconfig.core.EnumGetMethod; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java index 4cd0895d..65b4bfa4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import com.google.common.collect.Sets; import com.google.gson.Gson; @@ -9,9 +9,9 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.shrinking.Shrinking; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.FrameType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java similarity index 85% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java index 2ed1db0d..22a7e7c0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/AdvancementLangBuilder.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; -import dev.compactmods.machines.data.generated.lang.BaseLangGenerator; +import dev.compactmods.machines.forge.data.generated.lang.BaseLangGenerator; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java index 594095cd..ddf8a623 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/BlockLootGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.data.generated.functions.CopyRoomBindingFunction; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.data.generated.functions.CopyRoomBindingFunction; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.loot.BlockLoot; import net.minecraft.data.loot.LootTableProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java index 1dd0f4e3..450080f5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGenUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java @@ -1,11 +1,11 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import com.google.common.collect.ImmutableSet; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java similarity index 76% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java index 5fa2c155..b516654d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DataGeneration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.data.generated.lang.EnglishLangGenerator; -import dev.compactmods.machines.data.generated.lang.RussianLangGenerator; -import dev.compactmods.machines.data.generated.room.RoomTemplates; -import dev.compactmods.machines.data.generated.tags.BlockTagGenerator; -import dev.compactmods.machines.data.generated.tags.ItemTagGenerator; -import dev.compactmods.machines.data.generated.tags.PointOfInterestTagGenerator; +import dev.compactmods.machines.forge.data.generated.lang.EnglishLangGenerator; +import dev.compactmods.machines.forge.data.generated.lang.RussianLangGenerator; +import dev.compactmods.machines.forge.data.generated.room.RoomTemplates; +import dev.compactmods.machines.forge.data.generated.tags.BlockTagGenerator; +import dev.compactmods.machines.forge.data.generated.tags.ItemTagGenerator; +import dev.compactmods.machines.forge.data.generated.tags.PointOfInterestTagGenerator; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java index 5236a156..8869f73f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/DimensionTypeBuilder.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java index 2a48f291..aa2e650c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/ItemModelGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.common.data.ExistingFileHelper; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java index 82a6d582..ac881e0b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/LevelBiomeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; @@ -7,10 +7,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mojang.serialization.JsonOps; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.dimension.Dimension; +import dev.compactmods.machines.forge.dimension.Dimension; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java index 8d67d053..1f916c0b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/RecipeGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import com.google.gson.JsonObject; import dev.compactmods.machines.api.core.Constants; @@ -6,11 +6,11 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; import dev.compactmods.machines.machine.LegacySizedTemplates; -import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.BuiltInTunnels; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.shrinking.Shrinking; +import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.RecipeProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java index 7c0fff0b..7d47375b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/StateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java @@ -1,11 +1,11 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.BlockModelProvider; import net.minecraftforge.client.model.generators.BlockStateProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java index 24864561..c8013a5b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/TunnelWallStateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.data.generated; +package dev.compactmods.machines.forge.data.generated; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.tunnel.TunnelWallBlock; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.TunnelWallBlock; +import dev.compactmods.machines.forge.tunnel.Tunnels; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java new file mode 100644 index 00000000..e79f3735 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.forge.data.generated; + +public class VillagerTrades { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java index 73211952..0aef5129 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java @@ -1,11 +1,11 @@ -package dev.compactmods.machines.data.generated.functions; +package dev.compactmods.machines.forge.data.generated.functions; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java similarity index 78% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java index b0550c22..ac2e0a01 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/functions/LootFunctions.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.data.generated.functions; +package dev.compactmods.machines.forge.data.generated.functions; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.Registries; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraftforge.registries.RegistryObject; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java index b3084d55..58159a9d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/BaseLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java @@ -1,15 +1,15 @@ -package dev.compactmods.machines.data.generated.lang; +package dev.compactmods.machines.forge.data.generated.lang; +import dev.compactmods.machines.forge.data.generated.AdvancementLangBuilder; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.Advancements; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.data.generated.AdvancementLangBuilder; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.Util; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java index 372dfbca..356e2495 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java @@ -1,17 +1,17 @@ -package dev.compactmods.machines.data.generated.lang; +package dev.compactmods.machines.forge.data.generated.lang; +import dev.compactmods.machines.forge.dimension.VoidAirBlock; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.dimension.VoidAirBlock; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.BuiltInTunnels; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.upgrade.BuiltInUpgrades; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.shrinking.Shrinking; +import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; +import dev.compactmods.machines.forgebuiltin.upgrade.BuiltInUpgrades; import net.minecraft.data.DataGenerator; import static org.apache.commons.lang3.StringUtils.capitalize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java index 3c2a67fa..09761aaa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/lang/RussianLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.data.generated.lang; +package dev.compactmods.machines.forge.data.generated.lang; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.shrinking.Shrinking; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java index 44a21543..0a9abbc8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/room/RoomTemplates.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.generated.room; +package dev.compactmods.machines.forge.data.generated.room; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java index 19bcd65e..a81b4657 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/BlockTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.data.generated.tags; +package dev.compactmods.machines.forge.data.generated.tags; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.tags.BlockTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java index 32df97c6..9c79f653 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/ItemTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.data.generated.tags; +package dev.compactmods.machines.forge.data.generated.tags; +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.Registries; -import dev.compactmods.machines.machine.Machines; -import dev.compactmods.machines.shrinking.Shrinking; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.shrinking.Shrinking; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java index 2b24308f..21950b62 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/generated/tags/PointOfInterestTagGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.data.generated.tags; +package dev.compactmods.machines.forge.data.generated.tags; +import dev.compactmods.machines.forge.villager.Villagers; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.villager.Villagers; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.PoiTypeTagsProvider; import net.minecraft.tags.PoiTypeTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/EarlyLevelDataFileReader.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/EarlyLevelDataFileReader.java index 69cb4455..41a6f11f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/EarlyLevelDataFileReader.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/EarlyLevelDataFileReader.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.data.migration; +package dev.compactmods.machines.forge.data.migration; import com.google.common.collect.ImmutableSet; import com.mojang.serialization.Dynamic; diff --git a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java index 35b9fa24..ba52b226 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java @@ -1,16 +1,16 @@ -package dev.compactmods.machines.data.migration; +package dev.compactmods.machines.forge.data.migration; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.RoomCodeGenerator; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.util.DimensionUtil; import dev.compactmods.machines.util.SavedDataHelper; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java index a5e629ad..c4241829 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/Dimension.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.dimension; +package dev.compactmods.machines.forge.dimension; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.Registries; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/SimpleTeleporter.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/dimension/SimpleTeleporter.java index 4ad816b9..bf14f572 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/SimpleTeleporter.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/SimpleTeleporter.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.dimension; +package dev.compactmods.machines.forge.dimension; import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.core.BlockPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/VoidAirBlock.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/dimension/VoidAirBlock.java index c8a47341..7d959950 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/dimension/VoidAirBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/VoidAirBlock.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.dimension; +package dev.compactmods.machines.forge.dimension; import dev.compactmods.machines.api.room.IRoomHistory; -import dev.compactmods.machines.config.ServerConfig; -import dev.compactmods.machines.room.capability.RoomCapabilities; -import dev.compactmods.machines.util.ForgePlayerUtil; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.util.ForgePlayerUtil; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java index 84be0be3..7f1fcbe9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java @@ -1,15 +1,15 @@ -package dev.compactmods.machines.machine; - -import dev.compactmods.machines.CompactMachines; +package dev.compactmods.machines.forge.machine; + +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlock; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.api.machine.MachineIds; import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.Registries; -import dev.compactmods.machines.machine.block.CompactMachineBlock; -import dev.compactmods.machines.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; -import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java index 4e173675..f62992e4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.machine.block; +package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.room.RoomHelper; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.server.MinecraftServer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java index 14d973c6..a2d82827 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.machine.block; +package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.IMachineBlockEntity; @@ -11,18 +11,18 @@ import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.BasicRoomInfo; -import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.TunnelWallEntity; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.TunnelNode; import dev.compactmods.machines.util.NbtUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -246,8 +246,8 @@ public boolean hasPlayersInside() { return false; } - public LevelBlockPosition getLevelPosition() { - return new LevelBlockPosition(level.dimension(), worldPosition); + public GlobalPos getLevelPosition() { + return GlobalPos.of(level.dimension(), worldPosition); } public void syncConnectedRoom() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index 353e0c0b..d3c38c19 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -1,7 +1,9 @@ -package dev.compactmods.machines.machine.block; +package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; @@ -11,21 +13,19 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.LegacySizedTemplates; -import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.ui.MachineRoomMenu; -import dev.compactmods.machines.tunnel.Tunnels; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; -import dev.compactmods.machines.upgrade.RoomUpgradeItem; +import dev.compactmods.machines.forge.room.ui.MachineRoomMenu; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -236,7 +236,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var roomName = Rooms.getRoomName(server, room.code()); NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, room, machine.getLevelPosition()), (buf) -> { buf.writeBlockPos(pos); - buf.writeWithCodec(LevelBlockPosition.CODEC, machine.getLevelPosition()); + buf.writeWithCodec(GlobalPos.CODEC, machine.getLevelPosition()); buf.writeUtf(room.code()); roomName.ifPresentOrElse(name -> { buf.writeBoolean(true); diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java index 15336003..7f2997bc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java @@ -1,20 +1,20 @@ -package dev.compactmods.machines.machine.block; +package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.config.ServerConfig; import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; -import dev.compactmods.machines.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.machine.item.LegacyCompactMachineItem; -import dev.compactmods.machines.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.CompactStructureGenerator; -import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java index ab71d6a9..ea097fce 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java @@ -1,10 +1,11 @@ -package dev.compactmods.machines.machine.item; +package dev.compactmods.machines.forge.machine.item; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.Vec3i; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java index da6b846d..1b6f145f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java @@ -1,10 +1,11 @@ -package dev.compactmods.machines.machine.item; +package dev.compactmods.machines.forge.machine.item; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.machine.Machines; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; diff --git a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java index 211e62b6..f0a2d53e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.machine.item; +package dev.compactmods.machines.forge.machine.item; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineIds; @@ -6,7 +6,8 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; -import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.machine.item.ICompactMachineItem; +import dev.compactmods.machines.forge.room.RoomHelper; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.gui.screens.Screen; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/ClientRoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/network/ClientRoomNetworkHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java index 0d5e33a0..06ea5558 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/ClientRoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; -import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.forge.room.ui.MachineRoomScreen; import dev.compactmods.machines.room.client.ClientRoomMetadata; -import dev.compactmods.machines.room.ui.MachineRoomScreen; import net.minecraft.Util; import net.minecraft.client.Minecraft; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/network/CompactMachinesNet.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java index 78d91c21..a4afbdc9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java @@ -1,10 +1,8 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.forge.tunnel.network.TunnelAddedPacket; +import dev.compactmods.machines.forge.util.VersionUtil; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.network.PlayerRequestedTeleportPacket; -import dev.compactmods.machines.network.SyncRoomMetadataPacket; -import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; -import dev.compactmods.machines.util.VersionUtil; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.loading.FMLEnvironment; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/InitialRoomBlockDataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/network/InitialRoomBlockDataPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java index a57bd970..74b2bf86 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/InitialRoomBlockDataPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/PlayerRequestedTeleportPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java similarity index 76% rename from forge-main/src/main/java/dev/compactmods/machines/network/PlayerRequestedTeleportPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java index 5b9cd516..be9e91bd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/PlayerRequestedTeleportPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java @@ -1,24 +1,24 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.room.RoomHelper; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import net.minecraft.core.GlobalPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; -public record PlayerRequestedTeleportPacket(LevelBlockPosition machine, String room) { +public record PlayerRequestedTeleportPacket(GlobalPos machine, String room) { public PlayerRequestedTeleportPacket(FriendlyByteBuf buf) { - this(buf.readWithCodec(LevelBlockPosition.CODEC), buf.readUtf()); + this(buf.readWithCodec(GlobalPos.CODEC), buf.readUtf()); } public void encode(FriendlyByteBuf buf) { - buf.writeWithCodec(LevelBlockPosition.CODEC, machine); + buf.writeWithCodec(GlobalPos.CODEC, machine); buf.writeUtf(room); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/PlayerStartedRoomTrackingPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/network/PlayerStartedRoomTrackingPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java index 1ce6ed00..e11bff8f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/PlayerStartedRoomTrackingPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/RoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/RoomNetworkHandler.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/network/RoomNetworkHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/RoomNetworkHandler.java index ead65851..6dd2bfdc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/RoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/RoomNetworkHandler.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.forge.util.VersionUtil; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.util.VersionUtil; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkDirection; import net.minecraftforge.network.NetworkRegistry; diff --git a/forge-main/src/main/java/dev/compactmods/machines/network/SyncRoomMetadataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/network/SyncRoomMetadataPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java index ccaa95ac..0e7d69d8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/network/SyncRoomMetadataPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.network; +package dev.compactmods.machines.forge.network; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ForgeCompactRoomProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ForgeCompactRoomProvider.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/room/ForgeCompactRoomProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ForgeCompactRoomProvider.java index 5e4df636..1f592fe3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ForgeCompactRoomProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ForgeCompactRoomProvider.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/PlayerRoomMetadataProvider.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/PlayerRoomMetadataProvider.java index 40f6eb9f..cdb77319 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/PlayerRoomMetadataProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/PlayerRoomMetadataProvider.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; import dev.compactmods.machines.api.room.IPlayerRoomMetadata; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomClientEventHandler.java similarity index 85% rename from forge-main/src/main/java/dev/compactmods/machines/room/RoomClientEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomClientEventHandler.java index 1d24d077..d60d936d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomClientEventHandler.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.room.ui.overlay.RoomMetadataDebugOverlay; +import dev.compactmods.machines.forge.room.ui.overlay.RoomMetadataDebugOverlay; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomEventHandler.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomEventHandler.java index 63865e9e..4e585f9b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomEventHandler.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.network.SyncRoomMetadataPacket; +import dev.compactmods.machines.forge.network.SyncRoomMetadataPacket; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.server.level.ServerLevel; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java index 6e29bc66..577fb748 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java @@ -1,6 +1,8 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.dimension.SimpleTeleporter; +import dev.compactmods.machines.forge.util.ForgePlayerUtil; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; @@ -8,19 +10,17 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.network.CompactMachinesNet; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.location.PreciseDimensionalPosition; -import dev.compactmods.machines.dimension.SimpleTeleporter; -import dev.compactmods.machines.network.SyncRoomMetadataPacket; -import dev.compactmods.machines.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.SyncRoomMetadataPacket; +import dev.compactmods.machines.forge.room.capability.RoomCapabilities; import dev.compactmods.machines.room.client.RoomClientHelper; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; import dev.compactmods.machines.room.server.RoomServerHelper; -import dev.compactmods.machines.util.ForgePlayerUtil; import dev.compactmods.machines.util.PlayerUtil; +import net.minecraft.core.GlobalPos; import net.minecraft.core.Registry; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; @@ -48,7 +48,7 @@ public static Registry getTemplates() { }); } - public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, LevelBlockPosition machinePos, IRoomRegistration room) throws MissingDimensionException { + public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, GlobalPos machinePos, IRoomRegistration room) throws MissingDimensionException { MinecraftServer serv = machineLevel.getServer(); // Recursion check. Player tried to enter the room they're already in. @@ -98,7 +98,7 @@ public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer pla teleportPlayerIntoRoom(serv, player, room, null); } - public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer player, IRoomRegistration room, @Nullable LevelBlockPosition from) + public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer player, IRoomRegistration room, @Nullable GlobalPos from) throws MissingDimensionException, NonexistentRoomException { final var compactDim = CompactDimension.forServer(serv); final var roomProvider = CompactRoomProvider.instance(compactDim); @@ -145,7 +145,7 @@ public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull Serv }); var spawnPoint = prevArea.getEntryLocation(); - final var enteredMachine = prevArea.getMachine().getBlockPosition(); + final var enteredMachine = prevArea.getMachine().pos(); final var level = spawnPoint.level(serv); serverPlayer.changeDimension(level, SimpleTeleporter.lookingAt(spawnPoint.position(), enteredMachine)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java index 36d8469e..94b298dd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/Rooms.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.room; +package dev.compactmods.machines.forge.room; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.Registries; import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/CMRoomHistory.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/CMRoomHistory.java index 4089b535..618b674b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/CMRoomHistory.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/CMRoomHistory.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.capability; +package dev.compactmods.machines.forge.room.capability; import com.mojang.serialization.DataResult; import dev.compactmods.machines.api.room.IRoomHistory; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomHistoryProvider.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomHistoryProvider.java index 0fde3e15..c340f0b1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomHistoryProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomHistoryProvider.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.capability; +package dev.compactmods.machines.forge.room.capability; import dev.compactmods.machines.api.room.IRoomHistory; import net.minecraft.core.Direction; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomMetadataProviderProvider.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomMetadataProviderProvider.java index 8b58c4de..836b28ea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/PlayerRoomMetadataProviderProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/PlayerRoomMetadataProviderProvider.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.room.capability; +package dev.compactmods.machines.forge.room.capability; +import dev.compactmods.machines.forge.room.PlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; -import dev.compactmods.machines.room.PlayerRoomMetadataProvider; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.Capability; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapEventHandler.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapEventHandler.java index 1ba64e03..997a8665 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapEventHandler.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.capability; +package dev.compactmods.machines.forge.room.capability; import dev.compactmods.machines.api.core.Constants; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapabilities.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapabilities.java index 4e8d6ab8..e8cc1a66 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/capability/RoomCapabilities.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/capability/RoomCapabilities.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.capability; +package dev.compactmods.machines.forge.room.capability; import dev.compactmods.machines.api.room.IRoomHistory; import net.minecraftforge.common.capabilities.Capability; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java index 32b4c55c..72e05e93 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomMenu.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.room.ui; +package dev.compactmods.machines.forge.room.ui; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.room.Rooms; +import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import net.minecraft.core.GlobalPos; import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; import net.minecraft.world.MenuProvider; @@ -25,11 +25,11 @@ public class MachineRoomMenu extends AbstractContainerMenu { private final String room; private String roomName; - private final LevelBlockPosition machine; + private final GlobalPos machine; private StructureTemplate roomBlocks; public boolean loadingBlocks; - public MachineRoomMenu(int win, String room, LevelBlockPosition machine, String roomName) { + public MachineRoomMenu(int win, String room, GlobalPos machine, String roomName) { super(RoomUserInterfaceRegistration.MACHINE_MENU.get(), win); this.room = room; this.roomName = roomName; @@ -42,11 +42,11 @@ public String getRoom() { return room; } - public LevelBlockPosition getMachine() { + public GlobalPos getMachine() { return machine; } - public static MenuProvider makeProvider(MinecraftServer server, IRoomRegistration roomInfo, LevelBlockPosition machinePos) { + public static MenuProvider makeProvider(MinecraftServer server, IRoomRegistration roomInfo, GlobalPos machinePos) { return new MenuProvider() { @Override public Component getDisplayName() { diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomScreen.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomScreen.java index 48c1aae1..09f8c171 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ui/MachineRoomScreen.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomScreen.java @@ -1,25 +1,25 @@ -package dev.compactmods.machines.room.ui; +package dev.compactmods.machines.forge.room.ui; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; +import dev.compactmods.machines.forge.client.level.RenderingLevel; +import dev.compactmods.machines.forge.client.render.RenderTypes; +import dev.compactmods.machines.forge.compat.curios.CuriosCompat; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.client.level.RenderingLevel; -import dev.compactmods.machines.client.render.RenderTypes; import dev.compactmods.machines.client.render.SuperRenderTypeBuffer; import dev.compactmods.machines.client.util.TransformingVertexBuilder; -import dev.compactmods.machines.compat.curios.CuriosCompat; -import dev.compactmods.machines.location.LevelBlockPosition; -import dev.compactmods.machines.network.PlayerStartedRoomTrackingPacket; -import dev.compactmods.machines.network.RoomNetworkHandler; -import dev.compactmods.machines.shrinking.Shrinking; +import dev.compactmods.machines.forge.network.PlayerStartedRoomTrackingPacket; +import dev.compactmods.machines.forge.network.RoomNetworkHandler; +import dev.compactmods.machines.forge.shrinking.Shrinking; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; +import net.minecraft.core.GlobalPos; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.decoration.ArmorStand; @@ -229,7 +229,7 @@ protected void renderBg(PoseStack pose, float p_97788_, int p_97789_, int p_9779 // this.blit(pose, leftPos, topPos, 0, 0, this.imageWidth, this.imageHeight); } - public LevelBlockPosition getMachine() { + public GlobalPos getMachine() { return menu.getMachine(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/PSDIconButton.java similarity index 84% rename from forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/PSDIconButton.java index d9ef93c0..ef081aa6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ui/PSDIconButton.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/PSDIconButton.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.room.ui; +package dev.compactmods.machines.forge.room.ui; import com.mojang.blaze3d.vertex.PoseStack; -import dev.compactmods.machines.network.CompactMachinesNet; -import dev.compactmods.machines.network.PlayerRequestedTeleportPacket; -import dev.compactmods.machines.shrinking.Shrinking; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.PlayerRequestedTeleportPacket; +import dev.compactmods.machines.forge.shrinking.Shrinking; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/RoomUserInterfaceRegistration.java similarity index 77% rename from forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/RoomUserInterfaceRegistration.java index 1d4b17d9..58b0feb8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ui/RoomUserInterfaceRegistration.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/RoomUserInterfaceRegistration.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.room.ui; +package dev.compactmods.machines.forge.room.ui; -import dev.compactmods.machines.Registries; -import dev.compactmods.machines.location.LevelBlockPosition; +import dev.compactmods.machines.forge.Registries; +import net.minecraft.core.GlobalPos; import net.minecraft.world.inventory.MenuType; import net.minecraftforge.common.extensions.IForgeMenuType; import net.minecraftforge.registries.RegistryObject; @@ -11,7 +11,7 @@ public class RoomUserInterfaceRegistration { public static final RegistryObject> MACHINE_MENU = Registries.CONTAINERS.register("machine", () -> IForgeMenuType.create( ((windowId, inv, data) -> { data.readBlockPos(); - final var mach = data.readWithCodec(LevelBlockPosition.CODEC); + final var mach = data.readWithCodec(GlobalPos.CODEC); final var room = data.readUtf(); final boolean hasName = data.readBoolean(); final var roomName = hasName ? data.readUtf() : "Room Preview"; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java index 8da83b47..9c69d5f5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/ui/overlay/RoomMetadataDebugOverlay.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.ui.overlay; +package dev.compactmods.machines.forge.room.ui.overlay; import com.mojang.blaze3d.vertex.PoseStack; import dev.compactmods.machines.api.dimension.CompactDimension; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java index 8ed7c860..bca01aee 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java @@ -1,19 +1,19 @@ -package dev.compactmods.machines.room.upgrade; +package dev.compactmods.machines.forge.room.upgrade; import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.graph.RoomUpgradeConnection; +import dev.compactmods.machines.forge.upgrade.graph.UpgradeConnectionEntry; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.room.graph.RoomReferenceNode; -import dev.compactmods.machines.upgrade.graph.RoomUpgradeConnection; import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; -import dev.compactmods.machines.upgrade.graph.UpgradeConnectionEntry; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbench.java similarity index 95% rename from forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbench.java index 9b67b4ca..dfc14a4e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbench.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbench.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.room.upgrade; +package dev.compactmods.machines.forge.room.upgrade; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.i18n.TranslationUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbenchEntity.java similarity index 83% rename from forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbenchEntity.java index c9411611..60107611 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/room/upgrade/RoomUpgradeWorkbenchEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeWorkbenchEntity.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.room.upgrade; +package dev.compactmods.machines.forge.room.upgrade; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.entity.BlockEntity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java index 393589b5..7df37dbd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.shrinking; +package dev.compactmods.machines.forge.shrinking; +import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IMutableRoomRegistration; import dev.compactmods.machines.client.gui.PersonalShrinkingDeviceScreen; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.RoomHelper; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.ChatFormatting; diff --git a/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/Shrinking.java similarity index 85% rename from forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/Shrinking.java index c6f82471..c7e6d904 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/shrinking/Shrinking.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/Shrinking.java @@ -1,8 +1,8 @@ -package dev.compactmods.machines.shrinking; +package dev.compactmods.machines.forge.shrinking; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.Registries; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index 55b4a688..f6211897 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -1,6 +1,9 @@ -package dev.compactmods.machines.tunnel; +package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.tunnel.network.TunnelAddedPacket; +import dev.compactmods.machines.forge.wall.SolidWallBlock; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; @@ -9,14 +12,13 @@ import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.network.CompactMachinesNet; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.room.capability.RoomCapabilities; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.tunnel.network.TunnelAddedPacket; +import dev.compactmods.machines.tunnel.ITunnelItem; +import dev.compactmods.machines.tunnel.TunnelHelper; import dev.compactmods.machines.util.PlayerUtil; -import dev.compactmods.machines.wall.SolidWallBlock; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; @@ -25,7 +27,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; @@ -67,10 +68,7 @@ public static ItemStack createStack(TunnelDefinition definition) { @Override public Component getName(ItemStack stack) { String key = ITunnelItem.getDefinition(stack) - .map(def -> { - ResourceLocation id = Tunnels.getRegistryId(def); - return TranslationUtil.tunnelId(id); - }) + .map(TranslationUtil::tunnelId) .orElse("item." + Constants.MOD_ID + ".tunnels.unnamed"); return Component.translatable(key); @@ -80,7 +78,7 @@ public Component getName(ItemStack stack) { public void appendHoverText(@Nonnull ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { ITunnelItem.getDefinition(stack).ifPresent(tunnelDef -> { if (Screen.hasShiftDown()) { - MutableComponent type = Component.translatable("tooltip." + Constants.MOD_ID + ".tunnel_type", Tunnels.getRegistryId(tunnelDef)) + MutableComponent type = Component.translatable("tooltip." + Constants.MOD_ID + ".tunnel_type", tunnelDef) .withStyle(ChatFormatting.GRAY) .withStyle(ChatFormatting.ITALIC); @@ -122,7 +120,7 @@ public InteractionResult useOn(UseOnContext context) { if (state.getBlock() instanceof SolidWallBlock && player != null) { ITunnelItem.getDefinition(context.getItemInHand()).ifPresent(def -> { try { - boolean success = setupTunnelWall(sl, position, context.getClickedFace(), player, def); + boolean success = setupTunnelWall(sl, position, context.getClickedFace(), player, Tunnels.getDefinition(def)); if (success && !player.isCreative()) context.getItemInHand().shrink(1); } catch (Exception | MissingDimensionException e) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index 551029b8..e700367e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -1,6 +1,9 @@ -package dev.compactmods.machines.tunnel; +package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.wall.ProtectedWallBlock; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelPosition; @@ -8,12 +11,11 @@ import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.wall.ProtectedWallBlock; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.tunnel.TunnelHelper; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; @@ -76,11 +78,12 @@ public int getSignal(BlockState state, BlockGetter world, BlockPos position, Dir final var def = tunnelWall.getTunnelType(); final var machPos = tunnelWall.getConnectedPosition(); final var tunnPos = tunnelWall.getTunnelPosition(); + final var connectedLevel = serv.getLevel(machPos.dimension()); - if (!machPos.isLoaded(serv)) return 0; + if (!connectedLevel.isLoaded(machPos.pos())) return 0; if (def instanceof RedstoneReaderTunnel rrt) { - return rrt.powerLevel(serv, machPos, tunnPos); + return rrt.powerLevel(serv, GlobalPos.of(machPos.dimension(), machPos.pos()), tunnPos); } else { return 0; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index 4acb1d83..5c42f09f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.tunnel; +package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; @@ -10,16 +10,15 @@ import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; import dev.compactmods.machines.codec.CodecExtensions; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.BaseTunnelWallData; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Block; @@ -38,7 +37,7 @@ public class TunnelWallEntity extends BlockEntity implements ITunnelHolder { private static final String NBT_LEGACY_MACHINE_KEY = "machine"; - private LevelBlockPosition connectedMachine; + private GlobalPos connectedMachine; private TunnelDefinition tunnelType; @Nullable @@ -59,7 +58,7 @@ public void load(@Nonnull CompoundTag nbt) { .getOrThrow(true, CompactMachines.LOGGER::fatal); this.connectedMachine = baseData.connection(); - this.tunnelType = baseData.tunnel(); + this.tunnelType = Tunnels.getDefinition(baseData.tunnelType()); try { if (tunnelType instanceof InstancedTunnel it) @@ -115,14 +114,12 @@ public CompoundTag getUpdateTag() { @Override public void handleUpdateTag(CompoundTag tag) { super.handleUpdateTag(tag); - if (tag.contains(BaseTunnelWallData.KEY_TUNNEL_TYPE)) { - var id = new ResourceLocation(tag.getString(BaseTunnelWallData.KEY_TUNNEL_TYPE)); - this.tunnelType = Tunnels.getDefinition(id); - } + final var data = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, tag) + .getOrThrow(false, CompactMachines.LOGGER::error); - if (tag.contains(BaseTunnelWallData.KEY_CONNECTION)) { - this.connectedMachine = LevelBlockPosition.fromNBT(tag.getCompound(BaseTunnelWallData.KEY_CONNECTION)); - } + var id = data.tunnelType(); + this.tunnelType = Tunnels.getDefinition(id); + this.connectedMachine = data.connection(); setChanged(); } @@ -159,7 +156,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D } @NotNull - public IDimensionalBlockPosition getConnectedPosition() { + public GlobalPos getConnectedPosition() { return this.connectedMachine; } @@ -209,9 +206,9 @@ public TunnelDefinition getTunnelType() { * * @param machine Machine to connect tunnel to. */ - public void setConnectedTo(IDimensionalBlockPosition machine, Direction side) { + public void setConnectedTo(GlobalPos machine, Direction side) { if (level == null || level.isClientSide) return; - this.connectedMachine = new LevelBlockPosition(machine); + this.connectedMachine = machine; if (level instanceof ServerLevel sl) { // TODO - Weak references to room data so we don't have to do this diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java index 26e2b4ef..0469ad70 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.tunnel; +package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.graph.SimpleGraphNodeType; diff --git a/common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java similarity index 85% rename from common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java index cc80b785..ed90f63e 100644 --- a/common-main/src/main/java/dev/compactmods/machines/tunnel/client/TunnelColors.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java @@ -1,5 +1,6 @@ -package dev.compactmods.machines.tunnel.client; +package dev.compactmods.machines.forge.tunnel.client; +import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.tunnel.ITunnelItem; @@ -7,8 +8,6 @@ import net.minecraft.client.color.item.ItemColor; import net.minecraft.world.level.block.entity.BlockEntity; -import java.util.Optional; - public class TunnelColors { public static final BlockColor BLOCK = (state, reader, position, tintIndex) -> { @@ -37,11 +36,11 @@ public class TunnelColors { }; public static final ItemColor ITEM = (stack, tintIndex) -> { - Optional definition = ITunnelItem.getDefinition(stack); + var definition = ITunnelItem.getDefinition(stack); if(definition.isEmpty()) return 0; - TunnelDefinition actualDef = definition.get(); + TunnelDefinition actualDef = Tunnels.getDefinition(definition.get()); if (tintIndex == 0) { return actualDef.ringColor(); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java index 5f5ce0f0..b76413de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/graph/TunnelConnectionGraph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java @@ -1,12 +1,11 @@ -package dev.compactmods.machines.tunnel.graph; +package dev.compactmods.machines.forge.tunnel.graph; import com.google.common.graph.EndpointPair; import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.Registries; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; @@ -16,12 +15,17 @@ import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.location.LevelBlockPosition; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.MachineRoomEdge; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; +import dev.compactmods.machines.tunnel.graph.TunnelMachineInfo; +import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; +import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; @@ -63,7 +67,7 @@ public class TunnelConnectionGraph extends SavedData implements INBTSerializable /** * Quick access to machine information nodes. */ - private final Map machines; + private final Map machines; /** * Quick access to tunnel definition nodes. @@ -117,7 +121,7 @@ public static String getDataFilename(String room) { * @param tunnel The tunnel to find a connection for. * @return The id of the connected machine. */ - public Optional connectedMachine(BlockPos tunnel) { + public Optional connectedMachine(BlockPos tunnel) { if (!tunnels.containsKey(tunnel)) return Optional.empty(); @@ -140,7 +144,7 @@ public Optional connectedMachine(BlockPos tunnel) { * @param side The side of the machine the tunnel is connecting to. * @return True if the connection could be established; false if the tunnel type is already registered for the given side. */ - public boolean registerTunnel(BlockPos tunnelPos, TunnelDefinition type, IDimensionalBlockPosition machine, Direction side) { + public boolean registerTunnel(BlockPos tunnelPos, TunnelDefinition type, GlobalPos machine, Direction side) { // First we need to get the machine the tunnel is trying to connect to var machineNode = getOrCreateMachineNode(machine); var tunnelNode = getOrCreateTunnelNode(tunnelPos); @@ -180,11 +184,11 @@ public TunnelNode getOrCreateTunnelNode(BlockPos tunnelPos) { return newTunnel; } - public CompactMachineNode getOrCreateMachineNode(IDimensionalBlockPosition machine) { + public CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { var machineRegistered = machines.containsKey(machine); CompactMachineNode node; if (!machineRegistered) { - node = new CompactMachineNode(machine.dimension(), machine.getBlockPosition()); + node = new CompactMachineNode(machine.dimension(), machine.pos()); machines.put(machine, node); graph.addNode(node); setDirty(); @@ -429,7 +433,7 @@ public boolean hasTunnel(BlockPos location) { * @param facing * @return */ - public Stream getRedstoneTunnels(IDimensionalBlockPosition machine, Direction facing) { + public Stream getRedstoneTunnels(GlobalPos machine, Direction facing) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -456,7 +460,7 @@ public Optional getConnectedSide(BlockPos position) { .findFirst(); } - public Stream getTunnelsSupporting(LevelBlockPosition machine, Direction side, Capability capability) { + public Stream getTunnelsSupporting(GlobalPos machine, Direction side, Capability capability) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -473,7 +477,7 @@ public Stream getTunnelsSupporting(LevelBlockPosition machine, Dir })).map(TunnelNode::position); } - public Stream getTypesForSide(LevelBlockPosition machine, Direction side) { + public Stream getTypesForSide(GlobalPos machine, Direction side) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -485,7 +489,7 @@ public Stream getTypesForSide(LevelBlockPosition machine, Dire .distinct(); } - public Stream getTunnelsForSide(IDimensionalBlockPosition machine, Direction side) { + public Stream getTunnelsForSide(GlobalPos machine, Direction side) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -530,7 +534,7 @@ public void clear() { } @Deprecated(forRemoval = true, since = "5.0.0") - public Stream getMachineTunnels(IDimensionalBlockPosition machine, TunnelDefinition type) { + public Stream getMachineTunnels(GlobalPos machine, TunnelDefinition type) { return getTunnelNodesByType(type) .map(TunnelNode::position) .filter(position -> connectedMachine(position).map(machine::equals).orElse(false)) @@ -598,7 +602,7 @@ private void cleanupOrphanedTunnels() { } private void cleanupOrphanedMachines() { - HashSet removed = new HashSet<>(); + HashSet removed = new HashSet<>(); machines.forEach((machine, node) -> { if (graph.degree(node) == 0) { graph.removeNode(node); @@ -631,11 +635,11 @@ public void rotateTunnel(BlockPos tunnel, Direction newSide) { }); } - public Stream getMachines() { + public Stream getMachines() { return this.machines.keySet().stream(); } - public Stream getConnections(IDimensionalBlockPosition machine) { + public Stream getConnections(GlobalPos machine) { if (!machines.containsKey(machine)) return Stream.empty(); @@ -650,11 +654,11 @@ public Stream getConnections(IDimensionalBlockPosition machine) { } - public boolean hasAnyConnectedTo(IDimensionalBlockPosition machine) { + public boolean hasAnyConnectedTo(GlobalPos machine) { return getConnections(machine).findAny().isPresent(); } - public void rebind(BlockPos tunnel, IDimensionalBlockPosition newMachine, Direction side) { + public void rebind(BlockPos tunnel, GlobalPos newMachine, Direction side) { CompactMachines.LOGGER.debug("Rebinding tunnel at {} to machine {}", tunnel, newMachine); final var tunnelNode = getOrCreateTunnelNode(tunnel); diff --git a/forge-main/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java index 32e14c48..6134fd49 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/tunnel/network/TunnelAddedPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java @@ -1,7 +1,7 @@ -package dev.compactmods.machines.tunnel.network; +package dev.compactmods.machines.forge.tunnel.network; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.tunnel.client.ClientTunnelHandler; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/MachineRoomUpgrades.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/MachineRoomUpgrades.java index 47f4df3b..e10fab2a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/MachineRoomUpgrades.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/MachineRoomUpgrades.java @@ -1,10 +1,10 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.forge.upgrade; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import dev.compactmods.machines.Registries; -import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbench; -import dev.compactmods.machines.room.upgrade.RoomUpgradeWorkbenchEntity; +import dev.compactmods.machines.forge.room.upgrade.RoomUpgradeWorkbench; +import dev.compactmods.machines.forge.room.upgrade.RoomUpgradeWorkbenchEntity; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java index 9a1f65d7..c7c1d153 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/RoomUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade; +package dev.compactmods.machines.forge.upgrade; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.upgrade.RoomUpgradeHelper; diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java similarity index 90% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java index e7a563d5..ecd630ea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.upgrade.graph; +package dev.compactmods.machines.forge.upgrade.graph; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -6,7 +6,7 @@ import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import org.jetbrains.annotations.NotNull; public class RoomUpgradeConnection implements IGraphEdge> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/UpgradeConnectionEntry.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/UpgradeConnectionEntry.java index 2ddcf3ec..7ef489d0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/upgrade/graph/UpgradeConnectionEntry.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/UpgradeConnectionEntry.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.upgrade.graph; +package dev.compactmods.machines.forge.upgrade.graph; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; public record UpgradeConnectionEntry(String room, ResourceKey upgradeKey, T instance) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java b/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java index e327b494..d20f7dcf 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/AnnotationScanner.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.util; +package dev.compactmods.machines.forge.util; import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.ModFileScanData; diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/util/ForgePlayerUtil.java similarity index 79% rename from forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/util/ForgePlayerUtil.java index 76ae37f7..6531a8cd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/ForgePlayerUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/util/ForgePlayerUtil.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.util; +package dev.compactmods.machines.forge.util; -import dev.compactmods.machines.network.CompactMachinesNet; -import dev.compactmods.machines.dimension.SimpleTeleporter; -import dev.compactmods.machines.network.SyncRoomMetadataPacket; -import dev.compactmods.machines.room.RoomHelper; +import dev.compactmods.machines.forge.dimension.SimpleTeleporter; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.SyncRoomMetadataPacket; +import dev.compactmods.machines.forge.room.RoomHelper; import net.minecraft.Util; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; diff --git a/forge-main/src/main/java/dev/compactmods/machines/util/VersionUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/util/VersionUtil.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/util/VersionUtil.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/util/VersionUtil.java index 75b83266..6e9bb355 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/util/VersionUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/util/VersionUtil.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.util; +package dev.compactmods.machines.forge.util; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerTradesEventHandler.java similarity index 91% rename from forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerTradesEventHandler.java index a9112e95..c9aaeef1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerTradesEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerTradesEventHandler.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.villager; +package dev.compactmods.machines.forge.villager; import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerUpgradeTrade.java b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerUpgradeTrade.java new file mode 100644 index 00000000..c4d8956e --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/VillagerUpgradeTrade.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.forge.villager; + +public class VillagerUpgradeTrade { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/Villagers.java similarity index 92% rename from forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/villager/Villagers.java index 9cb0bdfe..031dda7c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/Villagers.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/villager/Villagers.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.villager; +package dev.compactmods.machines.forge.villager; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.upgrade.MachineRoomUpgrades; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedBlockHandler.java similarity index 94% rename from forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedBlockHandler.java index 82119592..c8950b61 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedBlockHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedBlockHandler.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.wall; +package dev.compactmods.machines.forge.wall; import dev.compactmods.machines.api.core.Constants; import net.minecraftforge.event.entity.player.PlayerInteractEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedWallBlock.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedWallBlock.java index 083e2482..a6a94b2e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/ProtectedWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/ProtectedWallBlock.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.wall; +package dev.compactmods.machines.forge.wall; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/SolidWallBlock.java similarity index 88% rename from forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/wall/SolidWallBlock.java index 0eee5b15..470eea8c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/SolidWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/SolidWallBlock.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.wall; +package dev.compactmods.machines.forge.wall; public class SolidWallBlock extends ProtectedWallBlock { public SolidWallBlock(Properties props) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/Walls.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/wall/Walls.java index 0d6a873a..76dc385a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/wall/Walls.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/wall/Walls.java @@ -1,7 +1,9 @@ -package dev.compactmods.machines.wall; +package dev.compactmods.machines.forge.wall; -import dev.compactmods.machines.CompactMachines; -import dev.compactmods.machines.Registries; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.wall.BreakableWallBlock; +import dev.compactmods.machines.wall.ItemBlockWall; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java b/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java deleted file mode 100644 index e67751cf..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/villager/VillagerUpgradeTrade.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.villager; - -public class VillagerUpgradeTrade { -} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java b/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java index 7abb243d..0f77c31b 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/ServerEvents.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.util.DimensionUtil; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java index 1b93f65a..944a47cb 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/core/CompactMachinesTests.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.core; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.test.TestBatches; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java b/forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java index 80c8345d..32c52ea1 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/crossmod/Mekanism.java @@ -1,6 +1,6 @@ package dev.compactmods.machines.test.crossmod; -import dev.compactmods.machines.CompactMachines; +import dev.compactmods.machines.forge.CompactMachines; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestHelper; import net.minecraftforge.gametest.PrefixGameTestTemplate; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java index f8fff669..0b84a7f5 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/EarlyFileLoaderTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.migrators; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.data.migration.EarlyLevelDataFileReader; +import dev.compactmods.machines.forge.data.migration.EarlyLevelDataFileReader; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.FileHelper; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java index e49fe83c..3effdaa6 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migrators/RoomInfoPre520MigratorTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.migrators; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.data.migration.Pre520RoomDataMigrator; +import dev.compactmods.machines.forge.data.migration.Pre520RoomDataMigrator; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.FileHelper; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java index 134b1783..479292c3 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/worldgen/RoomGenerationTests.java @@ -4,7 +4,7 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.util.CompactStructureGenerator; -import dev.compactmods.machines.wall.Walls; +import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.gametest.framework.GameTest; diff --git a/forge-api/.gitignore b/forge-tunnels-api/.gitignore similarity index 100% rename from forge-api/.gitignore rename to forge-tunnels-api/.gitignore diff --git a/forge-api/build.gradle.kts b/forge-tunnels-api/build.gradle.kts similarity index 80% rename from forge-api/build.gradle.kts rename to forge-tunnels-api/build.gradle.kts index ad0e44e2..27d0bb0e 100644 --- a/forge-api/build.gradle.kts +++ b/forge-tunnels-api/build.gradle.kts @@ -3,6 +3,9 @@ import net.minecraftforge.gradle.userdev.UserDevExtension import java.text.SimpleDateFormat import java.util.* +val coreVersion: String = property("core_version") as String +val tunnelsApiVersion: String = property("tunnels_version") as String + val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" val nightlyVersion: String = "${semver}.${buildNumber}-nightly" @@ -54,19 +57,28 @@ configure { accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) } -project.evaluationDependsOn(project(":common-api").path) +repositories { + maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + } + } +} dependencies { minecraft ("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - // implementation(project(":common-api")) - implementation(fg.deobf(project(":common-api"))) + + implementation("dev.compactmods.compactmachines", "core-api", coreVersion) { + isTransitive = false + } + + implementation("dev.compactmods.compactmachines", "tunnels-api", tunnelsApiVersion) { + isTransitive = false + } } tasks.withType { - // include common classes - val commonApi = project(":common-api").tasks.jar.get().archiveFile; - from(commonApi.map { zipTree(it) }) - manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) attributes(mapOf( diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java b/forge-tunnels-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java similarity index 76% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java rename to forge-tunnels-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java index 0bafe054..a7fc881b 100644 --- a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java +++ b/forge-tunnels-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityLookupTunnel.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.api.tunnels.capability; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.location.IDimensionalBlockPosition; import dev.compactmods.machines.api.tunnels.TunnelPosition; +import net.minecraft.core.GlobalPos; import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; @@ -13,5 +13,5 @@ public interface CapabilityLookupTunnel { ImmutableSet> getSupportedCapabilities(); - > LazyOptional findCapability(MinecraftServer server, TunnelPosition tunnelPosition, IDimensionalBlockPosition connectedPosition); + > LazyOptional findCapability(MinecraftServer server, TunnelPosition tunnelPosition, GlobalPos connectedPosition); } diff --git a/forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java b/forge-tunnels-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java similarity index 100% rename from forge-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java rename to forge-tunnels-api/src/main/java/dev/compactmods/machines/api/tunnels/capability/CapabilityTunnel.java diff --git a/forge-tunnels/build.gradle.kts b/forge-tunnels/build.gradle.kts deleted file mode 100644 index 7f452978..00000000 --- a/forge-tunnels/build.gradle.kts +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id("net.minecraftforge.gradle") version("5.1.+") - id("org.parchmentmc.librarian.forgegradle") version("1.+") -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) - withSourcesJar() -} - -var minecraft_version: String by extra -var forge_version: String by extra -var parchment_version: String by extra - -val runDepends: List = listOf( - project(":common-api"), - project(":forge-api") -) - -runDepends.forEach { - project.evaluationDependsOn(it.path) -} - -dependencies { - minecraft (group = "net.minecraftforge", name = "forge", version = "${minecraft_version}-${forge_version}") - runDepends.forEach { - compileOnly(it) - } -} - -minecraft { - mappings("parchment", "${parchment_version}-${minecraft_version}") - accessTransformer(file("../forge-main/src/main/resources/META-INF/accesstransformer.cfg")) -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c741a4a2..e4bde618 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,8 @@ forge_version=43.1.15 parchment_version=2022.10.16 mod_id=compactmachines +core_version=2.0.10 +tunnels_version=2.0.10 # Curseforge cf_project=224218 diff --git a/settings.gradle.kts b/settings.gradle.kts index d8f6e73d..cd262b43 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,15 +2,13 @@ pluginManagement { repositories { mavenCentral() mavenLocal() - maven("https://maven.minecraftforge.net") + maven("https://maven.minecraftforge.net") { + name = "Minecraft Forge" + } maven("https://maven.parchmentmc.org") { name = "ParchmentMC" } - - maven("https://maven.fabricmc.net") { - name = "Fabric" - } } resolutionStrategy { @@ -20,12 +18,9 @@ pluginManagement { } } } - - plugins { - id("fabric-loom").version(settings.extra["loom_version"] as String) - } } rootProject.name = "Compact Machines" -include("common-api", "common-main") -include("forge-api", "forge-main", "forge-tunnels") +include("forge-tunnels-api") +include("forge-main") +include("forge-builtin") From 5c67f8719a33fe97c63f99b716d713bc76f53cb5 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 20 Mar 2023 05:34:23 -0400 Subject: [PATCH 43/85] Bump core version, fix several crashes due to registry code --- forge-main/build.gradle.kts | 8 ++++---- .../forge/client/ClientEventHandler.java | 2 +- .../generated/TunnelWallStateGenerator.java | 14 +++++++------- .../machine/item/UnboundCompactMachineItem.java | 17 +++++++++-------- .../forge/room/ForgeRoomServerHelper.java | 14 ++++++++++++++ .../machines/forge/room/RoomHelper.java | 15 +++++---------- gradle.properties | 6 +++--- 7 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/room/ForgeRoomServerHelper.java diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 16a131c3..2948b464 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -101,9 +101,9 @@ runDepends.forEach { dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:core-api:$coreVersion")) - minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:core:$coreVersion")) - minecraftLibrary(fg.deobf("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion")) + implementation("dev.compactmods.compactmachines:core-api:$coreVersion") + implementation("dev.compactmods.compactmachines:core:$coreVersion") + implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") jarJar("dev.compactmods.compactmachines", "core-api", coreVersion) jarJar("dev.compactmods.compactmachines", "core", coreVersion) @@ -221,7 +221,7 @@ minecraft { create("data") { taskName("runData") workingDirectory(file("run/data")) - forceExit(false) + forceExit(true) args("--mod", mod_id) args("--existing", project.file("src/main/resources")) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java index ea4e8dea..cacc2d2f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java @@ -3,11 +3,11 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.compat.curios.CuriosCompat; import dev.compactmods.machines.forge.machine.Machines; -import dev.compactmods.machines.machine.client.MachineColors; import dev.compactmods.machines.forge.room.ui.MachineRoomScreen; import dev.compactmods.machines.forge.room.ui.RoomUserInterfaceRegistration; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.tunnel.client.TunnelColors; +import dev.compactmods.machines.machine.client.MachineColors; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java index c8013a5b..c535ec1b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java @@ -28,7 +28,7 @@ protected void registerStatesAndModels() { for (Direction dir : Direction.values()) { String typedTunnelDirectional = "tunnels/" + dir.getSerializedName(); - models() + final var dirModel = models() .withExistingParent(typedTunnelDirectional, modLoc("tunnels/base")) .texture("wall", modLoc("block/" + typedTunnelDirectional)) .renderType(mcLoc("cutout")); // NamedRenderTypeManager @@ -40,14 +40,14 @@ protected void registerStatesAndModels() { int y = dir.getAxis().isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + 180) % 360; */ + var dirModelConfigured = ConfiguredModel.builder() + .modelFile(dirModel) + .build(); + getVariantBuilder(block) .partialState() - .with(TunnelWallBlock.CONNECTED_SIDE, dir) - .setModels( - ConfiguredModel.builder() - .modelFile(models().getExistingFile(modLoc(typedTunnelDirectional))) - .build() - ); + .with(TunnelWallBlock.CONNECTED_SIDE, dir) + .setModels(dirModelConfigured); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java index f0a2d53e..1d9286dd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java @@ -4,24 +4,23 @@ import dev.compactmods.machines.api.machine.MachineIds; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.machine.item.ICompactMachineItem; -import dev.compactmods.machines.forge.room.RoomHelper; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,8 +35,6 @@ public class UnboundCompactMachineItem extends BlockItem implements ICompactMach public static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; - public static Holder REFERENCE_HOLDER = Holder.Reference.createStandAlone(Registry.ITEM, MachineIds.UNBOUND_MACHINE_ITEM_KEY); - public UnboundCompactMachineItem(Block blockIn, Properties builder) { super(blockIn, builder); } @@ -74,15 +71,19 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List getTemplates() { + final var serv = ServerLifecycleHooks.getCurrentServer(); + return getTemplates(serv); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java index 577fb748..53726c4f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java @@ -1,8 +1,5 @@ package dev.compactmods.machines.forge.room; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.dimension.SimpleTeleporter; -import dev.compactmods.machines.forge.util.ForgePlayerUtil; import dev.compactmods.machines.advancement.AdvancementTriggers; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; @@ -10,15 +7,17 @@ import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.location.PreciseDimensionalPosition; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.dimension.SimpleTeleporter; import dev.compactmods.machines.forge.network.CompactMachinesNet; import dev.compactmods.machines.forge.network.SyncRoomMetadataPacket; import dev.compactmods.machines.forge.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.util.ForgePlayerUtil; +import dev.compactmods.machines.location.PreciseDimensionalPosition; import dev.compactmods.machines.room.client.RoomClientHelper; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.room.history.PlayerRoomHistoryItem; -import dev.compactmods.machines.room.server.RoomServerHelper; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.core.GlobalPos; import net.minecraft.core.Registry; @@ -31,7 +30,6 @@ import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.network.PacketDistributor; -import net.minecraftforge.server.ServerLifecycleHooks; import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; @@ -42,10 +40,7 @@ public class RoomHelper { }); public static Registry getTemplates() { - return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> { - final var serv = ServerLifecycleHooks.getCurrentServer(); - return () -> RoomServerHelper.getTemplates(serv); - }); + return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> ForgeRoomServerHelper::getTemplates); } public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, GlobalPos machinePos, IRoomRegistration room) throws MissingDimensionException { diff --git a/gradle.properties b/gradle.properties index e4bde618..9851eec7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,12 +5,12 @@ org.gradle.daemon=false minecraft_version=1.19.2 loom_version = 1.0-SNAPSHOT -forge_version=43.1.15 +forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.0.10 -tunnels_version=2.0.10 +core_version=2.0.11 +tunnels_version=2.0.11 # Curseforge cf_project=224218 From 276919f172033289c47a873e4d1890bf0b4380c2 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:24:37 -0400 Subject: [PATCH 44/85] Update nightly runner, add announcer --- .github/workflows/ci-tests-nightly.yml | 200 +++++++++++++++---------- gradlew.bat | 0 2 files changed, 121 insertions(+), 79 deletions(-) mode change 100644 => 100755 gradlew.bat diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 5d6dcb88..92f12585 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -1,12 +1,12 @@ name: Gradle Tests and Nightly (CI) +env: + GH_PKG_URL: "https://maven.pkg.github.com/${{ github.repository }}" + CM_RELEASE: false + on: workflow_dispatch: push: - branches: - - '**' - tags-ignore: - - v* paths-ignore: - "README.md" - "LICENSE" @@ -17,34 +17,32 @@ jobs: name: Get Variables runs-on: ubuntu-20.04 outputs: - release_type: ${{steps.cf_release_type.outputs.value }} - version: ${{steps.version.outputs.version }} - build: ${{steps.build.outputs.buildver}} + version: ${{steps.version.outputs.version}} + mcVersion: ${{steps.gradle_props.outputs.minecraft_version}} + forgeVersion: ${{steps.gradle_props.outputs.forge_version}} steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Find Current Tag + - name: Version id: version - run: echo "version=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-rc*' '@')" >> $GITHUB_OUTPUT - - - name: Release Type - id: cf_release_type - uses: christian-draeger/read-properties@1.1.1 + uses: paulhatch/semantic-version@v5.0.2 + with: + change_path: "forge-main" + version_format: "${major}.${minor}.${patch}.${increment}-nightly" + search_commit_body: true + bump_each_commit: true + + - name: Read MC and Forge versions + id: gradle_props + uses: christian-draeger/read-properties@1.1.0 with: - path: './gradle.properties' - property: 'cf_release_type' + path: "gradle.properties" + properties: "minecraft_version forge_version" - - name: Build Version - id: build - run: | - buildver=$(git describe --tags --match v* | cut -d- -f2) - echo "build = $buildver" - echo "buildver=$buildver" >> $GITHUB_OUTPUT tests: name: Gradle Tests runs-on: ubuntu-20.04 @@ -53,41 +51,37 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Unshallow and Get Tags - run: git fetch --prune --unshallow --tags - - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: "17" + distribution: temurin + java-version: 17 + + - name: Prepare Gradle + uses: gradle/gradle-build-action@v2 - - name: Cache Gradle packages - uses: actions/cache@v2 + - name: Datagen + uses: gradle/gradle-build-action@v2 with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle- - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Create datagen assets - continue-on-error: true - run: ./gradlew runData + arguments: runData env: - CM_RELEASE: false - CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: ${{ needs.vars.outputs.build }} + CM_VERSION: ${{ needs.vars.outputs.version }} + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Test JAR with GameTest Server - run: ./gradlew runGameTestServer + - name: Store Built Assets + if: success() + uses: actions/upload-artifact@v3 + with: + name: generated-data + path: forge-main/src/generated/resources + + - name: Game Tests + uses: gradle/gradle-build-action@v2 + with: + arguments: runGameTestServer env: - CM_RELEASE: false - CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: ${{ needs.vars.outputs.build }} + CM_VERSION: ${{ needs.vars.outputs.version }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -106,39 +100,87 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Unshallow and Get Tags - run: git fetch --prune --unshallow --tags - - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: "17" + distribution: temurin + java-version: 17 - - name: Cache Gradle packages - uses: actions/cache@v2 + - name: Pull Built Generated Data + uses: actions/download-artifact@v3 with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: ${{ runner.os }}-gradle- + name: generated-data + path: forge-main/src/generated/resources - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Publish + uses: gradle/gradle-build-action@v2 + with: + arguments: publish + env: + CM_VERSION: ${{ needs.vars.outputs.version }} + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Generate Resources - run: ./gradlew runData + get-package-info: + name: Get Latest Package Info + runs-on: ubuntu-22.04 + needs: [ publish-gh-package ] + outputs: + version: ${{ steps.download-info.outputs.version }} + steps: + - name: Download Package Info + id: download-info + uses: compactmods/dl-package-info@1.0.2 env: - CM_RELEASE: false - CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: ${{ needs.vars.outputs.build }} + GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + owner: compactmods + repo: compactmachines + group: dev.compactmods.compactmachines + filter: "^compactmachines-(?:[\\d\\.]+)-nightly.jar$" + outputFile: compactmachines-nightly.json + + - name: Read info into variable [latest] + id: info + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT + + - name: Download JAR and prepare artifacts + run: | + mkdir release + curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}" + mv compactmachines-nightly.json release/compactmachines-nightly.json + + - name: Add Artifact + uses: actions/upload-artifact@v3 + with: + name: release + path: release + + announce: + name: Discord Announcement + needs: [ vars, get-package-info ] + runs-on: ubuntu-22.04 + steps: + - name: Grab JAR and Info + uses: actions/download-artifact@v3 + with: + name: release + path: . - - name: Publish gradle nightly jar - run: ./gradlew publishAllLibsPublicationToGitHubPackagesRepository + - name: Read info into variable [latest] + id: info + run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT + + - name: Announce Release + uses: compactmods/discord-releaser@0.1.5 env: - CM_RELEASE: false - CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }} - CM_BUILD_NUM: ${{ needs.vars.outputs.build }} - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} + with: + filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}} + channel: ${{ secrets.NIGHTLY_CHANNEL_ID }} + modName: Compact Machines + modVersion: ${{ needs.get-package-info.outputs.version }} + thumbnail: https://media.forgecdn.net/avatars/10/602/635460270800375500.png + + forgeVersion: ${{ needs.vars.outputs.forgeVersion }} + mcVersion: ${{ needs.vars.outputs.mcVersion }} \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 From e3d24ef3829976e64e819f3a440253b1e2ec2982 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:27:06 -0400 Subject: [PATCH 45/85] [CI] Update multiple ubuntu versions, add publish step ID --- .github/workflows/ci-tests-nightly.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 92f12585..d1452c1f 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -15,7 +15,7 @@ on: jobs: vars: name: Get Variables - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: version: ${{steps.version.outputs.version}} mcVersion: ${{steps.gradle_props.outputs.minecraft_version}} @@ -38,14 +38,14 @@ jobs: - name: Read MC and Forge versions id: gradle_props - uses: christian-draeger/read-properties@1.1.0 + uses: christian-draeger/read-properties@1.1.1 with: path: "gradle.properties" properties: "minecraft_version forge_version" tests: name: Gradle Tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [ vars ] steps: - name: Checkout @@ -94,7 +94,8 @@ jobs: nightly: name: Publish Nightly - runs-on: ubuntu-20.04 + id: publish-gh-package + runs-on: ubuntu-22.04 needs: [ vars, tests ] steps: - name: Checkout From 1f741ea7d61c7b5ad7c94d46860b39c927c16536 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:28:43 -0400 Subject: [PATCH 46/85] [CI] Fix thing.. again --- .github/workflows/ci-tests-nightly.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index d1452c1f..1efb42f1 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -92,9 +92,8 @@ jobs: name: test-data path: run/gametest - nightly: - name: Publish Nightly - id: publish-gh-package + publish-gh-package: + name: Publish Github Package - Nightly runs-on: ubuntu-22.04 needs: [ vars, tests ] steps: From 530240e1ed1deca164b131877c00cc4db91c6329 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:34:05 -0400 Subject: [PATCH 47/85] [CI] Fix github actor/token env variables --- forge-builtin/build.gradle.kts | 4 ++-- forge-main/build.gradle.kts | 4 ++-- forge-tunnels-api/build.gradle.kts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/forge-builtin/build.gradle.kts b/forge-builtin/build.gradle.kts index 99544b39..bc2d2195 100644 --- a/forge-builtin/build.gradle.kts +++ b/forge-builtin/build.gradle.kts @@ -20,8 +20,8 @@ project.evaluationDependsOn(project(":forge-tunnels-api").path) repositories { maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { credentials { - username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") - password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN") } } } diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 2948b464..dc7bc847 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -78,8 +78,8 @@ repositories { maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { name = "Github PKG Core" credentials { - username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") - password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN") } } } diff --git a/forge-tunnels-api/build.gradle.kts b/forge-tunnels-api/build.gradle.kts index 27d0bb0e..f0e8355b 100644 --- a/forge-tunnels-api/build.gradle.kts +++ b/forge-tunnels-api/build.gradle.kts @@ -60,8 +60,8 @@ configure { repositories { maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { credentials { - username = project.findProperty("gpr.user") as String? ?: System.getenv("GH_PKG_USER") - password = project.findProperty("gpr.token") as String? ?: System.getenv("GH_PKG_TOKEN") + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN") } } } From 5103a0aa72f37c897a549d8e3f8113dfa75725d0 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:40:07 -0400 Subject: [PATCH 48/85] [CI] Do not force exit runData --- forge-main/build.gradle.kts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index dc7bc847..33e0cec1 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -221,7 +221,10 @@ minecraft { create("data") { taskName("runData") workingDirectory(file("run/data")) - forceExit(true) + + if(environment.containsKey("CI")) { + forceExit(false) + } args("--mod", mod_id) args("--existing", project.file("src/main/resources")) From 610fc7a73b1e8d554a80bbb66c5e30ef2375059a Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 02:43:57 -0400 Subject: [PATCH 49/85] runData? --- forge-main/build.gradle.kts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 33e0cec1..c8481bad 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -221,10 +221,7 @@ minecraft { create("data") { taskName("runData") workingDirectory(file("run/data")) - - if(environment.containsKey("CI")) { - forceExit(false) - } + forceExit(false) args("--mod", mod_id) args("--existing", project.file("src/main/resources")) From 97d819f3cc2a89dac10180f454c711f506f77068 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 03:12:19 -0400 Subject: [PATCH 50/85] Adjust jar-in-jar version pinning --- forge-main/build.gradle.kts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index c8481bad..5f493ad9 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -101,13 +101,17 @@ runDepends.forEach { dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - implementation("dev.compactmods.compactmachines:core-api:$coreVersion") - implementation("dev.compactmods.compactmachines:core:$coreVersion") - implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") + implementation("dev.compactmods.compactmachines:core-api:$coreVersion") { + jarJar.pin(this, coreVersion) + } + + implementation("dev.compactmods.compactmachines:core:$coreVersion") { + jarJar.pin(this, coreVersion) + } - jarJar("dev.compactmods.compactmachines", "core-api", coreVersion) - jarJar("dev.compactmods.compactmachines", "core", coreVersion) - jarJar("dev.compactmods.compactmachines", "tunnels-api", tunnelsApiVersion) + implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") { + jarJar.pin(this, tunnelsApiVersion) + } implementation(project(":forge-tunnels-api")) testImplementation(project(":forge-tunnels-api")) From 128351295ffefa9fb8541f55522c35a6a4372094 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 03:29:44 -0400 Subject: [PATCH 51/85] Clean up published artifacts and version code --- forge-builtin/build.gradle.kts | 1 - forge-main/build.gradle.kts | 39 +++++++++--------------------- forge-tunnels-api/build.gradle.kts | 27 +++++++-------------- 3 files changed, 20 insertions(+), 47 deletions(-) diff --git a/forge-builtin/build.gradle.kts b/forge-builtin/build.gradle.kts index bc2d2195..613f56aa 100644 --- a/forge-builtin/build.gradle.kts +++ b/forge-builtin/build.gradle.kts @@ -26,7 +26,6 @@ repositories { } } - dependencies { minecraft (group = "net.minecraftforge", name = "forge", version = "${minecraft_version}-${forge_version}") diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 5f493ad9..be650f35 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -1,16 +1,12 @@ import java.text.SimpleDateFormat import java.util.* -val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" - -val nightlyVersion: String = "${semver}.${buildNumber}-nightly" -val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) +val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" val coreVersion: String = property("core_version") as String val tunnelsApiVersion: String = property("tunnels_version") as String -var mod_id: String by extra +var modId: String by extra var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra @@ -22,9 +18,8 @@ plugins { } base { - archivesName.set(mod_id) - group = "dev.compactmods" - version = if(isRelease) semver else nightlyVersion + group = "dev.compactmods.compactmachines" + version = modVersion } java { @@ -206,7 +201,7 @@ minecraft { // } source(sourceSets.main.get()) - mods.create(mod_id) { + mods.create(modId) { source(sourceSets.main.get()) for (p in runDepends) source(p.sourceSets.main.get()) @@ -227,7 +222,7 @@ minecraft { workingDirectory(file("run/data")) forceExit(false) - args("--mod", mod_id) + args("--mod", modId) args("--existing", project.file("src/main/resources")) args("--all") args("--output", file("src/generated/resources/")) @@ -241,7 +236,7 @@ minecraft { forceExit(false) environment("CM5_TEST_RESOURCES", file("src/test/resources")) - mods.named(mod_id) { + mods.named(modId) { source(sourceSets.test.get()) } } @@ -265,13 +260,6 @@ tasks.withType { this.exclude("dev/compactmods/machines/datagen/**") this.exclude(".cache/**") -// // TODO - Switch to API jar when JarInJar supports it better -// val api = project(":forge-api").tasks.jar.get().archiveFile; -// from(api.map { zipTree(it) }) -// -// val tunnels = project(":forge-tunnels").tasks.jar.get().archiveFile; -// from(tunnels.map { zipTree(it) }) - manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) attributes(mapOf( @@ -301,20 +289,15 @@ artifacts { archives(tasks.jarJar.get()) } +val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactcrafting" publishing { - publications.register("releaseMain") { - artifactId = mod_id - groupId = "dev.compactmods" - - artifacts { - artifact(tasks.jar.get()) - artifact(tasks.jarJar.get()) - } + publications.register("forge") { + from(components.findByName("java")) } repositories { // GitHub Packages - maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + maven(PACKAGES_URL) { name = "GitHubPackages" credentials { username = System.getenv("GITHUB_ACTOR") diff --git a/forge-tunnels-api/build.gradle.kts b/forge-tunnels-api/build.gradle.kts index f0e8355b..96268e09 100644 --- a/forge-tunnels-api/build.gradle.kts +++ b/forge-tunnels-api/build.gradle.kts @@ -3,15 +3,12 @@ import net.minecraftforge.gradle.userdev.UserDevExtension import java.text.SimpleDateFormat import java.util.* +val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" + val coreVersion: String = property("core_version") as String val tunnelsApiVersion: String = property("tunnels_version") as String -val semver: String = System.getenv("CM_SEMVER_VERSION") ?: "9.9.9" -val buildNumber: String = System.getenv("CM_BUILD_NUM") ?: "0" -val nightlyVersion: String = "${semver}.${buildNumber}-nightly" -val isRelease: Boolean = (System.getenv("CM_RELEASE") ?: "false").equals("true", true) - -var mod_id: String by extra +var modId: String by extra plugins { id("idea") @@ -22,9 +19,8 @@ plugins { } base { - archivesName.set(mod_id) - group = "dev.compactmods" - version = if(isRelease) semver else nightlyVersion + group = "dev.compactmods.compactmachines" + version = modVersion } java { @@ -107,20 +103,15 @@ artifacts { archives(tasks.named("sourcesJar").get()) } +val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines" publishing { - publications.register("releaseApi") { - artifactId = "compactmachines" - groupId = "dev.compactmods" - - artifacts { - artifact(tasks.jar.get()) - artifact(tasks.named("sourcesJar").get()) - } + publications.register("forge-tunnels-api") { + from(components.findByName("java")) } repositories { // GitHub Packages - maven("https://maven.pkg.github.com/CompactMods/CompactMachines") { + maven(PACKAGES_URL) { name = "GitHubPackages" credentials { username = System.getenv("GITHUB_ACTOR") From 21ec5cb1e52724bc86c030bd9d109f1c7e432c29 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 03:34:56 -0400 Subject: [PATCH 52/85] Fix mod_id mappings --- forge-main/build.gradle.kts | 2 +- forge-tunnels-api/build.gradle.kts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index be650f35..5ac56c3c 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -6,7 +6,7 @@ val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" val coreVersion: String = property("core_version") as String val tunnelsApiVersion: String = property("tunnels_version") as String -var modId: String by extra +var modId = property("mod_version") as String var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra diff --git a/forge-tunnels-api/build.gradle.kts b/forge-tunnels-api/build.gradle.kts index 96268e09..65f3f7e1 100644 --- a/forge-tunnels-api/build.gradle.kts +++ b/forge-tunnels-api/build.gradle.kts @@ -8,8 +8,6 @@ val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" val coreVersion: String = property("core_version") as String val tunnelsApiVersion: String = property("tunnels_version") as String -var modId: String by extra - plugins { id("idea") id("eclipse") From cb0d4b21fa3f34cb90a8eb8d7bbca862cca10269 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 03:38:06 -0400 Subject: [PATCH 53/85] Typo.. --- forge-main/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 5ac56c3c..85caeda9 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -6,7 +6,7 @@ val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" val coreVersion: String = property("core_version") as String val tunnelsApiVersion: String = property("tunnels_version") as String -var modId = property("mod_version") as String +var modId = property("mod_id") as String var minecraft_version: String by extra var forge_version: String by extra var parchment_version: String by extra From d5afd5f0b9190d7a768abc6c234cd40a5cdd6728 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 03:54:25 -0400 Subject: [PATCH 54/85] Adjust forge-main's artifact ID, debug package info upload --- .github/workflows/ci-tests-nightly.yml | 7 +++++++ forge-main/build.gradle.kts | 1 + 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 1efb42f1..6de7e34e 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -140,6 +140,13 @@ jobs: filter: "^compactmachines-(?:[\\d\\.]+)-nightly.jar$" outputFile: compactmachines-nightly.json + - name: Store Package Info + if: success() + uses: actions/upload-artifact@v3 + with: + name: package-info + path: compactmachines-nightly.json + - name: Read info into variable [latest] id: info run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 85caeda9..35d454d9 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -292,6 +292,7 @@ artifacts { val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactcrafting" publishing { publications.register("forge") { + artifactId = modId from(components.findByName("java")) } From 0ff78e5dcb808032a4f9c05f17d80709cf108943 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 04:28:20 -0400 Subject: [PATCH 55/85] Add forge to artifact names, rm CM_RELEASE from nightly workflow --- .github/workflows/ci-tests-nightly.yml | 3 +-- forge-main/build.gradle.kts | 5 +++-- forge-tunnels-api/build.gradle.kts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 6de7e34e..62ad0977 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -2,7 +2,6 @@ name: Gradle Tests and Nightly (CI) env: GH_PKG_URL: "https://maven.pkg.github.com/${{ github.repository }}" - CM_RELEASE: false on: workflow_dispatch: @@ -137,7 +136,7 @@ jobs: owner: compactmods repo: compactmachines group: dev.compactmods.compactmachines - filter: "^compactmachines-(?:[\\d\\.]+)-nightly.jar$" + filter: "^compactmachines-forge-(?:[\\d\\.]+)-nightly.jar$" outputFile: compactmachines-nightly.json - name: Store Package Info diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 35d454d9..7aea0f09 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -292,8 +292,9 @@ artifacts { val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactcrafting" publishing { publications.register("forge") { - artifactId = modId - from(components.findByName("java")) + artifactId = "$modId-forge" + artifact(tasks.getByName("jar")) + artifact(tasks.getByName("jarJar")) } repositories { diff --git a/forge-tunnels-api/build.gradle.kts b/forge-tunnels-api/build.gradle.kts index 65f3f7e1..e579580f 100644 --- a/forge-tunnels-api/build.gradle.kts +++ b/forge-tunnels-api/build.gradle.kts @@ -88,7 +88,7 @@ tasks.withType { } tasks.jar { - archiveClassifier.set("api") + archiveClassifier.set("") finalizedBy("reobfJar") } From e757f42b00166e71d498a9c7fd8bc1cad2164a57 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 25 Mar 2023 05:11:13 -0400 Subject: [PATCH 56/85] Fix some includes, rename "chunkloader" upgrade to "wip" --- .../upgrades/{chunkloader.json => wip.json} | 0 forge-main/build.gradle.kts | 25 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) rename forge-builtin/src/main/resources/compactmachines/upgrades/{chunkloader.json => wip.json} (100%) diff --git a/forge-builtin/src/main/resources/compactmachines/upgrades/chunkloader.json b/forge-builtin/src/main/resources/compactmachines/upgrades/wip.json similarity index 100% rename from forge-builtin/src/main/resources/compactmachines/upgrades/chunkloader.json rename to forge-builtin/src/main/resources/compactmachines/upgrades/wip.json diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 7aea0f09..b42b3e29 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -83,7 +83,6 @@ val jei_version: String? by extra val jei_mc_version: String by extra val curios_version: String? by extra -jarJar.enable() val runDepends: List = listOf( project(":forge-tunnels-api"), project(":forge-builtin") @@ -96,17 +95,13 @@ runDepends.forEach { dependencies { minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") - implementation("dev.compactmods.compactmachines:core-api:$coreVersion") { - jarJar.pin(this, coreVersion) - } + implementation("dev.compactmods.compactmachines:core-api:$coreVersion") + implementation("dev.compactmods.compactmachines:core:$coreVersion") + implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") - implementation("dev.compactmods.compactmachines:core:$coreVersion") { - jarJar.pin(this, coreVersion) - } - - implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") { - jarJar.pin(this, tunnelsApiVersion) - } + jarJar("dev.compactmods.compactmachines", "core", "[$coreVersion]") + jarJar("dev.compactmods.compactmachines", "core-api", "[$coreVersion]") + jarJar("dev.compactmods.compactmachines", "tunnels-api", "[$tunnelsApiVersion]") implementation(project(":forge-tunnels-api")) testImplementation(project(":forge-tunnels-api")) @@ -260,6 +255,13 @@ tasks.withType { this.exclude("dev/compactmods/machines/datagen/**") this.exclude(".cache/**") + val forgeBuiltin = project(":forge-builtin").tasks.jar.get().archiveFile; + val forgeTunnelsApi = project(":forge-builtin").tasks.jar.get().archiveFile; + from(forgeBuiltin.map { zipTree(it) }) + from(forgeTunnelsApi.map { zipTree(it) }) + + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + manifest { val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) attributes(mapOf( @@ -279,6 +281,7 @@ tasks.jar { finalizedBy("reobfJar") } +jarJar.enable() tasks.jarJar { archiveClassifier.set("") finalizedBy("reobfJarJar") From 3dd9467a557eb09f79245a97a7986e0e8d26a830 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 9 Apr 2023 03:35:08 -0400 Subject: [PATCH 57/85] Builds locally.. #githubPls --- forge-main/build.gradle.kts | 23 ++++++++++++++++++++--- gradle.properties | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index b42b3e29..de438224 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -99,9 +99,17 @@ dependencies { implementation("dev.compactmods.compactmachines:core:$coreVersion") implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") - jarJar("dev.compactmods.compactmachines", "core", "[$coreVersion]") - jarJar("dev.compactmods.compactmachines", "core-api", "[$coreVersion]") - jarJar("dev.compactmods.compactmachines", "tunnels-api", "[$tunnelsApiVersion]") + jarJar("dev.compactmods.compactmachines", "core", "[$coreVersion]", classifier = "srg") { + isTransitive = false + } + + jarJar("dev.compactmods.compactmachines", "core-api", "[$coreVersion]", classifier = "srg") { + isTransitive = false + } + + jarJar("dev.compactmods.compactmachines", "tunnels-api", "[$tunnelsApiVersion]", classifier = "srg") { + isTransitive = false + } implementation(project(":forge-tunnels-api")) testImplementation(project(":forge-tunnels-api")) @@ -287,6 +295,15 @@ tasks.jarJar { finalizedBy("reobfJarJar") } +tasks.reobfJarJar { +// doFirst { +// println("Reobfuscating JarJar") +// this.inputs.files.forEach { +// println(it.path) +// } +// } +} + artifacts { archives(tasks.jar.get()) archives(tasks.jarJar.get()) diff --git a/gradle.properties b/gradle.properties index 9851eec7..1ed4e463 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.0.11 -tunnels_version=2.0.11 +core_version=2.0.15 +tunnels_version=2.0.15 # Curseforge cf_project=224218 From 62d0c1f04a41be61a8fde74aaa26b8a87416b5bc Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 11 Apr 2023 23:38:24 -0400 Subject: [PATCH 58/85] Fix issues with bound machine item binding, remove constructor params --- .../machines/forge/machine/Machines.java | 4 ++-- .../machine/item/BoundCompactMachineItem.java | 17 ++++------------- .../machine/item/UnboundCompactMachineItem.java | 6 +++--- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java index 7f1fcbe9..2e5fd610 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java @@ -68,11 +68,11 @@ public class Machines { () -> new LegacyCompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); public static final RegistryObject BOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("machine", - () -> new BoundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); + () -> new BoundCompactMachineItem(MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); public static final RegistryObject UNBOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("new_machine", - () -> new UnboundCompactMachineItem(MACHINE_BLOCK.get(), MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); + () -> new UnboundCompactMachineItem(MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); public static final RegistryObject> MACHINE_TILE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.BLOCK_ENTITY.getPath(), () -> BlockEntityType.Builder.of(CompactMachineBlockEntity::new, diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java index ea097fce..1796a16f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java @@ -1,24 +1,18 @@ package dev.compactmods.machines.forge.machine.item; -import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.ICompactMachineItem; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -28,11 +22,8 @@ public class BoundCompactMachineItem extends BlockItem implements ICompactMachin public static final String ROOM_NBT = "room_pos"; public static final String ROOM_DIMENSIONS_NBT = "room_dimensions"; - public static Holder REFERENCE_HOLDER = Holder.Reference.createStandAlone(Registry.ITEM, - ResourceKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(Constants.MOD_ID, "machine"))); - - public BoundCompactMachineItem(Block blockIn, Properties builder) { - super(blockIn, builder); + public BoundCompactMachineItem(Properties builder) { + super(Machines.MACHINE_BLOCK.get(), builder); } @Deprecated(forRemoval = true) @@ -66,7 +57,7 @@ public static void setRoom(ItemStack stack, String room) { } public static ItemStack createForRoom(IBasicRoomInfo room) { - ItemStack item = new ItemStack(REFERENCE_HOLDER); + ItemStack item = new ItemStack(Machines.BOUND_MACHINE_BLOCK_ITEM.get()); setRoom(item, room.code()); ICompactMachineItem.setColor(item, room.color()); return item; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java index 1d9286dd..eea1d821 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java @@ -4,6 +4,7 @@ import dev.compactmods.machines.api.machine.MachineIds; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; @@ -19,7 +20,6 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,8 +35,8 @@ public class UnboundCompactMachineItem extends BlockItem implements ICompactMach public static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; - public UnboundCompactMachineItem(Block blockIn, Properties builder) { - super(blockIn, builder); + public UnboundCompactMachineItem(Properties builder) { + super(Machines.MACHINE_BLOCK.get(), builder); } @NotNull From 0a50bb9109f7e10f16977ee2cb44e61ead46ccc4 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 12 Apr 2023 01:30:47 -0400 Subject: [PATCH 59/85] Update stale settings to be less aggressive (90 days of stale, labels) --- .github/stale.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/stale.yml b/.github/stale.yml index 29daea6e..c33c1911 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,17 +1,25 @@ # Number of days of inactivity before an issue becomes stale daysUntilStale: 45 + # Number of days of inactivity before a stale issue is closed -daysUntilClose: 14 +daysUntilClose: 30 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: + - triage + - awaiting-user + # Issues with these labels will never be considered stale exemptLabels: - - pinned - - security -# Label to use when marking an issue as stale + - verified + - ready-for-release + staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable +exemptMilestones: true + markComment: > This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable + recent activity. It will be closed in one month if no further activity occurs. + Thank you for your contributions. + closeComment: false From e8b041e717a229ec4232845a4db83e4e29d1be19 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 12 Apr 2023 08:41:01 -0400 Subject: [PATCH 60/85] Tunnel graph serialization and tests --- .../machines/forge/CompactMachines.java | 3 - .../machines/forge/GraphCommon.java | 24 -- .../machines/forge/Registries.java | 29 +- .../migration/Pre520RoomDataMigrator.java | 6 +- .../block/CompactMachineBlockEntity.java | 26 +- .../machines/forge/room/Rooms.java | 20 +- .../machines/forge/tunnel/Tunnels.java | 19 +- .../tunnel/graph/GraphEdgeLookupResult.java | 9 + .../tunnel/graph/TunnelConnectionGraph.java | 276 ++++-------------- .../TunnelGraphEdgeDeserializationResult.java | 8 + .../tunnel/graph/nbt/TunnelGraphNbtKeys.java | 22 ++ .../graph/nbt/TunnelGraphNbtSerializer.java | 210 +++++++++++++ .../TunnelGraphNodeDeserializationResult.java | 9 + .../TunnelGraphNodeSerializationResult.java | 9 + .../upgrade/graph/RoomUpgradeConnection.java | 20 +- .../tunnel/TunnelGraphSerializationTests.java | 106 +++++++ .../machines/test/util/NbtTestUtils.java | 22 ++ gradle.properties | 4 +- 18 files changed, 463 insertions(+), 359 deletions(-) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/util/NbtTestUtils.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index c49212d7..2a221b75 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -88,8 +88,6 @@ private static void doRegistration() { Registries.CONTAINERS.register(bus); Registries.ROOM_TEMPLATES.register(bus); Registries.UPGRADES.register(bus); - Registries.NODE_TYPES.register(bus); - Registries.EDGE_TYPES.register(bus); Registries.COMMAND_ARGUMENT_TYPES.register(bus); Registries.LOOT_FUNCS.register(bus); // Registries.VILLAGERS.register(bus); @@ -127,7 +125,6 @@ private static void preparePackages() { Dimension.prepare(); Rooms.prepare(); MachineRoomUpgrades.prepare(); - GraphCommon.prepare(); Commands.prepare(); LootFunctions.prepare(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java b/forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java deleted file mode 100644 index ac4dd9e0..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/GraphCommon.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.compactmods.machines.forge; - -import dev.compactmods.machines.graph.DimensionGraphNode; -import dev.compactmods.machines.graph.SimpleGraphNodeType; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.machine.graph.MachineRoomEdge; -import dev.compactmods.machines.room.graph.RoomReferenceNode; -import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; - -public class GraphCommon { - - static { - Registries.NODE_TYPES.register("machine", SimpleGraphNodeType.supplier(CompactMachineNode.CODEC)); - Registries.NODE_TYPES.register("dimension", SimpleGraphNodeType.supplier(DimensionGraphNode.CODEC)); - Registries.NODE_TYPES.register("room", SimpleGraphNodeType.supplier(RoomReferenceNode.CODEC)); - Registries.NODE_TYPES.register("room_upgrade", SimpleGraphNodeType.supplier(RoomUpgradeGraphNode.CODEC)); - - Registries.EDGE_TYPES.register("machine_link", () -> MachineRoomEdge.EDGE_TYPE); - } - - public static void prepare() { - - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java b/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java index 5c5e3ff3..08ca248f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/Registries.java @@ -3,15 +3,10 @@ import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.IGraphNodeType; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; import net.minecraft.commands.synchronization.ArgumentTypeInfo; import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.npc.VillagerProfession; import net.minecraft.world.inventory.MenuType; @@ -21,11 +16,6 @@ import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.RegistryBuilder; -import org.jetbrains.annotations.ApiStatus; - -import java.util.function.Supplier; import static dev.compactmods.machines.api.core.Constants.MOD_ID; @@ -45,21 +35,6 @@ public class Registries { // MachineRoomUpgrades public static final DeferredRegister UPGRADES = DeferredRegister.create(CMRegistryKeys.ROOM_UPGRADES, MOD_ID); - // Graph - @ApiStatus.Internal - public static final ResourceKey>> NODES_REG_KEY = ResourceKey - .createRegistryKey(new ResourceLocation(MOD_ID, "graph_nodes")); - - @ApiStatus.Internal - public static final ResourceKey>> EDGES_REG_KEY = ResourceKey - .createRegistryKey(new ResourceLocation(MOD_ID, "graph_edges")); - - public static final DeferredRegister> NODE_TYPES = DeferredRegister.create(NODES_REG_KEY, MOD_ID); - public static final Supplier>> NODE_TYPE_REG = NODE_TYPES.makeRegistry(RegistryBuilder::new); - - public static final DeferredRegister> EDGE_TYPES = DeferredRegister.create(EDGES_REG_KEY, MOD_ID); - public static final Supplier>> EDGE_TYPE_REG = EDGE_TYPES.makeRegistry(RegistryBuilder::new); - // Commands public static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, MOD_ID); @@ -67,7 +42,7 @@ public class Registries { public static final DeferredRegister LOOT_FUNCS = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, MOD_ID); public static DeferredRegister ROOM_TEMPLATES = DeferredRegister - .create(Rooms.TEMPLATE_REG_KEY, Constants.MOD_ID); + .create(CMRegistryKeys.ROOM_TEMPLATES, Constants.MOD_ID); // Villagers public static final DeferredRegister VILLAGERS = DeferredRegister.create(ForgeRegistries.VILLAGER_PROFESSIONS, Constants.MOD_ID); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java index ba52b226..76b36924 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java @@ -63,6 +63,10 @@ public record RoomDataPre520(UUID owner, BlockPos center, Vec3 spawn, RoomSize s public record RoomDataLoadResult(HashMap oldRoomData, HashMap roomChunkLookup) { } + public static String getOldTunnelFilename(ChunkPos oldRoom) { + return "tunnels_%s_%s".formatted(oldRoom.x, oldRoom.z); + } + public static RoomDataLoadResult loadOldRoomData(DimensionDataStorage dataStore) throws IOException { AtomicReference result = new AtomicReference<>(); SavedDataHelper.processFile(dataStore, ROOM_DATA_NAME, nbt -> result.set(loadOldRoomData(nbt))); @@ -148,7 +152,7 @@ public static void migrateTunnelFiles(LevelStorageSource.LevelDirectory levelDir final var dataStore = CompactDimension.getDataStorage(levelDirectory); for(final var room : roomChunkLookup.entrySet()) { - final var prevFilename = TunnelConnectionGraph.getOldTunnelFilename(room.getKey()); + final var prevFilename = getOldTunnelFilename(room.getKey()); final var oldFile = dataStore.getDataFile(prevFilename); final var newFile = dataStore.getDataFile(TunnelConnectionGraph.getDataFilename(room.getValue())); if(oldFile.exists()) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java index a2d82827..7d4b0eb4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java @@ -1,6 +1,5 @@ package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.IMachineBlockEntity; @@ -11,14 +10,14 @@ import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; -import dev.compactmods.machines.machine.BasicRoomInfo; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.machine.BasicRoomInfo; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.tunnel.graph.TunnelNode; import dev.compactmods.machines.util.NbtUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -38,7 +37,6 @@ import java.lang.ref.WeakReference; import java.util.Optional; import java.util.UUID; -import java.util.stream.Stream; public class CompactMachineBlockEntity extends BlockEntity implements IMachineBlockEntity { @@ -313,22 +311,6 @@ public void disconnect() { } } - public Stream getTunnels(Direction dir) { - if (level == null || roomCode == null) return Stream.empty(); - - if (level instanceof ServerLevel sl) { - try { - final ServerLevel compactDim = CompactDimension.forServer(sl.getServer()); - final var tunnelGraph = TunnelConnectionGraph.forRoom(compactDim, roomCode); - return tunnelGraph.getTunnelsForSide(getLevelPosition(), dir).map(TunnelNode::position); - } catch (MissingDimensionException e) { - return Stream.empty(); - } - } - - return Stream.empty(); - } - public Optional getTunnelGraph() { if (level == null || roomCode == null) return Optional.empty(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java index 94b298dd..e9f213d2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/Rooms.java @@ -1,19 +1,11 @@ package dev.compactmods.machines.forge.room; -import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; -import dev.compactmods.machines.room.graph.RoomChunkEdge; -import dev.compactmods.machines.room.graph.RoomChunkNode; -import dev.compactmods.machines.room.graph.RoomMetadataNode; -import dev.compactmods.machines.room.graph.RoomOwnerEdge; -import dev.compactmods.machines.room.graph.RoomOwnerNode; -import dev.compactmods.machines.room.graph.RoomSpawnNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.server.MinecraftServer; @@ -33,16 +25,6 @@ public class Rooms { .makeRegistry(() -> new RegistryBuilder() .dataPackRegistry(RoomTemplate.CODEC, RoomTemplate.CODEC)); - static { - Registries.NODE_TYPES.register("room_spawn", SimpleGraphNodeType.supplier(RoomSpawnNode.CODEC)); - Registries.NODE_TYPES.register("room_owner", SimpleGraphNodeType.supplier(RoomOwnerNode.CODEC)); - Registries.NODE_TYPES.register("room_chunk", SimpleGraphNodeType.supplier(RoomChunkNode.CODEC)); - Registries.NODE_TYPES.register("room_meta", SimpleGraphNodeType.supplier(RoomMetadataNode.CODEC)); - - Registries.EDGE_TYPES.register("room_owner", SimpleGraphEdgeType.supplier(RoomOwnerEdge.CODEC)); - Registries.EDGE_TYPES.register("room_chunk", SimpleGraphEdgeType.supplier(RoomChunkEdge.CODEC)); - } - public static void prepare() { } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java index 0469ad70..0e07af1b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java @@ -1,15 +1,9 @@ package dev.compactmods.machines.forge.tunnel; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.Registries; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.graph.IGraphNodeType; -import dev.compactmods.machines.graph.SimpleGraphNodeType; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; -import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; -import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -30,10 +24,6 @@ public class Tunnels { public static final Supplier> TUNNEL_DEF_REGISTRY = Registries.TUNNEL_DEFINITIONS .makeRegistry(RegistryBuilder::new); - public static final RegistryObject> TUNNEL_NODE = Registries.NODE_TYPES - .register("tunnel", SimpleGraphNodeType.supplier(TunnelNode.CODEC)); - public static final RegistryObject> TUNNEL_TYPE_NODE = Registries.NODE_TYPES - .register("tunnel_type", SimpleGraphNodeType.supplier(TunnelTypeNode.CODEC)); public static boolean isRegistered(ResourceLocation id) { return TUNNEL_DEF_REGISTRY.get().containsKey(id); @@ -45,13 +35,6 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { return Tunnels.UNKNOWN.get(); } - // Graph Objects - static { - // Tunnel edges - Registries.EDGE_TYPES.register("tunnel_type", () -> TunnelTypeEdge.EDGE_TYPE); - Registries.EDGE_TYPES.register("tunnel_machine", () -> TunnelMachineEdge.EDGE_TYPE); - } - // ================================================================================================================ // TUNNELS // ================================================================================================================ diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java new file mode 100644 index 00000000..0d358eda --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.forge.tunnel.graph; + +import com.google.common.graph.EndpointPair; +import dev.compactmods.machines.graph.IGraphEdge; +import dev.compactmods.machines.graph.IGraphNode; + +@SuppressWarnings("UnstableApiUsage") +public record GraphEdgeLookupResult>(EndpointPair> endpoints, E edgeValue) { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java index b76413de..a0389c29 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java @@ -3,21 +3,16 @@ import com.google.common.graph.EndpointPair; import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; -import com.mojang.serialization.Codec; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.codec.NbtListCollector; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtSerializer; import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.graph.IGraphNodeType; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.MachineRoomEdge; -import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; import dev.compactmods.machines.tunnel.graph.TunnelMachineInfo; import dev.compactmods.machines.tunnel.graph.TunnelNode; @@ -27,15 +22,12 @@ import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.saveddata.SavedData; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.INBTSerializable; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import javax.annotation.Nonnull; import java.util.HashMap; @@ -43,21 +35,26 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; import java.util.stream.Stream; /** * Represents a room's tunnel connections in a graph-style format. * This should be accessed through the saved data for specific machine room chunks. + * + * Graph Types Used: + * @see TunnelNode + * @see TunnelTypeNode + * @see CompactMachineNode + * @see TunnelMachineEdge + * @see TunnelTypeEdge */ -public class TunnelConnectionGraph extends SavedData implements INBTSerializable, RoomTunnelConnections { +@SuppressWarnings("UnstableApiUsage") +public class TunnelConnectionGraph extends SavedData implements RoomTunnelConnections { /** * The full data graph. Contains tunnel nodes, machine ids, and tunnel type information. */ - private final MutableValueGraph, IGraphEdge> graph; + private final MutableValueGraph, IGraphEdge> graph; /** * Quick access to tunnel information for specific locations. @@ -74,7 +71,9 @@ public class TunnelConnectionGraph extends SavedData implements INBTSerializable */ private final Map tunnelTypes; - private TunnelConnectionGraph() { + private static final Logger LOGS = LogManager.getLogger("tunnel_graph"); + + public TunnelConnectionGraph() { graph = ValueGraphBuilder .directed() .build(); @@ -86,7 +85,7 @@ private TunnelConnectionGraph() { private TunnelConnectionGraph(CompoundTag nbt) { this(); - this.deserializeNBT(nbt); + TunnelGraphNbtSerializer.deserialize(this, nbt); } public static TunnelConnectionGraph forRoom(ServerLevel compactDim, String room) { @@ -101,14 +100,9 @@ public static TunnelConnectionGraph forRoom(ServerLevel compactDim, String room) @Nonnull @Override public CompoundTag save(CompoundTag tag) { - var gData = this.serializeNBT(); - tag.put("graph", gData); - return tag; - } - - @Deprecated(forRemoval = true, since = "5.2.0") - public static String getOldTunnelFilename(ChunkPos oldRoom) { - return "tunnels_%s_%s".formatted(oldRoom.x, oldRoom.z); + cleanupOrphans(); + var gData = TunnelGraphNbtSerializer.serialize(this); + return tag.merge(gData); } public static String getDataFilename(String room) { @@ -150,7 +144,7 @@ public boolean registerTunnel(BlockPos tunnelPos, TunnelDefinition type, GlobalP var tunnelNode = getOrCreateTunnelNode(tunnelPos); if (graph.hasEdgeConnecting(tunnelNode, machineNode)) { // connection already formed between the tunnel at pos and the machine - CompactMachines.LOGGER.info("Tunnel already registered for machine {} at position {}.", + LOGS.info("Tunnel already registered for machine {} at position {}.", machine, tunnelPos); @@ -160,19 +154,15 @@ public boolean registerTunnel(BlockPos tunnelPos, TunnelDefinition type, GlobalP var tunnelTypeNode = getOrCreateTunnelTypeNode(type); // no tunnels registered for side yet - free to make new tunnel node - var newTM = graph.putEdgeValue(tunnelNode, machineNode, new TunnelMachineEdge(side)); - var newTT = graph.putEdgeValue(tunnelNode, tunnelTypeNode, new TunnelTypeEdge()); + graph.putEdgeValue(tunnelNode, machineNode, new TunnelMachineEdge(side)); + graph.putEdgeValue(tunnelNode, tunnelTypeNode, new TunnelTypeEdge()); setDirty(); return true; } - private void createTunnelAndLink(TunnelNode newTunnel, Direction side, CompactMachineNode machNode, TunnelTypeNode typeNode) { - - } - @Nonnull - public TunnelNode getOrCreateTunnelNode(BlockPos tunnelPos) { + protected TunnelNode getOrCreateTunnelNode(BlockPos tunnelPos) { if (tunnels.containsKey(tunnelPos)) return tunnels.get(tunnelPos); @@ -184,7 +174,7 @@ public TunnelNode getOrCreateTunnelNode(BlockPos tunnelPos) { return newTunnel; } - public CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { + protected CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { var machineRegistered = machines.containsKey(machine); CompactMachineNode node; if (!machineRegistered) { @@ -199,7 +189,7 @@ public CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { return node; } - public TunnelTypeNode getOrCreateTunnelTypeNode(TunnelDefinition definition) { + protected TunnelTypeNode getOrCreateTunnelTypeNode(TunnelDefinition definition) { final ResourceLocation id = Tunnels.getRegistryId(definition); if (tunnelTypes.containsKey(id)) @@ -219,13 +209,7 @@ public int size() { return graph.nodes().size(); } - @Deprecated(forRemoval = true, since = "5.0.0") - public Stream getTunnelNodesByType(TunnelDefinition type) { - final var id = Tunnels.getRegistryId(type); - return getTunnelNodesByType(id); - } - - public Stream getTunnelNodesByType(ResourceLocation type) { + protected Stream getTunnelNodesByType(ResourceLocation type) { var defNode = tunnelTypes.get(type); if (defNode == null) return Stream.empty(); @@ -236,14 +220,6 @@ public Stream getTunnelNodesByType(ResourceLocation type) { .map(TunnelNode.class::cast); } - @Deprecated(forRemoval = true, since = "5.0.0") - public Set getTunnelsByType(TunnelDefinition type) { - return getTunnelNodesByType(type) - .map(TunnelNode::position) - .map(BlockPos::immutable) - .collect(Collectors.toSet()); - } - public Optional getTunnelSide(BlockPos pos) { if (!tunnels.containsKey(pos)) return Optional.empty(); @@ -284,144 +260,6 @@ public Stream tunnels() { .map(Optional::get); } - public Stream> nodes() { - return graph.nodes().stream(); - } - - @Override - public CompoundTag serializeNBT() { - cleanupOrphans(); - - CompoundTag tag = new CompoundTag(); - - HashMap nodeIds = new HashMap<>(); - - final var nodeReg = Registries.NODE_TYPE_REG.get(); - final Codec nodeRegCodec = nodeReg.getCodec() - .dispatchStable(IGraphNode::getType, IGraphNodeType::codec); - - final Codec edgeRegCodec = Registries.EDGE_TYPE_REG.get() - .getCodec() - .dispatchStable(IGraphEdge::getEdgeType, IGraphEdgeType::codec); - - final var nodeList = nodes().map(node -> { - CompoundTag nodeInfo = new CompoundTag(); - - var encoded = nodeRegCodec.encodeStart(NbtOps.INSTANCE, node); - var nodeEncoded = encoded.getOrThrow(false, CompactMachines.LOGGER::error); - - var id = UUID.randomUUID(); - nodeInfo.putUUID("id", id); - nodeInfo.put("data", nodeEncoded); - nodeIds.put(node, id); - return nodeInfo; - }).collect(NbtListCollector.toNbtList()); - - tag.put("nodes", nodeList); - - ListTag edges = new ListTag(); - for (var edge : graph.edges()) { - CompoundTag edgeInfo = new CompoundTag(); - - //noinspection OptionalGetWithoutIsPresent - var realEdge = graph.edgeValue(edge).get(); - - var encoded = edgeRegCodec.encodeStart(NbtOps.INSTANCE, realEdge); - var edgeEnc = encoded.getOrThrow(false, CompactMachines.LOGGER::error); - - edgeInfo.putUUID("from", nodeIds.get(edge.nodeU())); - edgeInfo.putUUID("to", nodeIds.get(edge.nodeV())); - edgeInfo.put("data", edgeEnc); - - edges.add(edgeInfo); - } - - tag.put("edges", edges); - - return tag; - } - - @Override - public void deserializeNBT(CompoundTag tag) { - if (!tag.contains("graph")) return; - - final var graphRoot = tag.getCompound("graph"); - - final var nodeReg = Registries.NODE_TYPE_REG.get(); - final var nodeRegCodec = nodeReg.getCodec() - .dispatchStable(IGraphNode::getType, IGraphNodeType::codec); - - final var edgeRegCodec = Registries.EDGE_TYPE_REG.get().getCodec() - .dispatchStable(IGraphEdge::getEdgeType, IGraphEdgeType::codec); - - final var nodes = graphRoot.getList("nodes", Tag.TAG_COMPOUND); - HashMap nodeMap = new HashMap<>(nodes.size()); - - if (graphRoot.contains("nodes", Tag.TAG_LIST)) { - for (var nodeNbt : nodes) { - if (!(nodeNbt instanceof CompoundTag nt)) - continue; - - if (!nt.contains("data") || !nt.hasUUID("id")) - continue; - - UUID nodeId = nt.getUUID("id"); - CompoundTag nodeData = nt.getCompound("data"); - - var result = nodeRegCodec.parse(NbtOps.INSTANCE, nodeData) - .getOrThrow(false, CompactMachines.LOGGER::error); - - if (result == null) continue; - - try { - if (result instanceof CompactMachineNode m) { - graph.addNode(m); - machines.put(m.dimpos(), m); - nodeMap.putIfAbsent(nodeId, m); - } - - if (result instanceof TunnelNode t) { - graph.addNode(t); - tunnels.put(t.position(), t); - nodeMap.putIfAbsent(nodeId, t); - } - - if (result instanceof TunnelTypeNode tt) { - graph.addNode(tt); - tunnelTypes.put(tt.id(), tt); - nodeMap.putIfAbsent(nodeId, tt); - } - - } catch (RuntimeException ignored) { - } - } - } - - // No edges - skip rest of processing - if (graphRoot.contains("edges", Tag.TAG_LIST)) { - final var edgeTags = graphRoot.getList("edges", Tag.TAG_COMPOUND); - for (var edgeTag : edgeTags) { - if (!(edgeTag instanceof CompoundTag edge)) - continue; - - // invalid edge data - if (!edge.contains("data") || !edge.hasUUID("from") || !edge.hasUUID("to")) - continue; - - var nodeFrom = nodeMap.get(edge.getUUID("from")); - var nodeTo = nodeMap.get(edge.getUUID("to")); - - if (nodeFrom == null || nodeTo == null) - continue; - - var edgeData = edgeRegCodec.parse(NbtOps.INSTANCE, edge.getCompound("data")) - .getOrThrow(false, CompactMachines.LOGGER::error); - - graph.putEdgeValue(nodeFrom, nodeTo, edgeData); - } - } - } - public boolean hasTunnel(BlockPos location) { return tunnels.containsKey(location); } @@ -489,7 +327,7 @@ public Stream getTypesForSide(GlobalPos machine, Direction sid .distinct(); } - public Stream getTunnelsForSide(GlobalPos machine, Direction side) { + protected Stream getTunnelsForSide(GlobalPos machine, Direction side) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -503,12 +341,6 @@ public Stream getTunnelsForSide(GlobalPos machine, Direction side) { .map(TunnelNode.class::cast); } - @Deprecated(forRemoval = true, since = "5.0.0") - public Stream getTunnelSides(TunnelDefinition type) { - final var id = Tunnels.getRegistryId(type); - return getTunnelSides(id); - } - public Stream getTunnelSides(ResourceLocation type) { if (!tunnelTypes.containsKey(type)) return Stream.empty(); @@ -519,28 +351,6 @@ public Stream getTunnelSides(ResourceLocation type) { .map(Optional::get); } - public void clear() { - for (var machine : machines.values()) - graph.removeNode(machine); - machines.clear(); - - for (var t : tunnelTypes.values()) - graph.removeNode(t); - tunnelTypes.clear(); - - for (var tun : tunnels.values()) - graph.removeNode(tun); - tunnels.clear(); - } - - @Deprecated(forRemoval = true, since = "5.0.0") - public Stream getMachineTunnels(GlobalPos machine, TunnelDefinition type) { - return getTunnelNodesByType(type) - .map(TunnelNode::position) - .filter(position -> connectedMachine(position).map(machine::equals).orElse(false)) - .map(BlockPos::immutable); - } - /** * Unlinks a tunnel at a specified point inside the machine room. * @@ -550,7 +360,7 @@ public void unregister(BlockPos pos) { if (!hasTunnel(pos)) return; - CompactMachines.LOGGER.debug("Unregistering tunnel at {}", pos); + LOGS.debug("Unregistering tunnel at {}", pos); final var existing = tunnels.get(pos); graph.removeNode(existing); @@ -578,7 +388,7 @@ private void cleanupOrphanedTypes() { }); if (!removedTypes.isEmpty()) { - CompactMachines.LOGGER.debug("Removed {} tunnel type nodes during cleanup.", removedTypes.size()); + LOGS.debug("Removed {} tunnel type nodes during cleanup.", removedTypes.size()); removedTypes.forEach(tunnelTypes::remove); setDirty(); } @@ -595,7 +405,7 @@ private void cleanupOrphanedTunnels() { }); if (!removed.isEmpty()) { - CompactMachines.LOGGER.debug("Removed {} tunnel nodes during cleanup.", removed.size()); + LOGS.debug("Removed {} tunnel nodes during cleanup.", removed.size()); removed.forEach(tunnels::remove); setDirty(); } @@ -611,7 +421,7 @@ private void cleanupOrphanedMachines() { }); if (!removed.isEmpty()) { - CompactMachines.LOGGER.debug("Removed {} machine nodes during cleanup.", removed.size()); + LOGS.debug("Removed {} machine nodes during cleanup.", removed.size()); removed.forEach(machines::remove); setDirty(); } @@ -659,7 +469,7 @@ public boolean hasAnyConnectedTo(GlobalPos machine) { } public void rebind(BlockPos tunnel, GlobalPos newMachine, Direction side) { - CompactMachines.LOGGER.debug("Rebinding tunnel at {} to machine {}", tunnel, newMachine); + LOGS.debug("Rebinding tunnel at {} to machine {}", tunnel, newMachine); final var tunnelNode = getOrCreateTunnelNode(tunnel); final var newMachineNode = getOrCreateMachineNode(newMachine); @@ -667,7 +477,21 @@ public void rebind(BlockPos tunnel, GlobalPos newMachine, Direction side) { setDirty(); } - public MutableValueGraph, IGraphEdge> getGraph() { - return graph; + public> Stream nodes(Class type) { + return graph.nodes() + .stream() + .filter(type::isInstance) + .map(type::cast); + } + + public > Stream> edges(Class type) { + return graph.edges() + .stream() + .map(e -> { + final var ev = graph.edgeValue(e); + return ev.map(ige -> type.isInstance(ige) ? new GraphEdgeLookupResult<>(e, type.cast(ige)) : null) + .orElse(null); + }) + .filter(Objects::nonNull); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java new file mode 100644 index 00000000..c370f4fe --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.forge.tunnel.graph.nbt; + +import dev.compactmods.machines.graph.IGraphEdge; + +import java.util.UUID; + +public record TunnelGraphEdgeDeserializationResult>(UUID from, UUID to, E data) { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java new file mode 100644 index 00000000..36039948 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.forge.tunnel.graph.nbt; + +public interface TunnelGraphNbtKeys { + + String NODE_GROUP = "nodes"; + String NODE_COUNT = "node_count"; + String NODE_ID = "id"; + String NODE_DATA = "data"; + String NODE_GROUP_TUNNEL_LIST = "tunnels"; + String NODE_GROUP_TUNNEL_TYPE_LIST = "tunnel_types"; + String NODE_GROUP_MACHINE_LIST = "machines"; + + + String EDGE_GROUP = "edges"; + String EDGE_COUNT = "edge_count"; + String EDGE_CONNECTION_FROM_ID = "from"; + String EDGE_CONNECTION_TO_ID = "to"; + String EDGE_CONNECTION_DATA = "data"; + String EDGE_GROUP_MACHINE_LIST = "machines"; + String EDGE_GROUP_TUNNEL_TYPE_LIST = "tunnel_types"; + +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java new file mode 100644 index 00000000..94c31cb8 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java @@ -0,0 +1,210 @@ +package dev.compactmods.machines.forge.tunnel.graph.nbt; + +import com.mojang.serialization.Codec; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.codec.NbtListCollector; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.graph.IGraphEdge; +import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.machine.graph.CompactMachineNode; +import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; +import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; +import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class TunnelGraphNbtSerializer { + + private static final Logger LOGS = LogManager.getLogger(Constants.MOD_ID); + private static final Marker SERIALIZER_MARKER = MarkerManager.getMarker("TunnelGraphSerializer"); + + private static final String VERSION = "3.1.0"; + + public static CompoundTag serialize(TunnelConnectionGraph graph) { + final var rootTag = new CompoundTag(); + + rootTag.putString("version", VERSION); + + // BEGIN NODES + CompoundTag nodesGroup = new CompoundTag(); + + final var tunnelNodes = serializeTunnels(graph); + final var tunnelTypeNodes = serializeTunnelTypes(graph); + final var machineNodes = serializeMachines(graph); + + int numNodes = graph.size(); + var nodeIds = new HashMap, UUID>(numNodes); + + nodeIds.putAll(tunnelNodes.idMap()); + nodeIds.putAll(tunnelTypeNodes.idMap()); + nodeIds.putAll(machineNodes.idMap()); + + nodesGroup.putInt(TunnelGraphNbtKeys.NODE_COUNT, nodeIds.size()); + nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, tunnelNodes.listTag()); + nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_TYPE_LIST, tunnelTypeNodes.listTag()); + nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_MACHINE_LIST, machineNodes.listTag()); + + rootTag.put(TunnelGraphNbtKeys.NODE_GROUP, nodesGroup); + + // BEGIN EDGES + final var edges = new CompoundTag(); + final var machineEdges = serializeEdges(graph, nodeIds, TunnelMachineEdge.CODEC, TunnelMachineEdge.class); + final var tunnelTypeEdges = serializeEdges(graph, nodeIds, TunnelTypeEdge.CODEC, TunnelTypeEdge.class); + + edges.putInt(TunnelGraphNbtKeys.EDGE_COUNT, machineEdges.size() + tunnelTypeEdges.size()); + edges.put(TunnelGraphNbtKeys.EDGE_GROUP_MACHINE_LIST, machineEdges); + edges.put(TunnelGraphNbtKeys.EDGE_GROUP_TUNNEL_TYPE_LIST, tunnelTypeEdges); + + rootTag.put(TunnelGraphNbtKeys.EDGE_GROUP, edges); + + return rootTag; + } + + public static TunnelConnectionGraph fromNbt(CompoundTag tag) { + final var graph = new TunnelConnectionGraph(); + deserialize(graph, tag); + return TunnelGraphNbtSerializer.fromNbt(tag); + } + + public static void deserialize(TunnelConnectionGraph graph, CompoundTag tag) { + if (!tag.contains(TunnelGraphNbtKeys.NODE_GROUP, Tag.TAG_COMPOUND)) { + LOGS.info(SERIALIZER_MARKER, "No nodes to load; skipping deserialization."); + return; + } + + final var nodesNbt = tag.getCompound(TunnelGraphNbtKeys.NODE_GROUP); + + final var tunnels = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, Tag.TAG_COMPOUND), TunnelNode.CODEC); + LOGS.debug(SERIALIZER_MARKER, "Loaded %s tunnel nodes.".formatted(tunnels.results().size())); + + final var tunnelTypes = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_TYPE_LIST, Tag.TAG_COMPOUND), TunnelTypeNode.CODEC); + LOGS.debug(SERIALIZER_MARKER, "Loaded %s tunnel type nodes.".formatted(tunnelTypes.results().size())); + + final var machines = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_MACHINE_LIST, Tag.TAG_COMPOUND), CompactMachineNode.CODEC); + LOGS.debug(SERIALIZER_MARKER, "Loaded %s machine nodes.".formatted(machines.results().size())); + + final var edgesNbt = tag.getCompound(TunnelGraphNbtKeys.EDGE_GROUP); + final var tunnelMachineEdges = deserializeEdges(edgesNbt, TunnelGraphNbtKeys.EDGE_GROUP_MACHINE_LIST, TunnelMachineEdge.CODEC); + final var tunnelTypeEdges = deserializeEdges(edgesNbt, TunnelGraphNbtKeys.EDGE_GROUP_TUNNEL_TYPE_LIST, TunnelTypeEdge.CODEC); + + tunnels.results().forEach((id, node) -> { + var connectedMachine = tunnelMachineEdges.get(id); + var connectedType = tunnelTypeEdges.get(id); + + final var machine = machines.results().get(connectedMachine.to()); + final var type = tunnelTypes.results().get(connectedType.to()); + + final var definition = Tunnels.getDefinition(type.id()); + graph.registerTunnel(node.position(), definition, machine.dimpos(), connectedMachine.data().side()); + }); + } + + private static > TunnelGraphNodeDeserializationResult deserializeNodes( + ListTag list, Codec codec + ) { + HashMap nodeMap = new HashMap<>(list.size()); + + list.forEach(nodeTag -> { + if (!(nodeTag instanceof CompoundTag ct)) return; + final var node = codec.parse(NbtOps.INSTANCE, ct.getCompound(TunnelGraphNbtKeys.NODE_DATA)) + .getOrThrow(false, e -> LOGS.error(SERIALIZER_MARKER, e)); + + final var nodeId = ct.getUUID(TunnelGraphNbtKeys.NODE_ID); + nodeMap.put(nodeId, node); + }); + + return new TunnelGraphNodeDeserializationResult<>(nodeMap); + } + + private static > HashMap> deserializeEdges( + CompoundTag edgesNbt, String listKey, Codec codec + ) { + final var connections = new HashMap>(); + edgesNbt.getList(listKey, Tag.TAG_COMPOUND).forEach(edgeTag -> { + if (!(edgeTag instanceof CompoundTag ct)) return; + + final var fromId = ct.getUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_FROM_ID); + final var toId = ct.getUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_TO_ID); + final var edgeData = codec.parse(NbtOps.INSTANCE, ct.getCompound(TunnelGraphNbtKeys.EDGE_CONNECTION_DATA)) + .getOrThrow(false, e -> LOGS.error(SERIALIZER_MARKER, e)); + + var result = new TunnelGraphEdgeDeserializationResult<>(fromId, toId, edgeData); + connections.putIfAbsent(fromId, result); + }); + + return connections; + } + + private static > TunnelGraphNodeSerializationResult serializeNodes( + final TunnelConnectionGraph connections, final Codec serializer, final Class nodeType + ) { + HashMap nodeIds = new HashMap<>(); + final ListTag listNbt = connections.nodes(nodeType) + .map(node -> { + var id = UUID.randomUUID(); + nodeIds.put(node, id); + var nodeNbt = serializer.encodeStart(NbtOps.INSTANCE, node) + .getOrThrow(false, err -> LOGS.error(SERIALIZER_MARKER, err)); + + var tag = new CompoundTag(); + tag.putUUID(TunnelGraphNbtKeys.NODE_ID, id); + tag.put(TunnelGraphNbtKeys.NODE_DATA, nodeNbt); + return tag; + }) + .collect(NbtListCollector.toNbtList()); + + return new TunnelGraphNodeSerializationResult(nodeIds, listNbt); + } + + private static > ListTag serializeEdges( + final TunnelConnectionGraph connections, final Map, UUID> nodeIds, + final Codec serializer, Class edgeType + ) { + return connections.edges(edgeType) + .map(tme -> { + var edge = tme.edgeValue(); + var edgeData = serializer.encodeStart(NbtOps.INSTANCE, edge) + .getOrThrow(false, err -> LOGS.error(SERIALIZER_MARKER, err)); + + CompoundTag edgeInfo = new CompoundTag(); + edgeInfo.putUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_FROM_ID, nodeIds.get(tme.endpoints().nodeU())); + edgeInfo.putUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_TO_ID, nodeIds.get(tme.endpoints().nodeV())); + edgeInfo.put(TunnelGraphNbtKeys.EDGE_CONNECTION_DATA, edgeData); + + return edgeInfo; + }).collect(NbtListCollector.toNbtList()); + } + + public static TunnelGraphNodeSerializationResult serializeTunnels(final TunnelConnectionGraph connections) { + LOGS.debug(SERIALIZER_MARKER, "Starting tunnel node serialization."); + final var result = serializeNodes(connections, TunnelNode.CODEC, TunnelNode.class); + LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} tunnel nodes serialized.", result.listTag().size()); + return result; + } + + public static TunnelGraphNodeSerializationResult serializeTunnelTypes(final TunnelConnectionGraph connections) { + LOGS.debug(SERIALIZER_MARKER, "Starting tunnel type node serialization."); + final var result = serializeNodes(connections, TunnelTypeNode.CODEC, TunnelTypeNode.class); + LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} tunnel type nodes serialized.", result.listTag().size()); + return result; + } + + public static TunnelGraphNodeSerializationResult serializeMachines(final TunnelConnectionGraph connections) { + LOGS.debug(SERIALIZER_MARKER, "Starting machine node serialization."); + final var result = serializeNodes(connections, CompactMachineNode.CODEC, CompactMachineNode.class); + LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} machine nodes serialized.", result.listTag().size()); + return result; + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java new file mode 100644 index 00000000..df6f9971 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.forge.tunnel.graph.nbt; + +import dev.compactmods.machines.graph.IGraphNode; + +import java.util.Map; +import java.util.UUID; + +public record TunnelGraphNodeDeserializationResult>(Map results) { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java new file mode 100644 index 00000000..a48ce50c --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java @@ -0,0 +1,9 @@ +package dev.compactmods.machines.forge.tunnel.graph.nbt; + +import dev.compactmods.machines.graph.IGraphNode; +import net.minecraft.nbt.ListTag; + +import java.util.Map; +import java.util.UUID; + +public record TunnelGraphNodeSerializationResult>(Map idMap, ListTag listTag) {} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java index ecd630ea..92b42057 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java @@ -4,30 +4,16 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.upgrade.RoomUpgrade; import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphEdgeType; -import dev.compactmods.machines.graph.SimpleGraphEdgeType; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import org.jetbrains.annotations.NotNull; -public class RoomUpgradeConnection implements IGraphEdge> { +public record RoomUpgradeConnection(T instance) implements IGraphEdge> { public static final Codec> CODEC = RecordCodecBuilder.create(i -> i.group( MachineRoomUpgrades.REGISTRY.get().getCodec().fieldOf("data").forGetter(RoomUpgradeConnection::instance) ).apply(i, RoomUpgradeConnection::new)); - public static final IGraphEdgeType> EDGE_TYPE = SimpleGraphEdgeType.instance(CODEC); - - private final T upgradeData; - - public RoomUpgradeConnection(final T instance) { - this.upgradeData = instance; - } - - public T instance() { - return upgradeData; - } - @Override - public @NotNull IGraphEdgeType> getEdgeType() { - return EDGE_TYPE; + public @NotNull Codec> codec() { + return CODEC; } } diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java new file mode 100644 index 00000000..d3a09970 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java @@ -0,0 +1,106 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtKeys; +import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtSerializer; +import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.test.util.NbtTestUtils; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.nbt.Tag; +import net.minecraft.world.level.Level; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class TunnelGraphSerializationTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canSerializeEmptyTunnelGraph(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var nbt = TunnelGraphNbtSerializer.serialize(graph); + + if(!nbt.contains(TunnelGraphNbtKeys.NODE_GROUP, Tag.TAG_COMPOUND)) { + test.fail("Expected an graph node compound in the dataset."); + return; + } + + if(!nbt.contains(TunnelGraphNbtKeys.EDGE_GROUP, Tag.TAG_COMPOUND)) { + test.fail("Expected an graph edge compound in the dataset."); + return; + } + + final var nodesNbt = nbt.getCompound(TunnelGraphNbtKeys.NODE_GROUP); + if(nodesNbt.isEmpty()) { + test.fail("Expected graph node group to be populated."); + return; + } + + final var edgesNbt = nbt.getCompound(TunnelGraphNbtKeys.EDGE_GROUP); + if(edgesNbt.isEmpty()) { + test.fail("Expected graph edge group to be populated."); + return; + } + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canSerializeSingleTunnel(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + + final var MACHINE_POS = GlobalPos.of(Level.OVERWORLD, BlockPos.ZERO); + graph.registerTunnel(BlockPos.ZERO, Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.UP); + + final var nbt = TunnelGraphNbtSerializer.serialize(graph); + + final var nodesNbt = nbt.getCompound(TunnelGraphNbtKeys.NODE_GROUP); + final var edgesNbt = nbt.getCompound(TunnelGraphNbtKeys.EDGE_GROUP); + + if(nodesNbt.size() != 4) { + test.fail("Did not get expected number of nodes for a single tunnel registration."); + return; + } + + if(nodesNbt.getInt(TunnelGraphNbtKeys.NODE_COUNT) != 3) { + test.fail("Expected 3 nodes accounted for; got a different result."); + } + + NbtTestUtils.checkListSize(nodesNbt, TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, 1); + NbtTestUtils.checkListSize(nodesNbt, TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_TYPE_LIST, 1); + NbtTestUtils.checkListSize(nodesNbt, TunnelGraphNbtKeys.NODE_GROUP_MACHINE_LIST, 1); + + if(edgesNbt.size() != 3) { + test.fail("Did not get expected number of edges for a single tunnel registration."); + return; + } + + if(edgesNbt.getInt(TunnelGraphNbtKeys.EDGE_COUNT) != 2) { + test.fail("Expected 2 edges accounted for; got a different result."); + } + + NbtTestUtils.checkListSize(edgesNbt, TunnelGraphNbtKeys.EDGE_GROUP_MACHINE_LIST, 1); + NbtTestUtils.checkListSize(edgesNbt, TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, 1); + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canDeserializeTunnels(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + + final var MACHINE_POS = GlobalPos.of(Level.OVERWORLD, BlockPos.ZERO); + graph.registerTunnel(BlockPos.ZERO.above(), Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.UP); + graph.registerTunnel(BlockPos.ZERO, Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.DOWN); + + final var nbt = TunnelGraphNbtSerializer.serialize(graph); + + final var newGraph = TunnelGraphNbtSerializer.fromNbt(nbt); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/util/NbtTestUtils.java b/forge-main/src/test/java/dev/compactmods/machines/test/util/NbtTestUtils.java new file mode 100644 index 00000000..bd7f9474 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/util/NbtTestUtils.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.test.util; + +import net.minecraft.gametest.framework.GameTestAssertException; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; + +public class NbtTestUtils { + public static boolean checkListSize(CompoundTag tag, String list, int expectedSize) { + return checkListSize(tag, list, Tag.TAG_COMPOUND, expectedSize); + } + + public static boolean checkListSize(CompoundTag tag, String list, int listType, int expectedSize) { + if(!tag.contains(list, Tag.TAG_LIST)) + return false; + + int actualSize = tag.getList(list, listType).size(); + if(actualSize != expectedSize) + throw new GameTestAssertException("Expected NBT list %s to have %s elements; got %s".formatted(list, expectedSize, actualSize)); + + return true; + } +} diff --git a/gradle.properties b/gradle.properties index 1ed4e463..d5b35622 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.0.15 -tunnels_version=2.0.15 +core_version=2.1.1 +tunnels_version=2.1.1 # Curseforge cf_project=224218 From 795e1b1ccf24349c4c300c869acf01c7cc34b8bb Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 12 Apr 2023 08:41:14 -0400 Subject: [PATCH 61/85] Start adding better lifecycle events for tunnels --- .../definitions/BufferedItemTunnel.java | 44 ++++++++------ .../forge/tunnel/TunnelWallBlock.java | 60 +++++++++++++++---- .../forge/tunnel/TunnelWallEntity.java | 21 +++++-- .../removal/ServerPlayerRemovedReason.java | 8 +++ .../rotation/ServerPlayerRotatedReason.java | 8 +++ 5 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/removal/ServerPlayerRemovedReason.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/rotation/ServerPlayerRotatedReason.java diff --git a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java index 2fd8475d..2143e398 100644 --- a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/BufferedItemTunnel.java @@ -1,17 +1,15 @@ package dev.compactmods.machines.forgebuiltin.tunnel.definitions; import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; +import dev.compactmods.machines.api.tunnels.lifecycle.IPlayerLifecycleEventReason; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; -import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; +import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveEventListener; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.MinecraftServer; import net.minecraft.util.FastColor; import net.minecraft.world.Containers; import net.minecraft.world.item.ItemStack; @@ -21,11 +19,12 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; public class BufferedItemTunnel implements TunnelDefinition, CapabilityTunnel, - TunnelTeardownHandler { + ITunnelRemoveEventListener { @Override public int ringColor() { @@ -59,25 +58,34 @@ public LazyOptional getCapability(Capability capType return LazyOptional.empty(); } + @Override + public @Nullable BeforeRemove createBeforeRemoveHandler(Instance instance) { + // Only allow players to remove item tunnels + return (server, position, reason) -> reason instanceof IPlayerLifecycleEventReason; + } + /** * Drops items into the machine room before the tunnel is removed from the wall. * * @param instance The tunnel instance being modified. */ @Override - public void onRemoved(MinecraftServer server, TunnelPosition position, Instance instance) { - BlockPos dropAt = position.pos().relative(position.wallSide(), 1); - - NonNullList stacks = NonNullList.create(); - for (int i = 0; i < instance.handler.getSlots(); i++) { - ItemStack stack = instance.handler.getStackInSlot(i); - if (!stack.isEmpty()) - stacks.add(stack); - } - - final var compactDim = server.getLevel(CompactDimension.LEVEL_KEY); - if(compactDim != null) - Containers.dropContents(compactDim, dropAt, stacks); + public @Nullable AfterRemove createAfterRemoveHandler(Instance instance) { + return (server, position, reason) -> { + if(reason instanceof IPlayerLifecycleEventReason playerReason) { + var player = playerReason.player(); + var dropAt = player.position(); + + NonNullList stacks = NonNullList.create(); + for (int i = 0; i < instance.handler.getSlots(); i++) { + ItemStack stack = instance.handler.getStackInSlot(i); + if (!stack.isEmpty()) + stacks.add(stack); + } + + stacks.forEach(s -> Containers.dropItemStack(player.level, dropAt.x, dropAt.y + 0.5, dropAt.z, s)); + } + }; } public static class Instance implements TunnelInstance, INBTSerializable { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index e700367e..095942aa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -1,14 +1,18 @@ package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.forge.wall.ProtectedWallBlock; -import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.tunnels.TunnelPosition; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; +import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveEventListener; +import dev.compactmods.machines.api.tunnels.lifecycle.rotation.ITunnelRotationEventListener; import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.tunnel.removal.ServerPlayerRemovedReason; +import dev.compactmods.machines.forge.tunnel.rotation.ServerPlayerRotatedReason; +import dev.compactmods.machines.forge.wall.ProtectedWallBlock; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.TunnelHelper; @@ -18,6 +22,7 @@ import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.item.ItemEntity; @@ -109,17 +114,32 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player if (level.isClientSide) return InteractionResult.SUCCESS; + final var server = level.getServer(); + if (!(player instanceof ServerPlayer serverPlayer)) + return InteractionResult.FAIL; + if (!(level.getBlockEntity(pos) instanceof TunnelWallEntity tunnel)) return InteractionResult.FAIL; if (level.dimension().equals(CompactDimension.LEVEL_KEY) && level instanceof ServerLevel compactDim) { - var def = tunnel.getTunnelType(); - final Direction tunnelWallSide = hitResult.getDirection(); - var tunnelConnectedSide = tunnel.getConnectedSide(); - + final var def = tunnel.getTunnelType(); + final var tunnelWallSide = hitResult.getDirection(); + final var tunnelConnectedSide = tunnel.getConnectedSide(); final var tunnelId = Tunnels.getRegistryId(def); - final var roomProvider = CompactRoomProvider.instance(compactDim); + final var tunnelOriginalPosition = new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide); + + if (player.isShiftKeyDown()) { + final var removalReason = new ServerPlayerRemovedReason(serverPlayer); + if (def instanceof ITunnelRemoveEventListener removeListener) { + var handler = removeListener.createBeforeRemoveHandler(tunnel.getTunnel()); + if (handler != null && handler.beforeRemove(server, tunnelOriginalPosition, removalReason)) { + // Cancel removal + return InteractionResult.FAIL; + } + } + } + return roomProvider.findByChunk(new ChunkPos(pos)).map(roomInfo -> { final var tunnels = TunnelConnectionGraph.forRoom(compactDim, roomInfo.code()); if (player.isShiftKeyDown()) { @@ -135,7 +155,8 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player level.addFreshEntity(ie); if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRemoved(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel()); + //noinspection removal + teardown.onRemoved(tunnelOriginalPosition, tunnel.getTunnel()); } tunnels.unregister(pos); @@ -157,14 +178,31 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var next = TunnelHelper.getNextDirection(dir, existingDirs); next.ifPresent(newSide -> { + final var rotationReason = new ServerPlayerRotatedReason(serverPlayer); + final var newRotation = new TunnelPosition(pos, tunnelWallSide, newSide); + + if(def instanceof ITunnelRotationEventListener rotationListener) { + var handler = rotationListener.createBeforeRotateHandler(tunnel.getTunnel()); + if(handler != null && handler.beforeRotate(server, tunnelOriginalPosition, newRotation, rotationReason)) { + return; + } + } + level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); if (def instanceof TunnelTeardownHandler teardown) { - teardown.onRotated(compactDim.getServer(), new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); + //noinspection removal + teardown.onRotated(new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); } tunnels.rotateTunnel(pos, newSide); tunnels.setDirty(); + + if(def instanceof ITunnelRotationEventListener rotationListener) { + var handler = rotationListener.createAfterRotateHandler(tunnel.getTunnel()); + if(handler != null) + handler.afterRotate(server, tunnelOriginalPosition, newRotation, rotationReason); + } }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index 5c42f09f..10a15b07 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -1,7 +1,5 @@ package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.api.tunnels.ITunnelHolder; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.TunnelPosition; @@ -9,10 +7,13 @@ import dev.compactmods.machines.api.tunnels.lifecycle.InstancedTunnel; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; +import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveEventListener; import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.BaseTunnelWallData; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.TunnelNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -185,15 +186,27 @@ public void setTunnelType(TunnelDefinition type) { return; } + // TODO Clean all this up properly with a real removal reason final var p = new TunnelPosition(worldPosition, getTunnelSide(), getConnectedSide()); if (tunnelType instanceof TunnelTeardownHandler teardown) { - teardown.onRemoved(sl.getServer(), p, tunnel); + //noinspection removal,unchecked + teardown.onRemoved(p, tunnel); + } + + if(tunnelType instanceof ITunnelRemoveEventListener removeListener) { + removeListener.createBeforeRemoveHandler(tunnel) + .beforeRemove(level.getServer(), p, null); } this.tunnelType = type; if (type instanceof InstancedTunnel it) this.tunnel = it.newInstance(p.pos(), p.wallSide()); + if(tunnelType instanceof ITunnelRemoveEventListener removeListener) { + removeListener.createAfterRemoveHandler(tunnel) + .afterRemove(level.getServer(), p, null); + } + setChanged(); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/removal/ServerPlayerRemovedReason.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/removal/ServerPlayerRemovedReason.java new file mode 100644 index 00000000..12e72bec --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/removal/ServerPlayerRemovedReason.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.forge.tunnel.removal; + +import dev.compactmods.machines.api.tunnels.lifecycle.IPlayerLifecycleEventReason; +import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveReason; +import net.minecraft.server.level.ServerPlayer; + +public record ServerPlayerRemovedReason(ServerPlayer player) implements IPlayerLifecycleEventReason, ITunnelRemoveReason { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/rotation/ServerPlayerRotatedReason.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/rotation/ServerPlayerRotatedReason.java new file mode 100644 index 00000000..432888a4 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/rotation/ServerPlayerRotatedReason.java @@ -0,0 +1,8 @@ +package dev.compactmods.machines.forge.tunnel.rotation; + +import dev.compactmods.machines.api.tunnels.lifecycle.IPlayerLifecycleEventReason; +import dev.compactmods.machines.api.tunnels.lifecycle.rotation.ITunnelRotationReason; +import net.minecraft.server.level.ServerPlayer; + +public record ServerPlayerRotatedReason(ServerPlayer player) implements ITunnelRotationReason, IPlayerLifecycleEventReason { +} From cb64543f8240a0db4c9019b4c0074a921553f8b4 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 12 Apr 2023 09:43:27 -0400 Subject: [PATCH 62/85] Fix a stupid recursion bug.. whoops --- .../forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java index 94c31cb8..7aa96a72 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java @@ -75,7 +75,7 @@ public static CompoundTag serialize(TunnelConnectionGraph graph) { public static TunnelConnectionGraph fromNbt(CompoundTag tag) { final var graph = new TunnelConnectionGraph(); deserialize(graph, tag); - return TunnelGraphNbtSerializer.fromNbt(tag); + return graph; } public static void deserialize(TunnelConnectionGraph graph, CompoundTag tag) { From e6a125490ec56b0371866b560c923619b0cf20a2 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Wed, 12 Apr 2023 15:01:49 -0400 Subject: [PATCH 63/85] Finish implementation of round-trip tunnel graph serialization --- .../tunnel/TunnelGraphSerializationTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java index d3a09970..da8d520d 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java @@ -7,6 +7,8 @@ import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtSerializer; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.NbtTestUtils; +import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -102,5 +104,22 @@ public static void canDeserializeTunnels(final GameTestHelper test) { final var nbt = TunnelGraphNbtSerializer.serialize(graph); final var newGraph = TunnelGraphNbtSerializer.fromNbt(nbt); + + long machineCount = newGraph.getMachines().count(); + if(machineCount != 1) { + test.fail("Expected one machine node; got %s.".formatted(machineCount)); + } + + long tunnelCount = newGraph.nodes(TunnelNode.class).count(); + if(tunnelCount != 2) { + test.fail("Expected 2 tunnel nodes; got %s.".formatted(tunnelCount)); + } + + long tunnelTypeCount = newGraph.nodes(TunnelTypeNode.class).count(); + if(tunnelTypeCount != 1) { + test.fail("Expected 1 tunnel type node; got %s.".formatted(tunnelTypeCount)); + } + + test.succeed(); } } From cad26925601e60bf6d0b8269a570472bba35ba51 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Apr 2023 02:33:23 -0400 Subject: [PATCH 64/85] Fix missing lang entry for NYI, try to fix semver build vs increment --- .github/workflows/ci-tests-nightly.yml | 1 - .../forge/data/generated/lang/EnglishLangGenerator.java | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 62ad0977..7b348e9d 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -33,7 +33,6 @@ jobs: change_path: "forge-main" version_format: "${major}.${minor}.${patch}.${increment}-nightly" search_commit_body: true - bump_each_commit: true - name: Read MC and Forge versions id: gradle_props diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java index 356e2495..8ff5c965 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java @@ -94,6 +94,8 @@ protected void addTranslations() { addTooltip(Tooltips.ROOM_NAME, "Bound to room: %s"); + addTooltip(Tooltips.NOT_YET_IMPLEMENTED, "Not Yet Implemented"); + //region Upgrades add(BuiltInUpgrades.CHUNKLOAD, "Chunkloader Upgrade"); From f2aac4640763fd6500af671c729d019364f8a9ac Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Apr 2023 07:16:07 -0400 Subject: [PATCH 65/85] Tunnel tests, deprecate looking up stuff by TunnelDef, graph refactors --- .../subcommand/CMRebindSubcommand.java | 2 +- .../subcommand/CMUnbindSubcommand.java | 2 +- .../providers/CompactMachineProvider.java | 8 +- .../theoneprobe/providers/TunnelProvider.java | 2 +- .../machines/forge/tunnel/TunnelItem.java | 27 +++-- .../forge/tunnel/TunnelWallBlock.java | 8 +- .../forge/tunnel/TunnelWallEntity.java | 2 +- .../machines/forge/tunnel/Tunnels.java | 15 +++ .../tunnel/graph/TunnelConnectionGraph.java | 102 +++++++++--------- .../graph/nbt/TunnelGraphNbtSerializer.java | 7 +- .../machines/test/TestRegistration.java | 22 ++++ .../test/tunnel/FakeTunnelDefinition.java | 17 +++ .../test/tunnel/TunnelGraphCleanupTests.java | 33 ++++++ .../test/tunnel/TunnelGraphMachineTests.java | 72 +++++++++++++ .../tunnel/TunnelGraphSerializationTests.java | 20 +++- .../test/tunnel/TunnelGraphSideTests.java | 73 +++++++++++++ .../test/tunnel/TunnelGraphTunnelTests.java | 69 ++++++++++++ 17 files changed, 405 insertions(+), 76 deletions(-) create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/TestRegistration.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/FakeTunnelDefinition.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java index 40aa7029..f3a1a093 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java @@ -55,7 +55,7 @@ private static int doRebind(CommandContext ctx) throws Comma machine.connectedRoom().ifPresentOrElse(currentRoom -> { final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); - final var firstTunnel = currentRoomTunnels.getConnections(machine.getLevelPosition()).findFirst(); + final var firstTunnel = currentRoomTunnels.positions(machine.getLevelPosition()).findFirst(); firstTunnel.ifPresent(ft -> { throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java index ae4b2dc0..91943d29 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java @@ -44,7 +44,7 @@ private static int doUnbind(CommandContext ctx) throws Comma machine.connectedRoom().ifPresentOrElse(currentRoom -> { final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); - final var firstTunnel = currentRoomTunnels.getConnections(machine.getLevelPosition()).findFirst(); + final var firstTunnel = currentRoomTunnels.positions(machine.getLevelPosition()).findFirst(); firstTunnel.ifPresent(ft -> { throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java index 96aefd87..7106af8c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java @@ -1,14 +1,14 @@ package dev.compactmods.machines.forge.compat.theoneprobe.providers; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.forge.tunnel.TunnelItem; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.tunnel.TunnelItem; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; @@ -88,7 +88,7 @@ private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHi final var graph = TunnelConnectionGraph.forRoom(compactDim, room.code()); - final var applied = graph.getTypesForSide(machine.getLevelPosition(), hitData.getSideHit()) + final var applied = graph.types(machine.getLevelPosition(), hitData.getSideHit()) .collect(Collectors.toSet()); switch (probeMode) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java index 4abf5753..d13eb92c 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/TunnelProvider.java @@ -61,7 +61,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player playerEnti .item(new ItemStack(Items.COMPASS)) .text(Component.translatable(sideTranslated)); - final var connectedMachinePos = tile.getConnectedPosition(); + final var connectedMachinePos = tile.connectedMachine(); final var connectedPos = connectedMachinePos.pos().relative(tile.getConnectedSide()); ServerLevel connectedWorld = (ServerLevel) level; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index f6211897..a0edd5b7 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -27,6 +27,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; @@ -53,12 +54,26 @@ public TunnelItem(Properties properties) { super(properties); } + @Deprecated(forRemoval = true, since = "5.2.0") public static void setTunnelType(ItemStack stack, TunnelDefinition definition) { CompoundTag defTag = stack.getOrCreateTagElement("definition"); defTag.putString("id", Tunnels.getRegistryId(definition).toString()); } + private static void setTunnelType(ItemStack stack, ResourceKey definition) { + CompoundTag defTag = stack.getOrCreateTagElement("definition"); + defTag.putString("id", definition.location().toString()); + } + + @Nonnull + public static ItemStack createStack(ResourceKey definition) { + var stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); + setTunnelType(stack, definition); + return stack; + } + @Nonnull + @Deprecated(forRemoval = true, since = "5.2.0") public static ItemStack createStack(TunnelDefinition definition) { var stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); setTunnelType(stack, definition); @@ -95,11 +110,11 @@ public void appendHoverText(@Nonnull ItemStack stack, @Nullable Level worldIn, L public void fillItemCategory(CreativeModeTab group, NonNullList items) { if (this.allowedIn(group)) { IForgeRegistry definitions = Tunnels.TUNNEL_DEF_REGISTRY.get(); - definitions.getValues().forEach(def -> { - if (def == Tunnels.UNKNOWN.get()) + definitions.getKeys().forEach(def -> { + if (def.equals(Tunnels.UNKNOWN_KEY.location())) return; - ItemStack withDef = createStack(def); + ItemStack withDef = createStack(ResourceKey.create(TunnelDefinition.REGISTRY_KEY, def)); items.add(withDef); }); } @@ -152,7 +167,7 @@ public static Optional getMachineBindingInfo(Player player) { private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position, Direction innerFace, Player player, TunnelDefinition def) throws Exception, MissingDimensionException { boolean redstone = def instanceof RedstoneTunnel; - final var tunnelId = Tunnels.getRegistryId(def); + final var tunnelId = Tunnels.getRegistryKey(def); final var provider = CompactRoomProvider.instance(compactDim); final var roomInfo = provider.findByChunk(player.chunkPosition()); @@ -171,7 +186,7 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position var hist = lastEnteredMachine.get(); var placedSides = roomTunnels - .getTunnelSides(tunnelId) + .sides(hist.getMachine(), tunnelId) .collect(Collectors.toSet()); // all tunnels already placed for type @@ -194,7 +209,7 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position .setValue(TunnelWallBlock.CONNECTED_SIDE, first) .setValue(TunnelWallBlock.REDSTONE, redstone); - boolean connected = roomTunnels.registerTunnel(position, def, hist.getMachine(), first); + boolean connected = roomTunnels.register(position, tunnelId, hist.getMachine(), first); if (!connected) { player.displayClientMessage(TranslationUtil.message(Messages.NO_TUNNEL_SIDE), true); return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index 095942aa..0356e4f9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -81,7 +81,7 @@ public int getSignal(BlockState state, BlockGetter world, BlockPos position, Dir if (world instanceof ServerLevel sl && world.getBlockEntity(position) instanceof TunnelWallEntity tunnelWall) { final var serv = sl.getServer(); final var def = tunnelWall.getTunnelType(); - final var machPos = tunnelWall.getConnectedPosition(); + final var machPos = tunnelWall.connectedMachine(); final var tunnPos = tunnelWall.getTunnelPosition(); final var connectedLevel = serv.getLevel(machPos.dimension()); @@ -125,7 +125,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var def = tunnel.getTunnelType(); final var tunnelWallSide = hitResult.getDirection(); final var tunnelConnectedSide = tunnel.getConnectedSide(); - final var tunnelId = Tunnels.getRegistryId(def); + final var tunnelId = Tunnels.getRegistryKey(def); final var roomProvider = CompactRoomProvider.instance(compactDim); final var tunnelOriginalPosition = new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide); @@ -165,7 +165,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player Direction dir = state.getValue(CONNECTED_SIDE); final var existingDirs = tunnels - .getTunnelSides(tunnelId) + .sides(tunnel.connectedMachine(), tunnelId) .collect(Collectors.toSet()); if (existingDirs.size() == 6) { @@ -195,7 +195,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player teardown.onRotated(new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); } - tunnels.rotateTunnel(pos, newSide); + tunnels.rotate(pos, newSide); tunnels.setDirty(); if(def instanceof ITunnelRotationEventListener rotationListener) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index 10a15b07..580e0da0 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -157,7 +157,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D } @NotNull - public GlobalPos getConnectedPosition() { + public GlobalPos connectedMachine() { return this.connectedMachine; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java index 0e07af1b..8301d3d3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/Tunnels.java @@ -4,6 +4,7 @@ import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.tunnel.definitions.UnknownTunnel; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -29,6 +30,12 @@ public static boolean isRegistered(ResourceLocation id) { return TUNNEL_DEF_REGISTRY.get().containsKey(id); } + public static TunnelDefinition getDefinition(ResourceKey id) { + if (isRegistered(id.location())) return TUNNEL_DEF_REGISTRY.get().getValue(id.location()); + CompactMachines.LOGGER.warn("Unknown tunnel requested: {}", id); + return Tunnels.UNKNOWN.get(); + } + public static TunnelDefinition getDefinition(ResourceLocation id) { if (isRegistered(id)) return TUNNEL_DEF_REGISTRY.get().getValue(id); CompactMachines.LOGGER.warn("Unknown tunnel requested: {}", id); @@ -38,6 +45,9 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { // ================================================================================================================ // TUNNELS // ================================================================================================================ + public static final ResourceKey UNKNOWN_KEY = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, + new ResourceLocation(MOD_ID, "unknown")); + public static final RegistryObject UNKNOWN = Registries.TUNNEL_DEFINITIONS .register("unknown", UnknownTunnel::new); @@ -57,6 +67,11 @@ public static TunnelDefinition getDefinition(ResourceLocation id) { .register("tunnel_wall", () -> BlockEntityType.Builder.of(TunnelWallEntity::new, BLOCK_TUNNEL_WALL.get()) .build(null)); + public static ResourceKey getRegistryKey(TunnelDefinition definition) { + final var reg = TUNNEL_DEF_REGISTRY.get(); + return reg.getResourceKey(definition).orElse(UNKNOWN_KEY); + } + public static ResourceLocation getRegistryId(TunnelDefinition definition) { final var reg = TUNNEL_DEF_REGISTRY.get(); if (!reg.containsValue(definition)) return new ResourceLocation(MOD_ID, "unknown"); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java index a0389c29..fc8e36f2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java @@ -12,7 +12,6 @@ import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.machine.graph.MachineRoomEdge; import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; import dev.compactmods.machines.tunnel.graph.TunnelMachineInfo; import dev.compactmods.machines.tunnel.graph.TunnelNode; @@ -22,6 +21,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.saveddata.SavedData; @@ -115,7 +115,7 @@ public static String getDataFilename(String room) { * @param tunnel The tunnel to find a connection for. * @return The id of the connected machine. */ - public Optional connectedMachine(BlockPos tunnel) { + public Optional machine(BlockPos tunnel) { if (!tunnels.containsKey(tunnel)) return Optional.empty(); @@ -138,7 +138,7 @@ public Optional connectedMachine(BlockPos tunnel) { * @param side The side of the machine the tunnel is connecting to. * @return True if the connection could be established; false if the tunnel type is already registered for the given side. */ - public boolean registerTunnel(BlockPos tunnelPos, TunnelDefinition type, GlobalPos machine, Direction side) { + public boolean register(BlockPos tunnelPos, ResourceKey type, GlobalPos machine, Direction side) { // First we need to get the machine the tunnel is trying to connect to var machineNode = getOrCreateMachineNode(machine); var tunnelNode = getOrCreateTunnelNode(tunnelPos); @@ -189,8 +189,8 @@ protected CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { return node; } - protected TunnelTypeNode getOrCreateTunnelTypeNode(TunnelDefinition definition) { - final ResourceLocation id = Tunnels.getRegistryId(definition); + protected TunnelTypeNode getOrCreateTunnelTypeNode(ResourceKey definition) { + final ResourceLocation id = definition.location(); if (tunnelTypes.containsKey(id)) return tunnelTypes.get(id); @@ -209,8 +209,8 @@ public int size() { return graph.nodes().size(); } - protected Stream getTunnelNodesByType(ResourceLocation type) { - var defNode = tunnelTypes.get(type); + protected Stream _type(ResourceKey type) { + var defNode = tunnelTypes.get(type.location()); if (defNode == null) return Stream.empty(); @@ -220,7 +220,18 @@ protected Stream getTunnelNodesByType(ResourceLocation type) { .map(TunnelNode.class::cast); } - public Optional getTunnelSide(BlockPos pos) { + /** + * @deprecated Use {@link #side(BlockPos)} + * @param position + * @return + */ + @Override + @Deprecated(forRemoval = true, since = "5.2.0") + public Optional getConnectedSide(BlockPos position) { + return side(position); + } + + public Optional side(BlockPos pos) { if (!tunnels.containsKey(pos)) return Optional.empty(); @@ -235,7 +246,7 @@ public Optional getTunnelSide(BlockPos pos) { .findFirst(); } - public Optional getTunnelInfo(BlockPos tunnel) { + public Optional info(BlockPos tunnel) { if (!tunnels.containsKey(tunnel)) return Optional.empty(); @@ -246,8 +257,8 @@ public Optional getTunnelInfo(BlockPos tunnel) { .findFirst() .orElseThrow(); - var mach = connectedMachine(tunnel).orElseThrow(); - var side = getTunnelSide(tunnel).orElseThrow(); + var mach = machine(tunnel).orElseThrow(); + var side = side(tunnel).orElseThrow(); var type = typeNode.id(); return Optional.of(new TunnelMachineInfo(tunnel, type, mach, side)); @@ -255,12 +266,19 @@ public Optional getTunnelInfo(BlockPos tunnel) { public Stream tunnels() { return tunnels.keySet().stream() - .map(this::getTunnelInfo) + .map(this::info) .filter(Optional::isPresent) .map(Optional::get); } - public boolean hasTunnel(BlockPos location) { + public Stream tunnels(GlobalPos machine) { + return positions(machine) + .map(this::info) + .filter(Optional::isPresent) + .map(Optional::get); + } + + public boolean has(BlockPos location) { return tunnels.containsKey(location); } @@ -275,7 +293,7 @@ public Stream getRedstoneTunnels(GlobalPos machine, Direction facing) final var node = machines.get(machine); if (node == null) return Stream.empty(); - return getTunnelsForSide(machine, facing) + return _side(machine, facing) .filter(sided -> graph.successors(sided).stream() .filter(TunnelTypeNode.class::isInstance) .map(TunnelTypeNode.class::cast) @@ -285,24 +303,11 @@ public Stream getRedstoneTunnels(GlobalPos machine, Direction facing) })).map(TunnelNode::position); } - @Override - public Optional getConnectedSide(BlockPos position) { - var node = tunnels.get(position); - return graph.adjacentNodes(node).stream() - .filter(CompactMachineNode.class::isInstance) - .map(mn -> graph.edgeValue(node, mn)) - .filter(Optional::isPresent) - .map(Optional::get) - .map(TunnelMachineEdge.class::cast) - .map(TunnelMachineEdge::side) - .findFirst(); - } - public Stream getTunnelsSupporting(GlobalPos machine, Direction side, Capability capability) { final var node = machines.get(machine); if (node == null) return Stream.empty(); - return getTunnelsForSide(machine, side) + return _side(machine, side) .filter(sided -> graph.successors(sided).stream() .filter(TunnelTypeNode.class::isInstance) .map(TunnelTypeNode.class::cast) @@ -315,19 +320,19 @@ public Stream getTunnelsSupporting(GlobalPos machine, Direction si })).map(TunnelNode::position); } - public Stream getTypesForSide(GlobalPos machine, Direction side) { + public Stream> types(GlobalPos machine, Direction side) { final var node = machines.get(machine); if (node == null) return Stream.empty(); - return getTunnelsForSide(machine, side) + return _side(machine, side) .flatMap(tn -> graph.successors(tn).stream()) .filter(TunnelTypeNode.class::isInstance) .map(TunnelTypeNode.class::cast) - .map(type -> Tunnels.getDefinition(type.id())) + .map(type -> ResourceKey.create(TunnelDefinition.REGISTRY_KEY, type.id())) .distinct(); } - protected Stream getTunnelsForSide(GlobalPos machine, Direction side) { + protected Stream _side(GlobalPos machine, Direction side) { final var node = machines.get(machine); if (node == null) return Stream.empty(); @@ -341,11 +346,12 @@ protected Stream getTunnelsForSide(GlobalPos machine, Direction side .map(TunnelNode.class::cast); } - public Stream getTunnelSides(ResourceLocation type) { - if (!tunnelTypes.containsKey(type)) + public Stream sides(GlobalPos machine, ResourceKey type) { + if (!tunnelTypes.containsKey(type.location())) return Stream.empty(); - return getTunnelNodesByType(type) + return _type(type) + .filter(node -> machine(node.position()).map(machine::equals).orElse(false)) .map(node -> node.getTunnelSide(this)) .filter(Optional::isPresent) .map(Optional::get); @@ -357,7 +363,7 @@ public Stream getTunnelSides(ResourceLocation type) { * @param pos Tunnel position inside the room. */ public void unregister(BlockPos pos) { - if (!hasTunnel(pos)) + if (!has(pos)) return; LOGS.debug("Unregistering tunnel at {}", pos); @@ -427,11 +433,11 @@ private void cleanupOrphanedMachines() { } } - public void rotateTunnel(BlockPos tunnel, Direction newSide) { + public void rotate(BlockPos tunnel, Direction newSide) { if (!tunnels.containsKey(tunnel)) return; - final var connected = connectedMachine(tunnel); + final var connected = machine(tunnel); connected.ifPresent(machine -> { if (!machines.containsKey(machine)) return; @@ -445,27 +451,21 @@ public void rotateTunnel(BlockPos tunnel, Direction newSide) { }); } - public Stream getMachines() { + public Stream machines() { return this.machines.keySet().stream(); } - public Stream getConnections(GlobalPos machine) { + public Stream positions(GlobalPos machine) { if (!machines.containsKey(machine)) return Stream.empty(); final var mNode = machines.get(machine); - return graph.incidentEdges(mNode).stream() - .filter(e -> graph.edgeValue(e).orElseThrow() instanceof MachineRoomEdge) - .map(edge -> { - if (edge.nodeU() instanceof TunnelNode cmn) return cmn; - if (edge.nodeV() instanceof TunnelNode cmn2) return cmn2; - return null; - }).filter(Objects::nonNull).map(TunnelNode::position); - } - - public boolean hasAnyConnectedTo(GlobalPos machine) { - return getConnections(machine).findAny().isPresent(); + // [CompactMachineNode] <--- [TunnelNode] + return graph.predecessors(mNode).stream() + .filter(TunnelNode.class::isInstance) + .map(TunnelNode.class::cast) + .map(TunnelNode::position); } public void rebind(BlockPos tunnel, GlobalPos newMachine, Direction side) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java index 7aa96a72..bae84686 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java @@ -2,8 +2,8 @@ import com.mojang.serialization.Codec; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.codec.NbtListCollector; -import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; @@ -16,6 +16,7 @@ import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceKey; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -106,8 +107,8 @@ public static void deserialize(TunnelConnectionGraph graph, CompoundTag tag) { final var machine = machines.results().get(connectedMachine.to()); final var type = tunnelTypes.results().get(connectedType.to()); - final var definition = Tunnels.getDefinition(type.id()); - graph.registerTunnel(node.position(), definition, machine.dimpos(), connectedMachine.data().side()); + final var definition = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, type.id()); + graph.register(node.position(), definition, machine.dimpos(), connectedMachine.data().side()); }); } diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/TestRegistration.java b/forge-main/src/test/java/dev/compactmods/machines/test/TestRegistration.java new file mode 100644 index 00000000..c7c1e18a --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/TestRegistration.java @@ -0,0 +1,22 @@ +package dev.compactmods.machines.test; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import dev.compactmods.machines.test.tunnel.FakeTunnelDefinition; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.registries.RegisterEvent; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class TestRegistration { + + @SubscribeEvent + public static void onRegisterEvent(final RegisterEvent e) { + if (e.getRegistryKey().equals(TunnelDefinition.REGISTRY_KEY)) { + e.register(TunnelDefinition.REGISTRY_KEY, (helper) -> { + final var inst = new FakeTunnelDefinition(); + helper.register(FakeTunnelDefinition.ID, inst); + }); + } + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/FakeTunnelDefinition.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/FakeTunnelDefinition.java new file mode 100644 index 00000000..682434b8 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/FakeTunnelDefinition.java @@ -0,0 +1,17 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.tunnels.TunnelDefinition; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.FastColor; + +public class FakeTunnelDefinition implements TunnelDefinition { + + public static final ResourceKey ID = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, new ResourceLocation(Constants.MOD_ID, "fake")); + + @Override + public int ringColor() { + return FastColor.ARGB32.color(255, 255, 0, 0); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java new file mode 100644 index 00000000..c286cd33 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java @@ -0,0 +1,33 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.test.TestBatches; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +import java.util.stream.Collectors; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class TunnelGraphCleanupTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canCleanupOrphanedMachines(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + graph.unregister(BlockPos.ZERO); + + final var machines = graph.machines().collect(Collectors.toSet()); + if(!machines.isEmpty()) + test.fail("Expected no machines to remain registered; got %s".formatted(machines.size())); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java new file mode 100644 index 00000000..0572f9b2 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java @@ -0,0 +1,72 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.test.TestBatches; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +import java.util.stream.Collectors; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class TunnelGraphMachineTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void unregisteredMachineConnectionCheck(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + final var connections = graph.positions(MACHINE_POS).collect(Collectors.toUnmodifiableSet()); + + if(!connections.isEmpty()) { + test.fail("There should be no connections registered."); + } + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void tunnelToMachineRelationship(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + // Check connected machine + graph.machine(BlockPos.ZERO).ifPresentOrElse(mp -> { + if(!mp.equals(MACHINE_POS)) + test.fail("Connected machine position did not match."); + }, () -> { + test.fail("Expected the tunnel to be connected to a machine. It was not."); + }); + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void machineToTunnelRelationship(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + final var connectedToMachine = graph.positions(MACHINE_POS) + .collect(Collectors.toUnmodifiableSet()); + + if(connectedToMachine.size() != 1) { + test.fail("Expected machine to have 1 connection."); + } + + if(!connectedToMachine.contains(BlockPos.ZERO)) { + test.fail("Expected machine to be connected to the tunnel."); + } + + test.succeed(); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java index da8d520d..c81a2cdb 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java @@ -14,6 +14,7 @@ import net.minecraft.core.GlobalPos; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.world.level.Level; import net.minecraftforge.gametest.GameTestHolder; @@ -58,7 +59,7 @@ public static void canSerializeSingleTunnel(final GameTestHelper test) { final var graph = new TunnelConnectionGraph(); final var MACHINE_POS = GlobalPos.of(Level.OVERWORLD, BlockPos.ZERO); - graph.registerTunnel(BlockPos.ZERO, Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.UP); + graph.register(BlockPos.ZERO, Tunnels.UNKNOWN_KEY, MACHINE_POS, Direction.UP); final var nbt = TunnelGraphNbtSerializer.serialize(graph); @@ -93,19 +94,30 @@ public static void canSerializeSingleTunnel(final GameTestHelper test) { test.succeed(); } + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void deserializeEarlyExitsEmptyTag(final GameTestHelper test) { + final var tag = new CompoundTag(); + + test.succeedIf(() -> { + final var graph = TunnelGraphNbtSerializer.fromNbt(tag); + if(graph.size() != 0) + test.fail("Expected an empty graph."); + }); + } + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) public static void canDeserializeTunnels(final GameTestHelper test) { final var graph = new TunnelConnectionGraph(); final var MACHINE_POS = GlobalPos.of(Level.OVERWORLD, BlockPos.ZERO); - graph.registerTunnel(BlockPos.ZERO.above(), Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.UP); - graph.registerTunnel(BlockPos.ZERO, Tunnels.UNKNOWN.get(), MACHINE_POS, Direction.DOWN); + graph.register(BlockPos.ZERO.above(), Tunnels.UNKNOWN_KEY, MACHINE_POS, Direction.UP); + graph.register(BlockPos.ZERO, Tunnels.UNKNOWN_KEY, MACHINE_POS, Direction.DOWN); final var nbt = TunnelGraphNbtSerializer.serialize(graph); final var newGraph = TunnelGraphNbtSerializer.fromNbt(nbt); - long machineCount = newGraph.getMachines().count(); + long machineCount = newGraph.machines().count(); if(machineCount != 1) { test.fail("Expected one machine node; got %s.".formatted(machineCount)); } diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java new file mode 100644 index 00000000..4aa9b6c8 --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java @@ -0,0 +1,73 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.test.TestBatches; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +import java.util.stream.Collectors; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class TunnelGraphSideTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void unregisteredMachineConnectionCheck(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + final var typesForUp = graph.types(MACHINE_POS, Direction.UP) + .collect(Collectors.toUnmodifiableSet()); + + if(typesForUp.size() != 1) { + test.fail("Expected the machine to have one tunnel registered for UP; got %s".formatted(typesForUp.size())); + } + + if(!typesForUp.contains(FakeTunnelDefinition.ID)) { + test.fail("Expected the fake tunnel definition to be registered for UP"); + } + + // Check side of tunnel + graph.side(BlockPos.ZERO).ifPresentOrElse(side -> { + if(side != Direction.UP) + test.fail("Expected tunnel side to be UP"); + }, () -> { + test.fail("Expected tunnel side to be set."); + }); + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canLookupSidesByDefinition(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + final var sides = graph.sides(MACHINE_POS, FakeTunnelDefinition.ID) + .collect(Collectors.toSet()); + + if(sides.size() != 1) { + test.fail("Expected one side matched; got %s".formatted(sides.size())); + } + + if(!sides.contains(Direction.UP)) { + var sidesString = sides.stream() + .map(Direction::getName) + .collect(Collectors.joining(",")); + + test.fail("Expected fake tunnel side lookup to include UP; it did not. Contents: %s".formatted(sidesString)); + } + + test.succeed(); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java new file mode 100644 index 00000000..c953625e --- /dev/null +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java @@ -0,0 +1,69 @@ +package dev.compactmods.machines.test.tunnel; + +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.test.TestBatches; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.gametest.framework.GameTest; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraftforge.gametest.GameTestHolder; +import net.minecraftforge.gametest.PrefixGameTestTemplate; + +@PrefixGameTestTemplate(false) +@GameTestHolder(Constants.MOD_ID) +public class TunnelGraphTunnelTests { + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void unboundTunnelPositionReturnsNoResult(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + + final var connectedTo = graph.machine(BlockPos.ZERO); + if(connectedTo.isPresent()) { + test.fail("There should not be a connection."); + } + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void returnsNothingForUnregisteredLocations(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + + graph.info(BlockPos.ZERO).ifPresent(info -> { + test.fail("Got registration info for an unregistered position: %s".formatted(info.type())); + }); + + test.succeed(); + } + + @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) + public static void canRegisterSingleTunnel(final GameTestHelper test) { + final var graph = new TunnelConnectionGraph(); + final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); + + graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); + + if(!graph.has(BlockPos.ZERO)) + test.fail("Graph is reporting tunnel is not registered."); + + graph.info(BlockPos.ZERO).ifPresentOrElse(info -> { + if(!info.location().equals(BlockPos.ZERO)) + test.fail("Tunnel location is not correct."); + + if(!info.machine().equals(MACHINE_POS)) + test.fail("Tunnel machine is not correct."); + + if(!info.side().equals(Direction.UP)) + test.fail("Tunnel side is not correct."); + + if(!info.type().equals(FakeTunnelDefinition.ID.location())) + test.fail("Tunnel type is not correct."); + }, () -> { + test.fail("Tunnel was not registered correctly."); + }); + + test.succeed(); + } +} From 74af175acc25dd117605f30fca3f8ad0665a0a3b Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Apr 2023 20:32:12 -0400 Subject: [PATCH 66/85] Bump core to v2.2; updated tunnel graph system --- .../data/CMTunnelDataExportCommand.java | 2 +- .../subcommand/CMRebindSubcommand.java | 22 +- .../subcommand/CMUnbindSubcommand.java | 14 +- .../providers/CompactMachineProvider.java | 2 +- .../migration/Pre520RoomDataMigrator.java | 2 +- .../block/CompactMachineBlockEntity.java | 9 +- .../block/LegacySizedCompactMachineBlock.java | 6 +- .../room/upgrade/RoomUpgradeManager.java | 2 +- .../machines/forge/tunnel/TunnelItem.java | 8 +- .../forge/tunnel/TunnelWallBlock.java | 6 +- .../forge/tunnel/TunnelWallEntity.java | 4 +- .../tunnel/graph/GraphEdgeLookupResult.java | 9 - .../tunnel/graph/TunnelConnectionGraph.java | 497 ------------------ .../TunnelGraphEdgeDeserializationResult.java | 8 - .../tunnel/graph/nbt/TunnelGraphNbtKeys.java | 22 - .../graph/nbt/TunnelGraphNbtSerializer.java | 211 -------- .../TunnelGraphNodeDeserializationResult.java | 9 - .../TunnelGraphNodeSerializationResult.java | 9 - .../traversal/ForgeTunnelTypeFilters.java | 20 + .../test/tunnel/TunnelGraphCleanupTests.java | 4 +- .../test/tunnel/TunnelGraphMachineTests.java | 8 +- .../tunnel/TunnelGraphSerializationTests.java | 15 +- .../test/tunnel/TunnelGraphSideTests.java | 9 +- .../test/tunnel/TunnelGraphTunnelTests.java | 4 +- gradle.properties | 4 +- 25 files changed, 90 insertions(+), 816 deletions(-) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java index bfb2be7f..e22c8b38 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java @@ -4,7 +4,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java index f3a1a093..d488d62a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java @@ -4,15 +4,16 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.config.ServerConfig; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; @@ -27,7 +28,7 @@ public static LiteralArgumentBuilder make() { subRoot.then(Commands.argument("pos", BlockPosArgument.blockPos()) .then(Commands.argument("bindTo", StringArgumentType.string()) - .executes(CMRebindSubcommand::doRebind))); + .executes(CMRebindSubcommand::doRebind))); return subRoot; } @@ -48,17 +49,18 @@ private static int doRebind(CommandContext ctx) throws Comma roomProvider.forRoom(roomCode).ifPresentOrElse(targetRoom -> { CompactMachines.LOGGER.debug("Binding machine at {} to room {}", rebindingMachine, targetRoom.code()); - if(!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { + if (!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); } machine.connectedRoom().ifPresentOrElse(currentRoom -> { final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); - final var firstTunnel = currentRoomTunnels.positions(machine.getLevelPosition()).findFirst(); - firstTunnel.ifPresent(ft -> { - throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); - }); + currentRoomTunnels.positions(TunnelMachineFilters.all(machine.getLevelPosition())) + .findFirst() + .ifPresent(match -> { + throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, match)); + }); // No tunnels - clear to rebind machine.setConnectedRoom(targetRoom); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java index 91943d29..0e1500d4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java @@ -6,9 +6,10 @@ import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.config.ServerConfig; import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.commands.CommandRuntimeException; import net.minecraft.commands.CommandSourceStack; @@ -37,17 +38,18 @@ private static int doUnbind(CommandContext ctx) throws Comma final var rebindingMachine = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); - if(!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { + if (!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); } machine.connectedRoom().ifPresentOrElse(currentRoom -> { final var currentRoomTunnels = TunnelConnectionGraph.forRoom(compactDim, currentRoom); - final var firstTunnel = currentRoomTunnels.positions(machine.getLevelPosition()).findFirst(); - firstTunnel.ifPresent(ft -> { - throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); - }); + currentRoomTunnels.positions(TunnelMachineFilters.all(machine.getLevelPosition())) + .findFirst() + .ifPresent(ft -> { + throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NO_REBIND_TUNNEL_PRESENT, ft)); + }); machine.disconnect(); }, () -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java index 7106af8c..18501c87 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java @@ -8,7 +8,7 @@ import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.forge.tunnel.TunnelItem; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.util.PlayerUtil; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java index 76b36924..bd6c28b6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java @@ -3,7 +3,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java index 7d4b0eb4..33261c1b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java @@ -9,15 +9,16 @@ import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.tunnel.graph.traversal.ForgeTunnelTypeFilters; import dev.compactmods.machines.machine.BasicRoomInfo; import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.util.NbtUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -82,7 +83,7 @@ public LazyOptional getCapability(@NotNull Capability cap, @Nullable D final var graph = TunnelConnectionGraph.forRoom(compactDim, roomId); - final var supportingTunnels = graph.getTunnelsSupporting(getLevelPosition(), side, cap); + final var supportingTunnels = graph.positions(TunnelMachineFilters.sided(getLevelPosition(), side), ForgeTunnelTypeFilters.capability(cap)); final var firstSupported = supportingTunnels.findFirst(); if (firstSupported.isEmpty()) return super.getCapability(cap, side); @@ -311,7 +312,7 @@ public void disconnect() { } } - public Optional getTunnelGraph() { + public Optional getTunnelGraph() { if (level == null || roomCode == null) return Optional.empty(); if (level instanceof ServerLevel sl) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index d3c38c19..3b8a2774 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -2,6 +2,8 @@ import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; import dev.compactmods.machines.api.core.CMTags; @@ -22,7 +24,7 @@ import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.forge.room.ui.MachineRoomMenu; import dev.compactmods.machines.forge.tunnel.Tunnels; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -102,7 +104,7 @@ public void neighborChanged(BlockState state, Level world, BlockPos pos, Block c // Horizontal neighbor changed machine.getTunnelGraph().ifPresent(graph -> { // Update redstone tunnel signals - graph.getRedstoneTunnels(machine.getLevelPosition(), dir).forEach(tunnelPos -> { + graph.positions(TunnelMachineFilters.sided(machine.getLevelPosition(), dir), TunnelTypeFilters.redstone(Tunnels::getDefinition)).forEach(tunnelPos -> { compactWorld.updateNeighbourForOutputSignal(tunnelPos, Tunnels.BLOCK_TUNNEL_WALL.get()); }); }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java index bca01aee..e1460bf3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java @@ -12,7 +12,7 @@ import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.room.graph.RoomReferenceNode; +import dev.compactmods.machines.room.graph.node.RoomReferenceNode; import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index a0edd5b7..86574129 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -1,7 +1,9 @@ package dev.compactmods.machines.forge.tunnel; import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import dev.compactmods.machines.forge.tunnel.network.TunnelAddedPacket; import dev.compactmods.machines.forge.wall.SolidWallBlock; import dev.compactmods.machines.api.core.Constants; @@ -83,7 +85,7 @@ public static ItemStack createStack(TunnelDefinition definition) { @Override public Component getName(ItemStack stack) { String key = ITunnelItem.getDefinition(stack) - .map(TranslationUtil::tunnelId) + .map(id -> TranslationUtil.tunnelId(id.location())) .orElse("item." + Constants.MOD_ID + ".tunnels.unnamed"); return Component.translatable(key); @@ -186,7 +188,7 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position var hist = lastEnteredMachine.get(); var placedSides = roomTunnels - .sides(hist.getMachine(), tunnelId) + .sides(TunnelMachineFilters.all(hist.getMachine()), TunnelTypeFilters.key(tunnelId)) .collect(Collectors.toSet()); // all tunnels already placed for type diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index 0356e4f9..8a6e3b23 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -8,7 +8,6 @@ import dev.compactmods.machines.api.tunnels.lifecycle.rotation.ITunnelRotationEventListener; import dev.compactmods.machines.api.tunnels.redstone.RedstoneReaderTunnel; import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.forge.tunnel.removal.ServerPlayerRemovedReason; import dev.compactmods.machines.forge.tunnel.rotation.ServerPlayerRotatedReason; import dev.compactmods.machines.forge.wall.ProtectedWallBlock; @@ -16,6 +15,9 @@ import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.TunnelHelper; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -165,7 +167,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player Direction dir = state.getValue(CONNECTED_SIDE); final var existingDirs = tunnels - .sides(tunnel.connectedMachine(), tunnelId) + .sides(TunnelMachineFilters.all(tunnel.connectedMachine()), TunnelTypeFilters.key(tunnelId)) .collect(Collectors.toSet()); if (existingDirs.size() == 6) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index 580e0da0..a5b89574 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -10,11 +10,11 @@ import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveEventListener; import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.BaseTunnelWallData; -import dev.compactmods.machines.tunnel.graph.TunnelNode; +import dev.compactmods.machines.tunnel.graph.node.TunnelNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java deleted file mode 100644 index 0d358eda..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/GraphEdgeLookupResult.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph; - -import com.google.common.graph.EndpointPair; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; - -@SuppressWarnings("UnstableApiUsage") -public record GraphEdgeLookupResult>(EndpointPair> endpoints, E edgeValue) { -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java deleted file mode 100644 index fc8e36f2..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/TunnelConnectionGraph.java +++ /dev/null @@ -1,497 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph; - -import com.google.common.graph.EndpointPair; -import com.google.common.graph.MutableValueGraph; -import com.google.common.graph.ValueGraphBuilder; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; -import dev.compactmods.machines.api.tunnels.connection.RoomTunnelConnections; -import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.forge.tunnel.Tunnels; -import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtSerializer; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; -import dev.compactmods.machines.tunnel.graph.TunnelMachineInfo; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; -import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.GlobalPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.saveddata.SavedData; -import net.minecraftforge.common.capabilities.Capability; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nonnull; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Stream; - -/** - * Represents a room's tunnel connections in a graph-style format. - * This should be accessed through the saved data for specific machine room chunks. - * - * Graph Types Used: - * @see TunnelNode - * @see TunnelTypeNode - * @see CompactMachineNode - * @see TunnelMachineEdge - * @see TunnelTypeEdge - */ -@SuppressWarnings("UnstableApiUsage") -public class TunnelConnectionGraph extends SavedData implements RoomTunnelConnections { - - /** - * The full data graph. Contains tunnel nodes, machine ids, and tunnel type information. - */ - private final MutableValueGraph, IGraphEdge> graph; - - /** - * Quick access to tunnel information for specific locations. - */ - private final Map tunnels; - - /** - * Quick access to machine information nodes. - */ - private final Map machines; - - /** - * Quick access to tunnel definition nodes. - */ - private final Map tunnelTypes; - - private static final Logger LOGS = LogManager.getLogger("tunnel_graph"); - - public TunnelConnectionGraph() { - graph = ValueGraphBuilder - .directed() - .build(); - - tunnels = new HashMap<>(); - machines = new HashMap<>(); - tunnelTypes = new HashMap<>(); - } - - private TunnelConnectionGraph(CompoundTag nbt) { - this(); - TunnelGraphNbtSerializer.deserialize(this, nbt); - } - - public static TunnelConnectionGraph forRoom(ServerLevel compactDim, String room) { - final var key = getDataFilename(room); - return compactDim.getDataStorage().computeIfAbsent( - TunnelConnectionGraph::new, - TunnelConnectionGraph::new, - key - ); - } - - @Nonnull - @Override - public CompoundTag save(CompoundTag tag) { - cleanupOrphans(); - var gData = TunnelGraphNbtSerializer.serialize(this); - return tag.merge(gData); - } - - public static String getDataFilename(String room) { - return "tunnels_" + room; - } - - /** - * Finds which machine a tunnel is connected to. - * - * @param tunnel The tunnel to find a connection for. - * @return The id of the connected machine. - */ - public Optional machine(BlockPos tunnel) { - if (!tunnels.containsKey(tunnel)) - return Optional.empty(); - - var tNode = tunnels.get(tunnel); - return graph.successors(tNode) - .stream() - .filter(CompactMachineNode.class::isInstance) - .map(CompactMachineNode.class::cast) - .findFirst() - .map(CompactMachineNode::dimpos); - } - - /** - * Registers a tunnel as being connected to a machine on a particular side. - * If the tunnel already is registered, this will report a failure. - * - * @param tunnelPos The position of the tunnel inside the room. - * @param type The type of tunnel being registered. - * @param machine The machine the tunnel is to be connected to. - * @param side The side of the machine the tunnel is connecting to. - * @return True if the connection could be established; false if the tunnel type is already registered for the given side. - */ - public boolean register(BlockPos tunnelPos, ResourceKey type, GlobalPos machine, Direction side) { - // First we need to get the machine the tunnel is trying to connect to - var machineNode = getOrCreateMachineNode(machine); - var tunnelNode = getOrCreateTunnelNode(tunnelPos); - if (graph.hasEdgeConnecting(tunnelNode, machineNode)) { - // connection already formed between the tunnel at pos and the machine - LOGS.info("Tunnel already registered for machine {} at position {}.", - machine, - tunnelPos); - - return false; - } - - var tunnelTypeNode = getOrCreateTunnelTypeNode(type); - - // no tunnels registered for side yet - free to make new tunnel node - graph.putEdgeValue(tunnelNode, machineNode, new TunnelMachineEdge(side)); - graph.putEdgeValue(tunnelNode, tunnelTypeNode, new TunnelTypeEdge()); - - setDirty(); - return true; - } - - @Nonnull - protected TunnelNode getOrCreateTunnelNode(BlockPos tunnelPos) { - if (tunnels.containsKey(tunnelPos)) - return tunnels.get(tunnelPos); - - var newTunnel = new TunnelNode(tunnelPos); - tunnels.put(tunnelPos, newTunnel); - graph.addNode(newTunnel); - setDirty(); - - return newTunnel; - } - - protected CompactMachineNode getOrCreateMachineNode(GlobalPos machine) { - var machineRegistered = machines.containsKey(machine); - CompactMachineNode node; - if (!machineRegistered) { - node = new CompactMachineNode(machine.dimension(), machine.pos()); - machines.put(machine, node); - graph.addNode(node); - setDirty(); - } else { - node = machines.get(machine); - } - - return node; - } - - protected TunnelTypeNode getOrCreateTunnelTypeNode(ResourceKey definition) { - final ResourceLocation id = definition.location(); - - if (tunnelTypes.containsKey(id)) - return tunnelTypes.get(id); - - TunnelTypeNode newType = new TunnelTypeNode(id); - tunnelTypes.put(id, newType); - graph.addNode(newType); - setDirty(); - return newType; - } - - /** - * Gets the number of registered nodes in the graph. - */ - public int size() { - return graph.nodes().size(); - } - - protected Stream _type(ResourceKey type) { - var defNode = tunnelTypes.get(type.location()); - if (defNode == null) - return Stream.empty(); - - return graph.adjacentNodes(defNode) - .stream() - .filter(TunnelNode.class::isInstance) - .map(TunnelNode.class::cast); - } - - /** - * @deprecated Use {@link #side(BlockPos)} - * @param position - * @return - */ - @Override - @Deprecated(forRemoval = true, since = "5.2.0") - public Optional getConnectedSide(BlockPos position) { - return side(position); - } - - public Optional side(BlockPos pos) { - if (!tunnels.containsKey(pos)) - return Optional.empty(); - - var node = tunnels.get(pos); - return graph.adjacentNodes(node).stream() - .filter(CompactMachineNode.class::isInstance) - .map(mn -> graph.edgeValue(node, mn)) - .filter(Optional::isPresent) - .map(Optional::get) - .map(TunnelMachineEdge.class::cast) - .map(TunnelMachineEdge::side) - .findFirst(); - } - - public Optional info(BlockPos tunnel) { - if (!tunnels.containsKey(tunnel)) - return Optional.empty(); - - var node = tunnels.get(tunnel); - var typeNode = graph.successors(node).stream() - .filter(TunnelTypeNode.class::isInstance) - .map(TunnelTypeNode.class::cast) - .findFirst() - .orElseThrow(); - - var mach = machine(tunnel).orElseThrow(); - var side = side(tunnel).orElseThrow(); - var type = typeNode.id(); - - return Optional.of(new TunnelMachineInfo(tunnel, type, mach, side)); - } - - public Stream tunnels() { - return tunnels.keySet().stream() - .map(this::info) - .filter(Optional::isPresent) - .map(Optional::get); - } - - public Stream tunnels(GlobalPos machine) { - return positions(machine) - .map(this::info) - .filter(Optional::isPresent) - .map(Optional::get); - } - - public boolean has(BlockPos location) { - return tunnels.containsKey(location); - } - - /** - * Fetches the locations of all redstone-enabled tunnels for a specific wallSide. - * - * @param machine - * @param facing - * @return - */ - public Stream getRedstoneTunnels(GlobalPos machine, Direction facing) { - final var node = machines.get(machine); - if (node == null) return Stream.empty(); - - return _side(machine, facing) - .filter(sided -> graph.successors(sided).stream() - .filter(TunnelTypeNode.class::isInstance) - .map(TunnelTypeNode.class::cast) - .anyMatch(ttn -> { - var def = Tunnels.getDefinition(ttn.id()); - return def instanceof RedstoneTunnel; - })).map(TunnelNode::position); - } - - public Stream getTunnelsSupporting(GlobalPos machine, Direction side, Capability capability) { - final var node = machines.get(machine); - if (node == null) return Stream.empty(); - - return _side(machine, side) - .filter(sided -> graph.successors(sided).stream() - .filter(TunnelTypeNode.class::isInstance) - .map(TunnelTypeNode.class::cast) - .anyMatch(ttn -> { - var def = Tunnels.getDefinition(ttn.id()); - if (!(def instanceof CapabilityTunnel tcp)) - return false; - - return tcp.getSupportedCapabilities().contains(capability); - })).map(TunnelNode::position); - } - - public Stream> types(GlobalPos machine, Direction side) { - final var node = machines.get(machine); - if (node == null) return Stream.empty(); - - return _side(machine, side) - .flatMap(tn -> graph.successors(tn).stream()) - .filter(TunnelTypeNode.class::isInstance) - .map(TunnelTypeNode.class::cast) - .map(type -> ResourceKey.create(TunnelDefinition.REGISTRY_KEY, type.id())) - .distinct(); - } - - protected Stream _side(GlobalPos machine, Direction side) { - final var node = machines.get(machine); - if (node == null) return Stream.empty(); - - return graph.incidentEdges(node).stream() - .filter(e -> graph.edgeValue(e) - .map(ed -> ed instanceof TunnelMachineEdge tme && tme.side() == side) - .orElse(false) - ) - .map(EndpointPair::nodeU) - .filter(TunnelNode.class::isInstance) - .map(TunnelNode.class::cast); - } - - public Stream sides(GlobalPos machine, ResourceKey type) { - if (!tunnelTypes.containsKey(type.location())) - return Stream.empty(); - - return _type(type) - .filter(node -> machine(node.position()).map(machine::equals).orElse(false)) - .map(node -> node.getTunnelSide(this)) - .filter(Optional::isPresent) - .map(Optional::get); - } - - /** - * Unlinks a tunnel at a specified point inside the machine room. - * - * @param pos Tunnel position inside the room. - */ - public void unregister(BlockPos pos) { - if (!has(pos)) - return; - - LOGS.debug("Unregistering tunnel at {}", pos); - - final var existing = tunnels.get(pos); - graph.removeNode(existing); - tunnels.remove(pos); - - cleanupOrphanedTypes(); - cleanupOrphanedMachines(); - - setDirty(); - } - - private void cleanupOrphans() { - cleanupOrphanedTunnels(); - cleanupOrphanedTypes(); - cleanupOrphanedMachines(); - } - - private void cleanupOrphanedTypes() { - HashSet removedTypes = new HashSet<>(); - tunnelTypes.forEach((type, node) -> { - if (graph.degree(node) == 0) { - graph.removeNode(node); - removedTypes.add(type); - } - }); - - if (!removedTypes.isEmpty()) { - LOGS.debug("Removed {} tunnel type nodes during cleanup.", removedTypes.size()); - removedTypes.forEach(tunnelTypes::remove); - setDirty(); - } - - } - - private void cleanupOrphanedTunnels() { - HashSet removed = new HashSet<>(); - tunnels.forEach((pos, node) -> { - if (graph.degree(node) == 0) { - graph.removeNode(node); - removed.add(pos); - } - }); - - if (!removed.isEmpty()) { - LOGS.debug("Removed {} tunnel nodes during cleanup.", removed.size()); - removed.forEach(tunnels::remove); - setDirty(); - } - } - - private void cleanupOrphanedMachines() { - HashSet removed = new HashSet<>(); - machines.forEach((machine, node) -> { - if (graph.degree(node) == 0) { - graph.removeNode(node); - removed.add(machine); - } - }); - - if (!removed.isEmpty()) { - LOGS.debug("Removed {} machine nodes during cleanup.", removed.size()); - removed.forEach(machines::remove); - setDirty(); - } - } - - public void rotate(BlockPos tunnel, Direction newSide) { - if (!tunnels.containsKey(tunnel)) - return; - - final var connected = machine(tunnel); - connected.ifPresent(machine -> { - if (!machines.containsKey(machine)) - return; - - final var t = tunnels.get(tunnel); - final var m = machines.get(machine); - graph.removeEdge(t, m); - graph.putEdgeValue(t, m, new TunnelMachineEdge(newSide)); - - setDirty(); - }); - } - - public Stream machines() { - return this.machines.keySet().stream(); - } - - public Stream positions(GlobalPos machine) { - if (!machines.containsKey(machine)) - return Stream.empty(); - - final var mNode = machines.get(machine); - - // [CompactMachineNode] <--- [TunnelNode] - return graph.predecessors(mNode).stream() - .filter(TunnelNode.class::isInstance) - .map(TunnelNode.class::cast) - .map(TunnelNode::position); - } - - public void rebind(BlockPos tunnel, GlobalPos newMachine, Direction side) { - LOGS.debug("Rebinding tunnel at {} to machine {}", tunnel, newMachine); - - final var tunnelNode = getOrCreateTunnelNode(tunnel); - final var newMachineNode = getOrCreateMachineNode(newMachine); - graph.putEdgeValue(tunnelNode, newMachineNode, new TunnelMachineEdge(side)); - setDirty(); - } - - public> Stream nodes(Class type) { - return graph.nodes() - .stream() - .filter(type::isInstance) - .map(type::cast); - } - - public > Stream> edges(Class type) { - return graph.edges() - .stream() - .map(e -> { - final var ev = graph.edgeValue(e); - return ev.map(ige -> type.isInstance(ige) ? new GraphEdgeLookupResult<>(e, type.cast(ige)) : null) - .orElse(null); - }) - .filter(Objects::nonNull); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java deleted file mode 100644 index c370f4fe..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphEdgeDeserializationResult.java +++ /dev/null @@ -1,8 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph.nbt; - -import dev.compactmods.machines.graph.IGraphEdge; - -import java.util.UUID; - -public record TunnelGraphEdgeDeserializationResult>(UUID from, UUID to, E data) { -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java deleted file mode 100644 index 36039948..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtKeys.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph.nbt; - -public interface TunnelGraphNbtKeys { - - String NODE_GROUP = "nodes"; - String NODE_COUNT = "node_count"; - String NODE_ID = "id"; - String NODE_DATA = "data"; - String NODE_GROUP_TUNNEL_LIST = "tunnels"; - String NODE_GROUP_TUNNEL_TYPE_LIST = "tunnel_types"; - String NODE_GROUP_MACHINE_LIST = "machines"; - - - String EDGE_GROUP = "edges"; - String EDGE_COUNT = "edge_count"; - String EDGE_CONNECTION_FROM_ID = "from"; - String EDGE_CONNECTION_TO_ID = "to"; - String EDGE_CONNECTION_DATA = "data"; - String EDGE_GROUP_MACHINE_LIST = "machines"; - String EDGE_GROUP_TUNNEL_TYPE_LIST = "tunnel_types"; - -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java deleted file mode 100644 index bae84686..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNbtSerializer.java +++ /dev/null @@ -1,211 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph.nbt; - -import com.mojang.serialization.Codec; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.codec.NbtListCollector; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; -import dev.compactmods.machines.machine.graph.CompactMachineNode; -import dev.compactmods.machines.tunnel.graph.TunnelMachineEdge; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.tunnel.graph.TunnelTypeEdge; -import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceKey; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class TunnelGraphNbtSerializer { - - private static final Logger LOGS = LogManager.getLogger(Constants.MOD_ID); - private static final Marker SERIALIZER_MARKER = MarkerManager.getMarker("TunnelGraphSerializer"); - - private static final String VERSION = "3.1.0"; - - public static CompoundTag serialize(TunnelConnectionGraph graph) { - final var rootTag = new CompoundTag(); - - rootTag.putString("version", VERSION); - - // BEGIN NODES - CompoundTag nodesGroup = new CompoundTag(); - - final var tunnelNodes = serializeTunnels(graph); - final var tunnelTypeNodes = serializeTunnelTypes(graph); - final var machineNodes = serializeMachines(graph); - - int numNodes = graph.size(); - var nodeIds = new HashMap, UUID>(numNodes); - - nodeIds.putAll(tunnelNodes.idMap()); - nodeIds.putAll(tunnelTypeNodes.idMap()); - nodeIds.putAll(machineNodes.idMap()); - - nodesGroup.putInt(TunnelGraphNbtKeys.NODE_COUNT, nodeIds.size()); - nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, tunnelNodes.listTag()); - nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_TYPE_LIST, tunnelTypeNodes.listTag()); - nodesGroup.put(TunnelGraphNbtKeys.NODE_GROUP_MACHINE_LIST, machineNodes.listTag()); - - rootTag.put(TunnelGraphNbtKeys.NODE_GROUP, nodesGroup); - - // BEGIN EDGES - final var edges = new CompoundTag(); - final var machineEdges = serializeEdges(graph, nodeIds, TunnelMachineEdge.CODEC, TunnelMachineEdge.class); - final var tunnelTypeEdges = serializeEdges(graph, nodeIds, TunnelTypeEdge.CODEC, TunnelTypeEdge.class); - - edges.putInt(TunnelGraphNbtKeys.EDGE_COUNT, machineEdges.size() + tunnelTypeEdges.size()); - edges.put(TunnelGraphNbtKeys.EDGE_GROUP_MACHINE_LIST, machineEdges); - edges.put(TunnelGraphNbtKeys.EDGE_GROUP_TUNNEL_TYPE_LIST, tunnelTypeEdges); - - rootTag.put(TunnelGraphNbtKeys.EDGE_GROUP, edges); - - return rootTag; - } - - public static TunnelConnectionGraph fromNbt(CompoundTag tag) { - final var graph = new TunnelConnectionGraph(); - deserialize(graph, tag); - return graph; - } - - public static void deserialize(TunnelConnectionGraph graph, CompoundTag tag) { - if (!tag.contains(TunnelGraphNbtKeys.NODE_GROUP, Tag.TAG_COMPOUND)) { - LOGS.info(SERIALIZER_MARKER, "No nodes to load; skipping deserialization."); - return; - } - - final var nodesNbt = tag.getCompound(TunnelGraphNbtKeys.NODE_GROUP); - - final var tunnels = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_LIST, Tag.TAG_COMPOUND), TunnelNode.CODEC); - LOGS.debug(SERIALIZER_MARKER, "Loaded %s tunnel nodes.".formatted(tunnels.results().size())); - - final var tunnelTypes = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_TUNNEL_TYPE_LIST, Tag.TAG_COMPOUND), TunnelTypeNode.CODEC); - LOGS.debug(SERIALIZER_MARKER, "Loaded %s tunnel type nodes.".formatted(tunnelTypes.results().size())); - - final var machines = deserializeNodes(nodesNbt.getList(TunnelGraphNbtKeys.NODE_GROUP_MACHINE_LIST, Tag.TAG_COMPOUND), CompactMachineNode.CODEC); - LOGS.debug(SERIALIZER_MARKER, "Loaded %s machine nodes.".formatted(machines.results().size())); - - final var edgesNbt = tag.getCompound(TunnelGraphNbtKeys.EDGE_GROUP); - final var tunnelMachineEdges = deserializeEdges(edgesNbt, TunnelGraphNbtKeys.EDGE_GROUP_MACHINE_LIST, TunnelMachineEdge.CODEC); - final var tunnelTypeEdges = deserializeEdges(edgesNbt, TunnelGraphNbtKeys.EDGE_GROUP_TUNNEL_TYPE_LIST, TunnelTypeEdge.CODEC); - - tunnels.results().forEach((id, node) -> { - var connectedMachine = tunnelMachineEdges.get(id); - var connectedType = tunnelTypeEdges.get(id); - - final var machine = machines.results().get(connectedMachine.to()); - final var type = tunnelTypes.results().get(connectedType.to()); - - final var definition = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, type.id()); - graph.register(node.position(), definition, machine.dimpos(), connectedMachine.data().side()); - }); - } - - private static > TunnelGraphNodeDeserializationResult deserializeNodes( - ListTag list, Codec codec - ) { - HashMap nodeMap = new HashMap<>(list.size()); - - list.forEach(nodeTag -> { - if (!(nodeTag instanceof CompoundTag ct)) return; - final var node = codec.parse(NbtOps.INSTANCE, ct.getCompound(TunnelGraphNbtKeys.NODE_DATA)) - .getOrThrow(false, e -> LOGS.error(SERIALIZER_MARKER, e)); - - final var nodeId = ct.getUUID(TunnelGraphNbtKeys.NODE_ID); - nodeMap.put(nodeId, node); - }); - - return new TunnelGraphNodeDeserializationResult<>(nodeMap); - } - - private static > HashMap> deserializeEdges( - CompoundTag edgesNbt, String listKey, Codec codec - ) { - final var connections = new HashMap>(); - edgesNbt.getList(listKey, Tag.TAG_COMPOUND).forEach(edgeTag -> { - if (!(edgeTag instanceof CompoundTag ct)) return; - - final var fromId = ct.getUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_FROM_ID); - final var toId = ct.getUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_TO_ID); - final var edgeData = codec.parse(NbtOps.INSTANCE, ct.getCompound(TunnelGraphNbtKeys.EDGE_CONNECTION_DATA)) - .getOrThrow(false, e -> LOGS.error(SERIALIZER_MARKER, e)); - - var result = new TunnelGraphEdgeDeserializationResult<>(fromId, toId, edgeData); - connections.putIfAbsent(fromId, result); - }); - - return connections; - } - - private static > TunnelGraphNodeSerializationResult serializeNodes( - final TunnelConnectionGraph connections, final Codec serializer, final Class nodeType - ) { - HashMap nodeIds = new HashMap<>(); - final ListTag listNbt = connections.nodes(nodeType) - .map(node -> { - var id = UUID.randomUUID(); - nodeIds.put(node, id); - var nodeNbt = serializer.encodeStart(NbtOps.INSTANCE, node) - .getOrThrow(false, err -> LOGS.error(SERIALIZER_MARKER, err)); - - var tag = new CompoundTag(); - tag.putUUID(TunnelGraphNbtKeys.NODE_ID, id); - tag.put(TunnelGraphNbtKeys.NODE_DATA, nodeNbt); - return tag; - }) - .collect(NbtListCollector.toNbtList()); - - return new TunnelGraphNodeSerializationResult(nodeIds, listNbt); - } - - private static > ListTag serializeEdges( - final TunnelConnectionGraph connections, final Map, UUID> nodeIds, - final Codec serializer, Class edgeType - ) { - return connections.edges(edgeType) - .map(tme -> { - var edge = tme.edgeValue(); - var edgeData = serializer.encodeStart(NbtOps.INSTANCE, edge) - .getOrThrow(false, err -> LOGS.error(SERIALIZER_MARKER, err)); - - CompoundTag edgeInfo = new CompoundTag(); - edgeInfo.putUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_FROM_ID, nodeIds.get(tme.endpoints().nodeU())); - edgeInfo.putUUID(TunnelGraphNbtKeys.EDGE_CONNECTION_TO_ID, nodeIds.get(tme.endpoints().nodeV())); - edgeInfo.put(TunnelGraphNbtKeys.EDGE_CONNECTION_DATA, edgeData); - - return edgeInfo; - }).collect(NbtListCollector.toNbtList()); - } - - public static TunnelGraphNodeSerializationResult serializeTunnels(final TunnelConnectionGraph connections) { - LOGS.debug(SERIALIZER_MARKER, "Starting tunnel node serialization."); - final var result = serializeNodes(connections, TunnelNode.CODEC, TunnelNode.class); - LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} tunnel nodes serialized.", result.listTag().size()); - return result; - } - - public static TunnelGraphNodeSerializationResult serializeTunnelTypes(final TunnelConnectionGraph connections) { - LOGS.debug(SERIALIZER_MARKER, "Starting tunnel type node serialization."); - final var result = serializeNodes(connections, TunnelTypeNode.CODEC, TunnelTypeNode.class); - LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} tunnel type nodes serialized.", result.listTag().size()); - return result; - } - - public static TunnelGraphNodeSerializationResult serializeMachines(final TunnelConnectionGraph connections) { - LOGS.debug(SERIALIZER_MARKER, "Starting machine node serialization."); - final var result = serializeNodes(connections, CompactMachineNode.CODEC, CompactMachineNode.class); - LOGS.debug(SERIALIZER_MARKER, "Done serializing node information: {} machine nodes serialized.", result.listTag().size()); - return result; - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java deleted file mode 100644 index df6f9971..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeDeserializationResult.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph.nbt; - -import dev.compactmods.machines.graph.IGraphNode; - -import java.util.Map; -import java.util.UUID; - -public record TunnelGraphNodeDeserializationResult>(Map results) { -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java deleted file mode 100644 index a48ce50c..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/nbt/TunnelGraphNodeSerializationResult.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.compactmods.machines.forge.tunnel.graph.nbt; - -import dev.compactmods.machines.graph.IGraphNode; -import net.minecraft.nbt.ListTag; - -import java.util.Map; -import java.util.UUID; - -public record TunnelGraphNodeSerializationResult>(Map idMap, ListTag listTag) {} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java new file mode 100644 index 00000000..1500ef35 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java @@ -0,0 +1,20 @@ +package dev.compactmods.machines.forge.tunnel.graph.traversal; + +import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.tunnel.graph.traversal.ITunnelFilter; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; +import net.minecraftforge.common.capabilities.Capability; + +public class ForgeTunnelTypeFilters { + + public static ITunnelFilter capability(Capability capability) { + return TunnelTypeFilters.definition(def -> { + + if (!(def instanceof CapabilityTunnel tcp)) + return false; + + return tcp.getSupportedCapabilities().contains(capability); + }, Tunnels::getDefinition); + } +} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java index c286cd33..647efa12 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphCleanupTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.tunnel; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.test.TestBatches; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -29,5 +29,7 @@ public static void canCleanupOrphanedMachines(final GameTestHelper test) { final var machines = graph.machines().collect(Collectors.toSet()); if(!machines.isEmpty()) test.fail("Expected no machines to remain registered; got %s".formatted(machines.size())); + + test.succeed(); } } diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java index 0572f9b2..2cb41747 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphMachineTests.java @@ -1,7 +1,8 @@ package dev.compactmods.machines.test.tunnel; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.test.TestBatches; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -22,7 +23,8 @@ public static void unregisteredMachineConnectionCheck(final GameTestHelper test) final var graph = new TunnelConnectionGraph(); final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); - final var connections = graph.positions(MACHINE_POS).collect(Collectors.toUnmodifiableSet()); + final var connections = graph.positions(TunnelMachineFilters.all(MACHINE_POS)) + .collect(Collectors.toUnmodifiableSet()); if(!connections.isEmpty()) { test.fail("There should be no connections registered."); @@ -56,7 +58,7 @@ public static void machineToTunnelRelationship(final GameTestHelper test) { graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); - final var connectedToMachine = graph.positions(MACHINE_POS) + final var connectedToMachine = graph.positions(TunnelMachineFilters.sided(MACHINE_POS, Direction.UP)) .collect(Collectors.toUnmodifiableSet()); if(connectedToMachine.size() != 1) { diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java index c81a2cdb..ab3c5fd0 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java @@ -2,13 +2,14 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.tunnel.Tunnels; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtKeys; -import dev.compactmods.machines.forge.tunnel.graph.nbt.TunnelGraphNbtSerializer; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.nbt.TunnelGraphNbtKeys; +import dev.compactmods.machines.tunnel.graph.nbt.TunnelGraphNbtSerializer; +import dev.compactmods.machines.tunnel.graph.traversal.GraphTraversalHelper; import dev.compactmods.machines.test.TestBatches; import dev.compactmods.machines.test.util.NbtTestUtils; -import dev.compactmods.machines.tunnel.graph.TunnelNode; -import dev.compactmods.machines.tunnel.graph.TunnelTypeNode; +import dev.compactmods.machines.tunnel.graph.node.TunnelNode; +import dev.compactmods.machines.tunnel.graph.node.TunnelTypeNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -122,12 +123,12 @@ public static void canDeserializeTunnels(final GameTestHelper test) { test.fail("Expected one machine node; got %s.".formatted(machineCount)); } - long tunnelCount = newGraph.nodes(TunnelNode.class).count(); + long tunnelCount = GraphTraversalHelper.nodes(graph, TunnelNode.class).count(); if(tunnelCount != 2) { test.fail("Expected 2 tunnel nodes; got %s.".formatted(tunnelCount)); } - long tunnelTypeCount = newGraph.nodes(TunnelTypeNode.class).count(); + long tunnelTypeCount = GraphTraversalHelper.nodes(graph, TunnelTypeNode.class).count(); if(tunnelTypeCount != 1) { test.fail("Expected 1 tunnel type node; got %s.".formatted(tunnelTypeCount)); } diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java index 4aa9b6c8..689309a5 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSideTests.java @@ -1,8 +1,10 @@ package dev.compactmods.machines.test.tunnel; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -18,7 +20,7 @@ public class TunnelGraphSideTests { @GameTest(template = "empty_1x1", batch = TestBatches.TUNNEL_DATA) - public static void unregisteredMachineConnectionCheck(final GameTestHelper test) { + public static void directionalTypeLookup(final GameTestHelper test) { final var graph = new TunnelConnectionGraph(); final var MACHINE_POS = GlobalPos.of(test.getLevel().dimension(), BlockPos.ZERO); @@ -53,7 +55,8 @@ public static void canLookupSidesByDefinition(final GameTestHelper test) { graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); - final var sides = graph.sides(MACHINE_POS, FakeTunnelDefinition.ID) + final var sides = graph + .sides(TunnelMachineFilters.all(MACHINE_POS), TunnelTypeFilters.key(FakeTunnelDefinition.ID)) .collect(Collectors.toSet()); if(sides.size() != 1) { diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java index c953625e..9237a273 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.test.tunnel; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.forge.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.test.TestBatches; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -58,7 +58,7 @@ public static void canRegisterSingleTunnel(final GameTestHelper test) { if(!info.side().equals(Direction.UP)) test.fail("Tunnel side is not correct."); - if(!info.type().equals(FakeTunnelDefinition.ID.location())) + if(!info.type().equals(FakeTunnelDefinition.ID)) test.fail("Tunnel type is not correct."); }, () -> { test.fail("Tunnel was not registered correctly."); diff --git a/gradle.properties b/gradle.properties index d5b35622..b76aaf54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.1.1 -tunnels_version=2.1.1 +core_version=2.2.0 +tunnels_version=2.2.0 # Curseforge cf_project=224218 From cc0794f65db060fe86394149c340e1993c6651e5 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Thu, 13 Apr 2023 23:48:24 -0400 Subject: [PATCH 67/85] Move datagen to its own module, clean up forge-main --- .github/workflows/ci-tests-nightly.yml | 2 +- forge-datagen/build.gradle.kts | 113 ++++++++++++++++++ .../datagen}/AdvancementGenerator.java | 2 +- .../datagen}/AdvancementLangBuilder.java | 4 +- .../machines/datagen}/BlockLootGenerator.java | 4 +- .../machines/datagen}/DataGenUtil.java | 2 +- .../machines/datagen}/DataGeneration.java | 14 +-- .../datagen}/DimensionTypeBuilder.java | 2 +- .../machines/datagen}/ItemModelGenerator.java | 2 +- .../datagen}/LevelBiomeGenerator.java | 2 +- .../machines/datagen}/RecipeGenerator.java | 2 +- .../machines/datagen}/StateGenerator.java | 2 +- .../datagen}/TunnelWallStateGenerator.java | 2 +- .../machines/datagen/VillagerTrades.java | 4 + .../datagen}/lang/BaseLangGenerator.java | 4 +- .../datagen}/lang/EnglishLangGenerator.java | 2 +- .../datagen}/lang/RussianLangGenerator.java | 2 +- .../machines/datagen}/room/RoomTemplates.java | 2 +- .../datagen}/tags/BlockTagGenerator.java | 2 +- .../datagen}/tags/ItemTagGenerator.java | 2 +- .../tags/PointOfInterestTagGenerator.java | 2 +- forge-main/build.gradle.kts | 15 --- .../machines/forge/CompactMachines.java | 2 +- .../functions/CopyRoomBindingFunction.java | 2 +- .../functions/LootFunctions.java | 2 +- .../forge/data/generated/VillagerTrades.java | 4 - .../test/tunnel/TunnelGraphTunnelTests.java | 14 +-- settings.gradle.kts | 1 + 28 files changed, 156 insertions(+), 57 deletions(-) create mode 100644 forge-datagen/build.gradle.kts rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/AdvancementGenerator.java (99%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/AdvancementLangBuilder.java (85%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/BlockLootGenerator.java (96%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/DataGenUtil.java (98%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/DataGeneration.java (76%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/DimensionTypeBuilder.java (98%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/ItemModelGenerator.java (97%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/LevelBiomeGenerator.java (99%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/RecipeGenerator.java (99%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/StateGenerator.java (98%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/TunnelWallStateGenerator.java (98%) create mode 100644 forge-datagen/src/main/java/dev/compactmods/machines/datagen/VillagerTrades.java rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/lang/BaseLangGenerator.java (97%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/lang/EnglishLangGenerator.java (99%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/lang/RussianLangGenerator.java (98%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/room/RoomTemplates.java (97%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/tags/BlockTagGenerator.java (96%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/tags/ItemTagGenerator.java (97%) rename {forge-main/src/main/java/dev/compactmods/machines/forge/data/generated => forge-datagen/src/main/java/dev/compactmods/machines/datagen}/tags/PointOfInterestTagGenerator.java (93%) rename forge-main/src/main/java/dev/compactmods/machines/forge/data/{generated => }/functions/CopyRoomBindingFunction.java (97%) rename forge-main/src/main/java/dev/compactmods/machines/forge/data/{generated => }/functions/LootFunctions.java (87%) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml index 7b348e9d..6ba3076f 100644 --- a/.github/workflows/ci-tests-nightly.yml +++ b/.github/workflows/ci-tests-nightly.yml @@ -61,7 +61,7 @@ jobs: - name: Datagen uses: gradle/gradle-build-action@v2 with: - arguments: runData + arguments: :forge-datagen:runData env: CM_VERSION: ${{ needs.vars.outputs.version }} GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} diff --git a/forge-datagen/build.gradle.kts b/forge-datagen/build.gradle.kts new file mode 100644 index 00000000..da4a9ab4 --- /dev/null +++ b/forge-datagen/build.gradle.kts @@ -0,0 +1,113 @@ +val modVersion: String = System.getenv("CM_VERSION") ?: "9.9.9" + +val coreVersion: String = property("core_version") as String +val tunnelsApiVersion: String = property("tunnels_version") as String + +var modId = property("mod_id") as String +var minecraft_version: String by extra +var forge_version: String by extra +var parchment_version: String by extra + +val forgeMain = project(":forge-main") + +plugins { + id("net.minecraftforge.gradle") version ("5.1.+") + id("org.parchmentmc.librarian.forgegradle") version ("1.+") +} + +base { + group = "dev.compactmods.compactmachines" + version = modVersion +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +sourceSets.main { + resources { + srcDir(file("src/main/resources")) + } +} + +repositories { + mavenLocal() + + maven("https://maven.pkg.github.com/compactmods/compactmachines-core") { + name = "Github PKG Core" + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN") + } + } +} + +val runDepends: List = listOf( + project(":forge-tunnels-api"), + project(":forge-builtin"), + forgeMain +) + +runDepends.forEach { + project.evaluationDependsOn(it.path) +} + +dependencies { + minecraft("net.minecraftforge", "forge", version = "${minecraft_version}-${forge_version}") + + implementation("dev.compactmods.compactmachines:core-api:$coreVersion") + implementation("dev.compactmods.compactmachines:core:$coreVersion") + implementation("dev.compactmods.compactmachines:tunnels-api:$tunnelsApiVersion") + + compileOnly(project(":forge-tunnels-api")) + compileOnly(project(":forge-builtin")) + compileOnly(project(":forge-main")) { + isTransitive = false + } +} + +minecraft { + mappings("parchment", "${parchment_version}-${minecraft_version}") + accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) + + runs { + all { + // Recommended logging data for a userdev environment + property("forge.logging.markers", "") // "SCAN,REGISTRIES,REGISTRYDUMP" + + // Recommended logging level for the console + property("forge.logging.console.level", "debug") + + property("mixin.env.remapRefMap", "true") + property("mixin.env.refMapRemappingFile", "${buildDir}/createSrgToMcp/output.srg") + + ideaModule("Compact_Machines.forge-datagen.main") + + source(sourceSets.main.get()) + mods.create(modId) { + source(sourceSets.main.get()) + for (p in runDepends) + source(p.sourceSets.main.get()) + } + } + + create("data") { + taskName("runData") + workingDirectory(file("run")) + forceExit(false) + + args("--mod", modId) + args("--existing", forgeMain.file("src/main/resources")) + args("--all") + args("--output", forgeMain.file("src/generated/resources")) + } + } +} + +tasks.compileJava { + options.encoding = "UTF-8"; +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} \ No newline at end of file diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java similarity index 99% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java index 65b4bfa4..d5323a8d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import com.google.common.collect.Sets; import com.google.gson.Gson; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java similarity index 85% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java index 22a7e7c0..879a4d3f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/AdvancementLangBuilder.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/AdvancementLangBuilder.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; -import dev.compactmods.machines.forge.data.generated.lang.BaseLangGenerator; +import dev.compactmods.machines.datagen.lang.BaseLangGenerator; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.resources.ResourceLocation; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java index ddf8a623..d902c20e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/BlockLootGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/BlockLootGenerator.java @@ -1,9 +1,9 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; import dev.compactmods.machines.forge.machine.Machines; -import dev.compactmods.machines.forge.data.generated.functions.CopyRoomBindingFunction; +import dev.compactmods.machines.forge.data.functions.CopyRoomBindingFunction; import dev.compactmods.machines.forge.wall.Walls; import net.minecraft.data.DataGenerator; import net.minecraft.data.loot.BlockLoot; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java index 450080f5..5a95ee54 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGenUtil.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGenUtil.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import com.google.common.collect.ImmutableSet; import com.google.gson.Gson; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java similarity index 76% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java index b516654d..a95cb9e5 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DataGeneration.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DataGeneration.java @@ -1,12 +1,12 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.forge.data.generated.lang.EnglishLangGenerator; -import dev.compactmods.machines.forge.data.generated.lang.RussianLangGenerator; -import dev.compactmods.machines.forge.data.generated.room.RoomTemplates; -import dev.compactmods.machines.forge.data.generated.tags.BlockTagGenerator; -import dev.compactmods.machines.forge.data.generated.tags.ItemTagGenerator; -import dev.compactmods.machines.forge.data.generated.tags.PointOfInterestTagGenerator; +import dev.compactmods.machines.datagen.lang.EnglishLangGenerator; +import dev.compactmods.machines.datagen.lang.RussianLangGenerator; +import dev.compactmods.machines.datagen.room.RoomTemplates; +import dev.compactmods.machines.datagen.tags.BlockTagGenerator; +import dev.compactmods.machines.datagen.tags.ItemTagGenerator; +import dev.compactmods.machines.datagen.tags.PointOfInterestTagGenerator; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java index 8869f73f..dc074516 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/DimensionTypeBuilder.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/DimensionTypeBuilder.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java index aa2e650c..2c9dee26 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/ItemModelGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/ItemModelGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java similarity index 99% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java index ac881e0b..86256337 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/LevelBiomeGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/LevelBiomeGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java similarity index 99% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 1f916c0b..03d228ec 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/RecipeGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import com.google.gson.JsonObject; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java index 7d47375b..2194f79d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/StateGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.room.RoomSize; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java index c535ec1b..e9d634be 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/TunnelWallStateGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/TunnelWallStateGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated; +package dev.compactmods.machines.datagen; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/VillagerTrades.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/VillagerTrades.java new file mode 100644 index 00000000..90b4da3a --- /dev/null +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/VillagerTrades.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.datagen; + +public class VillagerTrades { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java index 58159a9d..39ef16b3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/BaseLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/BaseLangGenerator.java @@ -1,6 +1,6 @@ -package dev.compactmods.machines.forge.data.generated.lang; +package dev.compactmods.machines.datagen.lang; -import dev.compactmods.machines.forge.data.generated.AdvancementLangBuilder; +import dev.compactmods.machines.datagen.AdvancementLangBuilder; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java similarity index 99% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 8ff5c965..7de2dde8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/EnglishLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.lang; +package dev.compactmods.machines.datagen.lang; import dev.compactmods.machines.forge.dimension.VoidAirBlock; import dev.compactmods.machines.forge.tunnel.Tunnels; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java similarity index 98% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java index 09761aaa..826a4d66 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/lang/RussianLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/RussianLangGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.lang; +package dev.compactmods.machines.datagen.lang; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.wall.Walls; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java index 0a9abbc8..55df9ff3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/room/RoomTemplates.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/room/RoomTemplates.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.room; +package dev.compactmods.machines.datagen.room; import com.mojang.serialization.JsonOps; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java similarity index 96% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java index a81b4657..d34c2114 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/BlockTagGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.tags; +package dev.compactmods.machines.datagen.tags; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java index 9c79f653..7b75df4d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/ItemTagGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.tags; +package dev.compactmods.machines.datagen.tags; import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.forge.machine.Machines; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/PointOfInterestTagGenerator.java similarity index 93% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java rename to forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/PointOfInterestTagGenerator.java index 21950b62..c98d0cdd 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/tags/PointOfInterestTagGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/PointOfInterestTagGenerator.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.tags; +package dev.compactmods.machines.datagen.tags; import dev.compactmods.machines.forge.villager.Villagers; import dev.compactmods.machines.api.core.Constants; diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index de438224..09a4c736 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -220,17 +220,6 @@ minecraft { args("--height", 1080) } - create("data") { - taskName("runData") - workingDirectory(file("run/data")) - forceExit(false) - - args("--mod", modId) - args("--existing", project.file("src/main/resources")) - args("--all") - args("--output", file("src/generated/resources/")) - } - create("gameTestServer") { taskName("runGameTestServer") workingDirectory(file("run/gametests")) @@ -259,10 +248,6 @@ tasks.withType { } tasks.withType { - // Remove datagen source and cache info - this.exclude("dev/compactmods/machines/datagen/**") - this.exclude(".cache/**") - val forgeBuiltin = project(":forge-builtin").tasks.jar.get().archiveFile; val forgeTunnelsApi = project(":forge-builtin").tasks.jar.get().archiveFile; from(forgeBuiltin.map { zipTree(it) }) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index 2a221b75..aa5ee60f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.forge.config.CommonConfig; import dev.compactmods.machines.forge.config.ServerConfig; -import dev.compactmods.machines.forge.data.generated.functions.LootFunctions; +import dev.compactmods.machines.forge.data.functions.LootFunctions; import dev.compactmods.machines.forge.dimension.Dimension; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.room.Rooms; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java similarity index 97% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java index 0aef5129..dbe19f37 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.functions; +package dev.compactmods.machines.forge.data.functions; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/LootFunctions.java similarity index 87% rename from forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/LootFunctions.java index ac2e0a01..0257714e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/functions/LootFunctions.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/LootFunctions.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.forge.data.generated.functions; +package dev.compactmods.machines.forge.data.functions; import dev.compactmods.machines.forge.Registries; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java deleted file mode 100644 index e79f3735..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/generated/VillagerTrades.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.compactmods.machines.forge.data.generated; - -public class VillagerTrades { -} diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java index 9237a273..3eb41f06 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphTunnelTests.java @@ -1,8 +1,8 @@ package dev.compactmods.machines.test.tunnel; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -20,7 +20,7 @@ public static void unboundTunnelPositionReturnsNoResult(final GameTestHelper tes final var graph = new TunnelConnectionGraph(); final var connectedTo = graph.machine(BlockPos.ZERO); - if(connectedTo.isPresent()) { + if (connectedTo.isPresent()) { test.fail("There should not be a connection."); } @@ -45,20 +45,20 @@ public static void canRegisterSingleTunnel(final GameTestHelper test) { graph.register(BlockPos.ZERO, FakeTunnelDefinition.ID, MACHINE_POS, Direction.UP); - if(!graph.has(BlockPos.ZERO)) + if (!graph.has(BlockPos.ZERO)) test.fail("Graph is reporting tunnel is not registered."); graph.info(BlockPos.ZERO).ifPresentOrElse(info -> { - if(!info.location().equals(BlockPos.ZERO)) + if (!info.location().equals(BlockPos.ZERO)) test.fail("Tunnel location is not correct."); - if(!info.machine().equals(MACHINE_POS)) + if (!info.machine().equals(MACHINE_POS)) test.fail("Tunnel machine is not correct."); - if(!info.side().equals(Direction.UP)) + if (!info.side().equals(Direction.UP)) test.fail("Tunnel side is not correct."); - if(!info.type().equals(FakeTunnelDefinition.ID)) + if (!info.type().equals(FakeTunnelDefinition.ID)) test.fail("Tunnel type is not correct."); }, () -> { test.fail("Tunnel was not registered correctly."); diff --git a/settings.gradle.kts b/settings.gradle.kts index cd262b43..3318b49e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,3 +24,4 @@ rootProject.name = "Compact Machines" include("forge-tunnels-api") include("forge-main") include("forge-builtin") +include("forge-datagen") From 390856173a6e36e16f5a50951d03c6cb800f7f16 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Mon, 24 Apr 2023 22:12:17 -0400 Subject: [PATCH 68/85] Basic tests for tunnels.. kinda works, definitely needs the network overhaul tho --- .../forgebuiltin/tunnel/BuiltInTunnels.java | 3 +- .../tunnel/definitions/SmartItemTunnel.java | 39 ------- .../machines/datagen/RecipeGenerator.java | 1 + .../machines/forge/CompactMachines.java | 4 +- .../migration/Pre520RoomDataMigrator.java | 4 + .../machines/forge/dimension/Dimension.java | 4 +- .../block/CompactMachineBlockEntity.java | 7 +- .../machine/item/BoundCompactMachineItem.java | 2 +- .../forge/network/CompactMachinesNet.java | 14 +-- .../network/InitialRoomBlockDataPacket.java | 3 +- .../PlayerStartedRoomTrackingPacket.java | 12 +- .../forge/network/SyncRoomMetadataPacket.java | 3 +- .../client/ClientRoomPacketHandler.java} | 17 +-- .../machines/forge/tunnel/TunnelItem.java | 52 ++++++--- .../forge/tunnel/TunnelWallBlock.java | 8 +- .../forge/tunnel/TunnelWallEntity.java | 108 ++++++++++++------ .../forge/tunnel/client/TunnelColors.java | 20 ++-- .../traversal/ForgeTunnelTypeFilters.java | 1 - .../CM510to520RoomTunnelsMigrator.java | 4 + .../tunnel/network/TunnelAddedPacket.java | 24 +--- .../EarlyFileLoaderTests.java | 2 +- .../RoomInfoPre520MigratorTests.java | 37 +++++- .../test/migration/TunnelMigrationTests.java | 18 +++ .../machines/test/util/FileHelper.java | 11 ++ .../resources/migrate/pre520/room_data.dat | Bin 179 -> 226 bytes .../resources/migrate/pre520/single_room.dat | Bin 0 -> 130 bytes .../migrate/pre520/tunnels_-64_-64.dat | Bin 0 -> 317 bytes gradle.properties | 4 +- 28 files changed, 234 insertions(+), 168 deletions(-) delete mode 100644 forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java rename forge-main/src/main/java/dev/compactmods/machines/forge/{network/ClientRoomNetworkHandler.java => room/client/ClientRoomPacketHandler.java} (55%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/migration/CM510to520RoomTunnelsMigrator.java rename forge-main/src/test/java/dev/compactmods/machines/test/{migrators => migration}/EarlyFileLoaderTests.java (96%) rename forge-main/src/test/java/dev/compactmods/machines/test/{migrators => migration}/RoomInfoPre520MigratorTests.java (53%) create mode 100644 forge-main/src/test/java/dev/compactmods/machines/test/migration/TunnelMigrationTests.java create mode 100644 forge-main/src/test/resources/migrate/pre520/single_room.dat create mode 100644 forge-main/src/test/resources/migrate/pre520/tunnels_-64_-64.dat diff --git a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java index e3e0815e..ea26bb6a 100644 --- a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java +++ b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/BuiltInTunnels.java @@ -5,7 +5,6 @@ import dev.compactmods.machines.forgebuiltin.tunnel.definitions.BufferedItemTunnel; import dev.compactmods.machines.forgebuiltin.tunnel.definitions.FluidTunnel; import dev.compactmods.machines.forgebuiltin.tunnel.definitions.ForgeEnergyTunnel; -import dev.compactmods.machines.forgebuiltin.tunnel.definitions.redstone.RedstoneInTunnelDefinition; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; @@ -22,7 +21,7 @@ public class BuiltInTunnels { public static final RegistryObject FORGE_ENERGY = REGISTRATION.register("energy", ForgeEnergyTunnel::new); - public static final RegistryObject REDSTONE_IN = REGISTRATION.register("redstone_in", RedstoneInTunnelDefinition::new); + // public static final RegistryObject REDSTONE_IN = REGISTRATION.register("redstone_in", RedstoneInTunnelDefinition::new); public static void prepare() { diff --git a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java b/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java deleted file mode 100644 index 6315e548..00000000 --- a/forge-builtin/src/main/java/dev/compactmods/machines/forgebuiltin/tunnel/definitions/SmartItemTunnel.java +++ /dev/null @@ -1,39 +0,0 @@ -package dev.compactmods.machines.forgebuiltin.tunnel.definitions; - -import com.google.common.collect.ImmutableSet; -import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.api.tunnels.TunnelPosition; -import dev.compactmods.machines.api.tunnels.capability.CapabilityLookupTunnel; -import net.minecraft.core.GlobalPos; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.FastColor; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; - -// WIP do not register yet -public class SmartItemTunnel implements TunnelDefinition, CapabilityLookupTunnel { - @Override - public int ringColor() { - return FastColor.ARGB32.color(255, 205, 143, 36); - } - - @Override - public ImmutableSet> getSupportedCapabilities() { - return ImmutableSet.of(ForgeCapabilities.ITEM_HANDLER); - } - - public > LazyOptional findCapability( - MinecraftServer server, TunnelPosition tunnelPosition, - GlobalPos targetPosition) { - final var lev = server.getLevel(targetPosition.dimension()); - if(!lev.isLoaded(targetPosition.pos())) { - return LazyOptional.empty(); - } - - return lev.getBlockEntity(targetPosition.pos()) - .getCapability(ForgeCapabilities.ITEM_HANDLER, tunnelPosition.machineSide().getOpposite()) - .cast(); - } - -} diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 03d228ec..681fc72c 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -93,6 +93,7 @@ private void addMachineRecipes(Consumer consumer) { Tags.Items.NETHER_STARS); } + @SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") protected void registerMachineRecipe(Consumer consumer, LegacySizedTemplates template, TagKey center) { registerMachineRecipe(consumer, template.id(), template.template(), center); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index aa5ee60f..b087f31b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -39,9 +39,9 @@ @Mod(Constants.MOD_ID) public class CompactMachines implements ICompactMachinesMod { /** - * @deprecated Switch usages to use api Constants in 1.20, eliminate it here + * @deprecated Switch usages to use api {@link Constants#MOD_ID} in 1.20, eliminate it here */ - @Deprecated(forRemoval = true) + @Deprecated(forRemoval = true, since = "5.2.0") public static final String MOD_ID = Constants.MOD_ID; public static final Marker ADDON_LIFECYCLE = MarkerManager.getMarker("addons"); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java index bd6c28b6..1e74bedb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java @@ -58,6 +58,10 @@ public record RoomDataPre520(UUID owner, BlockPos center, Vec3 spawn, RoomSize s RoomSize.CODEC.fieldOf("size").forGetter(RoomDataPre520::size), Codec.STRING.optionalFieldOf("name").forGetter(RoomDataPre520::name) ).apply(i, RoomDataPre520::new)); + + public static RoomDataPre520 of(CompoundTag data) { + return CODEC.parse(NbtOps.INSTANCE, data).getOrThrow(false, UPDATER_LOGGER::error); + } } public record RoomDataLoadResult(HashMap oldRoomData, HashMap roomChunkLookup) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java index c4241829..6c456944 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/dimension/Dimension.java @@ -18,11 +18,11 @@ public class Dimension { // ================================================================================================================ // DIMENSION // ================================================================================================================ - @Deprecated(forRemoval = true) + @Deprecated(forRemoval = true, since = "5.2.0") public static final ResourceKey COMPACT_DIMENSION = ResourceKey .create(Registry.DIMENSION_REGISTRY, new ResourceLocation(MOD_ID, "compact_world")); - @Deprecated(forRemoval = true) + @Deprecated(forRemoval = true, since = "5.2.0") public static final ResourceKey COMPACT_DIMENSION_DIM_TYPE = ResourceKey .create(Registry.DIMENSION_TYPE_REGISTRY, new ResourceLocation(MOD_ID, "compact_world")); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java index 33261c1b..b32a1b10 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java @@ -83,8 +83,11 @@ public LazyOptional getCapability(@NotNull Capability cap, @Nullable D final var graph = TunnelConnectionGraph.forRoom(compactDim, roomId); - final var supportingTunnels = graph.positions(TunnelMachineFilters.sided(getLevelPosition(), side), ForgeTunnelTypeFilters.capability(cap)); - final var firstSupported = supportingTunnels.findFirst(); + final var firstSupported = graph.positions( + TunnelMachineFilters.sided(getLevelPosition(), side), + ForgeTunnelTypeFilters.capability(cap) + ).findFirst(); + if (firstSupported.isEmpty()) return super.getCapability(cap, side); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java index 1796a16f..839c04a8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java @@ -26,7 +26,7 @@ public BoundCompactMachineItem(Properties builder) { super(Machines.MACHINE_BLOCK.get(), builder); } - @Deprecated(forRemoval = true) + @Deprecated(forRemoval = true, since = "5.2.0") public static Optional getMachineId(ItemStack stack) { if (!stack.hasTag()) return Optional.empty(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java index a4afbdc9..67f15794 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java @@ -1,11 +1,9 @@ package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.tunnel.network.TunnelAddedPacket; import dev.compactmods.machines.forge.util.VersionUtil; -import dev.compactmods.machines.api.core.Constants; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.network.NetworkDirection; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; @@ -13,15 +11,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion; public class CompactMachinesNet { - private static final ArtifactVersion PROTOCOL_VERSION; - - static { - if(FMLEnvironment.production) { - PROTOCOL_VERSION = new DefaultArtifactVersion(ModList.get().getModFileById(Constants.MOD_ID).versionString()); - } else { - PROTOCOL_VERSION = new DefaultArtifactVersion("9.99.999"); - } - } + private static final ArtifactVersion PROTOCOL_VERSION = new DefaultArtifactVersion("5.2.0"); public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(Constants.MOD_ID, "main"), diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java index 74b2bf86..3d8eb848 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/InitialRoomBlockDataPacket.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.forge.room.client.ClientRoomPacketHandler; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; @@ -23,7 +24,7 @@ public void toNetwork(FriendlyByteBuf buf) { } public boolean handle(Supplier ctx) { - ctx.get().enqueueWork(() -> ClientRoomNetworkHandler.handleBlockData(this)); + ctx.get().enqueueWork(() -> ClientRoomPacketHandler.handleBlockData(this.blocks)); return true; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java index e11bff8f..7b636071 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerStartedRoomTrackingPacket.java @@ -26,18 +26,10 @@ public void encode(FriendlyByteBuf buf) { public boolean handle(Supplier ctx) { var sender = ctx.get().getSender(); ctx.get().enqueueWork(() -> { - StructureTemplate blocks = null; + StructureTemplate blocks; try { blocks = Rooms.getInternalBlocks(sender.server, room).get(5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } catch (TimeoutException e) { - throw new RuntimeException(e); - } catch (MissingDimensionException e) { - throw new RuntimeException(e); - } catch (NonexistentRoomException e) { + } catch (InterruptedException | ExecutionException | TimeoutException | MissingDimensionException | NonexistentRoomException e) { throw new RuntimeException(e); } RoomNetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> sender), new InitialRoomBlockDataPacket(blocks)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java index 0e7d69d8..6c903ad4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/SyncRoomMetadataPacket.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.forge.room.client.ClientRoomPacketHandler; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; @@ -17,7 +18,7 @@ public void encode(FriendlyByteBuf buffer) { } public void handle(Supplier contextSupplier) { - ClientRoomNetworkHandler.handleRoomSync(this); + ClientRoomPacketHandler.handleRoomSync(this.roomCode, this.owner); contextSupplier.get().setPacketHandled(true); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/client/ClientRoomPacketHandler.java similarity index 55% rename from forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/room/client/ClientRoomPacketHandler.java index 06ea5558..4a1c7461 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/ClientRoomNetworkHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/client/ClientRoomPacketHandler.java @@ -1,27 +1,30 @@ -package dev.compactmods.machines.forge.network; +package dev.compactmods.machines.forge.room.client; import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.forge.room.ui.MachineRoomScreen; import dev.compactmods.machines.room.client.ClientRoomMetadata; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; -public class ClientRoomNetworkHandler { - public static void handleBlockData(InitialRoomBlockDataPacket blockData) { +import java.util.UUID; + +public class ClientRoomPacketHandler { + public static void handleBlockData(StructureTemplate blocks) { final var mc = Minecraft.getInstance(); if(mc.screen instanceof MachineRoomScreen mrs) { - mrs.getMenu().setBlocks(blockData.blocks()); + mrs.getMenu().setBlocks(blocks); mrs.updateBlockRender(); } } - public static void handleRoomSync(SyncRoomMetadataPacket sync) { + public static void handleRoomSync(String roomCode, UUID owner) { final var mc = Minecraft.getInstance(); mc.player.getCapability(RoomHelper.CURRENT_ROOM_META).ifPresent(meta -> { - if(sync.owner().equals(Util.NIL_UUID)) + if(owner.equals(Util.NIL_UUID)) meta.clearCurrent(); else - meta.setCurrent(new ClientRoomMetadata(sync.roomCode(), sync.owner())); + meta.setCurrent(new ClientRoomMetadata(roomCode, owner)); }); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index 86574129..4e53a925 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -30,6 +30,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; @@ -84,28 +85,41 @@ public static ItemStack createStack(TunnelDefinition definition) { @Override public Component getName(ItemStack stack) { - String key = ITunnelItem.getDefinition(stack) - .map(id -> TranslationUtil.tunnelId(id.location())) - .orElse("item." + Constants.MOD_ID + ".tunnels.unnamed"); + try { + String key = ITunnelItem.getDefinition(stack) + .map(id -> TranslationUtil.tunnelId(id.location())) + .orElse(TranslationUtil.tunnelId(Tunnels.UNKNOWN_KEY.location())); - return Component.translatable(key); + return Component.translatable(key); + } + + catch(Exception e) { + return Component.translatable(TranslationUtil.tunnelId(Tunnels.UNKNOWN_KEY.location())); + } } @Override public void appendHoverText(@Nonnull ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - ITunnelItem.getDefinition(stack).ifPresent(tunnelDef -> { - if (Screen.hasShiftDown()) { - MutableComponent type = Component.translatable("tooltip." + Constants.MOD_ID + ".tunnel_type", tunnelDef) - .withStyle(ChatFormatting.GRAY) - .withStyle(ChatFormatting.ITALIC); - - tooltip.add(type); - } else { - tooltip.add(TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) - .withStyle(ChatFormatting.DARK_GRAY) - .withStyle(ChatFormatting.ITALIC)); - } - }); + try { + ITunnelItem.getDefinition(stack).ifPresent(tunnelDef -> { + if (Screen.hasShiftDown()) { + MutableComponent type = Component.translatable("tooltip." + Constants.MOD_ID + ".tunnel_type", tunnelDef.location()) + .withStyle(ChatFormatting.GRAY) + .withStyle(ChatFormatting.ITALIC); + + tooltip.add(type); + } else { + tooltip.add(TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT) + .withStyle(ChatFormatting.DARK_GRAY) + .withStyle(ChatFormatting.ITALIC)); + } + }); + } + + catch(Exception e) { + tooltip.add(TranslationUtil.tooltip(new ResourceLocation(Constants.MOD_ID, "error_tunnel_tooltip")) + .withStyle(ChatFormatting.DARK_RED)); + } } @Override @@ -221,12 +235,12 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position compactDim.setBlock(position, tunnelState, Block.UPDATE_NEIGHBORS); if (compactDim.getBlockEntity(position) instanceof TunnelWallEntity twe) { - twe.setTunnelType(def); + twe.setTunnelType(tunnelId); twe.setConnectedTo(hist.getMachine(), first); CompactMachinesNet.CHANNEL.send( PacketDistributor.TRACKING_CHUNK.with(() -> compactDim.getChunkAt(position)), - new TunnelAddedPacket(position, def)); + new TunnelAddedPacket(position, tunnelId)); } compactDim.sendBlockUpdated(position, oldState, tunnelState, Block.UPDATE_ALL); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index 8a6e3b23..e396dbe4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -22,7 +22,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; -import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -149,9 +148,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player level.setBlockAndUpdate(pos, solidWall); - ItemStack stack = new ItemStack(Tunnels.ITEM_TUNNEL.get(), 1); - CompoundTag defTag = stack.getOrCreateTagElement("definition"); - defTag.putString("id", tunnelId.toString()); + ItemStack stack = TunnelItem.createStack(tunnelId); ItemEntity ie = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), stack); level.addFreshEntity(ie); @@ -185,13 +182,14 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player if(def instanceof ITunnelRotationEventListener rotationListener) { var handler = rotationListener.createBeforeRotateHandler(tunnel.getTunnel()); - if(handler != null && handler.beforeRotate(server, tunnelOriginalPosition, newRotation, rotationReason)) { + if(handler != null && !handler.beforeRotate(server, tunnelOriginalPosition, newRotation, rotationReason)) { return; } } level.setBlockAndUpdate(pos, state.setValue(CONNECTED_SIDE, newSide)); + // TODO Remove in 5.3/next if (def instanceof TunnelTeardownHandler teardown) { //noinspection removal teardown.onRotated(new TunnelPosition(pos, tunnelWallSide, tunnelConnectedSide), tunnel.getTunnel(), dir, newSide); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index a5b89574..48d6fdf8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -8,18 +8,20 @@ import dev.compactmods.machines.api.tunnels.lifecycle.TunnelInstance; import dev.compactmods.machines.api.tunnels.lifecycle.TunnelTeardownHandler; import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveEventListener; +import dev.compactmods.machines.api.tunnels.lifecycle.removal.ITunnelRemoveReason; import dev.compactmods.machines.codec.CodecExtensions; import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.forge.wall.Walls; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.BaseTunnelWallData; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.node.TunnelNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Block; @@ -29,9 +31,8 @@ import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; public class TunnelWallEntity extends BlockEntity implements ITunnelHolder { @@ -39,6 +40,8 @@ public class TunnelWallEntity extends BlockEntity implements ITunnelHolder { private static final String NBT_LEGACY_MACHINE_KEY = "machine"; private GlobalPos connectedMachine; + + private ResourceKey tunnelTypeKey; private TunnelDefinition tunnelType; @Nullable @@ -52,14 +55,15 @@ public TunnelWallEntity(BlockPos pos, BlockState state) { @Override @SuppressWarnings("unchecked") - public void load(@Nonnull CompoundTag nbt) { + public void load(@NotNull CompoundTag nbt) { super.load(nbt); final var baseData = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, nbt) .getOrThrow(true, CompactMachines.LOGGER::fatal); this.connectedMachine = baseData.connection(); - this.tunnelType = Tunnels.getDefinition(baseData.tunnelType()); + this.tunnelTypeKey = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, baseData.tunnelType()); + this.tunnelType = Tunnels.getDefinition(this.tunnelTypeKey); try { if (tunnelType instanceof InstancedTunnel it) @@ -92,9 +96,9 @@ public void onLoad() { } @Override - public void saveAdditional(@Nonnull CompoundTag compound) { + public void saveAdditional(@NotNull CompoundTag compound) { CodecExtensions.writeIntoTag(BaseTunnelWallData.CODEC, - new BaseTunnelWallData(connectedMachine, Tunnels.getRegistryId(tunnelType)), + new BaseTunnelWallData(connectedMachine, tunnelTypeKey.location()), compound); if (tunnel instanceof INBTSerializable persist) { @@ -104,11 +108,11 @@ public void saveAdditional(@Nonnull CompoundTag compound) { } @Override - @Nonnull + @NotNull public CompoundTag getUpdateTag() { CompoundTag nbt = super.getUpdateTag(); return CodecExtensions.writeIntoTag(BaseTunnelWallData.CODEC, - new BaseTunnelWallData(connectedMachine, Tunnels.getRegistryId(tunnelType)), + new BaseTunnelWallData(connectedMachine, tunnelTypeKey.location()), nbt); } @@ -118,15 +122,15 @@ public void handleUpdateTag(CompoundTag tag) { final var data = BaseTunnelWallData.CODEC.parse(NbtOps.INSTANCE, tag) .getOrThrow(false, CompactMachines.LOGGER::error); - var id = data.tunnelType(); - this.tunnelType = Tunnels.getDefinition(id); + this.tunnelTypeKey = ResourceKey.create(TunnelDefinition.REGISTRY_KEY, data.tunnelType()); + this.tunnelType = Tunnels.getDefinition(tunnelTypeKey); this.connectedMachine = data.connection(); setChanged(); } - @Nonnull - public LazyOptional getTunnelCapability(@Nonnull Capability cap, @Nullable Direction outerSide) { + @NotNull + public LazyOptional getTunnelCapability(@NotNull Capability cap, @Nullable Direction outerSide) { if (level == null || level.isClientSide) return LazyOptional.empty(); @@ -140,9 +144,9 @@ public LazyOptional getTunnelCapability(@Nonnull Capability cap, @Null return LazyOptional.empty(); } - @Nonnull + @NotNull @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { + public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { if (level == null || level.isClientSide) return super.getCapability(cap, side); @@ -177,39 +181,77 @@ public Direction getConnectedSide() { return blockState.getValue(TunnelWallBlock.CONNECTED_SIDE); } - public void setTunnelType(TunnelDefinition type) { - if (type == tunnelType) - return; - - if (level == null || level.isClientSide || !(level instanceof ServerLevel sl)) { - tunnelType = type; - return; - } - - // TODO Clean all this up properly with a real removal reason + @SuppressWarnings({"rawtypes", "unchecked"}) + private void serverPreRemoval(@Nullable ITunnelRemoveReason reason) { final var p = new TunnelPosition(worldPosition, getTunnelSide(), getConnectedSide()); if (tunnelType instanceof TunnelTeardownHandler teardown) { - //noinspection removal,unchecked + //noinspection removal teardown.onRemoved(p, tunnel); } - if(tunnelType instanceof ITunnelRemoveEventListener removeListener) { - removeListener.createBeforeRemoveHandler(tunnel) - .beforeRemove(level.getServer(), p, null); + if (tunnelType instanceof ITunnelRemoveEventListener removeListener) { + final var handler = removeListener.createBeforeRemoveHandler(tunnel); + if (handler != null) + handler.beforeRemove(level.getServer(), p, reason); } + } - this.tunnelType = type; - if (type instanceof InstancedTunnel it) + private void serverPostRemoval(@Nullable ITunnelRemoveReason reason) { + final var p = new TunnelPosition(worldPosition, getTunnelSide(), getConnectedSide()); + if (this.tunnelType instanceof InstancedTunnel it) this.tunnel = it.newInstance(p.pos(), p.wallSide()); - if(tunnelType instanceof ITunnelRemoveEventListener removeListener) { + if (this.tunnelType instanceof ITunnelRemoveEventListener removeListener) { removeListener.createAfterRemoveHandler(tunnel) - .afterRemove(level.getServer(), p, null); + .afterRemove(level.getServer(), p, reason); } + } + + // TODO : Fix tunnel removal and placement coloration + private void setTunnelTypeInternal(ResourceKey key, TunnelDefinition definition) { + if (level == null || level.isClientSide || !(level instanceof ServerLevel)) { + this.tunnelTypeKey = key; + this.tunnelType = definition; + return; + } + + // TODO Clean all this up properly with a real removal reason + serverPreRemoval(null); + + this.tunnelTypeKey = key; + this.tunnelType = definition; + + serverPostRemoval(null); setChanged(); } + @Override + public void setTunnelType(ResourceKey type) { + if(type == null) { + CompactMachines.LOGGER.warn("Removing tunnel at {} due to it being set null", worldPosition.toShortString()); + level.setBlock(worldPosition, Walls.BLOCK_SOLID_WALL.get().defaultBlockState(), Block.UPDATE_ALL); + return; + } + + if (type.equals(this.tunnelTypeKey)) + return; + + final var def = Tunnels.getDefinition(type); + setTunnelTypeInternal(type, def); + } + + @Override + @Deprecated(forRemoval = true, since = "5.2.0") + @SuppressWarnings("removal") + public void setTunnelType(TunnelDefinition definition) { + final var key = Tunnels.getRegistryKey(definition); + if (this.tunnelTypeKey.equals(key)) + return; + + setTunnelTypeInternal(key, definition); + } + public TunnelDefinition getTunnelType() { return tunnelType; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java index ed90f63e..3262bbdb 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/client/TunnelColors.java @@ -36,15 +36,21 @@ public class TunnelColors { }; public static final ItemColor ITEM = (stack, tintIndex) -> { - var definition = ITunnelItem.getDefinition(stack); - if(definition.isEmpty()) - return 0; + try { + var definition = ITunnelItem.getDefinition(stack); + if (definition.isEmpty()) + return 0; + + TunnelDefinition actualDef = Tunnels.getDefinition(definition.get()); + if (tintIndex == 0) { + return actualDef.ringColor(); + } - TunnelDefinition actualDef = Tunnels.getDefinition(definition.get()); - if (tintIndex == 0) { - return actualDef.ringColor(); + return actualDef.indicatorColor(); } - return actualDef.indicatorColor(); + catch(Exception e) { + return 0; + } }; } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java index 1500ef35..339df9b8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/graph/traversal/ForgeTunnelTypeFilters.java @@ -10,7 +10,6 @@ public class ForgeTunnelTypeFilters { public static ITunnelFilter capability(Capability capability) { return TunnelTypeFilters.definition(def -> { - if (!(def instanceof CapabilityTunnel tcp)) return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/migration/CM510to520RoomTunnelsMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/migration/CM510to520RoomTunnelsMigrator.java new file mode 100644 index 00000000..78da82ef --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/migration/CM510to520RoomTunnelsMigrator.java @@ -0,0 +1,4 @@ +package dev.compactmods.machines.forge.tunnel.migration; + +public class CM510to520RoomTunnelsMigrator { +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java index 6134fd49..878b70ff 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/network/TunnelAddedPacket.java @@ -1,38 +1,26 @@ package dev.compactmods.machines.forge.tunnel.network; import dev.compactmods.machines.api.tunnels.TunnelDefinition; -import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.tunnel.client.ClientTunnelHandler; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceKey; import net.minecraftforge.network.NetworkEvent; import javax.annotation.Nonnull; -import java.util.Objects; import java.util.function.Supplier; -public class TunnelAddedPacket { - - @Nonnull - private final BlockPos position; - - @Nonnull - private final TunnelDefinition type; - - public TunnelAddedPacket(@Nonnull BlockPos tunnelPos, @Nonnull TunnelDefinition tunnelType) { - this.position = tunnelPos; - this.type = tunnelType; - } +public record TunnelAddedPacket(BlockPos position, ResourceKey type) { public TunnelAddedPacket(FriendlyByteBuf buf) { - position = buf.readBlockPos(); - type = Tunnels.getDefinition(buf.readResourceLocation()); + this(buf.readBlockPos(), buf.readResourceKey(TunnelDefinition.REGISTRY_KEY)); } public static void handle(TunnelAddedPacket message, Supplier context) { NetworkEvent.Context ctx = context.get(); ctx.enqueueWork(() -> { - ClientTunnelHandler.setTunnel(message.position, message.type); + final var holder = ClientTunnelHandler.getTunnelHolder(message.position); + holder.setTunnelType(message.type); }); ctx.setPacketHandled(true); @@ -40,6 +28,6 @@ public static void handle(TunnelAddedPacket message, Supplier T getNbtFromSavedDataFile(String filename, Class tagClass) throws IOException { + InputStream isr = INSTANCE.getFileStream(filename); + final var nbtRoot = NbtIo.readCompressed(isr); + final var tag = nbtRoot.get("data"); + if(tagClass.isInstance(tag)) + return tagClass.cast(tag); + + return null; + } } diff --git a/forge-main/src/test/resources/migrate/pre520/room_data.dat b/forge-main/src/test/resources/migrate/pre520/room_data.dat index afab082587bd5415f36af51019a04d5dd4f32053..7d8323e935cac10896375e18cdef7248093e0b85 100644 GIT binary patch literal 226 zcmV<803H7yiwFR!+B{?c|E1AQZo)te1>h%<(2!h$MYpc&$Lq$?i zaS6BqSK(llXd1*0RjTUETUgd7+c6L$usrYrQOD-ZdFf*Svk2jK?`4N)rE6`p)|BO0 zL!~MjYD~strOHcIxwfWVAnf0H@8>_Gt0ksdt#5fbUZ#u?^zI-CH;(;~U~a?@qcDz4 zU4X9FuL%F4Ps_j4!9!ZAy4ETsNli;-VGH6+gi=-6CfAjyw*HmAU*S$ab^PhNkM0rv ca@&7~WIev(Rd&7GdLTLD8|##tm!Saw0P~}9VgLXD literal 179 zcmV;k08IZMiwFP!00000|D}+z4uUWkgf9xDz)LW=b^sB}#=tYU|CUBOSPX4K;!Efo z_$oY@2{t%58*jN>E|)L41V|8c za1`VhXO?8<=Yd2S80238>A?U0|9|3OU@56ANM#UD&d)7KOfJbyOwP#6OD(p7GB_AG zQ!;Z?^NK-w1(NfNbMp)Gb25vqih-(A8MqmkGE;zNu^c_X)z;Z Date: Mon, 24 Apr 2023 23:57:04 -0400 Subject: [PATCH 69/85] Fix unit tests for loading pre520 single room data, start tunnel migration tests --- .../machines/test/migration/RoomInfoPre520MigratorTests.java | 2 +- .../machines/test/migration/TunnelMigrationTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migration/RoomInfoPre520MigratorTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migration/RoomInfoPre520MigratorTests.java index 69d3bff1..facc9719 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migration/RoomInfoPre520MigratorTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migration/RoomInfoPre520MigratorTests.java @@ -52,7 +52,7 @@ public static void canReadPre520RoomFiles(final GameTestHelper test) { public static void canReadSingleRoom(final GameTestHelper test) { try { - final var nbtData = FileHelper.getNbtFromSavedDataFile("migrate/pre520/single_room.dat"); + final var nbtData = FileHelper.getNbtFromFile("migrate/pre520/single_room.dat"); final var oldData = Pre520RoomDataMigrator.RoomDataPre520.of(nbtData); if(!oldData.center().equals(new BlockPos(8, 45, -1016))) diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/migration/TunnelMigrationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/migration/TunnelMigrationTests.java index dbb7f582..e1e56791 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/migration/TunnelMigrationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/migration/TunnelMigrationTests.java @@ -13,6 +13,6 @@ public class TunnelMigrationTests { @GameTest(template = "empty_1x1", batch = TestBatches.MIGRATION) public static void canReadCM51RoomTunnelsFile(final GameTestHelper test) { - + test.succeed(); } } From 4086ba7c16368d84c3e4408d0af68600c1dd6795 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 29 Apr 2023 01:00:08 -0400 Subject: [PATCH 70/85] Some temporary lang fixes, machine color desync fix --- .../datagen/lang/EnglishLangGenerator.java | 2 + .../machines/forge/command/ForgeCommands.java | 6 +- .../forge/command/data/CMDataSubcommand.java | 21 --- .../data/CMMachineDataExportCommand.java | 91 ----------- .../command/data/CMRoomDataExportCommand.java | 90 ----------- .../data/CMTunnelDataExportCommand.java | 137 ---------------- .../subcommand/CMRebindSubcommand.java | 4 +- .../command/subcommand/CMRoomsSubcommand.java | 13 +- .../subcommand/CMSummarySubcommand.java | 16 +- .../compat/jei/CompactMachinesJeiPlugin.java | 3 +- .../overrides/CompactMachineNameOverride.java | 12 +- .../providers/CompactMachineProvider.java | 52 +++--- .../functions/CopyRoomBindingFunction.java | 6 +- .../machine/block/CompactMachineBlock.java | 40 ++++- .../block/CompactMachineBlockEntity.java | 88 ++++------ .../block/LegacySizedCompactMachineBlock.java | 153 ++++++++---------- .../forge/machine/block/MachineBlockUtil.java | 43 ++++- .../machine/item/BoundCompactMachineItem.java | 22 +++ .../forge/machine/item/MachineItemUtil.java | 54 +++++++ .../item/UnboundCompactMachineItem.java | 43 +---- .../PlayerRequestedTeleportPacket.java | 12 +- .../machines/forge/room/RoomHelper.java | 58 +++---- .../forge/room/ui/MachineRoomMenu.java | 11 +- .../room/upgrade/RoomUpgradeManager.java | 42 ++--- .../upgrade/graph/RoomUpgradeConnection.java | 2 +- .../tunnel/TunnelGraphSerializationTests.java | 10 +- gradle.properties | 4 +- 27 files changed, 376 insertions(+), 659 deletions(-) delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java delete mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/MachineItemUtil.java diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 7de2dde8..34a33c6f 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -13,6 +13,7 @@ import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; import dev.compactmods.machines.forgebuiltin.upgrade.BuiltInUpgrades; import net.minecraft.data.DataGenerator; +import net.minecraft.resources.ResourceLocation; import static org.apache.commons.lang3.StringUtils.capitalize; @@ -88,6 +89,7 @@ protected void addTranslations() { addTooltip(Tooltips.Machines.OWNER, "Owner: %s"); addTooltip(Tooltips.Machines.SIZE, "Internal Size: %1$sx%1$sx%1$s"); addTooltip(Tooltips.Machines.BOUND_TO, "Bound to: %1$s"); + addTooltip(new ResourceLocation(Constants.MOD_ID, "bound_machine_fallback"), "Bound Compact Machine"); addTooltip(Tooltips.TUNNEL_TYPE, "Type ID: %1$s"); addTooltip(Tooltips.UNKNOWN_TUNNEL_TYPE, "Unknown Tunnel Type (%s)"); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java index 326564d1..d671aefe 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java @@ -1,7 +1,8 @@ package dev.compactmods.machines.forge.command; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.forge.Registries; -import dev.compactmods.machines.forge.command.data.CMDataSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMEjectSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMGiveMachineSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMReaddDimensionSubcommand; @@ -11,8 +12,6 @@ import dev.compactmods.machines.forge.command.subcommand.CMSummarySubcommand; import dev.compactmods.machines.forge.command.subcommand.CMUnbindSubcommand; import dev.compactmods.machines.forge.command.subcommand.SpawnSubcommand; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.command.Commands; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.commands.synchronization.SingletonArgumentInfo; import net.minecraftforge.event.RegisterCommandsEvent; @@ -34,7 +33,6 @@ public class ForgeCommands { cm.then(CMUnbindSubcommand.make()); cm.then(CMReaddDimensionSubcommand.make()); cm.then(CMRoomsSubcommand.make()); - cm.then(CMDataSubcommand.make()); cm.then(CMGiveMachineSubcommand.make()); cm.then(SpawnSubcommand.make()); cm.then(CMRoomUpgradeCommand.make()); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java deleted file mode 100644 index 406eaa16..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMDataSubcommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.compactmods.machines.forge.command.data; - -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; - -public class CMDataSubcommand { - public static LiteralArgumentBuilder make() { - final LiteralArgumentBuilder root = LiteralArgumentBuilder.literal("data"); - - var export = Commands.literal("export"); - export.then(CMMachineDataExportCommand.makeMachineCsv()); - export.then(CMTunnelDataExportCommand.makeTunnelCsv()); - export.then(CMRoomDataExportCommand.makeRoomCsv()); - root.then(export); - - return root; - } - - -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java deleted file mode 100644 index 1b287f55..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMMachineDataExportCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -package dev.compactmods.machines.forge.command.data; - -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.LoggingUtil; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; -import net.minecraft.core.GlobalPos; -import net.minecraft.util.CsvOutput; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; - -public class CMMachineDataExportCommand { - - private static final Logger LOGGER = LoggingUtil.modLog(); - - public static ArgumentBuilder makeMachineCsv() { - return Commands.literal("machines") - .requires(cs -> cs.hasPermission(2)) - .executes(CMMachineDataExportCommand::execAll); - } - - private static int execAll(CommandContext ctx) { - var src = ctx.getSource(); - var serv = src.getServer(); - - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve("machines.csv") - .toAbsolutePath(); - - try { - Files.createDirectories(outdir.toPath()); - - var writer = Files.newBufferedWriter(out); - CsvOutput builder = makeCsv(writer); - - for (final var dim : serv.getAllLevels()) { - final var graph = DimensionMachineGraph.forDimension(dim); - graph.getMachines().forEach(machNode -> { - final var m = machNode.dimpos(); - final var r = graph.getConnectedRoom(m.pos()); - r.ifPresent(room -> writeMachine(m, room, builder)); - }); - } - - writer.close(); - } catch (IOException e) { - LOGGER.error(e); - src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); - return -1; - } - - return 0; - } - - @NotNull - private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { - return CsvOutput.builder() - .addColumn("dim") - .addColumn("machine_x") - .addColumn("machine_y") - .addColumn("machine_z") - .addColumn("room") - .build(writer); - } - - private static void writeMachine(GlobalPos machine, String room, CsvOutput builder) { - try { - var placedAt = machine.pos(); - - builder.writeRow( - machine.dimension().location().toString(), - placedAt.getX(), - placedAt.getY(), - placedAt.getZ(), - room - ); - } catch (IOException e) { - LOGGER.error(e); - } - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java deleted file mode 100644 index 9ba5e338..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMRoomDataExportCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -package dev.compactmods.machines.forge.command.data; - -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.room.IRoomOwnerLookup; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; -import dev.compactmods.machines.api.room.registration.IRoomSpawnLookup; -import dev.compactmods.machines.LoggingUtil; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.graph.CompactRoomProvider; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; -import net.minecraft.core.Vec3i; -import net.minecraft.util.CsvOutput; -import net.minecraft.world.phys.Vec3; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; - -public class CMRoomDataExportCommand { - - private static final Logger LOGGER = LoggingUtil.modLog(); - - public static ArgumentBuilder makeRoomCsv() { - return Commands.literal("rooms") - .requires(cs -> cs.hasPermission(2)) - .executes(CMRoomDataExportCommand::execAll); - } - - private static int execAll(CommandContext ctx) { - var src = ctx.getSource(); - try { - var roomProvider = CompactRoomProvider.instance(src.getServer()); - - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve("rooms.csv") - .toAbsolutePath(); - Files.createDirectories(outdir.toPath()); - - var writer = Files.newBufferedWriter(out); - CsvOutput builder = makeCsv(writer); - - roomProvider.allRooms().forEach(room -> writeRoom(builder, room, roomProvider, roomProvider)); - - writer.close(); - } catch (IOException e) { - LOGGER.error(e); - src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); - return -1; - } - - return 0; - } - - @NotNull - private static CsvOutput makeCsv(BufferedWriter writer) throws IOException { - return CsvOutput.builder() - .addColumn("room") - .addColumn("owner_uuid") - .addColumn("size_x") - .addColumn("size_y") - .addColumn("size_z") - .addColumn("spawn_x") - .addColumn("spawn_y") - .addColumn("spawn_z") - .build(writer); - } - - private static void writeRoom(CsvOutput builder, IRoomRegistration room, IRoomOwnerLookup owners, IRoomSpawnLookup spawns) { - try { - final Vec3i roomDims = room.dimensions(); - final Vec3 spawn = room.spawnPosition(spawns); - - builder.writeRow( - room.code(), - room.owner(owners), - roomDims.getX(), roomDims.getY(), roomDims.getZ(), - spawn.x, spawn.y, spawn.z - ); - } catch (IOException e) { - LOGGER.error(e); - } - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java deleted file mode 100644 index e22c8b38..00000000 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/data/CMTunnelDataExportCommand.java +++ /dev/null @@ -1,137 +0,0 @@ -package dev.compactmods.machines.forge.command.data; - -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.LoggingUtil; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.room.graph.CompactRoomProvider; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.CsvOutput; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; - -public class CMTunnelDataExportCommand { - - private static final Logger LOGGER = LoggingUtil.modLog(); - - public static ArgumentBuilder makeTunnelCsv() { - var chunk = Commands - .argument("room", StringArgumentType.string()) - .executes(CMTunnelDataExportCommand::exec); - - return Commands.literal("tunnels") - .requires(cs -> cs.hasPermission(Commands.LEVEL_GAMEMASTERS)) - .executes(CMTunnelDataExportCommand::execAll) - .then(chunk); - } - - private static int execAll(CommandContext ctx) { - var src = ctx.getSource(); - var serv = src.getServer(); - try (var compactDim = CompactDimension.forServer(serv)) { - final var roomProvider = CompactRoomProvider.instance(compactDim); - - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve("tunnels.csv") - .toAbsolutePath(); - - try { - Files.createDirectories(outdir.toPath()); - - var writer = Files.newBufferedWriter(out); - CsvOutput builder = makeTunnelCsvOut(writer); - - roomProvider.allRooms().forEach(room -> { - try { - writeRoomTunnels(compactDim, room.code(), builder); - } catch (MissingDimensionException e) { - LOGGER.error(e); - } - }); - - writer.close(); - } catch (IOException e) { - LOGGER.error(e); - src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); - return -1; - } - } catch (IOException | MissingDimensionException e) { - throw new RuntimeException(e); - } - - return 0; - } - - public static int exec(CommandContext ctx) throws CommandSyntaxException { - var src = ctx.getSource(); - ServerPlayer player = src.getPlayerOrException(); - - final var room = StringArgumentType.getString(ctx, "room"); - final var compactDim = src.getServer().getLevel(CompactDimension.LEVEL_KEY); - - var outdir = src.getServer().getFile(Constants.MOD_ID); - var out = outdir.toPath() - .resolve(String.format("tunnels_%s.csv", room)) - .toAbsolutePath(); - - try { - Files.createDirectories(outdir.toPath()); - - var writer = Files.newBufferedWriter(out); - CsvOutput builder = makeTunnelCsvOut(writer); - writeRoomTunnels(compactDim, room, builder); - - writer.close(); - } catch (IOException e) { - LOGGER.error(e); - src.sendFailure(TranslationUtil.command(CMCommands.FAILED_CMD_FILE_ERROR)); - return -1; - } catch (MissingDimensionException e) { - LOGGER.error(e); - } - - return 0; - } - - @NotNull - private static CsvOutput makeTunnelCsvOut(BufferedWriter writer) throws IOException { - return CsvOutput.builder() - .addColumn("type") - .addColumn("side") - .addColumn("pos_x").addColumn("pos_y").addColumn("pos_z") - .addColumn("machine_id") - .build(writer); - } - - private static void writeRoomTunnels(ServerLevel compactDim, String roomCode, CsvOutput builder) throws MissingDimensionException { - final var graph = TunnelConnectionGraph.forRoom(compactDim, roomCode); - graph.tunnels().forEach(info -> { - var pos = info.location(); - try { - builder.writeRow( - info.type().toString(), - info.side().getSerializedName(), - pos.getX(), pos.getY(), pos.getZ(), - info.machine() - ); - } catch (IOException e) { - LOGGER.warn("Error writing tunnel record.", e); - } - }); - } -} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java index d488d62a..694208ee 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java @@ -63,8 +63,8 @@ private static int doRebind(CommandContext ctx) throws Comma }); // No tunnels - clear to rebind - machine.setConnectedRoom(targetRoom); - }, () -> machine.setConnectedRoom(targetRoom)); + machine.setConnectedRoom(roomCode); + }, () -> machine.setConnectedRoom(roomCode)); }, () -> { CompactMachines.LOGGER.error("Cannot rebind to room {}; not registered.", roomCode); }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java index 56f31553..9ee2adea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java @@ -50,9 +50,13 @@ private static int fetchByMachineBlock(CommandContext ctx) t throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); if (level.getBlockEntity(block) instanceof CompactMachineBlockEntity be) { - be.roomInfo().ifPresent(room -> { - final var m = TranslationUtil.message(Messages.MACHINE_ROOM_INFO, block, room.dimensions(), room.code()); - ctx.getSource().sendSuccess(m, false); + be.connectedRoom().ifPresent(roomCode -> { + CompactRoomProvider.instance(ctx.getSource().getServer()) + .forRoom(roomCode) + .ifPresent(roomInfo -> { + final var m = TranslationUtil.message(Messages.MACHINE_ROOM_INFO, block, roomInfo.dimensions(), roomCode); + ctx.getSource().sendSuccess(m, false); + }); }); } @@ -61,7 +65,6 @@ private static int fetchByMachineBlock(CommandContext ctx) t private static int findByContainingPlayer(CommandContext ctx) throws CommandSyntaxException { final var player = EntityArgument.getPlayer(ctx, "player"); - final var server = ctx.getSource().getServer(); final var playerChunk = player.chunkPosition(); final var playerLevel = player.getLevel(); @@ -83,7 +86,7 @@ public static int findByOwner(CommandContext ctx) throws Com // TODO Localization final var owned = graph.findByOwner(owner.getUUID()).collect(Collectors.toSet()); - if(owned.isEmpty()) { + if (owned.isEmpty()) { source.sendSuccess(Component.literal("No rooms found."), false); } else { owned.forEach(roomInfo -> source.sendSuccess(Component.literal("Room: " + roomInfo.code()), false)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java index 30f90649..6ae0de13 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java @@ -6,7 +6,6 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.commands.CommandSourceStack; @@ -31,13 +30,14 @@ private static int exec(CommandContext ctx) { final var ls = LongStream.builder(); serv.getAllLevels().forEach(sl -> { - final var machineData = DimensionMachineGraph.forDimension(sl); - long numRegistered = machineData.getMachines().count(); - - if(numRegistered > 0) { - src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().location().toString(), numRegistered), false); - ls.add(numRegistered); - } + // TODO - Reimplement +// final var machineData = DimensionMachineGraph.forDimension(sl); +// long numRegistered = machineData.machineCount(); +// +// if(numRegistered > 0) { +// src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().location().toString(), numRegistered), false); +// ls.add(numRegistered); +// } }); long grandTotal = ls.build().sum(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java index 276fcda4..043c2c28 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.forge.compat.jei; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.item.MachineItemUtil; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.api.core.Constants; @@ -48,6 +49,6 @@ public void registerRecipes(IRecipeRegistration registration) { public void registerItemSubtypes(ISubtypeRegistration registration) { registration.useNbtForSubtypes(Tunnels.ITEM_TUNNEL.get()); registration.registerSubtypeInterpreter(Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(), - (ingredient, context) -> UnboundCompactMachineItem.getTemplateId(ingredient).toString()); + (ingredient, context) -> MachineItemUtil.getTemplateId(ingredient).toString()); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java index df547d04..9fb809f4 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,7 +1,8 @@ package dev.compactmods.machines.forge.compat.theoneprobe.overrides; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import mcjty.theoneprobe.Tools; @@ -14,7 +15,6 @@ import mcjty.theoneprobe.api.TextStyleClass; import mcjty.theoneprobe.config.Config; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; @@ -24,11 +24,11 @@ public class CompactMachineNameOverride implements IBlockDisplayOverride { public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level level, BlockState blockState, IProbeHitData hitData) { if(blockState.is(CMTags.MACHINE_BLOCK)) { if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity mach) { - final var cr = mach.roomInfo(); + final var cr = mach.connectedRoom(); if(cr.isEmpty()) return false; - cr.ifPresent(room -> { + cr.ifPresent(roomCode -> { final var pickBlock = hitData.getPickBlock(); if (!pickBlock.isEmpty()) { final var config = Config.getRealConfig(); @@ -37,9 +37,9 @@ public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player Component roomName; try { - roomName = Rooms.getRoomName(level.getServer(), room.code()) + roomName = Rooms.getRoomName(level.getServer(), roomCode) .map(Component::literal) - .orElse((MutableComponent) pickBlock.getHoverName()); + .orElse(BoundCompactMachineItem.name(pickBlock).copy()); } catch (NonexistentRoomException e) { roomName = pickBlock.getHoverName(); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java index 18501c87..53d057c6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java @@ -4,13 +4,12 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; import dev.compactmods.machines.forge.tunnel.TunnelItem; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.util.PlayerUtil; import mcjty.theoneprobe.api.ElementAlignment; import mcjty.theoneprobe.api.IProbeHitData; @@ -51,27 +50,26 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le return; if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity machine) { - machine.roomInfo().ifPresentOrElse(room -> { - final var boundTo = TranslationUtil.tooltip(Tooltips.Machines.BOUND_TO, room.code()); + machine.connectedRoom().ifPresentOrElse(roomCode -> { + final var boundTo = TranslationUtil.tooltip(Tooltips.Machines.BOUND_TO, roomCode); info.text(boundTo); final var roomGraph = CompactRoomProvider.instance(compactDim); - final var owner = room.owner(roomGraph); - if (owner != null) { - PlayerUtil.getProfileByUUID(server, owner).ifPresent(p -> { - MutableComponent ownerText = TranslationUtil - .tooltip(Tooltips.Machines.OWNER, p.getName()) - .withStyle(ChatFormatting.GRAY); - - info.horizontal(new LayoutStyle() - .alignment(ElementAlignment.ALIGN_CENTER) - .padding(0).spacing(0)) - .element(new PlayerFaceElement(p)) - .text(ownerText); - }); - } - - addTunnelInfo(probeMode, info, hitData, compactDim, machine, room); + roomGraph.getRoomOwner(roomCode) + .flatMap(owner -> PlayerUtil.getProfileByUUID(server, owner)) + .ifPresent(p -> { + MutableComponent ownerText = TranslationUtil + .tooltip(Tooltips.Machines.OWNER, p.getName()) + .withStyle(ChatFormatting.GRAY); + + info.horizontal(new LayoutStyle() + .alignment(ElementAlignment.ALIGN_CENTER) + .padding(0).spacing(0)) + .element(new PlayerFaceElement(p)) + .text(ownerText); + }); + + addTunnelInfo(probeMode, info, hitData, compactDim, machine, roomCode); }, () -> { MutableComponent newMachine = TranslationUtil .message(new ResourceLocation(Constants.MOD_ID, "new_machine")) @@ -82,29 +80,27 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le } } - private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHitData hitData, ServerLevel compactDim, CompactMachineBlockEntity machine, IRoomRegistration room) { + private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHitData hitData, ServerLevel compactDim, CompactMachineBlockEntity machine, String roomCode) { if (compactDim == null) return; - final var graph = TunnelConnectionGraph.forRoom(compactDim, room.code()); + final var graph = TunnelConnectionGraph.forRoom(compactDim, roomCode); final var applied = graph.types(machine.getLevelPosition(), hitData.getSideHit()) .collect(Collectors.toSet()); switch (probeMode) { - case NORMAL: + case NORMAL -> { final var group = info.horizontal(new LayoutStyle() .alignment(ElementAlignment.ALIGN_TOPLEFT) .padding(0) .spacing(0)); - applied.forEach(tn -> { ItemStack item = TunnelItem.createStack(tn); group.item(item, new ItemStyle().bounds(8, 8)); }); - break; - - case EXTENDED: + } + case EXTENDED -> { final var tgg = info.vertical(new LayoutStyle().alignment(ElementAlignment.ALIGN_TOPLEFT)); applied.forEach(tn -> { final var tg = tgg.horizontal(new LayoutStyle() @@ -116,7 +112,7 @@ private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHi tg.item(item, new ItemStyle().bounds(8, 8)); tg.itemLabel(item); }); - break; + } } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java index dbe19f37..da0fe213 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java @@ -30,9 +30,9 @@ protected ItemStack run(ItemStack stack, LootContext ctx) { if(state.is(CMTags.MACHINE_BLOCK)) { var data = ctx.getParam(LootContextParams.BLOCK_ENTITY); if (data instanceof CompactMachineBlockEntity machine) { - machine.basicRoomInfo().ifPresent(room -> { - ICompactMachineItem.setColor(stack, room.color()); - BoundCompactMachineItem.setRoom(stack, room.code()); + machine.connectedRoom().ifPresent(roomCode -> { + ICompactMachineItem.setColor(stack, machine.getColor()); + BoundCompactMachineItem.setRoom(stack, roomCode); }); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java index f62992e4..1fe41fd6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java @@ -1,9 +1,13 @@ package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.api.shrinking.PSDTags; +import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.MachineItemUtil; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.machine.item.ICompactMachineItem; +import dev.compactmods.machines.room.BasicRoomInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.server.MinecraftServer; @@ -48,9 +52,10 @@ public CompactMachineBlock(Properties props) { @Override public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity be) { - return be.basicRoomInfo() - .map(BoundCompactMachineItem::createForRoom) - .orElse(UnboundCompactMachineItem.unbound()); + return be.connectedRoom().map(roomCode -> { + final var roomInfo = new BasicRoomInfo(roomCode, be.getColor()); + return BoundCompactMachineItem.createForRoom(roomInfo); + }).orElse(UnboundCompactMachineItem.unbound()); } return UnboundCompactMachineItem.unbound(); @@ -75,7 +80,21 @@ public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList< @Override public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { // force client redraw - super.setPlacedBy(level, pos, state, placer, stack); + final int color = ICompactMachineItem.getMachineColor(stack); + level.getBlockEntity(pos, Machines.MACHINE_TILE_ENTITY.get()).ifPresent(tile -> { + tile.setColor(color); + + if(stack.getItem() instanceof BoundCompactMachineItem boundItem) { + BoundCompactMachineItem.getRoom(stack).ifPresent(roomCode -> { + tile.setConnectedRoom(roomCode); + }); + } + + if(stack.getItem() instanceof UnboundCompactMachineItem unboundItem) { + final var template = MachineItemUtil.getTemplateId(stack); + tile.tem + } + }); } @Nullable @@ -96,4 +115,17 @@ public InteractionResult use(@NotNull BlockState state, Level level, @NotNull Bl return InteractionResult.sidedSuccess(level.isClientSide); } + + @SuppressWarnings("deprecation") + public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState newState, boolean a) { + MinecraftServer server = level.getServer(); + if (level.isClientSide || server == null) { + super.onRemove(oldState, level, pos, newState, a); + return; + } + + MachineBlockUtil.cleanupTunnelsPostMachineRemove(level, pos); + + super.onRemove(oldState, level, pos, newState, a); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java index b32a1b10..b3344cae 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java @@ -1,20 +1,17 @@ package dev.compactmods.machines.forge.machine.block; +import dev.compactmods.machines.LoggingUtil; +import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.IMachineBlockEntity; import dev.compactmods.machines.api.machine.MachineEntityNbt; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.api.room.Rooms; -import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; import dev.compactmods.machines.forge.tunnel.graph.traversal.ForgeTunnelTypeFilters; -import dev.compactmods.machines.machine.BasicRoomInfo; -import dev.compactmods.machines.machine.graph.CompactMachineNode; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; @@ -24,6 +21,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; @@ -35,7 +33,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.lang.ref.WeakReference; import java.util.Optional; import java.util.UUID; @@ -61,12 +58,6 @@ public class CompactMachineBlockEntity extends BlockEntity implements IMachineBl private int customColor; private int roomColor; - private WeakReference graphNode; - private WeakReference fullRoomInfo; - - @Nullable - private IBasicRoomInfo basicInfo; - public CompactMachineBlockEntity(BlockPos pos, BlockState state) { super(Machines.MACHINE_TILE_ENTITY.get(), pos, state); this.roomTemplateId = RoomTemplate.NO_TEMPLATE; @@ -142,7 +133,7 @@ public void load(@NotNull CompoundTag nbt) { roomTemplateId = new ResourceLocation(nbt.getString(NBT_TEMPLATE_ID)); } - if(level != null && !level.isClientSide ) + if (level != null && !level.isClientSide) this.level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL); } @@ -167,10 +158,10 @@ protected void saveAdditional(@NotNull CompoundTag nbt) { public CompoundTag getUpdateTag() { CompoundTag data = super.getUpdateTag(); - roomInfo().ifPresent(room -> { + if(this.roomCode != null) { // data.putString(ROOM_POS_NBT, room); data.putString(NBT_ROOM_CODE, roomCode); - }); + } if (level instanceof ServerLevel) { // TODO - Internal player list @@ -196,7 +187,7 @@ private Optional getConnectedRoom() { final var graph = DimensionMachineGraph.forDimension(sl); - var chunk = graph.getConnectedRoom(worldPosition); + var chunk = graph.connectedRoom(worldPosition); chunk.ifPresent(c -> this.roomCode = c); return chunk; } @@ -231,8 +222,6 @@ public void handleUpdateTag(CompoundTag tag) { if (tag.contains(NBT_TEMPLATE_ID)) roomTemplateId = new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); - - this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); } public Optional getOwnerUUID() { @@ -260,31 +249,21 @@ public void syncConnectedRoom() { try { final var compactDim = CompactDimension.forServer(sl.getServer()); - graph.getMachineNode(worldPosition).ifPresent(node -> { - this.graphNode = new WeakReference<>(node); - }); - if (this.roomCode != null) { final var lookup = CompactRoomProvider.instance(compactDim); lookup.forRoom(roomCode).ifPresent(roomInfo -> { - this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); - this.fullRoomInfo = new WeakReference<>(roomInfo); this.roomColor = roomInfo.color(); }); } else { - graph.getConnectedRoom(worldPosition).ifPresentOrElse(room -> { - CompactMachines.LOGGER.debug("No room code found for {}/{}, but machine connection graph has value {}; connecting to that room...", - level.dimension().location(), worldPosition.toShortString(), room); + graph.connectedRoom(worldPosition).ifPresent(roomCode -> { + LoggingUtil.modLog().debug("No room code found for {}/{}, but machine connection graph has value {}; connecting to that room...", + level.dimension().location(), worldPosition.toShortString(), roomCode); - this.roomCode = room; + this.roomCode = roomCode; final var lookup = CompactRoomProvider.instance(compactDim); - lookup.forRoom(roomCode).ifPresent(roomInfo -> { - this.basicInfo = new BasicRoomInfo(this.roomCode, this.getColor()); - this.fullRoomInfo = new WeakReference<>(roomInfo); + lookup.forRoom(this.roomCode).ifPresent(roomInfo -> { this.roomColor = roomInfo.color(); }); - }, () -> { - this.basicInfo = null; }); } @@ -295,11 +274,15 @@ public void syncConnectedRoom() { } } - public void setConnectedRoom(IRoomRegistration room) { + public void setConnectedRoom(String roomCode) { if (level instanceof ServerLevel sl) { final var dimMachines = DimensionMachineGraph.forDimension(sl); - dimMachines.connectMachineToRoom(worldPosition, room.code()); - this.roomCode = room.code(); + if (this.roomCode != null) { + dimMachines.unregisterMachine(worldPosition); + } + + dimMachines.register(worldPosition, roomCode); + this.roomCode = roomCode; syncConnectedRoom(); } } @@ -307,10 +290,9 @@ public void setConnectedRoom(IRoomRegistration room) { public void disconnect() { if (level instanceof ServerLevel sl) { final var dimMachines = DimensionMachineGraph.forDimension(sl); - dimMachines.disconnect(worldPosition); + dimMachines.unregisterMachine(worldPosition); this.roomCode = null; - this.graphNode.clear(); setChanged(); } } @@ -331,26 +313,23 @@ public Optional getTunnelGraph() { return Optional.empty(); } - public Optional roomInfo() { - if (level != null && level.isClientSide) { - if (roomCode == null) return Optional.empty(); - return Optional.empty(); - } else { - if (fullRoomInfo == null) - return Optional.empty(); - - return Optional.ofNullable(fullRoomInfo.get()); - } - } - public int getColor() { return hasCustomColor ? customColor : roomColor; } + public void setColor(int color) { + this.customColor = color; + this.hasCustomColor = true; + } + + public ResourceKey templateId() { + return ResourceKey.create(CMRegistryKeys.ROOM_TEMPLATES, roomTemplateId); + } + public Optional getRoomTemplate() { if (level != null) { return level.registryAccess() - .registry(Rooms.TEMPLATE_REG_KEY) + .registry(CMRegistryKeys.ROOM_TEMPLATES) .map(reg -> reg.get(roomTemplateId)); } @@ -360,11 +339,4 @@ public Optional getRoomTemplate() { public Optional connectedRoom() { return Optional.ofNullable(roomCode); } - - public Optional basicRoomInfo() { - if (this.roomCode != null) - return Optional.of(this.basicInfo); - - return Optional.empty(); - } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index 3b8a2774..169a69ae 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -1,30 +1,29 @@ package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.Registries; -import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; -import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; -import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; -import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.LegacySizedTemplates; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.forge.machine.Machines; -import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.room.Rooms; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.forge.room.ui.MachineRoomMenu; import dev.compactmods.machines.forge.tunnel.Tunnels; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.LegacySizedTemplates; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; +import dev.compactmods.machines.util.PlayerUtil; +import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; @@ -148,7 +147,7 @@ public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable // Machine was previously bound to a room - make a new binding post-place BoundCompactMachineItem.getRoom(stack).ifPresent(room -> { final var g = DimensionMachineGraph.forDimension(sl); - g.connectMachineToRoom(pos, room); + g.register(pos, room); tile.syncConnectedRoom(); }); } @@ -167,37 +166,42 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player } // Try and pull the name off the nametag and apply it to the room - try { - var compactDim = CompactDimension.forServer(server); - final var roomData = CompactRoomProvider.instance(compactDim); + if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + final var ownerProfile = tile.getOwnerUUID().flatMap(id -> PlayerUtil.getProfileByUUID(server, id)); + boolean isOwner = ownerProfile.map(p -> p.getId().equals(player.getUUID())).orElse(false); + boolean isOp = player.hasPermissions(Commands.LEVEL_MODERATORS); + + if (ownerProfile.isEmpty()) { + return InteractionResult.FAIL; + } - if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.roomInfo().ifPresentOrElse(room -> { - final var ownerId = room.owner(roomData); - try { - if (player.getUUID().equals(ownerId)) { - final var newName = mainItem.getHoverName().getString(120); - Rooms.updateName(server, room.code(), newName); - } else { - player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, - server.getPlayerList().getPlayer(ownerId).getName()), true); - } - } catch (NonexistentRoomException e) { - throw new RuntimeException(e); - } - }, () -> { - CompactMachines.LOGGER.warn("Tried to apply upgrade to a 'claimed' machine, but there was no owner data attached."); + if (!isOp || !isOwner) + return InteractionResult.FAIL; + else { + ownerProfile.ifPresent(owner -> { + player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, + owner.getName()), true); }); } + + tile.connectedRoom().ifPresent(roomCode -> { + try { + final var newName = mainItem.getHoverName().getString(120); + Rooms.updateName(server, roomCode, newName); + } catch (NonexistentRoomException e) { + throw new RuntimeException(e); + } + }); } + } - // Upgrade Item - if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { - final var reg = MachineRoomUpgrades.REGISTRY.get(); - if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - // TODO + // Upgrade Item + if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { + final var reg = MachineRoomUpgrades.REGISTRY.get(); + if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + // TODO // tile.roomInfo().ifPresent(room -> { // final var ownerId = room.owner(roomData); // if (!player.getUUID().equals(ownerId)) { @@ -223,39 +227,36 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player // } // } // }); - } } } + } - - // All other items, open preview screen - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { - if (state.getBlock() instanceof LegacySizedCompactMachineBlock cmBlock) { - machine.roomInfo().ifPresent(room -> { - var size = cmBlock.getSize(); - try { - final var roomName = Rooms.getRoomName(server, room.code()); - NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, room, machine.getLevelPosition()), (buf) -> { - buf.writeBlockPos(pos); - buf.writeWithCodec(GlobalPos.CODEC, machine.getLevelPosition()); - buf.writeUtf(room.code()); - roomName.ifPresentOrElse(name -> { - buf.writeBoolean(true); - buf.writeUtf(name); - }, () -> { - buf.writeBoolean(false); - buf.writeUtf(""); - }); + // All other items, open preview screen + if (level.getBlockEntity(pos) instanceof + CompactMachineBlockEntity machine) { + if (state.getBlock() instanceof LegacySizedCompactMachineBlock cmBlock) { + machine.connectedRoom().ifPresent(roomCode -> { + var size = cmBlock.getSize(); + try { + final var roomName = Rooms.getRoomName(server, roomCode); + NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, roomCode, machine.getLevelPosition()), (buf) -> { + buf.writeBlockPos(pos); + buf.writeWithCodec(GlobalPos.CODEC, machine.getLevelPosition()); + buf.writeUtf(roomCode); + roomName.ifPresentOrElse(name -> { + buf.writeBoolean(true); + buf.writeUtf(name); + }, () -> { + buf.writeBoolean(false); + buf.writeUtf(""); }); - } catch (NonexistentRoomException e) { - e.printStackTrace(); - } - }); - } + }); + } catch (NonexistentRoomException e) { + e.printStackTrace(); + } + }); } - } catch (MissingDimensionException e) { - CompactMachines.LOGGER.fatal(e); } return InteractionResult.sidedSuccess(level.isClientSide); @@ -293,23 +294,7 @@ public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState return; } - if (level instanceof ServerLevel sl) { - final var serv = sl.getServer(); - final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); - - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity entity) { - entity.roomInfo().ifPresent(room -> { - final var dimGraph = DimensionMachineGraph.forDimension(sl); - dimGraph.disconnect(pos); - - if (compactDim == null) - return; - - final var tunnels = TunnelConnectionGraph.forRoom(compactDim, room.code()); - tunnels.unregister(pos); - }); - } - } + MachineBlockUtil.cleanupTunnelsPostMachineRemove(level, pos); super.onRemove(oldState, level, pos, newState, a); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java index 7f2997bc..eceb2d77 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java @@ -12,17 +12,23 @@ import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.BasicRoomInfo; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.util.CompactStructureGenerator; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import javax.annotation.Nonnull; @@ -32,13 +38,37 @@ @SuppressWarnings("removal") public class MachineBlockUtil { + static void cleanupTunnelsPostMachineRemove(Level level, BlockPos pos) { + if (level instanceof ServerLevel sl) { + final var serv = sl.getServer(); + final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); + + if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity entity) { + entity.connectedRoom().ifPresent(roomCode -> { + final var dimGraph = DimensionMachineGraph.forDimension(sl); + dimGraph.unregisterMachine(pos); + + if (compactDim == null) + return; + + final var tunnels = TunnelConnectionGraph.forRoom(compactDim, roomCode); + tunnels.positions(TunnelMachineFilters.all(entity.getLevelPosition())) + .forEach(pos1 -> { + tunnels.unregister(pos1); + compactDim.setBlock(pos1, Walls.BLOCK_SOLID_WALL.get().defaultBlockState(), Block.UPDATE_ALL); + }); + }); + } + } + } + @Nonnull static InteractionResult tryRoomTeleport(Level level, BlockPos pos, ServerPlayer player, MinecraftServer server) { // Try teleport to compact machine dimension if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - tile.roomInfo().ifPresentOrElse(room -> { + tile.connectedRoom().ifPresentOrElse(roomCode -> { try { - RoomHelper.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), room); + RoomHelper.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), roomCode); } catch (MissingDimensionException e) { e.printStackTrace(); } @@ -85,7 +115,7 @@ static void createAndEnterRoom(ServerPlayer owner, MinecraftServer server, RoomT CompactStructureGenerator.fillWithTemplate(compactDim, template.prefillTemplate(), template.dimensions(), newRoom.center()); } - machine.setConnectedRoom(newRoom); + machine.setConnectedRoom(newRoom.code()); RoomHelper.teleportPlayerIntoRoom(server, owner, newRoom, machine.getLevelPosition()); } catch (MissingDimensionException | NonexistentRoomException e) { @@ -136,9 +166,10 @@ public static ItemStack getCloneItemStack(BlockGetter world, BlockState state, B if(!state.is(CMTags.MACHINE_BLOCK) || !(world.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile)) return UnboundCompactMachineItem.unbound(); - return tile.basicRoomInfo() - .map(BoundCompactMachineItem::createForRoom) - .orElse(UnboundCompactMachineItem.unbound()); + return tile.connectedRoom().map(roomCode -> { + final var roomInfo = new BasicRoomInfo(roomCode, tile.getColor()); + return BoundCompactMachineItem.createForRoom(roomInfo); + }).orElse(UnboundCompactMachineItem.unbound()); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java index 839c04a8..a573e538 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/BoundCompactMachineItem.java @@ -1,18 +1,22 @@ package dev.compactmods.machines.forge.machine.item; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.registration.IBasicRoomInfo; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.item.ICompactMachineItem; +import net.minecraft.Util; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -22,10 +26,28 @@ public class BoundCompactMachineItem extends BlockItem implements ICompactMachin public static final String ROOM_NBT = "room_pos"; public static final String ROOM_DIMENSIONS_NBT = "room_dimensions"; + private static final String FALLBACK_ID = Util.makeDescriptionId("block", new ResourceLocation(Constants.MOD_ID, "bound_machine_fallback")); + public BoundCompactMachineItem(Properties builder) { super(Machines.MACHINE_BLOCK.get(), builder); } + public static Component name(ItemStack stack) { + return MachineItemUtil.getMachineName(stack) + .map(Component::literal) + .orElse(Component.translatable(FALLBACK_ID)); + } + @Override + public Component getName(ItemStack stack) { + return name(stack); + } + + @NotNull + @Override + public String getDescriptionId(ItemStack stack) { + return FALLBACK_ID; + } + @Deprecated(forRemoval = true, since = "5.2.0") public static Optional getMachineId(ItemStack stack) { if (!stack.hasTag()) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/MachineItemUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/MachineItemUtil.java new file mode 100644 index 00000000..f8232353 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/MachineItemUtil.java @@ -0,0 +1,54 @@ +package dev.compactmods.machines.forge.machine.item; + +import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.forge.room.RoomHelper; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; + +public class MachineItemUtil { + public static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; + public static final String NBT_CUSTOM_NAME = "custom_name"; + + public static ItemStack setTemplate(ItemStack stack, ResourceLocation templateId) { + var tag = stack.getOrCreateTag(); + tag.putString(NBT_TEMPLATE_ID, templateId.toString()); + return stack; + } + + @NotNull + public static ResourceLocation getTemplateId(ItemStack stack) { + if (!stack.hasTag()) return RoomTemplate.NO_TEMPLATE; + + final var tag = stack.getTag(); + if (tag == null || tag.isEmpty() || !tag.contains(NBT_TEMPLATE_ID)) + return RoomTemplate.NO_TEMPLATE; + + return new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); + } + + @NotNull + public static Optional getTemplate(ItemStack stack) { + var template = getTemplateId(stack); + if (!template.equals(RoomTemplate.NO_TEMPLATE)) { + final var actualTemplate = RoomHelper.getTemplates().get(template); + return Optional.ofNullable(actualTemplate); + } + + return Optional.empty(); + } + + public static Optional getMachineName(ItemStack stack) { + if(!stack.hasTag()) return Optional.empty(); + + final var tag = stack.getTag(); + if(!tag.contains(NBT_CUSTOM_NAME, Tag.TAG_STRING)) + return Optional.empty(); + + return Optional.of(tag.getString(NBT_CUSTOM_NAME)); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java index eea1d821..9d1d5c1d 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java @@ -2,10 +2,8 @@ import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.machine.MachineIds; -import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.forge.machine.Machines; -import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.machine.item.ICompactMachineItem; @@ -25,7 +23,6 @@ import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.Optional; /** * Represents a machine item that has not been bound to a room yet, @@ -33,8 +30,6 @@ */ public class UnboundCompactMachineItem extends BlockItem implements ICompactMachineItem { - public static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; - public UnboundCompactMachineItem(Properties builder) { super(Machines.MACHINE_BLOCK.get(), builder); } @@ -42,7 +37,7 @@ public UnboundCompactMachineItem(Properties builder) { @NotNull @Override public String getDescriptionId(ItemStack stack) { - return Util.makeDescriptionId("machine", getTemplateId(stack)); + return Util.makeDescriptionId("machine", MachineItemUtil.getTemplateId(stack)); } @Override @@ -51,11 +46,11 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List { + MachineItemUtil.getTemplate(stack).ifPresent(actualTemplate -> { final var roomDimensions = actualTemplate.dimensions(); tooltip.add(Component.literal("Size: " + roomDimensions.toShortString()).withStyle(ChatFormatting.YELLOW)); - final var templateId = getTemplateId(stack); + final var templateId = MachineItemUtil.getTemplateId(stack); tooltip.add(Component.literal("Template: " + templateId).withStyle(ChatFormatting.DARK_GRAY)); if (!actualTemplate.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { @@ -77,14 +72,14 @@ private static ItemLike fromRegistry() { public static ItemStack unbound() { final var stack = new ItemStack(fromRegistry(), 1); - setTemplate(stack, RoomTemplate.NO_TEMPLATE); + MachineItemUtil.setTemplate(stack, RoomTemplate.NO_TEMPLATE); ICompactMachineItem.setColor(stack, 0xFFFFFFFF); return stack; } public static ItemStack forTemplate(ResourceLocation templateId, RoomTemplate template) { final var stack = new ItemStack(fromRegistry(), 1); - setTemplate(stack, templateId); + MachineItemUtil.setTemplate(stack, templateId); ICompactMachineItem.setColor(stack, template.color()); MachineDataTagBuilder.empty() @@ -94,32 +89,4 @@ public static ItemStack forTemplate(ResourceLocation templateId, RoomTemplate te return stack; } - - private static ItemStack setTemplate(ItemStack stack, ResourceLocation templateId) { - var tag = stack.getOrCreateTag(); - tag.putString(NBT_TEMPLATE_ID, templateId.toString()); - return stack; - } - - @NotNull - public static ResourceLocation getTemplateId(ItemStack stack) { - if (!stack.hasTag()) return RoomTemplate.NO_TEMPLATE; - - final var tag = stack.getTag(); - if (tag == null || tag.isEmpty() || !tag.contains(NBT_TEMPLATE_ID)) - return RoomTemplate.NO_TEMPLATE; - - return new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); - } - - @NotNull - public static Optional getTemplate(ItemStack stack) { - var template = getTemplateId(stack); - if (!template.equals(RoomTemplate.NO_TEMPLATE)) { - final var actualTemplate = RoomHelper.getTemplates().get(template); - return Optional.ofNullable(actualTemplate); - } - - return Optional.empty(); - } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java index be9e91bd..05c33ad9 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedTeleportPacket.java @@ -1,10 +1,8 @@ package dev.compactmods.machines.forge.network; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.room.RoomHelper; -import dev.compactmods.machines.api.dimension.CompactDimension; -import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.core.GlobalPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; @@ -27,13 +25,7 @@ public boolean handle(Supplier ctx) { final var player = ctx.get().getSender(); if (player != null) { try { - final var provider = CompactRoomProvider.instance(CompactDimension.forServer(player.server)); - provider.forRoom(room).ifPresent(info -> { - try { - RoomHelper.teleportPlayerIntoMachine(player.level, player, machine, info); - } catch (MissingDimensionException ignored) { - } - }); + RoomHelper.teleportPlayerIntoMachine(player.level, player, machine, room); } catch (MissingDimensionException e) { CompactMachines.LOGGER.error("Failed to teleport player into machine.", e); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java index 53726c4f..bb5ac7e3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java @@ -43,38 +43,41 @@ public static Registry getTemplates() { return DistExecutor.safeRunForDist(() -> RoomClientHelper::getTemplates, () -> ForgeRoomServerHelper::getTemplates); } - public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, GlobalPos machinePos, IRoomRegistration room) throws MissingDimensionException { + public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer player, GlobalPos machinePos, String roomCode) throws MissingDimensionException { MinecraftServer serv = machineLevel.getServer(); - // Recursion check. Player tried to enter the room they're already in. - if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { - final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { - if (room.chunks().anyMatch(chunk -> player.chunkPosition().equals(chunk))) { - AdvancementTriggers.RECURSIVE_ROOMS.trigger(player); - return true; - } - - return false; - }).orElse(false); + CompactRoomProvider.instance(serv) + .forRoom(roomCode) + .ifPresent(roomInfo -> { + // Recursion check. Player tried to enter the room they're already in. + if (player.level.dimension().equals(CompactDimension.LEVEL_KEY)) { + final boolean recursion = player.getCapability(RoomCapabilities.ROOM_HISTORY).map(hist -> { + if (roomInfo.chunks().anyMatch(chunk -> player.chunkPosition().equals(chunk))) { + AdvancementTriggers.RECURSIVE_ROOMS.trigger(player); + return true; + } - if (recursion) return; - } + return false; + }).orElse(false); - try { - final var entry = PreciseDimensionalPosition.fromPlayer(player); + if (recursion) return; + } + try { + final var entry = PreciseDimensionalPosition.fromPlayer(player); - teleportPlayerIntoRoom(serv, player, room); + teleportPlayerIntoRoom(serv, player, roomInfo); - // Mark the player as inside the machine, set external spawn, and yeet - player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { - hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); + // Mark the player as inside the machine, set external spawn, and yeet + player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { + hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); - setCurrentRoom(serv, player, room); - }); - } catch (MissingDimensionException | NonexistentRoomException e) { - CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); - } + setCurrentRoom(serv, player, roomInfo); + }); + } catch (MissingDimensionException | NonexistentRoomException e) { + CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); + } + }); } public static void setCurrentRoom(MinecraftServer server, ServerPlayer player, IRoomRegistration room) { @@ -102,12 +105,11 @@ public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer pla player.changeDimension(compactDim, SimpleTeleporter.to(room.spawnPosition(roomProvider), room.spawnRotation(roomProvider))); }); - if(from != null) { + if (from != null) { // Mark the player as inside the machine, set external spawn player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { var entry = PreciseDimensionalPosition.fromPlayer(player); hist.addHistory(new PlayerRoomHistoryItem(entry, from)); - }); } @@ -118,7 +120,7 @@ public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer pla public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { MinecraftServer serv = compactDim.getServer(); - if(!serverPlayer.level.dimension().equals(CompactDimension.LEVEL_KEY)) + if (!serverPlayer.level.dimension().equals(CompactDimension.LEVEL_KEY)) return; serverPlayer.getCapability(RoomCapabilities.ROOM_HISTORY) @@ -130,7 +132,7 @@ public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull Serv // Mark current room, invalidates any listeners + debug screen serverPlayer.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { // Check entry dimension - if it isn't a machine room, clear room info - if(!prevArea.getEntryLocation().dimension().equals(CompactDimension.LEVEL_KEY)) + if (!prevArea.getEntryLocation().dimension().equals(CompactDimension.LEVEL_KEY)) provider.clearCurrent(); else { roomProvider.findByChunk(prevArea.getEntryLocation().chunkPos()).ifPresent(roomMeta -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java index 72e05e93..e55e176b 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/MachineRoomMenu.java @@ -1,9 +1,8 @@ package dev.compactmods.machines.forge.room.ui; -import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import net.minecraft.core.GlobalPos; @@ -46,7 +45,7 @@ public GlobalPos getMachine() { return machine; } - public static MenuProvider makeProvider(MinecraftServer server, IRoomRegistration roomInfo, GlobalPos machinePos) { + public static MenuProvider makeProvider(MinecraftServer server, String roomCode, GlobalPos machinePos) { return new MenuProvider() { @Override public Component getDisplayName() { @@ -57,10 +56,10 @@ public Component getDisplayName() { @Override public AbstractContainerMenu createMenu(int winId, Inventory inv, Player player2) { try { - final var title = Rooms.getRoomName(server, roomInfo.code()); + final var title = Rooms.getRoomName(server, roomCode); - var menu = new MachineRoomMenu(winId, roomInfo.code(), machinePos, title.orElse("Room Preview")); - menu.roomBlocks = Rooms.getInternalBlocks(server, roomInfo.code()).get(5, TimeUnit.SECONDS); + var menu = new MachineRoomMenu(winId, roomCode, machinePos, title.orElse("Room Preview")); + menu.roomBlocks = Rooms.getInternalBlocks(server, roomCode).get(5, TimeUnit.SECONDS); return menu; } catch (NonexistentRoomException | MissingDimensionException e) { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java index e1460bf3..1d8c2b84 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/upgrade/RoomUpgradeManager.java @@ -3,15 +3,16 @@ import com.google.common.graph.MutableValueGraph; import com.google.common.graph.ValueGraphBuilder; import com.mojang.serialization.Codec; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.upgrade.RoomUpgrade; +import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.forge.upgrade.graph.RoomUpgradeConnection; import dev.compactmods.machines.forge.upgrade.graph.UpgradeConnectionEntry; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import dev.compactmods.machines.api.upgrade.RoomUpgradeInstance; -import dev.compactmods.machines.graph.IGraphEdge; -import dev.compactmods.machines.graph.IGraphNode; +import dev.compactmods.machines.graph.GraphTraversalHelper; +import dev.compactmods.machines.graph.edge.IGraphEdge; +import dev.compactmods.machines.graph.node.IGraphNode; import dev.compactmods.machines.room.graph.node.RoomReferenceNode; import dev.compactmods.machines.room.upgrade.graph.RoomUpgradeGraphNode; import net.minecraft.nbt.CompoundTag; @@ -31,13 +32,14 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +@SuppressWarnings("UnstableApiUsage") public class RoomUpgradeManager extends SavedData { public static final String DATA_NAME = Constants.MOD_ID + "_upgrades"; private final HashMap upgradeNodes; private final HashMap roomNodes; - private final MutableValueGraph graph; + private final MutableValueGraph, IGraphEdge> graph; private static final Codec> UPGRADE_CONNECTIONS_CODEC = UpgradeConnectionEntry.CODEC.listOf(); @@ -128,18 +130,18 @@ public boolean addUpgrade(T upgrade, String room) { public boolean removeUpgrade(T upgrade, String room) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); - if(!upgRegistry.containsValue(upgrade)) return false; + if (!upgRegistry.containsValue(upgrade)) return false; final var upgId = upgRegistry.getKey(upgrade); - if(!upgradeNodes.containsKey(upgId)) + if (!upgradeNodes.containsKey(upgId)) return true; - if(!roomNodes.containsKey(room)) + if (!roomNodes.containsKey(room)) return true; final var uNode = upgradeNodes.get(upgId); final var rNode = roomNodes.get(room); - graph.removeEdge(rNode, uNode); + graph.removeEdge(rNode, uNode); setDirty(); return true; } @@ -173,16 +175,14 @@ public Stream> implementing(Class // Build a set of matched upgrade instance nodes HashSet> instances = new HashSet<>(); - final var roomNodes = new HashSet<>(); for (RoomUpgradeGraphNode upgNode : matchedUpgradeNodes) { - for (IGraphNode adjNode : graph.adjacentNodes(upgNode)) { - if (adjNode instanceof RoomReferenceNode roomNode) { - graph.edgeValue(roomNode, upgNode).ifPresent(edv -> { - if (edv instanceof RoomUpgradeConnection conn && inter.isInstance(conn.instance())) - instances.add(new RoomUpgradeInstance<>(inter.cast(conn.instance()), roomNode.code())); + GraphTraversalHelper.predecessors(graph, upgNode, RoomReferenceNode.class) + .forEach(roomNode -> { + var edge = graph.edgeValue(roomNode, upgNode).orElseThrow(); + if (edge instanceof RoomUpgradeConnection upgEdge) { + instances.add(new RoomUpgradeInstance<>(inter.cast(upgEdge.instance()), roomNode.code())); + } }); - } - } } // Stream the instances off the set built above @@ -191,14 +191,14 @@ public Stream> implementing(Class public boolean hasUpgrade(String room, RoomUpgrade upgrade) { final var upgRegistry = MachineRoomUpgrades.REGISTRY.get(); - if(!upgRegistry.containsValue(upgrade)) + if (!upgRegistry.containsValue(upgrade)) return false; final var upgId = upgRegistry.getKey(upgrade); - if(!upgradeNodes.containsKey(upgId)) + if (!upgradeNodes.containsKey(upgId)) return false; - if(!roomNodes.containsKey(room)) + if (!roomNodes.containsKey(room)) return false; final var upgNode = upgradeNodes.get(upgId); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java index 92b42057..dd1ec736 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/graph/RoomUpgradeConnection.java @@ -3,8 +3,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.compactmods.machines.api.upgrade.RoomUpgrade; -import dev.compactmods.machines.graph.IGraphEdge; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.graph.edge.IGraphEdge; import org.jetbrains.annotations.NotNull; public record RoomUpgradeConnection(T instance) implements IGraphEdge> { diff --git a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java index ab3c5fd0..3b0720ff 100644 --- a/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java +++ b/forge-main/src/test/java/dev/compactmods/machines/test/tunnel/TunnelGraphSerializationTests.java @@ -2,12 +2,12 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.graph.GraphTraversalHelper; +import dev.compactmods.machines.test.TestBatches; +import dev.compactmods.machines.test.util.NbtTestUtils; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.nbt.TunnelGraphNbtKeys; import dev.compactmods.machines.tunnel.graph.nbt.TunnelGraphNbtSerializer; -import dev.compactmods.machines.tunnel.graph.traversal.GraphTraversalHelper; -import dev.compactmods.machines.test.TestBatches; -import dev.compactmods.machines.test.util.NbtTestUtils; import dev.compactmods.machines.tunnel.graph.node.TunnelNode; import dev.compactmods.machines.tunnel.graph.node.TunnelTypeNode; import net.minecraft.core.BlockPos; @@ -123,12 +123,12 @@ public static void canDeserializeTunnels(final GameTestHelper test) { test.fail("Expected one machine node; got %s.".formatted(machineCount)); } - long tunnelCount = GraphTraversalHelper.nodes(graph, TunnelNode.class).count(); + long tunnelCount = GraphTraversalHelper.nodes(graph.graph(), TunnelNode.class).count(); if(tunnelCount != 2) { test.fail("Expected 2 tunnel nodes; got %s.".formatted(tunnelCount)); } - long tunnelTypeCount = GraphTraversalHelper.nodes(graph, TunnelTypeNode.class).count(); + long tunnelTypeCount = GraphTraversalHelper.nodes(graph.graph(), TunnelTypeNode.class).count(); if(tunnelTypeCount != 1) { test.fail("Expected 1 tunnel type node; got %s.".formatted(tunnelTypeCount)); } diff --git a/gradle.properties b/gradle.properties index 84b095b2..c3184ff4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.2.3 -tunnels_version=2.2.3 +core_version=2.2.4 +tunnels_version=2.2.4 # Curseforge cf_project=224218 From ae4b226f6c5dbdfd035059f551006b789324e613 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Fri, 5 May 2023 00:50:58 -0400 Subject: [PATCH 71/85] Further split machine block entities --- .../machines/datagen/RecipeGenerator.java | 14 +- .../datagen/lang/EnglishLangGenerator.java | 4 +- .../machines/forge/CompactMachines.java | 2 + .../machines/forge/client/ClientConfig.java | 48 ++++ .../subcommand/CMRebindSubcommand.java | 4 +- .../command/subcommand/CMRoomsSubcommand.java | 4 +- .../subcommand/CMSummarySubcommand.java | 16 +- .../subcommand/CMUnbindSubcommand.java | 4 +- .../overrides/CompactMachineNameOverride.java | 4 +- .../providers/CompactMachineProvider.java | 6 +- .../functions/CopyRoomBindingFunction.java | 4 +- .../migration/Pre520RoomDataMigrator.java | 40 +++- .../machines/forge/machine/Machines.java | 47 +++- .../block/BoundCompactMachineBlock.java | 56 +++++ .../machine/block/CompactMachineBlock.java | 81 +------ .../block/LegacySizedCompactMachineBlock.java | 202 +++++++--------- .../forge/machine/block/MachineBlockUtil.java | 153 ++++++------ .../block/UnboundCompactMachineBlock.java | 126 ++++++++++ .../BoundCompactMachineBlockEntity.java} | 172 ++++---------- .../LegacyCompactMachineBlockEntity.java | 218 ++++++++++++++++++ .../entity/UnboundCompactMachineEntity.java | 78 +++++++ .../item/LegacyCompactMachineItem.java | 2 +- .../item/UnboundCompactMachineItem.java | 11 +- .../forge/upgrade/RoomUpgradeItem.java | 8 +- gradle.properties | 4 +- 25 files changed, 861 insertions(+), 447 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientConfig.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java rename forge-main/src/main/java/dev/compactmods/machines/forge/machine/{block/CompactMachineBlockEntity.java => entity/BoundCompactMachineBlockEntity.java} (55%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java index 681fc72c..c24ca823 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/RecipeGenerator.java @@ -2,12 +2,14 @@ import com.google.gson.JsonObject; import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.machine.MachineEntityNbt; +import dev.compactmods.machines.api.machine.MachineIds; +import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.recipe.ShapedWithNbtRecipeBuilder; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.tunnels.recipe.TunnelRecipeBuilder; import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.forge.machine.Machines; -import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.forge.shrinking.Shrinking; import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; import dev.compactmods.machines.forge.wall.Walls; @@ -116,9 +118,13 @@ protected void registerMachineRecipe(Consumer consumer, Resource recipe.unlockedBy("has_recipe", has(wall)); recipe.addWriter(r -> { final var nbt = new JsonObject(); - MachineDataTagBuilder.forTemplate(temId, tem) - .writeToItemJson(nbt) - .writeToBlockDataJson(nbt); + nbt.addProperty(MachineNbt.NBT_TEMPLATE_ID, temId.toString()); + + final var blockTag = new JsonObject(); + blockTag.addProperty("id", MachineIds.UNBOUND_MACHINE_ITEM_ID.toString()); + blockTag.addProperty(MachineEntityNbt.NBT_TEMPLATE_ID, temId.toString()); + + nbt.add("BlockEntityTag", blockTag); r.add("nbt", nbt); }); diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index 34a33c6f..b39da861 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -12,6 +12,7 @@ import dev.compactmods.machines.forge.shrinking.Shrinking; import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; import dev.compactmods.machines.forgebuiltin.upgrade.BuiltInUpgrades; +import net.minecraft.Util; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; @@ -67,6 +68,7 @@ protected void addTranslations() { addBlock(Walls.BLOCK_BREAKABLE_WALL, "Compact Machine Wall"); addBlock(Walls.BLOCK_SOLID_WALL, "Solid Compact Machine Wall"); addBlock(Tunnels.BLOCK_TUNNEL_WALL, "Solid Compact Machine Wall (with Tunnel)"); + add(Util.makeDescriptionId("block", new ResourceLocation(Constants.MOD_ID, "bound_machine_fallback")), "Bound Compact Machine"); add(Shrinking.PERSONAL_SHRINKING_DEVICE.get(), "Personal Shrinking Device"); @@ -82,6 +84,7 @@ protected void addTranslations() { addTooltip(Tooltips.Details.PERSONAL_SHRINKING_DEVICE, "Used as in-game documentation and to enter Compact Machines."); addTooltip(Tooltips.Details.SOLID_WALL, "Warning! Unbreakable for non-creative players!"); + addTooltip(Tooltips.CRAFT_TO_UPGRADE, "Craft to upgrade to a new machine."); addTooltip(Tooltips.HINT_HOLD_SHIFT, "Hold shift for details."); addTooltip(Tooltips.UNKNOWN_PLAYER_NAME, "Unknown Player"); @@ -89,7 +92,6 @@ protected void addTranslations() { addTooltip(Tooltips.Machines.OWNER, "Owner: %s"); addTooltip(Tooltips.Machines.SIZE, "Internal Size: %1$sx%1$sx%1$s"); addTooltip(Tooltips.Machines.BOUND_TO, "Bound to: %1$s"); - addTooltip(new ResourceLocation(Constants.MOD_ID, "bound_machine_fallback"), "Bound Compact Machine"); addTooltip(Tooltips.TUNNEL_TYPE, "Type ID: %1$s"); addTooltip(Tooltips.UNKNOWN_TUNNEL_TYPE, "Unknown Tunnel Type (%s)"); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index b087f31b..4b7456de 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -7,6 +7,7 @@ import dev.compactmods.machines.api.room.IPlayerRoomMetadataProvider; import dev.compactmods.machines.api.room.IRoomHistory; import dev.compactmods.machines.command.Commands; +import dev.compactmods.machines.forge.client.ClientConfig; import dev.compactmods.machines.forge.config.CommonConfig; import dev.compactmods.machines.forge.config.ServerConfig; import dev.compactmods.machines.forge.data.functions.LootFunctions; @@ -63,6 +64,7 @@ public CompactMachines() { // Configuration ModLoadingContext mlCtx = ModLoadingContext.get(); + mlCtx.registerConfig(ModConfig.Type.CLIENT, ClientConfig.CONFIG); mlCtx.registerConfig(ModConfig.Type.COMMON, CommonConfig.CONFIG); mlCtx.registerConfig(ModConfig.Type.SERVER, ServerConfig.CONFIG); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientConfig.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientConfig.java new file mode 100644 index 00000000..2fa91e52 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientConfig.java @@ -0,0 +1,48 @@ +package dev.compactmods.machines.forge.client; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.config.ModConfigEvent; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class ClientConfig { + + public static ForgeConfigSpec CONFIG; + + private static ForgeConfigSpec.BooleanValue SHOW_LEGACY_ITEMS_IN_CREATIVE; + private static boolean showLegacyItems; + + static { + generateConfig(); + } + + private static void generateConfig() { + ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder(); + + builder + .comment("Machines") + .push("machines"); + + SHOW_LEGACY_ITEMS_IN_CREATIVE = builder + .comment("Show the old machine items in creative/JEI?") + .comment("Requires re-joining the world/server to take effect.") + .define("showLegacyItems", false); + + builder.pop(); + + CONFIG = builder.build(); + } + + public static boolean showLegacyItems() { + return showLegacyItems; + } + + @SubscribeEvent + public static void onLoadedOrChanged(ModConfigEvent loading) { + if(loading.getConfig().getModId().equals(Constants.MOD_ID)) { + showLegacyItems = SHOW_LEGACY_ITEMS_IN_CREATIVE.get(); + } + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java index 694208ee..6b62ee77 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRebindSubcommand.java @@ -9,7 +9,7 @@ import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.config.ServerConfig; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; @@ -49,7 +49,7 @@ private static int doRebind(CommandContext ctx) throws Comma roomProvider.forRoom(roomCode).ifPresentOrElse(targetRoom -> { CompactMachines.LOGGER.debug("Binding machine at {} to room {}", rebindingMachine, targetRoom.code()); - if (!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { + if (!(level.getBlockEntity(rebindingMachine) instanceof BoundCompactMachineBlockEntity machine)) { CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java index 9ee2adea..d721d7b1 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomsSubcommand.java @@ -3,7 +3,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; @@ -49,7 +49,7 @@ private static int fetchByMachineBlock(CommandContext ctx) t if (!level.getBlockState(block).is(MachineTags.BLOCK)) throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); - if (level.getBlockEntity(block) instanceof CompactMachineBlockEntity be) { + if (level.getBlockEntity(block) instanceof BoundCompactMachineBlockEntity be) { be.connectedRoom().ifPresent(roomCode -> { CompactRoomProvider.instance(ctx.getSource().getServer()) .forRoom(roomCode) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java index 6ae0de13..017caf48 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMSummarySubcommand.java @@ -6,6 +6,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.ChatFormatting; import net.minecraft.commands.CommandSourceStack; @@ -30,14 +31,13 @@ private static int exec(CommandContext ctx) { final var ls = LongStream.builder(); serv.getAllLevels().forEach(sl -> { - // TODO - Reimplement -// final var machineData = DimensionMachineGraph.forDimension(sl); -// long numRegistered = machineData.machineCount(); -// -// if(numRegistered > 0) { -// src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().location().toString(), numRegistered), false); -// ls.add(numRegistered); -// } + final var machineData = DimensionMachineGraph.forDimension(sl); + long numRegistered = machineData.machines().count(); + + if(numRegistered > 0) { + src.sendSuccess(TranslationUtil.command(CMCommands.MACHINE_REG_DIM, sl.dimension().location().toString(), numRegistered), false); + ls.add(numRegistered); + } }); long grandTotal = ls.build().sum(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java index 0e1500d4..9db52e91 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMUnbindSubcommand.java @@ -5,7 +5,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.config.ServerConfig; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.CMCommands; import dev.compactmods.machines.api.dimension.CompactDimension; @@ -38,7 +38,7 @@ private static int doUnbind(CommandContext ctx) throws Comma final var rebindingMachine = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); - if (!(level.getBlockEntity(rebindingMachine) instanceof CompactMachineBlockEntity machine)) { + if (!(level.getBlockEntity(rebindingMachine) instanceof BoundCompactMachineBlockEntity machine)) { CompactMachines.LOGGER.error("Refusing to rebind block at {}; block has invalid machine data.", rebindingMachine); throw new CommandRuntimeException(TranslationUtil.command(CMCommands.NOT_A_MACHINE_BLOCK)); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java index 9fb809f4..6797488a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/overrides/CompactMachineNameOverride.java @@ -1,7 +1,7 @@ package dev.compactmods.machines.forge.compat.theoneprobe.overrides; import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.room.Rooms; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; @@ -23,7 +23,7 @@ public class CompactMachineNameOverride implements IBlockDisplayOverride { @Override public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level level, BlockState blockState, IProbeHitData hitData) { if(blockState.is(CMTags.MACHINE_BLOCK)) { - if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity mach) { + if (level.getBlockEntity(hitData.getPos()) instanceof BoundCompactMachineBlockEntity mach) { final var cr = mach.connectedRoom(); if(cr.isEmpty()) return false; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java index 53d057c6..9b135b79 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/theoneprobe/providers/CompactMachineProvider.java @@ -5,7 +5,7 @@ import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.forge.compat.theoneprobe.elements.PlayerFaceElement; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.tunnel.TunnelItem; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; @@ -49,7 +49,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le if (compactDim == null) return; - if (level.getBlockEntity(hitData.getPos()) instanceof CompactMachineBlockEntity machine) { + if (level.getBlockEntity(hitData.getPos()) instanceof BoundCompactMachineBlockEntity machine) { machine.connectedRoom().ifPresentOrElse(roomCode -> { final var boundTo = TranslationUtil.tooltip(Tooltips.Machines.BOUND_TO, roomCode); info.text(boundTo); @@ -80,7 +80,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player player, Le } } - private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHitData hitData, ServerLevel compactDim, CompactMachineBlockEntity machine, String roomCode) { + private static void addTunnelInfo(ProbeMode probeMode, IProbeInfo info, IProbeHitData hitData, ServerLevel compactDim, BoundCompactMachineBlockEntity machine, String roomCode) { if (compactDim == null) return; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java index da0fe213..ae9251aa 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/functions/CopyRoomBindingFunction.java @@ -3,7 +3,7 @@ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.machine.item.ICompactMachineItem; @@ -29,7 +29,7 @@ protected ItemStack run(ItemStack stack, LootContext ctx) { var state = ctx.getParam(LootContextParams.BLOCK_STATE); if(state.is(CMTags.MACHINE_BLOCK)) { var data = ctx.getParam(LootContextParams.BLOCK_ENTITY); - if (data instanceof CompactMachineBlockEntity machine) { + if (data instanceof BoundCompactMachineBlockEntity machine) { machine.connectedRoom().ifPresent(roomCode -> { ICompactMachineItem.setColor(stack, machine.getColor()); BoundCompactMachineItem.setRoom(stack, roomCode); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java index 1e74bedb..f194a40e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/data/migration/Pre520RoomDataMigrator.java @@ -2,15 +2,15 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.codec.CodecExtensions; +import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.room.RoomCodeGenerator; import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.util.DimensionUtil; import dev.compactmods.machines.util.SavedDataHelper; import net.minecraft.core.BlockPos; @@ -37,6 +37,7 @@ import java.nio.file.StandardCopyOption; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -64,6 +65,16 @@ public static RoomDataPre520 of(CompoundTag data) { } } + public record MachineRoomConnection(ChunkPos room, List machines) { + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + CodecExtensions.CHUNKPOS.fieldOf("room") + .forGetter(MachineRoomConnection::room), + + BlockPos.CODEC.listOf().fieldOf("machines") + .forGetter(MachineRoomConnection::machines) + ).apply(i, MachineRoomConnection::new)); + } + public record RoomDataLoadResult(HashMap oldRoomData, HashMap roomChunkLookup) { } @@ -127,20 +138,33 @@ public static void migrateConnectionInfo(LevelStorageSource.LevelDirectory level UPDATER_LOGGER.debug(UPDATER, "Updating connection info for dimension: {}", level.location()); Files.copy(connFile.toPath(), thisDimDir.resolve(connFile.getName() + ".backup")); - final var machineGraphNbt = DimensionUtil.readSavedFile(dimDataStore, DimensionMachineGraph.DATA_KEY); + /** + * data/ CompoundTag + * graph: CompoundTag + * connections: ListTag (CompoundTag/MachineRoomConnectionRecord) + * + * MachineRoomConnectionRecord: + * machines: ListTag (integer) - BlockPos + * room: array [x, z] + */ + final var machineGraphNbt = DimensionUtil.readSavedFile(dimDataStore, "machine_connections"); machineGraphNbt.getCompound("graph") .getList("connections", Tag.TAG_COMPOUND) .forEach(machConnTag -> { // Loop machine-room connection info, replace room pos with room code if (machConnTag instanceof CompoundTag ct) { - final var oldChunk = ct.getIntArray("room"); - final var oldRoomPos = new ChunkPos(oldChunk[0], oldChunk[1]); - if (roomChunkLookup.containsKey(oldRoomPos)) { - final var newCode = roomChunkLookup.get(oldRoomPos); + var record = MachineRoomConnection.CODEC.parse(NbtOps.INSTANCE, ct) + .getOrThrow(false, UPDATER_LOGGER::error); + + // Change the room reference from a chunkpos to a room code + if (roomChunkLookup.containsKey(record.room)) { + final var newCode = roomChunkLookup.get(record.room); ct.remove("room"); ct.putString("room", newCode); - UPDATER_LOGGER.debug(UPDATER, "Assigning new code to room {}; code: {}", oldRoomPos.toString(), newCode); + UPDATER_LOGGER.debug(UPDATER, "Assigning new code to room {}; code: {}", record.room.toString(), newCode); } + + // note: machines are read here but not needed; the dim graph still reads those fine } }); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java index 2e5fd610..b68083df 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java @@ -1,15 +1,18 @@ package dev.compactmods.machines.forge.machine; +import dev.compactmods.machines.api.machine.MachineIds; +import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.Registries; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlock; -import dev.compactmods.machines.forge.machine.block.CompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.block.BoundCompactMachineBlock; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; +import dev.compactmods.machines.forge.machine.block.UnboundCompactMachineBlock; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.UnboundCompactMachineEntity; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.api.machine.MachineIds; -import dev.compactmods.machines.api.room.RoomSize; -import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.LegacyCompactMachineBlockEntity; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -26,44 +29,60 @@ public class Machines { .strength(8.0F, 20.0F) .requiresCorrectToolForDrops(); - static final Supplier MACHINE_ITEM_PROPS = Item.Properties::new; + static final Supplier MACHINE_ITEM_PROPS = () -> new Item.Properties() + .tab(CompactMachines.COMPACT_MACHINES_ITEMS); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_TINY = Registries.BLOCKS.register("machine_tiny", () -> new LegacySizedCompactMachineBlock(RoomSize.TINY, MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_SMALL = Registries.BLOCKS.register("machine_small", () -> new LegacySizedCompactMachineBlock(RoomSize.SMALL, MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_NORMAL = Registries.BLOCKS.register("machine_normal", () -> new LegacySizedCompactMachineBlock(RoomSize.NORMAL, MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_LARGE = Registries.BLOCKS.register("machine_large", () -> new LegacySizedCompactMachineBlock(RoomSize.LARGE, MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_GIANT = Registries.BLOCKS.register("machine_giant", () -> new LegacySizedCompactMachineBlock(RoomSize.GIANT, MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_MAXIMUM = Registries.BLOCKS.register("machine_maximum", () -> new LegacySizedCompactMachineBlock(RoomSize.MAXIMUM, MACHINE_BLOCK_PROPS)); + public static final RegistryObject UNBOUND_MACHINE_BLOCK = Registries.BLOCKS.register("new_machine", () -> + new UnboundCompactMachineBlock(MACHINE_BLOCK_PROPS)); + public static final RegistryObject MACHINE_BLOCK = Registries.BLOCKS.register("machine", () -> - new CompactMachineBlock(MACHINE_BLOCK_PROPS)); + new BoundCompactMachineBlock(MACHINE_BLOCK_PROPS)); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_TINY = Registries.ITEMS.register("machine_tiny", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_TINY.get(), MACHINE_ITEM_PROPS.get())); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_SMALL = Registries.ITEMS.register("machine_small", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_SMALL.get(), MACHINE_ITEM_PROPS.get())); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_NORMAL = Registries.ITEMS.register("machine_normal", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_NORMAL.get(), MACHINE_ITEM_PROPS.get())); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_LARGE = Registries.ITEMS.register("machine_large", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_LARGE.get(), MACHINE_ITEM_PROPS.get())); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_GIANT = Registries.ITEMS.register("machine_giant", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_GIANT.get(), MACHINE_ITEM_PROPS.get())); + @Deprecated(forRemoval = true, since = "5.2.0") public static final RegistryObject MACHINE_BLOCK_ITEM_MAXIMUM = Registries.ITEMS.register("machine_maximum", () -> new LegacyCompactMachineItem(MACHINE_BLOCK_MAXIMUM.get(), MACHINE_ITEM_PROPS.get())); @@ -74,13 +93,21 @@ public class Machines { public static final RegistryObject UNBOUND_MACHINE_BLOCK_ITEM = Registries.ITEMS.register("new_machine", () -> new UnboundCompactMachineItem(MACHINE_ITEM_PROPS.get().tab(CompactMachines.COMPACT_MACHINES_ITEMS))); - public static final RegistryObject> MACHINE_TILE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.BLOCK_ENTITY.getPath(), () -> - BlockEntityType.Builder.of(CompactMachineBlockEntity::new, - MACHINE_BLOCK.get(), + @Deprecated(forRemoval = true, since = "5.2.0") + public static final RegistryObject> LEGACY_MACHINE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.OLD_MACHINE_ENTITY.getPath(), () -> + BlockEntityType.Builder.of(LegacyCompactMachineBlockEntity::new, MACHINE_BLOCK_TINY.get(), MACHINE_BLOCK_SMALL.get(), MACHINE_BLOCK_NORMAL.get(), MACHINE_BLOCK_LARGE.get(), MACHINE_BLOCK_GIANT.get(), MACHINE_BLOCK_MAXIMUM.get()) .build(null)); + public static final RegistryObject> UNBOUND_MACHINE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.UNBOUND_MACHINE_ENTITY.getPath(), () -> + BlockEntityType.Builder.of(UnboundCompactMachineEntity::new, UNBOUND_MACHINE_BLOCK.get()) + .build(null)); + + public static final RegistryObject> MACHINE_ENTITY = Registries.BLOCK_ENTITIES.register(MachineIds.BOUND_MACHINE_ENTITY.getPath(), () -> + BlockEntityType.Builder.of(BoundCompactMachineBlockEntity::new, MACHINE_BLOCK.get()) + .build(null)); + public static void prepare() { } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java new file mode 100644 index 00000000..2136ee04 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java @@ -0,0 +1,56 @@ +package dev.compactmods.machines.forge.machine.block; + +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.machine.item.ICompactMachineItem; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +public class BoundCompactMachineBlock extends CompactMachineBlock { + public BoundCompactMachineBlock(Properties props) { + super(props); + } + + @Override + public float getDestroyProgress(BlockState state, Player player, BlockGetter level, BlockPos pos) { + return MachineBlockUtil.destroyProgress(state, player, level, pos); + } + + @Override + public void fillItemCategory(CreativeModeTab pTab, NonNullList pItems) { + // Do not add additional items to Creative + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if (!level.isClientSide) { + level.getBlockEntity(pos, Machines.MACHINE_ENTITY.get()).ifPresent(tile -> { + // force client redraw + final int color = ICompactMachineItem.getMachineColor(stack); + tile.setColor(color); + + BoundCompactMachineItem.getRoom(stack).ifPresent(tile::setConnectedRoom); + }); + } + } + + @SuppressWarnings("deprecation") + public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState newState, boolean a) { + if (level.isClientSide) { + super.onRemove(oldState, level, pos, newState, a); + return; + } + + MachineBlockUtil.cleanupTunnelsPostMachineRemove(level, pos); + + super.onRemove(oldState, level, pos, newState, a); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java index 1fe41fd6..9cd3eed8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java @@ -1,57 +1,39 @@ package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.forge.machine.item.MachineItemUtil; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.forge.room.RoomHelper; -import dev.compactmods.machines.machine.item.ICompactMachineItem; import dev.compactmods.machines.room.BasicRoomInfo; import net.minecraft.core.BlockPos; -import net.minecraft.core.NonNullList; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.stream.Collectors; /** * Primary block. * * @since 5.2.0 */ -public class CompactMachineBlock extends Block implements EntityBlock { - - public static final BooleanProperty IS_CONNECTED = BooleanProperty.create("connected"); +public class CompactMachineBlock extends Block { - public CompactMachineBlock(Properties props) { + CompactMachineBlock(Properties props) { super(props); - registerDefaultState(getStateDefinition().any() - .setValue(IS_CONNECTED, false) - ); } // client-side @Override public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity be) { + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity be) { return be.connectedRoom().map(roomCode -> { final var roomInfo = new BasicRoomInfo(roomCode, be.getColor()); return BoundCompactMachineItem.createForRoom(roomInfo); @@ -61,48 +43,6 @@ public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState s return UnboundCompactMachineItem.unbound(); } - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(IS_CONNECTED); - super.createBlockStateDefinition(builder); - } - - @Override - public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList tabItems) { - var reg = RoomHelper.getTemplates(); - // todo - fix ordering - tabItems.addAll(reg.entrySet() - .stream() - .map((template) -> UnboundCompactMachineItem.forTemplate(template.getKey().location(), template.getValue())) - .collect(Collectors.toSet())); - } - - @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - // force client redraw - final int color = ICompactMachineItem.getMachineColor(stack); - level.getBlockEntity(pos, Machines.MACHINE_TILE_ENTITY.get()).ifPresent(tile -> { - tile.setColor(color); - - if(stack.getItem() instanceof BoundCompactMachineItem boundItem) { - BoundCompactMachineItem.getRoom(stack).ifPresent(roomCode -> { - tile.setConnectedRoom(roomCode); - }); - } - - if(stack.getItem() instanceof UnboundCompactMachineItem unboundItem) { - final var template = MachineItemUtil.getTemplateId(stack); - tile.tem - } - }); - } - - @Nullable - @Override - public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { - return new CompactMachineBlockEntity(pos, state); - } - @NotNull @Override @SuppressWarnings("deprecation") @@ -115,17 +55,4 @@ public InteractionResult use(@NotNull BlockState state, Level level, @NotNull Bl return InteractionResult.sidedSuccess(level.isClientSide); } - - @SuppressWarnings("deprecation") - public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState newState, boolean a) { - MinecraftServer server = level.getServer(); - if (level.isClientSide || server == null) { - super.onRemove(oldState, level, pos, newState, a); - return; - } - - MachineBlockUtil.cleanupTunnelsPostMachineRemove(level, pos); - - super.onRemove(oldState, level, pos, newState, a); - } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index 169a69ae..b2e98a96 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -2,32 +2,29 @@ import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.client.ClientConfig; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.forge.room.Rooms; -import dev.compactmods.machines.forge.room.ui.MachineRoomMenu; +import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; -import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.LegacyCompactMachineBlockEntity; import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; -import dev.compactmods.machines.util.PlayerUtil; -import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.GlobalPos; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; @@ -37,8 +34,8 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.NameTagItem; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -47,14 +44,13 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.network.NetworkHooks; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") -public class LegacySizedCompactMachineBlock extends Block implements EntityBlock { +public class LegacySizedCompactMachineBlock extends CompactMachineBlock implements EntityBlock { public static final TagKey LEGACY_MACHINES_TAG = TagKey.create(Registries.BLOCKS.getRegistryKey(), new ResourceLocation(Constants.MOD_ID, "legacy_machines")); @@ -66,6 +62,13 @@ public LegacySizedCompactMachineBlock(RoomSize size, BlockBehaviour.Properties p this.size = size; } + @Override + public void fillItemCategory(CreativeModeTab pTab, NonNullList pItems) { + if(ClientConfig.showLegacyItems()) { + pItems.add(new ItemStack(LegacyCompactMachineItem.getItemBySize(this.size))); + } + } + @Override @SuppressWarnings("deprecation") public float getDestroyProgress(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { @@ -92,7 +95,7 @@ public void neighborChanged(BlockState state, Level world, BlockPos pos, Block c return; ServerLevel serverWorld = (ServerLevel) world; - if (serverWorld.getBlockEntity(pos) instanceof CompactMachineBlockEntity machine) { + if (serverWorld.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity machine) { ServerLevel compactWorld = serverWorld.getServer().getLevel(CompactDimension.LEVEL_KEY); if (compactWorld == null) { CompactMachines.LOGGER.warn("Warning: Compact Dimension was null! Cannot fetch internal state for machine neighbor change listener."); @@ -126,31 +129,38 @@ public static Block getBySize(RoomSize size) { @Override public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { - return MachineBlockUtil.getCloneItemStack(level, state, pos); + if (state.getBlock() instanceof LegacySizedCompactMachineBlock leg) { + final var item = LegacyCompactMachineItem.getItemBySize(leg.getSize()); + return new ItemStack(item); + } + + return UnboundCompactMachineItem.unbound(); } @Override - public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { - - if (worldIn.isClientSide()) - return; + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + level.getBlockEntity(pos, Machines.LEGACY_MACHINE_ENTITY.get()).ifPresent(machine -> { - if (worldIn.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile && worldIn instanceof ServerLevel sl) { // TODO - Custom machine names - if (!stack.hasTag()) - return; - - CompoundTag nbt = stack.getTag(); - if (nbt == null) - return; - - // Machine was previously bound to a room - make a new binding post-place - BoundCompactMachineItem.getRoom(stack).ifPresent(room -> { - final var g = DimensionMachineGraph.forDimension(sl); - g.register(pos, room); - tile.syncConnectedRoom(); - }); - } + if (!level.isClientSide && level instanceof ServerLevel serverLevel) { + // Custom machine name override +// if(stack.hasCustomHoverName()) { +// tile.setCustomName(stack.getHoverName()); +// } +// +// MachineItemUtil.getMachineName(stack).ifPresent(customName -> { +// tile.setCustomName(Component.literal(customName)); +// }); + + + // Machine was previously bound to a room - make a new binding post-place + BoundCompactMachineItem.getRoom(stack).ifPresent(room -> { + final var g = DimensionMachineGraph.forDimension(serverLevel); + g.register(pos, room); + machine.setConnectedRoom(room); + }); + } + }); } @Override @@ -166,97 +176,49 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player } // Try and pull the name off the nametag and apply it to the room - if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - final var ownerProfile = tile.getOwnerUUID().flatMap(id -> PlayerUtil.getProfileByUUID(server, id)); - boolean isOwner = ownerProfile.map(p -> p.getId().equals(player.getUUID())).orElse(false); - boolean isOp = player.hasPermissions(Commands.LEVEL_MODERATORS); - - if (ownerProfile.isEmpty()) { - return InteractionResult.FAIL; - } - - if (!isOp || !isOwner) - return InteractionResult.FAIL; - else { - ownerProfile.ifPresent(owner -> { - player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, - owner.getName()), true); - }); - } - - tile.connectedRoom().ifPresent(roomCode -> { - try { - final var newName = mainItem.getHoverName().getString(120); - Rooms.updateName(server, roomCode, newName); - } catch (NonexistentRoomException e) { - throw new RuntimeException(e); - } - }); - } - } + InteractionResult applyNametag = MachineBlockUtil.tryApplyNametag(level, pos, player); + if (applyNametag != null) return applyNametag; // Upgrade Item if (mainItem.is(CMTags.ROOM_UPGRADE_ITEM)) { final var reg = MachineRoomUpgrades.REGISTRY.get(); if (mainItem.getItem() instanceof RoomUpgradeItem upItem) { - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { - // TODO -// tile.roomInfo().ifPresent(room -> { -// final var ownerId = room.owner(roomData); -// if (!player.getUUID().equals(ownerId)) { -// final var ownerName = server.getPlayerList().getPlayer(ownerId).getName(); -// player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, ownerName), true); -// return; -// } -// -// final var upg = RoomUpgradeHelper.getUpgradeId(mainItem); -// final var manager = RoomUpgradeManager.get(compactDim); -// -// if (manager.hasUpgrade(room.code(), upg)) { -// player.displayClientMessage(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE), true); -// } else { -// final var added = manager.addUpgrade(upg, room.code()); -// -// if (added) { -// player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_APPLIED) -// .withStyle(ChatFormatting.DARK_GREEN), true); -// } else { -// player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED) -// .withStyle(ChatFormatting.DARK_RED), true); -// } -// } -// }); + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity tile) { + // TODO - Upgrades for legacy machine blocks + /* + tile.roomInfo().ifPresent(room -> { + final var ownerId = room.owner(roomData); + if (!player.getUUID().equals(ownerId)) { + final var ownerName = server.getPlayerList().getPlayer(ownerId).getName(); + player.displayClientMessage(TranslationUtil.message(Messages.NOT_ROOM_OWNER, ownerName), true); + return; + } + + final var upg = RoomUpgradeHelper.getUpgradeId(mainItem); + final var manager = RoomUpgradeManager.get(compactDim); + + if (manager.hasUpgrade(room.code(), upg)) { + player.displayClientMessage(TranslationUtil.message(Messages.ALREADY_HAS_UPGRADE), true); + } else { + final var added = manager.addUpgrade(upg, room.code()); + + if (added) { + player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_APPLIED) + .withStyle(ChatFormatting.DARK_GREEN), true); + } else { + player.displayClientMessage(TranslationUtil.message(Messages.UPGRADE_ADD_FAILED) + .withStyle(ChatFormatting.DARK_RED), true); + } + } + }); +*/ } } } - // All other items, open preview screen - if (level.getBlockEntity(pos) instanceof - CompactMachineBlockEntity machine) { - if (state.getBlock() instanceof LegacySizedCompactMachineBlock cmBlock) { - machine.connectedRoom().ifPresent(roomCode -> { - var size = cmBlock.getSize(); - try { - final var roomName = Rooms.getRoomName(server, roomCode); - NetworkHooks.openScreen((ServerPlayer) player, MachineRoomMenu.makeProvider(server, roomCode, machine.getLevelPosition()), (buf) -> { - buf.writeBlockPos(pos); - buf.writeWithCodec(GlobalPos.CODEC, machine.getLevelPosition()); - buf.writeUtf(roomCode); - roomName.ifPresentOrElse(name -> { - buf.writeBoolean(true); - buf.writeUtf(name); - }, () -> { - buf.writeBoolean(false); - buf.writeUtf(""); - }); - }); - } catch (NonexistentRoomException e) { - e.printStackTrace(); - } - }); - } + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity machine) { + MachineBlockUtil.roomPreviewScreen(pos, (ServerPlayer) player, server, machine); } return InteractionResult.sidedSuccess(level.isClientSide); @@ -279,12 +241,6 @@ public RoomSize getSize() { return this.size; } - @Nullable - @Override - public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { - return new CompactMachineBlockEntity(pos, state); - } - @Override @SuppressWarnings("deprecation") public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState newState, boolean a) { @@ -298,4 +254,10 @@ public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState super.onRemove(oldState, level, pos, newState, a); } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pPos, BlockState state) { + return new LegacyCompactMachineBlockEntity(pPos, state); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java index eceb2d77..621f51b6 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/MachineBlockUtil.java @@ -1,35 +1,38 @@ package dev.compactmods.machines.forge.machine.block; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.forge.config.ServerConfig; -import dev.compactmods.machines.forge.wall.Walls; -import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; -import dev.compactmods.machines.api.room.RoomTemplate; -import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; -import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; -import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.forge.room.Rooms; +import dev.compactmods.machines.forge.room.ui.MachineRoomMenu; +import dev.compactmods.machines.forge.wall.Walls; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.machine.EnumMachinePlayersBreakHandling; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; -import dev.compactmods.machines.room.BasicRoomInfo; import dev.compactmods.machines.room.exceptions.NonexistentRoomException; -import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; -import dev.compactmods.machines.util.CompactStructureGenerator; +import dev.compactmods.machines.util.PlayerUtil; +import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; +import net.minecraft.core.GlobalPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.NameTagItem; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; import java.util.Optional; @@ -43,7 +46,7 @@ static void cleanupTunnelsPostMachineRemove(Level level, BlockPos pos) { final var serv = sl.getServer(); final var compactDim = serv.getLevel(CompactDimension.LEVEL_KEY); - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity entity) { + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity entity) { entity.connectedRoom().ifPresent(roomCode -> { final var dimGraph = DimensionMachineGraph.forDimension(sl); dimGraph.unregisterMachine(pos); @@ -65,7 +68,7 @@ static void cleanupTunnelsPostMachineRemove(Level level, BlockPos pos) { @Nonnull static InteractionResult tryRoomTeleport(Level level, BlockPos pos, ServerPlayer player, MinecraftServer server) { // Try teleport to compact machine dimension - if (level.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile) { + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity tile) { tile.connectedRoom().ifPresentOrElse(roomCode -> { try { RoomHelper.teleportPlayerIntoMachine(level, player, tile.getLevelPosition(), roomCode); @@ -73,16 +76,7 @@ static InteractionResult tryRoomTeleport(Level level, BlockPos pos, ServerPlayer e.printStackTrace(); } }, () -> { - final var state = level.getBlockState(pos); - RoomTemplate template = RoomTemplate.INVALID_TEMPLATE; - if(state.is(LegacySizedCompactMachineBlock.LEGACY_MACHINES_TAG)) { - if(state.getBlock() instanceof LegacySizedCompactMachineBlock b) - template = LegacySizedCompactMachineBlock.getLegacyTemplate(b.getSize()); - } else { - template = tile.getRoomTemplate().orElse(RoomTemplate.INVALID_TEMPLATE); - } - createAndEnterRoom(player, server, template, tile); // AdvancementTriggers.getTriggerForMachineClaim(size).trigger(sp); }); @@ -92,47 +86,29 @@ static InteractionResult tryRoomTeleport(Level level, BlockPos pos, ServerPlayer return InteractionResult.sidedSuccess(level.isClientSide); } - static void createAndEnterRoom(ServerPlayer owner, MinecraftServer server, RoomTemplate template, CompactMachineBlockEntity machine) { - try { - final var compactDim = CompactDimension.forServer(server); - if(template.equals(RoomTemplate.INVALID_TEMPLATE)) { - CompactMachines.LOGGER.fatal("Tried to create and enter an invalidly-registered room. Something went very wrong!"); - return; - } - - final var roomInfo = CompactRoomProvider.instance(compactDim); - final var newRoom = roomInfo.registerNew(builder -> builder - .setColor(template.color()) - .setDimensions(template.dimensions()) - .setOwner(owner.getUUID())); - - // Generate a new machine room - final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); - CompactStructureGenerator.generateRoom(compactDim, template.dimensions(), newRoom.center(), unbreakableWall); - - // If template specified, prefill new room - if (!template.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { - CompactStructureGenerator.fillWithTemplate(compactDim, template.prefillTemplate(), template.dimensions(), newRoom.center()); - } - - machine.setConnectedRoom(newRoom.code()); - - RoomHelper.teleportPlayerIntoRoom(server, owner, newRoom, machine.getLevelPosition()); - } catch (MissingDimensionException | NonexistentRoomException e) { - CompactMachines.LOGGER.error("Error occurred while generating new room and machine info for first player entry.", e); - } + /** + * Gets destroy progress, without any lookups on owner, internal players, etcetera. + * + * @param state + * @param player + * @param worldIn + * @param pos + * @return + */ + public static float destroyProgressUnchecked(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { + int baseSpeedForge = ForgeHooks.isCorrectToolForDrops(state, player) ? 30 : 100; + return player.getDigSpeed(state, pos) / (float) baseSpeedForge; } public static float destroyProgress(BlockState state, Player player, BlockGetter worldIn, BlockPos pos) { - CompactMachineBlockEntity tile = (CompactMachineBlockEntity) worldIn.getBlockEntity(pos); - float normalHardness = state.getDestroyProgress(player, worldIn, pos); + float normalHardness = destroyProgressUnchecked(state, player, worldIn, pos); + BoundCompactMachineBlockEntity tile = (BoundCompactMachineBlockEntity) worldIn.getBlockEntity(pos); if (tile == null) return normalHardness; boolean hasPlayers = tile.hasPlayersInside(); - // If there are players inside, check config for break handling if (hasPlayers) { EnumMachinePlayersBreakHandling hand = ServerConfig.MACHINE_PLAYER_BREAK_HANDLING.get(); @@ -155,21 +131,60 @@ public static float destroyProgress(BlockState state, Player player, BlockGetter return normalHardness; } - public static ItemStack getCloneItemStack(BlockGetter world, BlockState state, BlockPos pos) { - if(state.is(LegacySizedCompactMachineBlock.LEGACY_MACHINES_TAG) && state.getBlock() instanceof LegacySizedCompactMachineBlock l) - { - final var item = LegacyCompactMachineItem.getItemBySize(l.getSize()); - return new ItemStack(item); - } + public static void roomPreviewScreen(BlockPos pos, ServerPlayer player, MinecraftServer server, BoundCompactMachineBlockEntity machine) { + machine.connectedRoom().ifPresent(roomCode -> { + try { + final var roomName = Rooms.getRoomName(server, roomCode); + NetworkHooks.openScreen(player, MachineRoomMenu.makeProvider(server, roomCode, machine.getLevelPosition()), (buf) -> { + buf.writeBlockPos(pos); + buf.writeWithCodec(GlobalPos.CODEC, machine.getLevelPosition()); + buf.writeUtf(roomCode); + roomName.ifPresentOrElse(name -> { + buf.writeBoolean(true); + buf.writeUtf(name); + }, () -> { + buf.writeBoolean(false); + buf.writeUtf(""); + }); + }); + } catch (NonexistentRoomException e) { + e.printStackTrace(); + } + }); + } - // If not a machine or the block data is invalid... - if(!state.is(CMTags.MACHINE_BLOCK) || !(world.getBlockEntity(pos) instanceof CompactMachineBlockEntity tile)) - return UnboundCompactMachineItem.unbound(); + @Nullable + public static InteractionResult tryApplyNametag(Level level, BlockPos pos, Player player) { + ItemStack mainItem = player.getMainHandItem(); + if (mainItem.getItem() instanceof NameTagItem && mainItem.hasCustomHoverName()) { + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity tile) { + final var ownerProfile = tile.getOwnerUUID().flatMap(id -> PlayerUtil.getProfileByUUID(level, id)); + boolean isOwner = ownerProfile.map(p -> p.getId().equals(player.getUUID())).orElse(false); + boolean isOp = player.hasPermissions(Commands.LEVEL_MODERATORS); + + if (ownerProfile.isEmpty()) { + return InteractionResult.FAIL; + } - return tile.connectedRoom().map(roomCode -> { - final var roomInfo = new BasicRoomInfo(roomCode, tile.getColor()); - return BoundCompactMachineItem.createForRoom(roomInfo); - }).orElse(UnboundCompactMachineItem.unbound()); - } + if (!isOp || !isOwner) + return InteractionResult.FAIL; + else { + ownerProfile.ifPresent(owner -> { + player.displayClientMessage(TranslationUtil.message(Messages.CANNOT_RENAME_NOT_OWNER, + owner.getName()), true); + }); + } + tile.connectedRoom().ifPresent(roomCode -> { + try { + final var newName = mainItem.getHoverName().getString(120); + Rooms.updateName(level.getServer(), roomCode, newName); + } catch (NonexistentRoomException e) { + throw new RuntimeException(e); + } + }); + } + } + return null; + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java new file mode 100644 index 00000000..c3f9631f --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java @@ -0,0 +1,126 @@ +package dev.compactmods.machines.forge.machine.block; + +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.api.shrinking.PSDTags; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.entity.UnboundCompactMachineEntity; +import dev.compactmods.machines.forge.machine.item.MachineItemUtil; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.forge.wall.Walls; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import dev.compactmods.machines.util.CompactStructureGenerator; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.stream.Collectors; + +public class UnboundCompactMachineBlock extends CompactMachineBlock implements EntityBlock { + public UnboundCompactMachineBlock(Properties props) { + super(props); + } + + @Override + public @Nullable BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { + return new UnboundCompactMachineEntity(pos, state); + } + + @Override + public float getDestroyProgress(BlockState state, Player player, BlockGetter level, BlockPos pos) { + return MachineBlockUtil.destroyProgressUnchecked(state, player, level, pos); + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + level.getBlockEntity(pos, Machines.UNBOUND_MACHINE_ENTITY.get()).ifPresent(tile -> { + if(!level.isClientSide) { + final var template = MachineItemUtil.getTemplateId(stack); + tile.setTemplate(template); + } + }); + } + + @Override + public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList tabItems) { + var reg = RoomHelper.getTemplates(); + // TODO - fix ordering + tabItems.addAll(reg.entrySet() + .stream() + .map((template) -> UnboundCompactMachineItem.forTemplate(template.getKey().location(), template.getValue())) + .collect(Collectors.toSet())); + } + + @Override + public @NotNull InteractionResult use(@NotNull BlockState state, Level level, @NotNull BlockPos pos, Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult hitResult) { + MinecraftServer server = level.getServer(); + ItemStack mainItem = player.getMainHandItem(); + + if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { + level.getBlockEntity(pos, Machines.UNBOUND_MACHINE_ENTITY.get()).ifPresent(unboundEntity -> { + RoomTemplate template = unboundEntity.template().orElse(RoomTemplate.INVALID_TEMPLATE); + if(!template.equals(RoomTemplate.INVALID_TEMPLATE)) + { + try { + final var compactDim = CompactDimension.forServer(server); + if (template.equals(RoomTemplate.INVALID_TEMPLATE)) { + CompactMachines.LOGGER.fatal("Tried to create and enter an invalidly-registered room. Something went very wrong!"); + return; + } + + final var roomInfo = CompactRoomProvider.instance(compactDim); + final var newRoom = roomInfo.registerNew(builder -> builder + .setColor(template.color()) + .setDimensions(template.dimensions()) + .setOwner(player.getUUID())); + + // Generate a new machine room + final var unbreakableWall = Walls.BLOCK_SOLID_WALL.get().defaultBlockState(); + CompactStructureGenerator.generateRoom(compactDim, template.dimensions(), newRoom.center(), unbreakableWall); + + // If template specified, prefill new room + if (!template.prefillTemplate().equals(RoomTemplate.NO_TEMPLATE)) { + CompactStructureGenerator.fillWithTemplate(compactDim, template.prefillTemplate(), template.dimensions(), newRoom.center()); + } + + level.setBlock(pos, Machines.MACHINE_BLOCK.get().defaultBlockState(), Block.UPDATE_ALL); + + level.getBlockEntity(pos, Machines.MACHINE_ENTITY.get()).ifPresent(ent -> { + ent.setConnectedRoom(newRoom.code()); + try { + RoomHelper.teleportPlayerIntoRoom(server, sp, newRoom, ent.getLevelPosition()); + } catch (MissingDimensionException | NonexistentRoomException e) { + throw new RuntimeException(e); + } + }); + + } catch (MissingDimensionException e) { + CompactMachines.LOGGER.error("Error occurred while generating new room and machine info for first player entry.", e); + } + } + }); + } + + return InteractionResult.sidedSuccess(level.isClientSide); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java similarity index 55% rename from forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java index b3344cae..00ae03f3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java @@ -1,13 +1,10 @@ -package dev.compactmods.machines.forge.machine.block; +package dev.compactmods.machines.forge.machine.entity; -import dev.compactmods.machines.LoggingUtil; -import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.IMachineBlockEntity; import dev.compactmods.machines.api.machine.MachineEntityNbt; import dev.compactmods.machines.api.machine.MachineNbt; -import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; @@ -16,15 +13,12 @@ import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; -import dev.compactmods.machines.util.NbtUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -36,31 +30,21 @@ import java.util.Optional; import java.util.UUID; -public class CompactMachineBlockEntity extends BlockEntity implements IMachineBlockEntity { - - /** - * @deprecated Store a room code instead or use room lookup utils - */ - @Deprecated(forRemoval = true, since = "5.2.0") - public static final String NBT_ROOM_POS = "room_pos"; - private static final String NBT_ROOM_CODE = MachineEntityNbt.NBT_ROOM_CODE; - private static final String NBT_CUSTOM_COLOR = MachineEntityNbt.NBT_CUSTOM_COLOR; - private static final String NBT_TEMPLATE_ID = MachineEntityNbt.NBT_TEMPLATE_ID; - private static final String NBT_ROOM_COLOR = MachineEntityNbt.NBT_ROOM_COLOR; - - @Nullable - private ResourceLocation roomTemplateId = null; +@SuppressWarnings("removal") +public class BoundCompactMachineBlockEntity extends BlockEntity implements IMachineBlockEntity { protected UUID owner; private String roomCode; - private boolean hasCustomColor = false; - private int customColor; + private boolean hasMachineColorOverride = false; + private int machineColor; private int roomColor; - public CompactMachineBlockEntity(BlockPos pos, BlockState state) { - super(Machines.MACHINE_TILE_ENTITY.get(), pos, state); - this.roomTemplateId = RoomTemplate.NO_TEMPLATE; + @Nullable + private Component customName; + + public BoundCompactMachineBlockEntity(BlockPos pos, BlockState state) { + super(Machines.MACHINE_ENTITY.get(), pos, state); } @NotNull @@ -97,25 +81,12 @@ public LazyOptional getCapability(@NotNull Capability cap, @Nullable D return super.getCapability(cap, side); } - @Override - public void onLoad() { - super.onLoad(); - this.syncConnectedRoom(); - } - @Override public void load(@NotNull CompoundTag nbt) { super.load(nbt); - if (nbt.contains(NBT_ROOM_POS)) { - final var originalRoomPos = NbtUtil.readChunkPos(nbt.get(NBT_ROOM_POS)); - CompactMachines.LOGGER.debug("Machine block has a chunk position specified, it will be rewritten to the new room code system." + - "The block at {} was originally connected to position {}", worldPosition, originalRoomPos); - } - - if (nbt.contains(NBT_ROOM_CODE)) { - this.hasCustomColor = true; - this.roomCode = nbt.getString(NBT_ROOM_CODE); + if (nbt.contains(MachineEntityNbt.NBT_ROOM_CODE)) { + this.roomCode = nbt.getString(MachineEntityNbt.NBT_ROOM_CODE); } if (nbt.contains(MachineNbt.OWNER)) { @@ -124,13 +95,9 @@ public void load(@NotNull CompoundTag nbt) { owner = null; } - if (nbt.contains(NBT_CUSTOM_COLOR)) { - customColor = nbt.getInt(NBT_CUSTOM_COLOR); - hasCustomColor = true; - } - - if (nbt.contains(NBT_TEMPLATE_ID)) { - roomTemplateId = new ResourceLocation(nbt.getString(NBT_TEMPLATE_ID)); + if (nbt.contains(MachineEntityNbt.NBT_CUSTOM_COLOR)) { + machineColor = nbt.getInt(MachineNbt.NBT_COLOR); + hasMachineColorOverride = true; } if (level != null && !level.isClientSide) @@ -143,24 +110,21 @@ protected void saveAdditional(@NotNull CompoundTag nbt) { nbt.putUUID(MachineNbt.OWNER, this.owner); } - if (hasCustomColor) { - nbt.putInt(NBT_CUSTOM_COLOR, customColor); + if (hasMachineColorOverride) { + nbt.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, machineColor); } if (roomCode != null) - nbt.putString(NBT_ROOM_CODE, roomCode); - - if (roomTemplateId != null) - nbt.putString(NBT_TEMPLATE_ID, roomTemplateId.toString()); + nbt.putString(MachineEntityNbt.NBT_ROOM_CODE, roomCode); } @Override public CompoundTag getUpdateTag() { CompoundTag data = super.getUpdateTag(); - if(this.roomCode != null) { + if (this.roomCode != null) { // data.putString(ROOM_POS_NBT, room); - data.putString(NBT_ROOM_CODE, roomCode); + data.putString(MachineEntityNbt.NBT_ROOM_CODE, roomCode); } if (level instanceof ServerLevel) { @@ -169,13 +133,10 @@ public CompoundTag getUpdateTag() { data.putUUID("owner", this.owner); } - if (hasCustomColor) - data.putInt(NBT_CUSTOM_COLOR, customColor); + if (hasMachineColorOverride) + data.putInt(MachineEntityNbt.NBT_CUSTOM_COLOR, machineColor); else - data.putInt(NBT_ROOM_COLOR, getColor()); - - if (!this.roomTemplateId.equals(RoomTemplate.NO_TEMPLATE)) - data.putString(NBT_TEMPLATE_ID, this.roomTemplateId.toString()); + data.putInt(MachineEntityNbt.NBT_ROOM_COLOR, getColor()); return data; } @@ -205,23 +166,21 @@ public void handleUpdateTag(CompoundTag tag) { } - if (tag.contains(NBT_ROOM_POS)) { - int[] room = tag.getIntArray(NBT_ROOM_POS); - final var oldChunk = new ChunkPos(room[0], room[1]); + if (tag.contains(MachineEntityNbt.NBT_ROOM_CODE)) { + this.roomCode = tag.getString(MachineEntityNbt.NBT_ROOM_CODE); } - if (tag.contains(NBT_CUSTOM_COLOR)) { - hasCustomColor = true; - customColor = tag.getInt(NBT_CUSTOM_COLOR); - } else { - roomColor = tag.getInt(NBT_ROOM_COLOR); + if (tag.contains(MachineEntityNbt.NBT_CUSTOM_COLOR)) { + hasMachineColorOverride = true; + machineColor = tag.getInt(MachineNbt.NBT_COLOR); + } + + if (tag.contains(MachineEntityNbt.NBT_ROOM_COLOR)) { + roomColor = tag.getInt(MachineEntityNbt.NBT_ROOM_COLOR); } if (tag.contains("owner")) owner = tag.getUUID("owner"); - - if (tag.contains(NBT_TEMPLATE_ID)) - roomTemplateId = new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); } public Optional getOwnerUUID() { @@ -241,39 +200,6 @@ public GlobalPos getLevelPosition() { return GlobalPos.of(level.dimension(), worldPosition); } - public void syncConnectedRoom() { - if (this.level == null || this.level.isClientSide) return; - - if (level instanceof ServerLevel sl) { - final var graph = DimensionMachineGraph.forDimension(sl); - try { - final var compactDim = CompactDimension.forServer(sl.getServer()); - - if (this.roomCode != null) { - final var lookup = CompactRoomProvider.instance(compactDim); - lookup.forRoom(roomCode).ifPresent(roomInfo -> { - this.roomColor = roomInfo.color(); - }); - } else { - graph.connectedRoom(worldPosition).ifPresent(roomCode -> { - LoggingUtil.modLog().debug("No room code found for {}/{}, but machine connection graph has value {}; connecting to that room...", - level.dimension().location(), worldPosition.toShortString(), roomCode); - - this.roomCode = roomCode; - final var lookup = CompactRoomProvider.instance(compactDim); - lookup.forRoom(this.roomCode).ifPresent(roomInfo -> { - this.roomColor = roomInfo.color(); - }); - }); - } - - this.setChanged(); - } catch (MissingDimensionException e) { - throw new RuntimeException(e); - } - } - } - public void setConnectedRoom(String roomCode) { if (level instanceof ServerLevel sl) { final var dimMachines = DimensionMachineGraph.forDimension(sl); @@ -283,7 +209,12 @@ public void setConnectedRoom(String roomCode) { dimMachines.register(worldPosition, roomCode); this.roomCode = roomCode; - syncConnectedRoom(); + + CompactRoomProvider.instance(sl.getServer()).forRoom(roomCode).ifPresent(roomInfo -> { + this.roomColor = roomInfo.color(); + }); + + this.setChanged(); } } @@ -314,29 +245,24 @@ public Optional getTunnelGraph() { } public int getColor() { - return hasCustomColor ? customColor : roomColor; + return hasMachineColorOverride ? machineColor : roomColor; } public void setColor(int color) { - this.customColor = color; - this.hasCustomColor = true; + this.machineColor = color; + this.hasMachineColorOverride = true; } - public ResourceKey templateId() { - return ResourceKey.create(CMRegistryKeys.ROOM_TEMPLATES, roomTemplateId); + public Optional connectedRoom() { + return Optional.ofNullable(roomCode); } - - public Optional getRoomTemplate() { - if (level != null) { - return level.registryAccess() - .registry(CMRegistryKeys.ROOM_TEMPLATES) - .map(reg -> reg.get(roomTemplateId)); - } - return Optional.empty(); + public Optional getCustomName() { + return Optional.ofNullable(customName); } - public Optional connectedRoom() { - return Optional.ofNullable(roomCode); + public void setCustomName(Component customName) { + this.customName = customName; + this.setChanged(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java new file mode 100644 index 00000000..76747537 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java @@ -0,0 +1,218 @@ +package dev.compactmods.machines.machine; + +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.api.machine.MachineEntityNbt; +import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.forge.CompactMachines; +import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; +import dev.compactmods.machines.forge.tunnel.graph.traversal.ForgeTunnelTypeFilters; +import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.util.NbtUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.Optional; +import java.util.UUID; + +@SuppressWarnings("removal") +@Deprecated(forRemoval = true, since = "5.2.0") +public class LegacyCompactMachineBlockEntity extends BlockEntity { + @Deprecated(forRemoval = true, since = "5.2.0") + public static final String NBT_ROOM_POS = "room_pos"; + private static final String NBT_ROOM_CODE = MachineEntityNbt.NBT_ROOM_CODE; + + protected UUID owner; + private String roomCode; + + public long nextSpawnTick = 0; + protected String schema; + protected boolean locked = false; + private int legacyMachineId = -1; + + public LegacyCompactMachineBlockEntity(BlockPos pos, BlockState state) { + super(Machines.LEGACY_MACHINE_ENTITY.get(), pos, state); + } + + @Nonnull + @Override + public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { + if (level instanceof ServerLevel sl) { + return getConnectedRoom().map(roomId -> { + final var serv = sl.getServer(); + try { + final ServerLevel compactDim = CompactDimension.forServer(serv); + return TunnelConnectionGraph.forRoom(compactDim, roomId) + .tunnels( + TunnelMachineFilters.sided(getLevelPosition(), side), + ForgeTunnelTypeFilters.capability(cap) + ) + .findFirst() + .map(tmi -> { + if (compactDim.getBlockEntity(tmi.location()) instanceof TunnelWallEntity tunnel) { + return tunnel.getTunnelCapability(cap, side); + } else { + return super.getCapability(cap, side); + } + }).orElse(super.getCapability(cap, side)); + } catch (MissingDimensionException e) { + return super.getCapability(cap, side); + } + }).orElse(super.getCapability(cap, side)); + } + + return super.getCapability(cap, side); + } + + @Override + public void onLoad() { + super.onLoad(); + if (this.roomCode == null || this.legacyMachineId == -1) + this.updateLegacyData(); + } + + @Override + public void load(@NotNull CompoundTag nbt) { + super.load(nbt); + + if (nbt.contains(NBT_ROOM_POS)) { + final var originalRoomPos = NbtUtil.readChunkPos(nbt.get(NBT_ROOM_POS)); + CompactMachines.LOGGER.debug("Machine block has a chunk position specified, it will be rewritten to the new room code system." + + "The block at {} was originally connected to position {}", worldPosition, originalRoomPos); + } + + if (nbt.contains(NBT_ROOM_CODE)) { + this.roomCode = nbt.getString(NBT_ROOM_CODE); + } + + if (nbt.contains(MachineNbt.OWNER)) { + owner = nbt.getUUID(MachineNbt.OWNER); + } else { + owner = null; + } + +// if (level != null && !level.isClientSide) +// this.level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL); + } + + @Override + protected void saveAdditional(CompoundTag nbt) { + // nbt.putString("CustomName", customName.getString()); + + if (owner != null) { + nbt.putUUID(MachineNbt.OWNER, this.owner); + } + + if (roomCode != null) + nbt.putString(NBT_ROOM_CODE, roomCode); + } + + @Override + public CompoundTag getUpdateTag() { + CompoundTag data = super.getUpdateTag(); + + getConnectedRoom().ifPresent(room -> { + data.putString(MachineEntityNbt.NBT_ROOM_CODE, roomCode); + }); + + if (level instanceof ServerLevel) { + // TODO - Internal player list + if (this.owner != null) + data.putUUID(MachineNbt.OWNER, this.owner); + } + + return data; + } + + private void updateLegacyData() { + if (level instanceof ServerLevel sl) { + DimensionMachineGraph graph = DimensionMachineGraph.forDimension(sl); + graph.connectedRoom(worldPosition).ifPresent(roomCode -> { + CompactMachines.LOGGER.info("Rebinding machine {} ({}/{}) to room {}", legacyMachineId, worldPosition, level.dimension(), roomCode); + this.roomCode = roomCode; + this.legacyMachineId = -1; + this.setChanged(); + }); + } + } + + private Optional getConnectedRoom() { + if (level instanceof ServerLevel sl) { + if (roomCode != null) + return Optional.of(roomCode); + + final var graph = DimensionMachineGraph.forDimension(sl); + + var chunk = graph.connectedRoom(worldPosition); + chunk.ifPresent(c -> this.roomCode = c); + return chunk; + } + + return Optional.ofNullable(roomCode); + } + + @Override + public void handleUpdateTag(CompoundTag tag) { + super.handleUpdateTag(tag); + + if (tag.contains("players")) { + CompoundTag players = tag.getCompound("players"); + // playerData = CompactMachinePlayerData.fromNBT(players); + } + + if (tag.contains(MachineEntityNbt.NBT_ROOM_CODE)) { + this.roomCode = tag.getString(MachineEntityNbt.NBT_ROOM_CODE); + } + + if (tag.contains("owner")) + owner = tag.getUUID("owner"); + } + + public Optional getOwnerUUID() { + return Optional.ofNullable(this.owner); + } + + public void setOwner(UUID owner) { + this.owner = owner; + } + + public boolean hasPlayersInside() { + // TODO + return false; + } + + public GlobalPos getLevelPosition() { + return GlobalPos.of(level.dimension(), worldPosition); + } + + public void setConnectedRoom(String room) { + if (level instanceof ServerLevel sl) { + final var dimMachines = DimensionMachineGraph.forDimension(sl); + dimMachines.register(worldPosition, room); + this.roomCode = room; + setChanged(); + } + } + + public void disconnect() { + if (level instanceof ServerLevel sl) { + final var dimMachines = DimensionMachineGraph.forDimension(sl); + dimMachines.unregisterMachine(worldPosition); + this.roomCode = null; + setChanged(); + } + } +} \ No newline at end of file diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java new file mode 100644 index 00000000..fc545b49 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java @@ -0,0 +1,78 @@ +package dev.compactmods.machines.forge.machine.entity; + +import dev.compactmods.machines.api.core.CMRegistryKeys; +import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.room.RoomTemplate; +import dev.compactmods.machines.forge.machine.Machines; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; + +public class UnboundCompactMachineEntity extends BlockEntity { + + private static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; + + private ResourceLocation roomTemplateId; + + public UnboundCompactMachineEntity(BlockPos pos, BlockState state) { + super(Machines.UNBOUND_MACHINE_ENTITY.get(), pos, state); + this.roomTemplateId = RoomTemplate.NO_TEMPLATE; + } + + @Override + public void load(@NotNull CompoundTag nbt) { + super.load(nbt); + + if (nbt.contains(NBT_TEMPLATE_ID)) { + roomTemplateId = new ResourceLocation(nbt.getString(NBT_TEMPLATE_ID)); + } + } + + @Override + protected void saveAdditional(@NotNull CompoundTag nbt) { + if (roomTemplateId != null) + nbt.putString(NBT_TEMPLATE_ID, roomTemplateId.toString()); + } + + @Override + public CompoundTag getUpdateTag() { + CompoundTag data = super.getUpdateTag(); + + if (!this.roomTemplateId.equals(RoomTemplate.NO_TEMPLATE)) + data.putString(NBT_TEMPLATE_ID, this.roomTemplateId.toString()); + + return data; + } + + @Override + public void handleUpdateTag(CompoundTag tag) { + super.handleUpdateTag(tag); + + if (tag.contains(NBT_TEMPLATE_ID)) + roomTemplateId = new ResourceLocation(tag.getString(NBT_TEMPLATE_ID)); + } + + public ResourceKey templateId() { + return ResourceKey.create(CMRegistryKeys.ROOM_TEMPLATES, roomTemplateId); + } + + public void setTemplate(ResourceLocation template) { + this.roomTemplateId = template; + } + + public Optional template() { + if (level != null) { + return level.registryAccess() + .registry(CMRegistryKeys.ROOM_TEMPLATES) + .map(reg -> reg.get(roomTemplateId)); + } + + return Optional.empty(); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java index 1b6f145f..e17a9169 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java @@ -40,7 +40,7 @@ public static Item getItemBySize(RoomSize size) { @Override public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List tooltip, TooltipFlag flagIn) { - // tooltip.add(TranslationUtil.tooltip(Tooltips.CRAFT_TO_UPGRADE).withStyle(ChatFormatting.YELLOW)); + tooltip.add(TranslationUtil.tooltip(Tooltips.CRAFT_TO_UPGRADE).withStyle(ChatFormatting.YELLOW)); boolean sneaking = Screen.hasShiftDown(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java index 9d1d5c1d..c8c2baad 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/UnboundCompactMachineItem.java @@ -1,11 +1,11 @@ package dev.compactmods.machines.forge.machine.item; import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.machine.MachineEntityNbt; import dev.compactmods.machines.api.machine.MachineIds; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.machine.data.MachineDataTagBuilder; import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.ChatFormatting; import net.minecraft.Util; @@ -31,7 +31,7 @@ public class UnboundCompactMachineItem extends BlockItem implements ICompactMachineItem { public UnboundCompactMachineItem(Properties builder) { - super(Machines.MACHINE_BLOCK.get(), builder); + super(Machines.UNBOUND_MACHINE_BLOCK.get(), builder); } @NotNull @@ -82,11 +82,8 @@ public static ItemStack forTemplate(ResourceLocation templateId, RoomTemplate te MachineItemUtil.setTemplate(stack, templateId); ICompactMachineItem.setColor(stack, template.color()); - MachineDataTagBuilder.empty() - .template(templateId) - .color(template.color()) - .writeToBlockData(stack); - + final var tag = stack.getOrCreateTag(); + tag.putString(MachineEntityNbt.NBT_TEMPLATE_ID, templateId.toString()); return stack; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java index c7c1d153..8f19ac05 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/upgrade/RoomUpgradeItem.java @@ -21,17 +21,17 @@ public RoomUpgradeItem(Properties props) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List info, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltips, TooltipFlag flag) { if (Screen.hasShiftDown()) { - info.add(TranslationUtil.tooltip(Tooltips.TUTORIAL_APPLY_ROOM_UPGRADE).withStyle(ChatFormatting.ITALIC)); + tooltips.add(TranslationUtil.tooltip(Tooltips.TUTORIAL_APPLY_ROOM_UPGRADE).withStyle(ChatFormatting.ITALIC)); } else { - info.add(TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT).withStyle(ChatFormatting.DARK_GRAY)); + tooltips.add(TranslationUtil.tooltip(Tooltips.HINT_HOLD_SHIFT).withStyle(ChatFormatting.DARK_GRAY)); } // Show upgrade type while sneaking, or if advanced tooltips are on if (Screen.hasShiftDown() || flag.isAdvanced()) { RoomUpgradeHelper.getUpgradeId(stack).ifPresent(upgType -> { - info.add(TranslationUtil.tooltip(Tooltips.ROOM_UPGRADE_TYPE, upgType).withStyle(ChatFormatting.DARK_GRAY)); + tooltips.add(TranslationUtil.tooltip(Tooltips.ROOM_UPGRADE_TYPE, upgType).withStyle(ChatFormatting.DARK_GRAY)); }); } } diff --git a/gradle.properties b/gradle.properties index c3184ff4..2fe944fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.2.4 -tunnels_version=2.2.4 +core_version=2.2.9 +tunnels_version=2.2.9 # Curseforge cf_project=224218 From 45ef6671018e5422d537a1d091430d23d2577afc Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 6 May 2023 04:56:16 -0400 Subject: [PATCH 72/85] Fix wrong package for legacy block entity, update README Thanks to rezonant from the Forge discord! --- README.md | 58 +++++++++++-------- .../machines/forge/machine/Machines.java | 2 +- .../block/LegacySizedCompactMachineBlock.java | 2 +- .../LegacyCompactMachineBlockEntity.java | 2 +- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 63663bae..cc18f748 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,50 @@ -# Compact Machines 4 +Discord -Minecraft Mod. Adds one simple game mechanic: Small rooms inside of blocks. +A Minecraft mod that adds one simple game mechanic: small rooms inside of blocks. You can grab the latest build off [Curseforge] or on [Github Releases]. -You can grab the latest build (tagged) in the releases tab. +| Version | Minecraft Version | Released | Support | Support Ends | +| :-------------- | :---------------: | ------------: | :-----: | -------------- | +| 5.2 | 1.19.2 | - | ✅ | - | +| **5.1** | 1.19.2 | July 2022 | ✅ | - | +| 5.0 | 1.19.2 | July 2022 | ❌ | July 2022 | +| **4.5** | 1.18.2 | July 2022 | ❌ | September 2022 | +| 4.4 | 1.18.2 | July 2022 | ❌ | - | +| 4.3 | 1.18.2 | May 2022 | ❌ | - | +| 4.2 | 1.18.2 | April 2022 | ❌ | - | +| **4.0-beta2** | 1.16.5 | March 2021 | ❌ | July 2022 | +| **3.0.19-b278** | 1.12.2 | May 2019 | ❌ | 2021 | +| **2.0.1-b141** | 1.10.2 | October 2017 | ❌ | 2019 | +| **1.21** | 1.7.10 | November 2015 | ❌ | 2017 | -## Compact Machines +\* *Note - only the most recent versions are shown here for brevity.* -These are the main component of this mod and allow you to build complicated machine contraptions and hide them within a single Compact Machine block. +Standard support policy is after a new version is released for the current Minecraft version, support for the previous version is dropped. If a new major Minecraft version is released and CM is updated, support for the previous major version is currently ***45*** days. -#### Sizes -There are 6 different sizes of machines: +​ -| Name | Description | -| ----------------------------| -------------| -| Tiny | 3x3x3 | -| Small | 5x5x5 | -| Normal | 7x7x7 | -| Large | 9x9x9 | -| Giant | 11x11x11 | -| Maximum | 13x13x13 | +# Contributing -#### Personal Shrinking Device +## Prerequisite: Github Packages +First of all, thank you for wanting to help! To get started, you will need to set up authentication for Github Packages. Github has a guide for how to set up authentication here: -This little tool allows you to enter your Compact Machines. Right clicking a Compact Machine world will teleport you inside. +https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages -#### Spawn location +It is recommended to create a `gradle.properties` file in your user-level gradle folder to simplify working across multiple repositories. -By default, you spawn in the center of the room. You can change this by shift-right-clicking a Personal Shrinking Device at the location you want to set the spawn to. +## Modules +Compact Machines is split into multiple modules to make updating and version maintenance easier. The following is a quick summary of each module's purpose: -Make sure not to obstruct the spawn location, there is currently no mechanic to automatically search for a better spawn location. You don't want to have to break the blocks you spawn in. +| Module | Description +| --- | --- +| core-api | Contains classes used across all other modules; modloader-independent. +| core | Contains data classes and core functionality not tied to a mod loader. +| tunnels-api | Shipped to end users as a baseline for working with tunnel integration. +| forge-tunnels-api | Contains Forge-specific API code for tunnels. (Mainly capability support) -## Miniaturization Crafting -See the [Compact Crafting] mod instead. The crafting mechanic was split in 1.16 due to the dimension and worldgen changes. +If you are interested in working with `core-api`, `core`, or `tunnels-api`, you can find them in the [core repository](https://github.com/CompactMods/compactmachines-core). +--- -[Compact Crafting]: https://github.com/robotgryphon/CompactCrafting +[Curseforge]: https://www.curseforge.com/minecraft/mc-mods/compact-machines +[Github Releases]: https://github.com/CompactMods/CompactMachines/releases \ No newline at end of file diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java index b68083df..82dc9add 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/Machines.java @@ -12,7 +12,7 @@ import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.machine.LegacyCompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.LegacyCompactMachineBlockEntity; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index b2e98a96..ad748242 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -11,13 +11,13 @@ import dev.compactmods.machines.forge.client.ClientConfig; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; +import dev.compactmods.machines.forge.machine.entity.LegacyCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; -import dev.compactmods.machines.machine.LegacyCompactMachineBlockEntity; import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java index 76747537..1fabce60 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java @@ -1,4 +1,4 @@ -package dev.compactmods.machines.machine; +package dev.compactmods.machines.forge.machine.entity; import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.dimension.MissingDimensionException; From d0bf6f752259813b8685f89cd3017c7ef6af5ba3 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 6 May 2023 05:11:13 -0400 Subject: [PATCH 73/85] Fix manual nightly announcer workflow --- .github/workflows/announce-latest-nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/announce-latest-nightly.yml b/.github/workflows/announce-latest-nightly.yml index 647b2ffd..df9f4a75 100644 --- a/.github/workflows/announce-latest-nightly.yml +++ b/.github/workflows/announce-latest-nightly.yml @@ -44,8 +44,8 @@ jobs: with: owner: compactmods repo: compactmachines - group: dev.compactmods - filter: "^compactmachines-(?:[\\d\\.]+)-nightly.jar$" + group: dev.compactmods.compactmachines + filter: "^compactmachines-forge-(?:[\\d\\.]+)-nightly.jar$" outputFile: compactmachines-nightly.json - name: Debug output From d24f53d15fb8edf6e2239eac6b9fc68e28e209bc Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 02:07:53 -0400 Subject: [PATCH 74/85] Add teleport command and room suggestors --- .../machines/forge/command/ForgeCommands.java | 3 + .../{ => argument}/RoomUpgradeArgument.java | 15 ++-- .../forge/command/argument/Suggestors.java | 29 +++++++ .../subcommand/CMGiveMachineSubcommand.java | 2 + .../subcommand/CMRoomUpgradeCommand.java | 7 +- .../subcommand/CMTeleportSubcommand.java | 76 +++++++++++++++++++ 6 files changed, 119 insertions(+), 13 deletions(-) rename forge-main/src/main/java/dev/compactmods/machines/forge/command/{ => argument}/RoomUpgradeArgument.java (72%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/Suggestors.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMTeleportSubcommand.java diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java index d671aefe..48c15a55 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/ForgeCommands.java @@ -3,6 +3,7 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.command.Commands; import dev.compactmods.machines.forge.Registries; +import dev.compactmods.machines.forge.command.argument.RoomUpgradeArgument; import dev.compactmods.machines.forge.command.subcommand.CMEjectSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMGiveMachineSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMReaddDimensionSubcommand; @@ -10,6 +11,7 @@ import dev.compactmods.machines.forge.command.subcommand.CMRoomUpgradeCommand; import dev.compactmods.machines.forge.command.subcommand.CMRoomsSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMSummarySubcommand; +import dev.compactmods.machines.forge.command.subcommand.CMTeleportSubcommand; import dev.compactmods.machines.forge.command.subcommand.CMUnbindSubcommand; import dev.compactmods.machines.forge.command.subcommand.SpawnSubcommand; import net.minecraft.commands.synchronization.ArgumentTypeInfos; @@ -27,6 +29,7 @@ public class ForgeCommands { var cm = Commands.getRoot(); + cm.then(CMTeleportSubcommand.make()); cm.then(CMEjectSubcommand.make()); cm.then(CMSummarySubcommand.make()); cm.then(CMRebindSubcommand.make()); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/RoomUpgradeArgument.java similarity index 72% rename from forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/RoomUpgradeArgument.java index bd02ca98..621aa947 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/RoomUpgradeArgument.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/RoomUpgradeArgument.java @@ -1,16 +1,14 @@ -package dev.compactmods.machines.forge.command; +package dev.compactmods.machines.forge.command.argument; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; -import com.mojang.brigadier.suggestion.SuggestionProvider; -import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.CMCommands; -import dev.compactmods.machines.api.room.Rooms; +import dev.compactmods.machines.api.core.CMRegistryKeys; import dev.compactmods.machines.api.upgrade.RoomUpgrade; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.i18n.TranslationUtil; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.ResourceKeyArgument; import net.minecraft.resources.ResourceKey; @@ -18,19 +16,16 @@ public class RoomUpgradeArgument extends ResourceKeyArgument { - public static final SuggestionProvider SUGGESTOR = (ctx, builder) -> - SharedSuggestionProvider.suggestResource(MachineRoomUpgrades.REGISTRY.get().getKeys(), builder); - private static final DynamicCommandExceptionType ERROR_INVALID_UPGRADE = new DynamicCommandExceptionType((a) -> TranslationUtil.command(CMCommands.WRONG_DIMENSION)); private RoomUpgradeArgument() { - super(Rooms.ROOM_UPGRADES_REG_KEY); + super(CMRegistryKeys.ROOM_UPGRADES); } public static Optional getUpgrade(CommandContext stack, String argName) throws CommandSyntaxException { final var UPGRADES = MachineRoomUpgrades.REGISTRY.get(); - ResourceKey resourcekey = getRegistryType(stack, argName, Rooms.ROOM_UPGRADES_REG_KEY, ERROR_INVALID_UPGRADE); + ResourceKey resourcekey = getRegistryType(stack, argName, CMRegistryKeys.ROOM_UPGRADES, ERROR_INVALID_UPGRADE); return Optional.ofNullable(UPGRADES.getValue(resourcekey.location())); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/Suggestors.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/Suggestors.java new file mode 100644 index 00000000..1644e068 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/argument/Suggestors.java @@ -0,0 +1,29 @@ +package dev.compactmods.machines.forge.command.argument; + +import com.mojang.brigadier.suggestion.SuggestionProvider; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.SharedSuggestionProvider; + +public class Suggestors { + + public static final SuggestionProvider ROOM_UPGRADES = (ctx, builder) -> + SharedSuggestionProvider.suggestResource(MachineRoomUpgrades.REGISTRY.get().getKeys(), builder); + + public static final SuggestionProvider OWNED_ROOM_CODES = (ctx, builder) -> { + final var server = ctx.getSource().getServer(); + final var owner = ctx.getSource().getPlayerOrException(); + final var roomProvider = CompactRoomProvider.instance(server); + final var codes = roomProvider.findByOwner(owner.getUUID()).map(IRoomRegistration::code); + return SharedSuggestionProvider.suggest(codes, builder); + }; + + public static final SuggestionProvider ROOM_CODES = (ctx, builder) -> { + final var server = ctx.getSource().getServer(); + final var roomProvider = CompactRoomProvider.instance(server); + final var codes = roomProvider.allRooms().map(IRoomRegistration::code); + return SharedSuggestionProvider.suggest(codes, builder); + }; +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java index bf1ffa39..92a36e1a 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMGiveMachineSubcommand.java @@ -4,6 +4,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.command.argument.Suggestors; import dev.compactmods.machines.forge.config.ServerConfig; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.api.core.CMCommands; @@ -27,6 +28,7 @@ public static LiteralArgumentBuilder make() { subRoot.then(Commands.argument("player", EntityArgument.player()) .then(Commands.argument("room", StringArgumentType.string()) + .suggests(Suggestors.ROOM_CODES) .executes(CMGiveMachineSubcommand::giveMachine))); return subRoot; diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java index 3d7bd714..1edd23cc 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMRoomUpgradeCommand.java @@ -3,6 +3,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.forge.command.argument.Suggestors; import dev.compactmods.machines.forge.config.ServerConfig; import dev.compactmods.machines.forge.room.upgrade.RoomUpgradeManager; import dev.compactmods.machines.api.core.CMCommands; @@ -10,7 +11,7 @@ import dev.compactmods.machines.api.dimension.CompactDimension; import dev.compactmods.machines.api.upgrade.IUpgradeAppliedListener; import dev.compactmods.machines.api.upgrade.IUpgradeRemovedListener; -import dev.compactmods.machines.forge.command.RoomUpgradeArgument; +import dev.compactmods.machines.forge.command.argument.RoomUpgradeArgument; import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import net.minecraft.commands.CommandSourceStack; @@ -26,7 +27,7 @@ public class CMRoomUpgradeCommand { final var addRoot = Commands.literal("add"); final var addUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) - .suggests(RoomUpgradeArgument.SUGGESTOR) + .suggests(Suggestors.ROOM_UPGRADES) .executes(CMRoomUpgradeCommand::addToCurrentRoom); addUpgRoot.then(Commands.literal("current").executes(CMRoomUpgradeCommand::addToCurrentRoom)); @@ -36,7 +37,7 @@ public class CMRoomUpgradeCommand { final var remRoot = Commands.literal("remove"); final var remUpgRoot = Commands.argument("upgrade", RoomUpgradeArgument.upgrade()) - .suggests(RoomUpgradeArgument.SUGGESTOR) + .suggests(Suggestors.ROOM_UPGRADES) .executes(CMRoomUpgradeCommand::removeFromCurrentRoom); remUpgRoot.then(Commands.literal("current").executes(CMRoomUpgradeCommand::removeFromCurrentRoom)); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMTeleportSubcommand.java b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMTeleportSubcommand.java new file mode 100644 index 00000000..61c55920 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/command/subcommand/CMTeleportSubcommand.java @@ -0,0 +1,76 @@ +package dev.compactmods.machines.forge.command.subcommand; + +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dev.compactmods.machines.LoggingUtil; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.forge.command.argument.Suggestors; +import dev.compactmods.machines.forge.config.ServerConfig; +import dev.compactmods.machines.forge.room.RoomHelper; +import dev.compactmods.machines.i18n.TranslationUtil; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; +import dev.compactmods.machines.room.graph.CompactRoomProvider; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import org.apache.logging.log4j.Logger; + +public class CMTeleportSubcommand { + + private static final Logger LOGGER = LoggingUtil.modLog(); + + public static LiteralArgumentBuilder make() { + final var subRoot = Commands.literal("tp") + .requires(cs -> cs.hasPermission(ServerConfig.giveMachineLevel())); + + subRoot.then(Commands.argument("room", StringArgumentType.string()) + .suggests(Suggestors.ROOM_CODES) + .executes(CMTeleportSubcommand::teleportExecutor)); + + subRoot.then(Commands.argument("player", EntityArgument.player()) + .then(Commands.argument("room", StringArgumentType.string()) + .suggests(Suggestors.ROOM_CODES) + .executes(CMTeleportSubcommand::teleportSpecificPlayer))); + + return subRoot; + } + + private static void teleportToRoom(CommandSourceStack src, MinecraftServer server, ServerPlayer player, String roomCode) { + var roomProvider = CompactRoomProvider.instance(src.getServer()); + roomProvider.forRoom(roomCode).ifPresentOrElse(room -> { + try { + RoomHelper.teleportPlayerIntoRoom(server, player, room); + } catch (MissingDimensionException | NonexistentRoomException e) { + throw new RuntimeException(e); + } + }, () -> { + LOGGER.error("Error teleporting player into room: room not found."); + src.sendFailure(TranslationUtil.message(Messages.UNKNOWN_ROOM_CHUNK, roomCode)); + }); + } + + private static int teleportExecutor(CommandContext ctx) throws CommandSyntaxException { + final var src = ctx.getSource(); + final var server = src.getServer(); + final var player = src.getPlayerOrException(); + final var roomCode = StringArgumentType.getString(ctx, "room"); + + teleportToRoom(src, server, player, roomCode); + return 0; + } + + private static int teleportSpecificPlayer(CommandContext ctx) throws CommandSyntaxException { + final var src = ctx.getSource(); + final var server = src.getServer(); + final var player = EntityArgument.getPlayer(ctx, "player"); + final var roomCode = StringArgumentType.getString(ctx, "room"); + + teleportToRoom(src, server, player, roomCode); + return 0; + } +} From ae11bb5408f9030cc872264ce989bcc6a356c1bc Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 02:08:24 -0400 Subject: [PATCH 75/85] Update dev-time mods --- forge-main/build.gradle.kts | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/forge-main/build.gradle.kts b/forge-main/build.gradle.kts index 09a4c736..ec8c4bba 100644 --- a/forge-main/build.gradle.kts +++ b/forge-main/build.gradle.kts @@ -145,30 +145,37 @@ dependencies { runtimeOnly(fg.deobf("curse.maven:SuperMartijn642-454372:3910759")) runtimeOnly(fg.deobf("curse.maven:trashcans-394535:3871885")) - // runtimeOnly(fg.deobf("curse.maven:flywheel-486392:3871082")) - // runtimeOnly(fg.deobf("curse.maven:create-328085:3737418")) + // Flywheel/Create - v0.6.8.a / v0.5.0i - Jan 29, 2023 + runtimeOnly(fg.deobf("curse.maven:flywheel-486392:4341471")) + runtimeOnly(fg.deobf("curse.maven:create-328085:4371809")) - // runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151")) - // runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:3573145")) - // runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:3623324")) + // 1.18 runtimeOnly(fg.deobf("curse.maven:refinedpipes-370696:3570151")) + + // Pretty Pipes - 1.13.6 - Oct 25, 2022 + runtimeOnly(fg.deobf("curse.maven:prettypipes-376737:4049655")) + + // Refined Storage - 1.11.6 - Mar 30, 2023 + runtimeOnly(fg.deobf("curse.maven:refinedstorage-243076:4465872")) // Scalable Cat's Force, BdLib, Advanced Generators - // runtimeOnly(fg.deobf("curse.maven:scalable-320926:3634756")) - // runtimeOnly(fg.deobf("curse.maven:bdlib-70496:3663149")) - // runtimeOnly(fg.deobf("curse.maven:advgen-223622:3665335")) + // 2.13.10-b10 - Oct 13, 2022 / 1.25.0.5 - Nov 20, 2022 / 1.4.0.5 - Nov 22, 2022 + runtimeOnly(fg.deobf("curse.maven:scalable-320926:4028119")) + runtimeOnly(fg.deobf("curse.maven:bdlib-70496:4100704")) + runtimeOnly(fg.deobf("curse.maven:advgen-223622:4104739")) // Immersive Eng - 7.1.0-145 (Dec 31) // runtimeOnly(fg.deobf("curse.maven:immersiveeng-231951:3587149")) // FTB Chunks - // runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711")) - // runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501")) - // runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485")) - // runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113")) +// runtimeOnly(fg.deobf("curse.maven:architectury-forge-419699:3781711")) +// runtimeOnly(fg.deobf("curse.maven:ftb-teams-404468:3725501")) +// runtimeOnly(fg.deobf("curse.maven:ftblib-404465:3725485")) +// runtimeOnly(fg.deobf("curse.maven:ftbchunks-314906:3780113")) // Mekanism + Mek Generators - Tunnel testing - runtimeOnly(fg.deobf("curse.maven:mekanism-268560:3922056")) - runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:3922058")) + // 10.3.8.477 - Feb 7, 2023 / 10.3.8.477 - Feb 7, 2023 + runtimeOnly(fg.deobf("curse.maven:mekanism-268560:4385637")) + runtimeOnly(fg.deobf("curse.maven:mekanismgenerators-268566:4385639")) // Soul Shards (FTB) // runtimeOnly(fg.deobf("curse.maven:polylib-576589:3751528")) @@ -197,11 +204,10 @@ minecraft { ideaModule("Compact_Machines.forge-main.main") -// if (!System.getenv().containsKey("CI")) { -// // JetBrains Runtime Hotswap -// jvmArg("-XX:+AllowEnhancedClassRedefinition") -// jvmArg("-XX:HotswapAgent=fatjar") -// } + if (!System.getenv().containsKey("CI")) { + // JetBrains Runtime Hotswap + jvmArg("-XX:+AllowEnhancedClassRedefinition") + } source(sourceSets.main.get()) mods.create(modId) { From c6f9ed3973469378403d6dd559cba3d72923d0b0 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 02:08:37 -0400 Subject: [PATCH 76/85] Cleaning up unused parts of legacy machines, testing --- .../block/BoundCompactMachineBlock.java | 11 +++++++++- .../block/LegacySizedCompactMachineBlock.java | 21 +++++++++++++++++-- .../LegacyCompactMachineBlockEntity.java | 16 ++++++++++---- .../machines/forge/room/RoomHelper.java | 2 -- .../ui/overlay/RoomMetadataDebugOverlay.java | 13 ------------ 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java index 2136ee04..01364062 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.machine.item.ICompactMachineItem; import net.minecraft.core.BlockPos; @@ -11,10 +12,12 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.Nullable; -public class BoundCompactMachineBlock extends CompactMachineBlock { +public class BoundCompactMachineBlock extends CompactMachineBlock implements EntityBlock { public BoundCompactMachineBlock(Properties props) { super(props); } @@ -53,4 +56,10 @@ public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState super.onRemove(oldState, level, pos, newState, a); } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return new BoundCompactMachineBlockEntity(pos, state); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java index ad748242..11bfcb76 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/LegacySizedCompactMachineBlock.java @@ -3,6 +3,7 @@ import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.room.RoomSize; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.api.shrinking.PSDTags; @@ -15,16 +16,19 @@ import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.room.RoomHelper; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.forge.upgrade.RoomUpgradeItem; import dev.compactmods.machines.machine.LegacySizedTemplates; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.exceptions.NonexistentRoomException; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; @@ -64,7 +68,7 @@ public LegacySizedCompactMachineBlock(RoomSize size, BlockBehaviour.Properties p @Override public void fillItemCategory(CreativeModeTab pTab, NonNullList pItems) { - if(ClientConfig.showLegacyItems()) { + if (ClientConfig.showLegacyItems()) { pItems.add(new ItemStack(LegacyCompactMachineItem.getItemBySize(this.size))); } } @@ -172,7 +176,20 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player MinecraftServer server = level.getServer(); ItemStack mainItem = player.getMainHandItem(); if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { - return MachineBlockUtil.tryRoomTeleport(level, pos, sp, server); + level.getBlockEntity(pos, Machines.LEGACY_MACHINE_ENTITY.get()).ifPresentOrElse(machine -> { + machine.roomInfo().ifPresentOrElse(room -> { + try { + + RoomHelper.teleportPlayerIntoRoom(server, sp, room, machine.getLevelPosition()); + } catch (MissingDimensionException | NonexistentRoomException e) { + throw new RuntimeException(e); + } + }, () -> { + player.displayClientMessage(Component.literal("Please break and replace this block to create a new room."), true); + }); + }, () -> { + player.displayClientMessage(Component.literal("Error in block entry: not a legacy machine block entity"), true); + }); } // Try and pull the name off the nametag and apply it to the room diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java index 1fabce60..98ab09ea 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/LegacyCompactMachineBlockEntity.java @@ -4,11 +4,13 @@ import dev.compactmods.machines.api.dimension.MissingDimensionException; import dev.compactmods.machines.api.machine.MachineEntityNbt; import dev.compactmods.machines.api.machine.MachineNbt; +import dev.compactmods.machines.api.room.registration.IRoomRegistration; import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.tunnel.TunnelWallEntity; import dev.compactmods.machines.forge.tunnel.graph.traversal.ForgeTunnelTypeFilters; import dev.compactmods.machines.machine.graph.DimensionMachineGraph; +import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; import dev.compactmods.machines.util.NbtUtil; @@ -25,6 +27,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.lang.ref.WeakReference; import java.util.Optional; import java.util.UUID; @@ -37,11 +40,8 @@ public class LegacyCompactMachineBlockEntity extends BlockEntity { protected UUID owner; private String roomCode; - - public long nextSpawnTick = 0; - protected String schema; - protected boolean locked = false; private int legacyMachineId = -1; + private WeakReference roomInfo; public LegacyCompactMachineBlockEntity(BlockPos pos, BlockState state) { super(Machines.LEGACY_MACHINE_ENTITY.get(), pos, state); @@ -82,6 +82,8 @@ public void onLoad() { super.onLoad(); if (this.roomCode == null || this.legacyMachineId == -1) this.updateLegacyData(); + + roomInfo().ifPresent(r -> this.roomInfo = new WeakReference<>(r)); } @Override @@ -215,4 +217,10 @@ public void disconnect() { setChanged(); } } + + public Optional roomInfo() { + if(level == null || level.isClientSide) return Optional.empty(); + return getConnectedRoom() + .flatMap(code -> CompactRoomProvider.instance(level.getServer()).forRoom(code)); + } } \ No newline at end of file diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java index bb5ac7e3..0aa3ba9f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java @@ -71,8 +71,6 @@ public static void teleportPlayerIntoMachine(Level machineLevel, ServerPlayer pl // Mark the player as inside the machine, set external spawn, and yeet player.getCapability(RoomCapabilities.ROOM_HISTORY).ifPresent(hist -> { hist.addHistory(new PlayerRoomHistoryItem(entry, machinePos)); - - setCurrentRoom(serv, player, roomInfo); }); } catch (MissingDimensionException | NonexistentRoomException e) { CompactMachines.LOGGER.fatal("Critical error; could not enter a freshly-created room instance.", e); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java index 9c69d5f5..1247ad89 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/ui/overlay/RoomMetadataDebugOverlay.java @@ -39,21 +39,8 @@ public void render(ForgeGui gui, PoseStack poseStack, float partialTick, int scr PlayerUtil.getProfileByUUID(player.level, room.owner()).ifPresent(ownerInfo -> { final int ownerWidth = font.width(ownerInfo.getName()); -// final var shader = GameRenderer.getPositionTexShader(); -// final var floatBackup = shader.COLOR_MODULATOR.getFloatBuffer() -// .duplicate(); -// -// -// RenderSystem.setShader(GameRenderer::getPositionTexShader); -// shader.COLOR_MODULATOR.set(1, 1, 1, 0.2f); -// shader.COLOR_MODULATOR.upload(); - PlayerFaceRenderer.render(ownerInfo, poseStack, -6, -14); -// shader.COLOR_MODULATOR.getFloatBuffer().rewind(); -// shader.COLOR_MODULATOR.getFloatBuffer().put(floatBackup); -// shader.COLOR_MODULATOR.upload(); - font.drawShadow(poseStack, ownerInfo.getName(), -(ownerWidth / 2f), 0, 0xFFFFFFFF, false); poseStack.translate(0, 12, 0); }); From 886ed7d5c8adf61b265b5393cd5376d6ccfb3e98 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 07:25:28 -0400 Subject: [PATCH 77/85] Tag unbound machines with cm:new_machine --- .../machines/datagen/StateGenerator.java | 6 +++++- .../datagen/tags/BlockTagGenerator.java | 20 ++++++++++++------- gradle.properties | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java index 2194f79d..0d3503f3 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/StateGenerator.java @@ -33,7 +33,7 @@ protected void registerStatesAndModels() { .texture("border", modLoc("block/machine/border")) .texture("tint", modLoc("block/machine/tint")) .texture("overlay", modLoc("block/machine/overlay")) - .renderType(mcLoc("cutout_mipped_all")) + .renderType(mcLoc("cutout")) .element() .allFaces((dir, face) -> face.texture("#border") .uvs(0, 0, 16, 16) @@ -56,6 +56,10 @@ protected void registerStatesAndModels() { .end()) .end(); + simpleBlock(Machines.UNBOUND_MACHINE_BLOCK.get(), ConfiguredModel.builder() + .modelFile(m) + .build()); + simpleBlock(Machines.MACHINE_BLOCK.get(), ConfiguredModel.builder() .modelFile(m) .build()); diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java index d34c2114..996892a2 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/BlockTagGenerator.java @@ -1,14 +1,13 @@ package dev.compactmods.machines.datagen.tags; +import dev.compactmods.machines.api.core.CMTags; +import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.forge.wall.Walls; -import dev.compactmods.machines.api.core.CMTags; -import dev.compactmods.machines.api.core.Constants; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.tags.BlockTags; -import net.minecraft.world.level.block.Block; import net.minecraftforge.common.data.ExistingFileHelper; import java.util.Set; @@ -45,9 +44,16 @@ public void addTags() { ironTool.add(mach); }); - Block machine = Machines.MACHINE_BLOCK.get(); - allMachines.add(machine); - pickaxe.add(machine); - ironTool.add(machine); + var boundMachine = Machines.MACHINE_BLOCK.get(); + allMachines.add(boundMachine); + pickaxe.add(boundMachine); + ironTool.add(boundMachine); + + var unboundTag = tag(CMTags.UNBOUND_MACHINE_BLOCK); + var unboundMachine = Machines.UNBOUND_MACHINE_BLOCK.get(); + allMachines.add(unboundMachine); + unboundTag.add(unboundMachine); + pickaxe.add(unboundMachine); + ironTool.add(unboundMachine); } } diff --git a/gradle.properties b/gradle.properties index 2fe944fc..b895942f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.2.9 -tunnels_version=2.2.9 +core_version=2.2.10 +tunnels_version=2.2.10 # Curseforge cf_project=224218 From 24c1ad3adf796e30fc7f4b52f2bbd5e315569de4 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 07:26:29 -0400 Subject: [PATCH 78/85] Temp fix for unbound machine colors --- assets/machine.aseprite | Bin 1899 -> 1817 bytes .../forge/client/ClientEventHandler.java | 12 ++++++++++++ .../machine/block/CompactMachineBlock.java | 18 ------------------ .../block/UnboundCompactMachineBlock.java | 15 +++++++++++---- .../entity/UnboundCompactMachineEntity.java | 9 ++++++++- .../textures/block/machine/overlay.png | Bin 451 -> 146 bytes .../textures/block/machine/tint.png | Bin 126 -> 391 bytes 7 files changed, 31 insertions(+), 23 deletions(-) diff --git a/assets/machine.aseprite b/assets/machine.aseprite index 5a862e98cfbf511bcc05b1a0115e8ae2c41c51a8..d0dc456459e7a0eff2a2c3f34e00655bf560ede7 100644 GIT binary patch delta 314 zcmaFOH3L7*ZG*7-Tl~N-{DsPhQR_J2{j|VDc5l??B!eCOIHa zX!0K>$H_++1vuCkLQ3=UQgbGUGVfvE1=Pl>z&!aPi)j7ZX$LtEDDb#`?{;VZ@JJ!= zxr|?ur=qKhT2QXWQu%);Kg~~)VrCGPsD7V6^R&`&3H{|$w(U5ZV`=&P@@|((ne^>d zeDgkQCT>$@&vtn{CCDXPW|eDav!!Cot2xQN*_ZB~E9h8QcwupI=A3B@J(JEBWSpP% zV)y*d#bFj=rFS=PQTtzVMfl#8@~CTB@_%prPX3t}eNIuVcoyr1o z>gEKN5XQ-&Y-{!?`t*&hF>3L8B!P+7-Tp0N-{DkOC?gvqqvGT|>#6xGSo4XCyIl1nfeesuKOK!>}e;4oNe+&!n zH`|-5F1{t8d#k0g$ud93c<0boUKcjcg8SBdK*M3*JTYkSb+3wfhtq;zd z{QKv0fBv+0`8WPE|NQUt&wirp`s&{pD@Lex+#z*PP!8gZN@t<%zc-U8-^P!WU Z%>=3UJ1+5PzT}D24}2-buv&HUd;kbXlB56t diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java index cacc2d2f..74cba0a3 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java @@ -3,12 +3,16 @@ import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.forge.compat.curios.CuriosCompat; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.entity.UnboundCompactMachineEntity; import dev.compactmods.machines.forge.room.ui.MachineRoomScreen; import dev.compactmods.machines.forge.room.ui.RoomUserInterfaceRegistration; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.tunnel.client.TunnelColors; import dev.compactmods.machines.machine.client.MachineColors; import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.client.event.TextureStitchEvent; @@ -31,6 +35,14 @@ public static void onItemColors(final RegisterColorHandlersEvent.Item colors) { public static void onBlockColors(final RegisterColorHandlersEvent.Block colors) { colors.register(TunnelColors.BLOCK, Tunnels.BLOCK_TUNNEL_WALL.get()); colors.register(MachineColors.BLOCK, Machines.MACHINE_BLOCK.get()); + colors.register(ClientEventHandler::unboundMachineColor, Machines.UNBOUND_MACHINE_BLOCK.get()); + } + + private static int unboundMachineColor(BlockState state, BlockAndTintGetter level, BlockPos pos, int tintIndex) { + return switch (tintIndex) { + case 0 -> level.getBlockEntity(pos) instanceof UnboundCompactMachineEntity unbound ? unbound.getColor() : 0xFFFFFFFF; + default -> 0xFFFFFFFF; + }; } @SubscribeEvent diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java index 9cd3eed8..de57ddac 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/CompactMachineBlock.java @@ -1,10 +1,6 @@ package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.api.shrinking.PSDTags; -import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; -import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; -import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; -import dev.compactmods.machines.room.BasicRoomInfo; import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -12,7 +8,6 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -30,19 +25,6 @@ public class CompactMachineBlock extends Block { super(props); } - // client-side - @Override - public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { - if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity be) { - return be.connectedRoom().map(roomCode -> { - final var roomInfo = new BasicRoomInfo(roomCode, be.getColor()); - return BoundCompactMachineItem.createForRoom(roomInfo); - }).orElse(UnboundCompactMachineItem.unbound()); - } - - return UnboundCompactMachineItem.unbound(); - } - @NotNull @Override @SuppressWarnings("deprecation") diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java index c3f9631f..5648e258 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/UnboundCompactMachineBlock.java @@ -41,6 +41,15 @@ public UnboundCompactMachineBlock(Properties props) { super(props); } + @Override + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { + if (level.getBlockEntity(pos) instanceof UnboundCompactMachineEntity be) { + return UnboundCompactMachineItem.forTemplate(be.templateId().location(), be.template().get()); + } + + return UnboundCompactMachineItem.unbound(); + } + @Override public @Nullable BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { return new UnboundCompactMachineEntity(pos, state); @@ -54,10 +63,8 @@ public float getDestroyProgress(BlockState state, Player player, BlockGetter lev @Override public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { level.getBlockEntity(pos, Machines.UNBOUND_MACHINE_ENTITY.get()).ifPresent(tile -> { - if(!level.isClientSide) { - final var template = MachineItemUtil.getTemplateId(stack); - tile.setTemplate(template); - } + final var template = MachineItemUtil.getTemplateId(stack); + tile.setTemplate(template); }); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java index fc545b49..a63f8a5e 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/UnboundCompactMachineEntity.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.forge.machine.entity; import dev.compactmods.machines.api.core.CMRegistryKeys; +import dev.compactmods.machines.api.machine.IMachineBlockEntity; import dev.compactmods.machines.api.machine.MachineNbt; import dev.compactmods.machines.api.room.RoomTemplate; import dev.compactmods.machines.forge.machine.Machines; @@ -14,7 +15,7 @@ import java.util.Optional; -public class UnboundCompactMachineEntity extends BlockEntity { +public class UnboundCompactMachineEntity extends BlockEntity implements IMachineBlockEntity { private static final String NBT_TEMPLATE_ID = MachineNbt.NBT_TEMPLATE_ID; @@ -64,6 +65,7 @@ public ResourceKey templateId() { public void setTemplate(ResourceLocation template) { this.roomTemplateId = template; + this.setChanged(); } public Optional template() { @@ -75,4 +77,9 @@ public Optional template() { return Optional.empty(); } + + @Override + public int getColor() { + return this.template().map(RoomTemplate::color).orElse(0xFFFFFFFF); + } } diff --git a/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/overlay.png index 4ba359634eabd2c1a55a0321311c86ef6c46c526..d505c643a3af04adc8b9316e01b497a9b7de77f8 100644 GIT binary patch delta 105 zcmV-v0G9v51CjxdFk%2qNklwP>OBJ=PKHlfD542>(Fz=BM-x006K6b4LZj*Bsaw00000 LNkvXXu0mjf_L?he delta 413 zcmV;O0b>4=0mB23Fn(Om2&~3MnPvPvPf4Ot#lO_CD`99HAuaB3}V` z2-x=k-T-{XZkQ4RL*9oM^n2-oSPxvtXKOrlEj%poq1V15BAHV{5ORC&x?}+k4oi1D zTj%XF`Z4?$kbj*6xiP;*z`pRhBmo%|X00000NkvXX Hu0mjf%ucp0 diff --git a/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/tint.png b/forge-main/src/main/resources/assets/compactmachines/textures/block/machine/tint.png index 020d06b1f5ffe2dd9b420cfe6fa333c504e57c78..6b2a129063e59cc036d1a00d482fdeaea497f6e8 100644 GIT binary patch delta 351 zcmV-l0igbVhXar>e*r;BL_t(oh3!`{j({K#oV#3OPh|-2@D09##D-T;@Cq9fUt!`8 zc!wcY_Lg^*1`!lJa$ez7=q}8#yWk4Eco-k{Ls^#JKBp|pZY@5~v-f@1bt~_eYs~X} z9aBng5xX$PtmAPUH@2Ms0H~@808kV~5&>Fk06^0;JKJYye^M&)v$b{tD5XisZ4thd z1|#rS*wjEwwGYE^XlINa+FcHB5gw6CDKSlx*G>q55aLn_qf@YupP{bn(D5Xx*5iI~fFzk2z7Ce3mUIDLw=u<;usRq`u3cn5Q72_v*W4%|7B#FowlW&cTK&1so-m$N~Y!7UHf-G f{vghP01d~i-)>?t3C@1}9VF=K>gTe~DWM4fOd1~* From 935d64ec373323350757525fbf2fa8bef5e89b60 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 07:26:41 -0400 Subject: [PATCH 79/85] Fix tunnels not warning about side exhaustion --- .../dev/compactmods/machines/forge/tunnel/TunnelItem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index 4e53a925..e2c70200 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -206,8 +206,10 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position .collect(Collectors.toSet()); // all tunnels already placed for type - if (placedSides.size() == 6) + if (placedSides.size() == 6) { + player.displayClientMessage(TranslationUtil.message(Messages.NO_TUNNEL_SIDE).withStyle(ChatFormatting.DARK_RED), true); return false; + } var newlyPlacedSide = TunnelHelper.getOrderedSides() .filter(s -> !placedSides.contains(s)) From ea33a27a753b208b3090f14f4f45d7477375c866 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 9 May 2023 07:27:06 -0400 Subject: [PATCH 80/85] Start fixing bound machine colors - needs higher data changes --- .../machine/block/BoundCompactMachineBlock.java | 16 ++++++++++++++++ .../entity/BoundCompactMachineBlockEntity.java | 1 + 2 files changed, 17 insertions(+) diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java index 01364062..a96c9945 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java @@ -1,9 +1,12 @@ package dev.compactmods.machines.forge.machine.block; +import dev.compactmods.machines.LoggingUtil; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; +import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; import dev.compactmods.machines.machine.item.ICompactMachineItem; +import dev.compactmods.machines.room.BasicRoomInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.world.entity.LivingEntity; @@ -22,6 +25,19 @@ public BoundCompactMachineBlock(Properties props) { super(props); } + @Override + public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState state) { + if (level.getBlockEntity(pos) instanceof BoundCompactMachineBlockEntity be) { + return be.connectedRoom().map(roomCode -> { + final var roomInfo = new BasicRoomInfo(roomCode, be.getColor()); + return BoundCompactMachineItem.createForRoom(roomInfo); + }).orElse(UnboundCompactMachineItem.unbound()); + } + + LoggingUtil.modLog().warn("Warning: tried to pick block on a machine that does not have an associated block entity."); + return null; + } + @Override public float getDestroyProgress(BlockState state, Player player, BlockGetter level, BlockPos pos) { return MachineBlockUtil.destroyProgress(state, player, level, pos); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java index 00ae03f3..21cfd530 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/entity/BoundCompactMachineBlockEntity.java @@ -210,6 +210,7 @@ public void setConnectedRoom(String roomCode) { dimMachines.register(worldPosition, roomCode); this.roomCode = roomCode; + // FIXME - Rooms do not have colors on first creation; this should be pulled from the template! CompactRoomProvider.instance(sl.getServer()).forRoom(roomCode).ifPresent(roomInfo -> { this.roomColor = roomInfo.color(); }); From 2c0670ab288f1a2f76dca379eb626a36b6075c81 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sat, 10 Jun 2023 02:08:35 -0400 Subject: [PATCH 81/85] Fix tunnel removal handler, finish curios compat --- .../datagen/lang/EnglishLangGenerator.java | 4 ++ .../client/ClientForgeBusEventHandler.java | 19 +++++++++ ...ler.java => ClientModBusEventHandler.java} | 12 ++++-- .../forge/client/RoomExitKeyMapping.java | 39 +++++++++++++++++++ .../forge/network/CompactMachinesNet.java | 6 +++ .../network/PlayerRequestedLeavePacket.java | 24 ++++++++++++ .../machines/forge/room/RoomHelper.java | 7 ++-- .../shrinking/PersonalShrinkingDevice.java | 2 +- .../forge/tunnel/TunnelWallBlock.java | 2 +- 9 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientForgeBusEventHandler.java rename forge-main/src/main/java/dev/compactmods/machines/forge/client/{ClientEventHandler.java => ClientModBusEventHandler.java} (86%) create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/client/RoomExitKeyMapping.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedLeavePacket.java diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java index b39da861..287e5eed 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/EnglishLangGenerator.java @@ -1,5 +1,6 @@ package dev.compactmods.machines.datagen.lang; +import dev.compactmods.machines.forge.client.RoomExitKeyMapping; import dev.compactmods.machines.forge.dimension.VoidAirBlock; import dev.compactmods.machines.forge.tunnel.Tunnels; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; @@ -140,6 +141,9 @@ protected void addTranslations() { add(MachineRoomUpgrades.WORKBENCH_BLOCK.get(), "Workbench"); add("entity.minecraft.villager.compactmachines.tinkerer", "Tinkerer"); + + add(RoomExitKeyMapping.CATEGORY, "Compact Machines"); + add(RoomExitKeyMapping.NAME, "Quick-Exit Compact Machine"); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientForgeBusEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientForgeBusEventHandler.java new file mode 100644 index 00000000..02832438 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientForgeBusEventHandler.java @@ -0,0 +1,19 @@ +package dev.compactmods.machines.forge.client; + +import dev.compactmods.machines.api.core.Constants; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) +public class ClientForgeBusEventHandler { + @SubscribeEvent + public static void onClientTick(final TickEvent.ClientTickEvent clientTick) { + if(clientTick.phase != TickEvent.Phase.END) + return; + + if(RoomExitKeyMapping.MAPPING.consumeClick()) + RoomExitKeyMapping.handle(); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientModBusEventHandler.java similarity index 86% rename from forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java rename to forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientModBusEventHandler.java index 74cba0a3..a6742ce2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientEventHandler.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/ClientModBusEventHandler.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterColorHandlersEvent; +import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; @@ -22,7 +23,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @Mod.EventBusSubscriber(modid = Constants.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) -public class ClientEventHandler { +public class ClientModBusEventHandler { @SubscribeEvent public static void onItemColors(final RegisterColorHandlersEvent.Item colors) { @@ -35,7 +36,7 @@ public static void onItemColors(final RegisterColorHandlersEvent.Item colors) { public static void onBlockColors(final RegisterColorHandlersEvent.Block colors) { colors.register(TunnelColors.BLOCK, Tunnels.BLOCK_TUNNEL_WALL.get()); colors.register(MachineColors.BLOCK, Machines.MACHINE_BLOCK.get()); - colors.register(ClientEventHandler::unboundMachineColor, Machines.UNBOUND_MACHINE_BLOCK.get()); + colors.register(ClientModBusEventHandler::unboundMachineColor, Machines.UNBOUND_MACHINE_BLOCK.get()); } private static int unboundMachineColor(BlockState state, BlockAndTintGetter level, BlockPos pos, int tintIndex) { @@ -45,6 +46,11 @@ private static int unboundMachineColor(BlockState state, BlockAndTintGetter leve }; } + @SubscribeEvent + public static void onKeybindRegistration(final RegisterKeyMappingsEvent evt) { + evt.register(RoomExitKeyMapping.MAPPING); + } + @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent client) { MenuScreens.register(RoomUserInterfaceRegistration.MACHINE_MENU.get(), MachineRoomScreen::new); @@ -52,7 +58,7 @@ public static void onClientSetup(final FMLClientSetupEvent client) { @SubscribeEvent public static void onTextureStitch(final TextureStitchEvent.Pre stitch) { - if(ModList.get().isLoaded("curios")) + if (ModList.get().isLoaded("curios")) CuriosCompat.addTextures(stitch); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/client/RoomExitKeyMapping.java b/forge-main/src/main/java/dev/compactmods/machines/forge/client/RoomExitKeyMapping.java new file mode 100644 index 00000000..f0b232a7 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/client/RoomExitKeyMapping.java @@ -0,0 +1,39 @@ +package dev.compactmods.machines.forge.client; + +import com.mojang.blaze3d.platform.InputConstants; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.network.PlayerRequestedLeavePacket; +import net.minecraft.Util; +import net.minecraft.client.KeyMapping; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.settings.IKeyConflictContext; + +public class RoomExitKeyMapping { + + public static final String CATEGORY = Util.makeDescriptionId("key.category", new ResourceLocation(Constants.MOD_ID, "general")); + public static final String NAME = Util.makeDescriptionId("key.mapping", new ResourceLocation(Constants.MOD_ID, "exit_room")); + + public static final IKeyConflictContext CONFLICT_CONTEXT = new IKeyConflictContext() { + @Override + public boolean isActive() { + final var level = Minecraft.getInstance().level; + return level != null && level.dimension().equals(CompactDimension.LEVEL_KEY); + } + + @Override + public boolean conflicts(IKeyConflictContext other) { + return this == other; + } + }; + + public static final KeyMapping MAPPING = new KeyMapping(NAME, CONFLICT_CONTEXT, InputConstants.UNKNOWN, CATEGORY); + + public static void handle() { + final var level = Minecraft.getInstance().level; + if(level != null && level.dimension().equals(CompactDimension.LEVEL_KEY)) + CompactMachinesNet.CHANNEL.sendToServer(new PlayerRequestedLeavePacket()); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java index 67f15794..ac34bc78 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/CompactMachinesNet.java @@ -39,5 +39,11 @@ public static void setupMessages() { .decoder(SyncRoomMetadataPacket::new) .consumerMainThread(SyncRoomMetadataPacket::handle) .add(); + + CHANNEL.messageBuilder(PlayerRequestedLeavePacket.class, 4, NetworkDirection.PLAY_TO_SERVER) + .encoder(PlayerRequestedLeavePacket::encode) + .decoder(PlayerRequestedLeavePacket::new) + .consumerMainThread(PlayerRequestedLeavePacket::handle) + .add(); } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedLeavePacket.java b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedLeavePacket.java new file mode 100644 index 00000000..c1082f22 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/network/PlayerRequestedLeavePacket.java @@ -0,0 +1,24 @@ +package dev.compactmods.machines.forge.network; + +import dev.compactmods.machines.forge.room.RoomHelper; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraftforge.network.NetworkEvent; + +import java.util.function.Supplier; + +public record PlayerRequestedLeavePacket() { + public PlayerRequestedLeavePacket(FriendlyByteBuf friendlyByteBuf) { + this(); + } + + public void handle(Supplier context) { + final var ctx = context.get(); + final var sender = ctx.getSender(); + + RoomHelper.teleportPlayerOutOfRoom(sender); + } + + public void encode(FriendlyByteBuf buffer) { + + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java index 0aa3ba9f..a759f5fe 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/RoomHelper.java @@ -22,7 +22,6 @@ import net.minecraft.core.GlobalPos; import net.minecraft.core.Registry; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; @@ -115,9 +114,9 @@ public static void teleportPlayerIntoRoom(MinecraftServer serv, ServerPlayer pla RoomHelper.setCurrentRoom(serv, player, room); } - public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull ServerPlayer serverPlayer) { + public static void teleportPlayerOutOfRoom(@Nonnull ServerPlayer serverPlayer) { - MinecraftServer serv = compactDim.getServer(); + MinecraftServer serv = serverPlayer.getServer(); if (!serverPlayer.level.dimension().equals(CompactDimension.LEVEL_KEY)) return; @@ -125,7 +124,7 @@ public static void teleportPlayerOutOfRoom(ServerLevel compactDim, @Nonnull Serv .resolve() .ifPresentOrElse(hist -> { if (hist.hasHistory()) { - final var roomProvider = CompactRoomProvider.instance(compactDim); + final var roomProvider = CompactRoomProvider.instance(serv); final IRoomHistoryItem prevArea = hist.pop(); // Mark current room, invalidates any listeners + debug screen serverPlayer.getCapability(CURRENT_ROOM_META).ifPresent(provider -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java index 7df37dbd..ba3a81ab 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/shrinking/PersonalShrinkingDevice.java @@ -80,7 +80,7 @@ public InteractionResultHolder use(Level world, Player player, Intera player.displayClientMessage(tc, true); } else { - RoomHelper.teleportPlayerOutOfRoom(playerDim, serverPlayer); + RoomHelper.teleportPlayerOutOfRoom(serverPlayer); } } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java index e396dbe4..f1756de2 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallBlock.java @@ -134,7 +134,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player final var removalReason = new ServerPlayerRemovedReason(serverPlayer); if (def instanceof ITunnelRemoveEventListener removeListener) { var handler = removeListener.createBeforeRemoveHandler(tunnel.getTunnel()); - if (handler != null && handler.beforeRemove(server, tunnelOriginalPosition, removalReason)) { + if (handler != null && !handler.beforeRemove(server, tunnelOriginalPosition, removalReason)) { // Cancel removal return InteractionResult.FAIL; } From e12d4a14911291880526ca59827e3d797d298f23 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 11 Jun 2023 00:12:06 -0400 Subject: [PATCH 82/85] Update discord invite in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc18f748..fef036ad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Discord +Discord A Minecraft mod that adds one simple game mechanic: small rooms inside of blocks. You can grab the latest build off [Curseforge] or on [Github Releases]. From b6741082e96af7408ecc139a6d18ae0a34cf5f55 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Sun, 11 Jun 2023 01:25:46 -0400 Subject: [PATCH 83/85] Tag all legacy machine items, hide from JEI --- .../datagen/tags/ItemTagGenerator.java | 4 ++++ .../compat/jei/CompactMachinesJeiPlugin.java | 23 +++++++++++++++---- .../item/LegacyCompactMachineItem.java | 7 ++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java index 7b75df4d..8b7e1d82 100644 --- a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/tags/ItemTagGenerator.java @@ -2,6 +2,7 @@ import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; import dev.compactmods.machines.api.core.CMTags; import dev.compactmods.machines.api.core.Constants; @@ -26,6 +27,7 @@ public ItemTagGenerator(DataGenerator gen, BlockTagsProvider blockTags, @Nullabl protected void addTags() { var upgradeTag = tag(CMTags.ROOM_UPGRADE_ITEM); var machinesTag = tag(CMTags.MACHINE_ITEM); + var legacyMachinesTag = tag(LegacyCompactMachineItem.TAG); var legacySizedMachines = Set.of(Machines.MACHINE_BLOCK_ITEM_TINY.get(), Machines.MACHINE_BLOCK_ITEM_SMALL.get(), @@ -38,6 +40,8 @@ protected void addTags() { var unboundMachineItem = Machines.UNBOUND_MACHINE_BLOCK_ITEM.get(); legacySizedMachines.forEach(machinesTag::add); + legacySizedMachines.forEach(legacyMachinesTag::add); + machinesTag.add(boundMachineItem); machinesTag.add(unboundMachineItem); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java index 043c2c28..33c77703 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/jei/CompactMachinesJeiPlugin.java @@ -1,14 +1,15 @@ package dev.compactmods.machines.forge.compat.jei; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.JeiInfo; +import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.forge.machine.Machines; +import dev.compactmods.machines.forge.machine.item.LegacyCompactMachineItem; import dev.compactmods.machines.forge.machine.item.MachineItemUtil; import dev.compactmods.machines.forge.machine.item.UnboundCompactMachineItem; +import dev.compactmods.machines.forge.shrinking.Shrinking; import dev.compactmods.machines.forge.tunnel.Tunnels; -import dev.compactmods.machines.api.core.Constants; -import dev.compactmods.machines.api.core.JeiInfo; -import dev.compactmods.machines.api.room.Rooms; import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.forge.shrinking.Shrinking; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.VanillaTypes; @@ -16,8 +17,11 @@ import mezz.jei.api.registration.ISubtypeRegistration; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.server.ServerLifecycleHooks; +import java.util.stream.Collectors; + @JeiPlugin public class CompactMachinesJeiPlugin implements IModPlugin { @Override @@ -27,6 +31,8 @@ public ResourceLocation getPluginUid() { @Override public void registerRecipes(IRecipeRegistration registration) { + final var ingManager = registration.getIngredientManager(); + registration.addIngredientInfo( UnboundCompactMachineItem.unbound(), VanillaTypes.ITEM_STACK, @@ -43,6 +49,15 @@ public void registerRecipes(IRecipeRegistration registration) { new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get()), VanillaTypes.ITEM_STACK, TranslationUtil.jeiInfo(JeiInfo.SHRINKING_DEVICE)); + + //noinspection removal Will be removing once 5.3 or 6.0 drops + final var allLegacyMachines = ForgeRegistries.ITEMS.tags() + .getTag(LegacyCompactMachineItem.TAG) + .stream() + .map(ItemStack::new) + .collect(Collectors.toSet()); + + ingManager.removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, allLegacyMachines); } @Override diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java index e17a9169..3beaea24 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/item/LegacyCompactMachineItem.java @@ -1,5 +1,7 @@ package dev.compactmods.machines.forge.machine.item; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.forge.Registries; import dev.compactmods.machines.forge.machine.block.LegacySizedCompactMachineBlock; import dev.compactmods.machines.api.core.Tooltips; import dev.compactmods.machines.api.room.RoomSize; @@ -10,6 +12,8 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -23,6 +27,9 @@ @SuppressWarnings("removal") @Deprecated(forRemoval = true, since = "5.2.0") public class LegacyCompactMachineItem extends BlockItem implements ICompactMachineItem { + public static final TagKey TAG = TagKey.create(Registries.ITEMS.getRegistryKey(), + new ResourceLocation(Constants.MOD_ID, "legacy_machines"));; + public LegacyCompactMachineItem(Block blockIn, Properties builder) { super(blockIn, builder); } From bb2d5fa3956e673fba37b6c5bebb50bbb57d0992 Mon Sep 17 00:00:00 2001 From: Ted Senft Date: Tue, 12 Dec 2023 02:08:19 -0500 Subject: [PATCH 84/85] Last WIP before starting port to 1.20.4 --- .../src/main/resources/META-INF/MANIFEST.MF | 0 .../machines/forge/CompactMachines.java | 33 +- .../forge/compat/curios/CuriosCompat.java | 4 +- .../block/BoundCompactMachineBlock.java | 27 ++ .../forge/room/data/AllRoomsDataFile.java | 314 ++++++++++++++++++ .../machines/forge/room/data/RoomPreview.java | 14 + .../machines/forge/tunnel/TunnelItem.java | 30 +- .../forge/tunnel/TunnelWallEntity.java | 12 + .../forge/util/AnnotationScanner.java | 1 + .../src/main/resources/META-INF/mods.toml | 32 +- gradle.properties | 4 +- 11 files changed, 409 insertions(+), 62 deletions(-) create mode 100644 forge-builtin/src/main/resources/META-INF/MANIFEST.MF create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/room/data/AllRoomsDataFile.java create mode 100644 forge-main/src/main/java/dev/compactmods/machines/forge/room/data/RoomPreview.java diff --git a/forge-builtin/src/main/resources/META-INF/MANIFEST.MF b/forge-builtin/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e69de29b diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java index 4b7456de..3e69824f 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/CompactMachines.java @@ -92,22 +92,31 @@ private static void doRegistration() { Registries.UPGRADES.register(bus); Registries.COMMAND_ARGUMENT_TYPES.register(bus); Registries.LOOT_FUNCS.register(bus); - // Registries.VILLAGERS.register(bus); + Registries.VILLAGERS.register(bus); // Villagers.TRADES.register(bus); Registries.POINTS_OF_INTEREST.register(bus); +// CompactMachines.loadedAddons = ServiceLoader.load(ICompactMachinesAddon.class) +// .stream() +// .filter(p -> Arrays.stream(p.type().getAnnotationsByType(CompactMachinesAddon.class)) +// .anyMatch(cma -> cma.major() == 2)) +// .map(allowedThisMajor -> { +// allowedThisMajor.get(); +// }) +// .collect(Collectors.toSet()); + CompactMachines.loadedAddons = AnnotationScanner.scanModList(CompactMachinesAddon.class) - .map(ModFileScanData.AnnotationData::memberName) - .map(cmAddonClass -> { - try { - final var cl = Class.forName(cmAddonClass); - final var cla = cl.asSubclass(ICompactMachinesAddon.class); - return cla.getDeclaredConstructor().newInstance(); - } catch (Exception e) { - return null; - } - }) - .filter(Objects::nonNull) + .map(ModFileScanData.AnnotationData::memberName) + .map(cmAddonClass -> { + try { + final var cl = Class.forName(cmAddonClass); + final var cla = cl.asSubclass(ICompactMachinesAddon.class); + return cla.getDeclaredConstructor().newInstance(); + } catch (Exception e) { + return null; + } + }) + .filter(Objects::nonNull) .collect(Collectors.toSet()); CompactMachines.loadedAddons.forEach(addon -> { diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java index f74a1d3c..27df3757 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/compat/curios/CuriosCompat.java @@ -22,8 +22,6 @@ public static void sendIMC() { .size(1) .icon(CURIO_TEXTURE) .build()); - - } private static boolean isPsd(ItemStack stack) { @@ -34,7 +32,7 @@ public static void addTextures(final TextureStitchEvent.Pre stitch) { stitch.addSprite(CURIO_TEXTURE); } - public static boolean hasPsdCurio(@Nonnull LivingEntity ent) { + public static boolean hasPsdCurio(@Nonnull LivingEntity ent) { return CuriosApi.getCuriosHelper() .findFirstCurio(ent, CuriosCompat::isPsd) .isPresent(); diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java index a96c9945..97389415 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/machine/block/BoundCompactMachineBlock.java @@ -1,6 +1,7 @@ package dev.compactmods.machines.forge.machine.block; import dev.compactmods.machines.LoggingUtil; +import dev.compactmods.machines.api.shrinking.PSDTags; import dev.compactmods.machines.forge.machine.Machines; import dev.compactmods.machines.forge.machine.entity.BoundCompactMachineBlockEntity; import dev.compactmods.machines.forge.machine.item.BoundCompactMachineItem; @@ -9,6 +10,10 @@ import dev.compactmods.machines.room.BasicRoomInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; @@ -18,6 +23,8 @@ import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class BoundCompactMachineBlock extends CompactMachineBlock implements EntityBlock { @@ -78,4 +85,24 @@ public void onRemove(BlockState oldState, Level level, BlockPos pos, BlockState public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BoundCompactMachineBlockEntity(pos, state); } + + @NotNull + @Override + @SuppressWarnings("deprecation") + public InteractionResult use(@NotNull BlockState state, Level level, @NotNull BlockPos pos, Player player, @NotNull InteractionHand hand, @NotNull BlockHitResult hitResult) { + MinecraftServer server = level.getServer(); + ItemStack mainItem = player.getMainHandItem(); + if (mainItem.is(PSDTags.ITEM) && player instanceof ServerPlayer sp) { + return MachineBlockUtil.tryRoomTeleport(level, pos, sp, server); + } + + // All other items, open preview screen + if(!level.isClientSide) { + level.getBlockEntity(pos, Machines.MACHINE_ENTITY.get()).ifPresent(machine -> { + MachineBlockUtil.roomPreviewScreen(pos, (ServerPlayer) player, server, machine); + }); + } + + return InteractionResult.sidedSuccess(level.isClientSide); + } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/AllRoomsDataFile.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/AllRoomsDataFile.java new file mode 100644 index 00000000..f787c880 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/AllRoomsDataFile.java @@ -0,0 +1,314 @@ +package dev.compactmods.machines.forge.room.data; + +import com.google.common.graph.MutableValueGraph; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.dimension.CompactDimension; +import dev.compactmods.machines.api.dimension.MissingDimensionException; +import dev.compactmods.machines.codec.NbtListCollector; +import dev.compactmods.machines.graph.GraphTraversalHelper; +import dev.compactmods.machines.graph.edge.IGraphEdge; +import dev.compactmods.machines.graph.node.IGraphNode; +import dev.compactmods.machines.room.RoomCodeGenerator; +import dev.compactmods.machines.room.graph.NewRoomBuilder; +import dev.compactmods.machines.room.graph.edge.RoomChunkEdge; +import dev.compactmods.machines.room.graph.edge.RoomOwnerEdge; +import dev.compactmods.machines.room.graph.node.RoomChunkNode; +import dev.compactmods.machines.room.graph.node.RoomOwnerNode; +import dev.compactmods.machines.room.graph.node.RoomRegistrationNode; +import dev.compactmods.machines.util.MathUtil; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.saveddata.SavedData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Stream; + +@SuppressWarnings("UnstableApiUsage") +public class AllRoomsDataFile extends SavedData { + + public static final Logger LOGS = LogManager.getLogger(); + + public static final String DATA_NAME = Constants.MOD_ID + "_rooms"; + public static final String NBT_NODE_ID_KEY = "node_id"; + + private final Map registrationNodes; + + private final Map owners; + + + private AllRoomsDataFile() { + this.registrationNodes = new HashMap<>(); + this.owners = new HashMap<>(); + } + + public static AllRoomsDataFile empty() { + return new AllRoomsDataFile(); + } + + @Nullable + public static AllRoomsDataFile instance(MinecraftServer server) { + try { + final ServerLevel level = CompactDimension.forServer(server); + return level.getDataStorage() + .computeIfAbsent(AllRoomsDataFile::fromDisk, AllRoomsDataFile::empty, DATA_NAME); + } catch (MissingDimensionException e) { + LOGS.fatal(e); + return null; + } + } + + public static AllRoomsDataFile instance(ServerLevel compactDim) { + return compactDim.getDataStorage() + .computeIfAbsent(AllRoomsDataFile::fromDisk, AllRoomsDataFile::empty, DATA_NAME); + } + + public static AllRoomsDataFile fromDisk(CompoundTag compoundTag) { + final var graph = new AllRoomsDataFile(); + + final HashMap metaNodeIdMap = new HashMap<>(); + if (compoundTag.contains("rooms")) { + compoundTag.getList("rooms", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(roomNode -> { + UUID id = roomNode.getUUID(NBT_NODE_ID_KEY); + final var node = RoomRegistrationNode.CODEC.parse(NbtOps.INSTANCE, roomNode) + .getOrThrow(false, LOGS::fatal); + + metaNodeIdMap.put(id, node); + graph.registrationNodes.put(node.code(), node); + + node.chunks().forEach(chunk -> { + RoomChunkNode chunkNode = new RoomChunkNode(chunk); + graph.graph.putEdgeValue(node, chunkNode, new RoomChunkEdge()); + graph.chunks.put(chunk, chunkNode); + }); + }); + } + + final HashMap roomOwnerNodeMap = new HashMap<>(); + if (compoundTag.contains("owners")) { + compoundTag.getList("owners", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(ownerNode -> { + UUID id = ownerNode.getUUID(NBT_NODE_ID_KEY); + final var node = RoomOwnerNode.CODEC.parse(NbtOps.INSTANCE, ownerNode) + .getOrThrow(false, LOGS::fatal); + + roomOwnerNodeMap.put(id, node); + graph.owners.put(node.owner(), node); + }); + } + + if (compoundTag.contains("roomOwners")) { + compoundTag.getList("roomOwners", ListTag.TAG_COMPOUND) + .stream() + .map(CompoundTag.class::cast) + .forEach(roomOwnerConn -> { + RoomRegistrationNode meta = metaNodeIdMap.get(roomOwnerConn.getUUID("room")); + RoomOwnerNode owner = roomOwnerNodeMap.get(roomOwnerConn.getUUID("owner")); + graph.graph.putEdgeValue(meta, owner, new RoomOwnerEdge()); + }); + } + + LOGS.debug("Number of rooms loaded from disk: {}", metaNodeIdMap.size()); + return graph; + } + + @NotNull + @Override + public CompoundTag save(@NotNull CompoundTag tag) { + //region Room Metadata Nodes + final HashMap metaNodeIdMap = new HashMap<>(); + registrationNodes.values().forEach(metaNode -> metaNodeIdMap.put(metaNode.code(), UUID.randomUUID())); + ListTag meta = (ListTag) RoomRegistrationNode.CODEC.listOf() + .encodeStart(NbtOps.INSTANCE, List.copyOf(registrationNodes.values())) + .getOrThrow(false, LOGS::fatal); + + meta.stream() + .filter(CompoundTag.class::isInstance) + .map(CompoundTag.class::cast) + .forEach(mct -> mct.putUUID(NBT_NODE_ID_KEY, metaNodeIdMap.get(mct.getString("code")))); + + tag.put("rooms", meta); + //endregion + + //region Room Owner nodes + final HashMap ownerByUuidMap = new HashMap<>(); + owners.values().forEach(ownerNode -> ownerByUuidMap.put(ownerNode.owner(), UUID.randomUUID())); + ListTag ownerList = (ListTag) RoomOwnerNode.CODEC.listOf() + .encodeStart(NbtOps.INSTANCE, List.copyOf(owners.values())) + .getOrThrow(false, LOGS::fatal); + + ownerList.stream().map(CompoundTag.class::cast) + .forEach(oct -> oct.putUUID(NBT_NODE_ID_KEY, ownerByUuidMap.get(oct.getUUID("owner")))); + + tag.put("owners", ownerList); + //endregion + + //region Room-Owner connections + if (!registrationNodes.isEmpty() && !owners.isEmpty()) { + final ListTag roomOwnerConnections = registrationNodes.values() + .stream() + .map(roomNode -> graph.adjacentNodes(roomNode) + .stream() + .filter(RoomOwnerNode.class::isInstance) + .map(RoomOwnerNode.class::cast) + .findFirst() + .map(roomOwner -> { + UUID roomId = metaNodeIdMap.get(roomNode.code()); + UUID ownerId = ownerByUuidMap.get(roomOwner.owner()); + CompoundTag connection = new CompoundTag(); + connection.putUUID("room", roomId); + connection.putUUID("owner", ownerId); + return connection; + })) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(NbtListCollector.toNbtList()); + + tag.put("roomOwners", roomOwnerConnections); + } + //endregion + + return tag; + } + + @Override + public Stream allRooms() { + return registrationNodes.values().stream() + .map(mn -> mn); + } + + @Override + public boolean isRegistered(String room) { + return false; + } + + @Override + public Stream findByOwner(UUID owner) { + if (!owners.containsKey(owner)) + return Stream.empty(); + + return graph.adjacentNodes(owners.get(owner)).stream() + .filter(RoomRegistrationNode.class::isInstance) + .map(RoomRegistrationNode.class::cast); + } + + @Override + public Optional get(String room) { + return Optional.ofNullable(registrationNodes.get(room)); + } + + @Override + public Optional findByChunk(ChunkPos chunk) { + + } + + @Override + public boolean isRoomChunk(ChunkPos chunk) { + return chunks.containsKey(chunk); + } + + @Override + public long count() { + return registrationNodes.size(); + } + + private IRoomRegistration finalizeNew(String code, RoomRegistrationNode roomNode, UUID owner) { + this.registrationNodes.put(code, roomNode); + this.owners.computeIfAbsent(owner, RoomOwnerNode::new); + final var ownerNode = owners.get(owner); + + graph.putEdgeValue(roomNode, ownerNode, new RoomOwnerEdge()); + + // calculate chunks + roomNode.chunks().forEach(c -> { + final var roomChunkNode = new RoomChunkNode(c); + chunks.put(c, roomChunkNode); + graph.putEdgeValue(roomNode, roomChunkNode, new RoomChunkEdge()); + }); + + setDirty(); + + return roomNode; + } + + /** + * Registers a new room with a specified room code and data from the builder. + * This assumes that data is coming from a previous source such as a migrator, and + * will take all values from the returned builder. + * + * @param code + * @param newRoom + * @return + */ + public IRoomRegistration registerNew(String code, Function newRoom) { + final var builder = newRoom.apply(new NewRoomBuilder(code)); + + final var roomNode = builder.build(); + return finalizeNew(code, roomNode, builder.owner); + } + + public IRoomRegistration registerNew(Function newRoom) { + final var newRoomCode = RoomCodeGenerator.generateRoomId(); + + Vec3i location = MathUtil.getRegionPositionByIndex(registrationNodes.size()); + + final var builder = newRoom.apply(new NewRoomBuilder(newRoomCode)); + BlockPos newCenter = MathUtil.getCenterWithY(location, 40).above(builder.yOffset()); + + builder.setCenter(newCenter); + + final var roomNode = builder.build(); + return finalizeNew(newRoomCode, roomNode, builder.owner); + } + + /** + * @deprecated Fetch an instance of {@link dev.compactmods.machines.api.room.spawn.IRoomSpawnManager} and use the method there. + * @param room + * @throws NonexistentRoomException + */ + @Deprecated(forRemoval = true) + public void resetSpawn(String room) throws NonexistentRoomException { + + } + + @Override + public UUID getRoomOwner(String roomCode) throws NonexistentRoomException { + if (!registrationNodes.containsKey(roomCode)) + throw new NonexistentRoomException(roomCode); + + final var roomNode = registrationNodes.get(roomCode); + return GraphTraversalHelper.predecessors(graph, roomNode, RoomOwnerNode.class) + .map(RoomOwnerNode::owner) + .findFirst() + .orElseThrow(() -> new NonexistentRoomException(roomCode)); + } + + @ApiStatus.Internal + public MutableValueGraph, IGraphEdge> getGraph() { + return graph; + } + + public Optional roomNode(String roomCode) { + return Optional.ofNullable(registrationNodes.get(roomCode)); + } +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/RoomPreview.java b/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/RoomPreview.java new file mode 100644 index 00000000..69e3dac9 --- /dev/null +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/room/data/RoomPreview.java @@ -0,0 +1,14 @@ +package dev.compactmods.machines.forge.room.data; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.compactmods.machines.codec.CodecExtensions; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.levelgen.structure.BoundingBox; + +public record RoomPreview(ChunkPos chunk, BoundingBox area) { + public static final Codec CODEC = RecordCodecBuilder.create(i -> i.group( + CodecExtensions.CHUNKPOS.fieldOf("pos").forGetter(RoomPreview::chunk), + BoundingBox.CODEC.fieldOf("area").forGetter(RoomPreview::area) + ).apply(i, RoomPreview::new)); +} diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java index e2c70200..7f456789 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelItem.java @@ -1,11 +1,5 @@ package dev.compactmods.machines.forge.tunnel; -import dev.compactmods.machines.forge.CompactMachines; -import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; -import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; -import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; -import dev.compactmods.machines.forge.tunnel.network.TunnelAddedPacket; -import dev.compactmods.machines.forge.wall.SolidWallBlock; import dev.compactmods.machines.api.core.Constants; import dev.compactmods.machines.api.core.Messages; import dev.compactmods.machines.api.core.Tooltips; @@ -14,12 +8,16 @@ import dev.compactmods.machines.api.room.history.IRoomHistoryItem; import dev.compactmods.machines.api.tunnels.TunnelDefinition; import dev.compactmods.machines.api.tunnels.redstone.RedstoneTunnel; -import dev.compactmods.machines.i18n.TranslationUtil; -import dev.compactmods.machines.forge.network.CompactMachinesNet; +import dev.compactmods.machines.forge.CompactMachines; import dev.compactmods.machines.forge.room.capability.RoomCapabilities; +import dev.compactmods.machines.forge.wall.SolidWallBlock; +import dev.compactmods.machines.i18n.TranslationUtil; import dev.compactmods.machines.room.graph.CompactRoomProvider; import dev.compactmods.machines.tunnel.ITunnelItem; import dev.compactmods.machines.tunnel.TunnelHelper; +import dev.compactmods.machines.tunnel.graph.TunnelConnectionGraph; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelMachineFilters; +import dev.compactmods.machines.tunnel.graph.traversal.TunnelTypeFilters; import dev.compactmods.machines.util.PlayerUtil; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; @@ -43,7 +41,6 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.registries.IForgeRegistry; import javax.annotation.Nonnull; @@ -233,19 +230,16 @@ private static boolean setupTunnelWall(ServerLevel compactDim, BlockPos position return false; } - final var oldState = compactDim.getBlockState(position); - compactDim.setBlock(position, tunnelState, Block.UPDATE_NEIGHBORS); - - if (compactDim.getBlockEntity(position) instanceof TunnelWallEntity twe) { + compactDim.setBlock(position, tunnelState, Block.UPDATE_ALL); + compactDim.getBlockEntity(position, Tunnels.TUNNEL_BLOCK_ENTITY.get()).ifPresent(twe -> { twe.setTunnelType(tunnelId); twe.setConnectedTo(hist.getMachine(), first); - CompactMachinesNet.CHANNEL.send( - PacketDistributor.TRACKING_CHUNK.with(() -> compactDim.getChunkAt(position)), - new TunnelAddedPacket(position, tunnelId)); - } +// CompactMachinesNet.CHANNEL.send( +// PacketDistributor.TRACKING_CHUNK.with(() -> compactDim.getChunkAt(position)), +// new TunnelAddedPacket(position, tunnelId)); + }); - compactDim.sendBlockUpdated(position, oldState, tunnelState, Block.UPDATE_ALL); return true; } } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java index 48d6fdf8..9a6dc979 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/tunnel/TunnelWallEntity.java @@ -21,6 +21,8 @@ import net.minecraft.core.GlobalPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; @@ -107,6 +109,12 @@ public void saveAdditional(@NotNull CompoundTag compound) { } } + @Nullable + @Override + public Packet getUpdatePacket() { + return super.getUpdatePacket(); + } + @Override @NotNull public CompoundTag getUpdateTag() { @@ -223,6 +231,10 @@ private void setTunnelTypeInternal(ResourceKey key, TunnelDefi this.tunnelType = definition; serverPostRemoval(null); + + final var state = getBlockState(); + level.sendBlockUpdated(worldPosition, state, state, Block.UPDATE_ALL); + setChanged(); } diff --git a/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java b/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java index d20f7dcf..6f57eca8 100644 --- a/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java +++ b/forge-main/src/main/java/dev/compactmods/machines/forge/util/AnnotationScanner.java @@ -13,6 +13,7 @@ import java.util.Set; import java.util.stream.Stream; +// thanks to JEI's ForgePluginFinder for a baseline public class AnnotationScanner { private static final Logger SCANNER_LOG = LogManager.getLogger(); diff --git a/forge-main/src/main/resources/META-INF/mods.toml b/forge-main/src/main/resources/META-INF/mods.toml index e5704f56..376aa724 100644 --- a/forge-main/src/main/resources/META-INF/mods.toml +++ b/forge-main/src/main/resources/META-INF/mods.toml @@ -1,17 +1,7 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="[42,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. -# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="MIT" -# A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory modId="compactmachines" version="${file.jarVersion}" @@ -19,37 +9,25 @@ license="MIT" authors="Davenonymous, RobotGryphon" #optional description="It's all so tiny!" - ## OPTIONAL INFO ## - - # A URL to refer people to when problems occur with this mod issueTrackerURL="https://github.com/CompactMods/CompactMachines/issues" - # A URL to query for updates for this mod. See the JSON update specification #updateJSONURL="http://myurl.me/" #optional - - # A URL for the "homepage" for this mod, displayed in the mod UI - # displayURL="http://example.com/" #optional + displayURL="https://compactmods.dev" # A file name (in the root of the mod JAR) containing a logo for display # logoFile="examplemod.png" #optional # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.compactmachines]] #optional - # the modid of the dependency - modId="forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory=true #mandatory - # The version range of the dependency - versionRange="[42,)" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory + modId="forge" + mandatory=true + versionRange="[42,)" ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" -# Here's another dependency [[dependencies.compactmachines]] modId="minecraft" mandatory=true versionRange="[1.19.1,)" ordering="NONE" - side="BOTH" + side="BOTH" \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b895942f..f5f7ac49 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,8 +9,8 @@ forge_version=43.2.0 parchment_version=2022.10.16 mod_id=compactmachines -core_version=2.2.10 -tunnels_version=2.2.10 +core_version=2.2.12 +tunnels_version=2.2.12 # Curseforge cf_project=224218 From 8df3e00f4c640d5b56670d3bee7f18b476d5fcb8 Mon Sep 17 00:00:00 2001 From: Marvin Raiser Date: Thu, 25 Jan 2024 06:11:16 +0100 Subject: [PATCH 85/85] Add German Translation by GeneralMine --- .../datagen/lang/GermanLangGenerator.java | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/GermanLangGenerator.java diff --git a/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/GermanLangGenerator.java b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/GermanLangGenerator.java new file mode 100644 index 00000000..92624cf9 --- /dev/null +++ b/forge-datagen/src/main/java/dev/compactmods/machines/datagen/lang/GermanLangGenerator.java @@ -0,0 +1,153 @@ +package dev.compactmods.machines.datagen.lang; + +import dev.compactmods.machines.forge.client.RoomExitKeyMapping; +import dev.compactmods.machines.forge.dimension.VoidAirBlock; +import dev.compactmods.machines.forge.tunnel.Tunnels; +import dev.compactmods.machines.forge.upgrade.MachineRoomUpgrades; +import dev.compactmods.machines.forge.wall.Walls; +import dev.compactmods.machines.api.core.CMCommands; +import dev.compactmods.machines.api.core.Constants; +import dev.compactmods.machines.api.core.Messages; +import dev.compactmods.machines.api.core.Tooltips; +import dev.compactmods.machines.api.room.RoomSize; +import dev.compactmods.machines.forge.shrinking.Shrinking; +import dev.compactmods.machines.forgebuiltin.tunnel.BuiltInTunnels; +import dev.compactmods.machines.forgebuiltin.upgrade.BuiltInUpgrades; +import net.minecraft.Util; +import net.minecraft.data.DataGenerator; +import net.minecraft.resources.ResourceLocation; + +import static org.apache.commons.lang3.StringUtils.capitalize; + +public class EnglishLangGenerator extends BaseLangGenerator { + public EnglishLangGenerator(DataGenerator gen) { + super(gen, "de_de"); + } + + @Override + protected void addTranslations() { + super.addTranslations(); + + final var machineTranslation = getMachineTranslation(); + add("machine.compactmachines.tiny", "%s (%s)".formatted(machineTranslation, "Winzig")); + add("machine.compactmachines.small", "%s (%s)".formatted(machineTranslation, "Klein")); + add("machine.compactmachines.normal", "%s (%s)".formatted(machineTranslation, "Normal")); + add("machine.compactmachines.large", "%s (%s)".formatted(machineTranslation, "Groß")); + add("machine.compactmachines.giant", "%s (%s)".formatted(machineTranslation, "Gigantisch")); + add("machine.compactmachines.colossal", "%s (%s)".formatted(machineTranslation, "Kolossal")); + add("machine.compactmachines.absurd", "%s (%s)".formatted(machineTranslation, "Absurd")); + + addMessage(Messages.CANNOT_ENTER_MACHINE, "Sie fummeln vergeblich am Schrumpfgerät herum. Es weigert sich zu arbeiten."); + addMessage(Messages.NO_MACHINE_DATA, "Keine Maschinendaten geladen; melde dies."); + addMessage(Messages.ROOM_SPAWNPOINT_SET, "Neuer Spawnpunkt gesetzt."); + addMessage(Messages.HOW_DID_YOU_GET_HERE, "Wie bist du hier her gekommen?!"); + addMessage(Messages.NEW_MACHINE, "Neue Maschine"); + addMessage(Messages.TELEPORT_OUT_OF_BOUNDS, "Eine jenseitige Kraft verhindert Ihre Teleportation."); + addMessage(Messages.NO_TUNNEL_SIDE, "Für diesen Tunneltyp sind keine Seiten verfügbar."); + + addMessage(Messages.NOT_ROOM_OWNER, "Sie sind nicht der Zimmereigentümer; Nur %s darf Änderungen vornehmen."); + + // 1 = Display Name, 2 = Chunk, 3 = Size + addMessage(Messages.PLAYER_ROOM_INFO, "Spieler '%1$s' befindet sich in einem %3$s-Raum bei %2$s."); + addMessage(Messages.MACHINE_ROOM_INFO, "Die Maschine bei %1$s ist an einen Raum der Größe %2$s bei %3$s gebunden"); + + addMessage(Messages.CANNOT_RENAME_NOT_OWNER, "Nur %s darf diesen Raum umbenennen."); + + addCommand(CMCommands.NOT_IN_COMPACT_DIMENSION, "Dieser Befehl kann nicht außerhalb eines Maschinenraums verwendet werden."); + addCommand(CMCommands.FAILED_CMD_FILE_ERROR, "Befehl konnte nicht ausgeführt werden; Es ist ein Dateifehler aufgetreten. Bericht prüfen."); + addCommand(CMCommands.MACHINE_NOT_BOUND, "Maschine bei %s ist nicht an einen Raum gebunden."); + addCommand(CMCommands.ROOM_REG_COUNT, "Anzahl der registrierten Räume: %s"); + addCommand(CMCommands.MACHINE_REG_DIM, "[%s]: %s"); + addCommand(CMCommands.MACHINE_REG_TOTAL, "Insgesamt: %s"); + addCommand(CMCommands.LEVEL_REGISTERED, "Compact Machine Dimension gefunden."); + addCommand(CMCommands.LEVEL_NOT_FOUND, "Compact Machine Dimension konnte nicht gefunden werden."); + addCommand(CMCommands.ROOM_NOT_FOUND, "Raum [%s] konnte nicht gefunden werden."); + addCommand(CMCommands.SPAWN_CHANGED_SUCCESSFULLY, "Spawnpunkt für Raum [%s] erfolgreich geändert."); + + addAdvancementTranslations(); + + addBlock(Walls.BLOCK_BREAKABLE_WALL, "Kompakte Maschinenwand"); + addBlock(Walls.BLOCK_SOLID_WALL, "Solide kompakte Maschinenwand"); + addBlock(Tunnels.BLOCK_TUNNEL_WALL, "Solide kompakte Maschinenwand (mit Tunnel)"); + add(Util.makeDescriptionId("block", new ResourceLocation(Constants.MOD_ID, "bound_machine_fallback")), "Gebundene Kompaktmaschine"); + + add(Shrinking.PERSONAL_SHRINKING_DEVICE.get(), "Persönliches Schrumpfgerät"); + + add(Constants.MOD_ID + ".direction.side", "Seite: %s"); + add(Constants.MOD_ID + ".connected_block", "Verbunden: %s"); + + addTunnel(BuiltInTunnels.ITEM_TUNNEL_DEF, "Itemtunnel"); + addTunnel(BuiltInTunnels.FLUID_TUNNEL_DEF, "Flüssigkeitstunnel"); + addTunnel(BuiltInTunnels.FORGE_ENERGY, "Energietunnel"); + // addTunnel(Tunnels.REDSTONE_IN_DEF.get(), "Redstone Tunnel (In)"); + // addTunnel(Tunnels.REDSTONE_OUT_DEF.get(), "Redstone Tunnel (Out)"); + + addTooltip(Tooltips.Details.PERSONAL_SHRINKING_DEVICE, "Wird als In-Game-Dokumentation und zum Betreten von Compact Machines verwendet."); + addTooltip(Tooltips.Details.SOLID_WALL, "Warnung! Unzerbrechlich für nicht-kreative Spieler!"); + + addTooltip(Tooltips.CRAFT_TO_UPGRADE, "Craft, um auf eine neue Maschine aufzurüsten."); + addTooltip(Tooltips.HINT_HOLD_SHIFT, "Halten Sie die Umschalttaste gedrückt, um Details anzuzeigen."); + addTooltip(Tooltips.UNKNOWN_PLAYER_NAME, "Unbekannter Spieler"); + + addTooltip(Tooltips.Machines.ID, "Maschine #%s"); + addTooltip(Tooltips.Machines.OWNER, "Besitzer: %s"); + addTooltip(Tooltips.Machines.SIZE, "Interne Größe: %1$sx%1$sx%1$s"); + addTooltip(Tooltips.Machines.BOUND_TO, "Gebunden zu: %1$s"); + + addTooltip(Tooltips.TUNNEL_TYPE, "Typ ID: %1$s"); + addTooltip(Tooltips.UNKNOWN_TUNNEL_TYPE, "Unbekannter Tunneltyp (%s)"); + + addTooltip(Tooltips.ROOM_NAME, "An den Raum gebunden: %s"); + + addTooltip(Tooltips.NOT_YET_IMPLEMENTED, "Noch nicht implementiert"); + + //region Upgrades + add(BuiltInUpgrades.CHUNKLOAD, "Chunkloader-Upgrade"); + + addMessage(Messages.ALREADY_HAS_UPGRADE, "Das Upgrade wurde bereits auf den Raum angewendet."); + addMessage(Messages.UPGRADE_NOT_PRESENT, "Das Upgrade wurde nicht auf den Raum angewendet."); + + addMessage(Messages.UPGRADE_APPLIED, "Upgrade auf Raum angewendet."); + addMessage(Messages.UPGRADE_ADD_FAILED, "Das Upgrade konnte nicht auf den Raum angewendet werden."); + + addMessage(Messages.UPGRADE_REMOVED, "Upgrade aus dem Raum entfernt."); + addMessage(Messages.UPGRADE_REM_FAILED, "Die Upgradeentfernung konnte nicht auf den Raum angewendet werden."); + + addTooltip(Tooltips.ROOM_UPGRADE_TYPE, "Typ: %s"); + addTooltip(Tooltips.TUTORIAL_APPLY_ROOM_UPGRADE, "Auf einem gebundenen Maschinenblock verwenden, um ein Upgrade anzuwenden."); + //endregion + + addCommand(CMCommands.CANNOT_GIVE_MACHINE, "Dem Spieler konnte keine neue Maschine gegeben werden."); + addCommand(CMCommands.MACHINE_GIVEN, "Ein neues Maschinenelement erstellt und an %s übergeben."); + + addMessage(Messages.UNKNOWN_ROOM_CHUNK, "Unbekannter Raum bei %s; Bitte überprüfen Sie, ob es existiert."); + + add("itemGroup." + Constants.MOD_ID, "Kompakte Maschine"); + + add("biome." + Constants.MOD_ID + ".machine", "Compact Machine"); + + add("compactmachines.psd.pages.machines.title", "Kompakte Maschinen"); + add("compactmachines.psd.pages.machines", "Kompakte Maschinen sind die Kernmechanik dieses Mods." + + "Sie ermöglichen den Bau großer Räume in einem einzigen Block, der mit der Außenwelt verbunden ist. Es gibt sie in verschiedenen Größen von 3x3x3 bis 13x13x13.\n\n" + + "Sie können Tunnel verwenden, um die äußeren Blockflächen mit den Innenwänden zu verbinden und so Gegenstände, Flüssigkeiten usw. zu transportieren.\n\n" + + "Sie können eine Kompaktmaschine betreten, indem Sie mit einem persönlichen Schrumpfgerät mit der rechten Maustaste darauf klicken. Bitte verwenden Sie JEI, um nach den Craftingrezepten zu suchen."); + + add("jei.compactmachines.machines", "Die Maschinen erschaffen die Taschen-Dimensionen. Crafte eine Maschine und platziere sie in der Welt. Benutze dann ein persönliches Schrumpfgerät, um hineinzugehen."); + add("jei.compactmachines.shrinking_device", "Verwenden Sie das Persönliche Schrumpfgerät (PSD) an einer Maschine, um einen kompakten Raum zu betreten. " + + "Sie können auch mit der rechten Maustaste in der Oberwelt darauf klicken, um weitere Informationen zu erhalten."); + add("death.attack." + VoidAirBlock.DAMAGE_SOURCE.msgId, "%1$s konnte das Nichts nicht betreten"); + + add("curios.identifier.psd", "Persönliches Schrumpfgerät"); + + add(MachineRoomUpgrades.WORKBENCH_BLOCK.get(), "Werkbank"); + add("entity.minecraft.villager.compactmachines.tinkerer", "Bastler"); + + add(RoomExitKeyMapping.CATEGORY, "Kompakte Maschine"); + add(RoomExitKeyMapping.NAME, " Kompakte Maschine"); + } + + @Override + protected String getSizeTranslation(RoomSize size) { + return capitalize(size.getSerializedName()); + } +}