diff --git a/README.md b/README.md index 1228ff3ec..bab4b444e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Pylon uses an addon system, meaning anyone can add content to Pylon by writing a ## Find out more Join our Discord: https://discord.gg/4tMAnBAacW -Visit our website: https://pylonmc.github.io/ +Visit our website: https://pylonmc.github.io ## Warning PYLON IS CURRENTLY EXPERIMENTAL. ONLY RUN IT ON A TEST SERVER THAT YOU ARE WILLING TO DELETE. THE NEXT PYLON VERSION WILL PROBABLY NOT BE COMPATIBLE WITH THE PREVIOUS ONE. IF YOU INSTALL PYLON SOMEWHERE YOU SHOULDN'T AND END UP LOSING DATA, WE WILL POINT AND LAUGH AT YOU. diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoExtractor.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoExtractor.java index b4f72eb3b..b4995c945 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoExtractor.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoExtractor.java @@ -9,8 +9,8 @@ import io.github.pylonmc.pylon.core.datatypes.PylonSerializers; import io.github.pylonmc.pylon.core.entity.display.ItemDisplayBuilder; import io.github.pylonmc.pylon.core.entity.display.transform.TransformBuilder; -import io.github.pylonmc.pylon.core.event.PylonCargoDuctConnectEvent; -import io.github.pylonmc.pylon.core.event.PylonCargoDuctDisconnectEvent; +import io.github.pylonmc.pylon.core.event.PylonCargoConnectEvent; +import io.github.pylonmc.pylon.core.event.PylonCargoDisconnectEvent; import io.github.pylonmc.pylon.core.i18n.PylonArgument; import io.github.pylonmc.pylon.core.item.PylonItem; import io.github.pylonmc.pylon.core.item.builder.ItemStackBuilder; @@ -79,7 +79,8 @@ public CargoExtractor(@NotNull Block block, @NotNull BlockCreateContext context) throw new IllegalArgumentException("Cargo extractor can only be placed by player"); } - facing = playerPlaceContext.getPlayer().getFacing(); + // TODO add a util function for this because ffs really + facing = PylonUtils.rotateToPlayerFacing(playerPlaceContext.getPlayer(), BlockFace.NORTH, true).getOppositeFace(); addCargoLogisticGroup(facing.getOppositeFace(), "output"); for (BlockFace face : PylonUtils.perpendicularImmediateFaces(facing)) { @@ -97,7 +98,7 @@ public CargoExtractor(@NotNull Block block, @NotNull BlockCreateContext context) .build(block.getLocation().toCenterLocation()) ); - addEntity("input", new ItemDisplayBuilder() + addEntity("output", new ItemDisplayBuilder() .itemStack(outputStack) .transformation(new TransformBuilder() .lookAlong(facing) @@ -166,21 +167,18 @@ public void setupLogisticGroups() {} } @Override - public void onDuctConnected(@NotNull PylonCargoDuctConnectEvent event) { + public void onDuctConnected(@NotNull PylonCargoConnectEvent event) { // Remove all faces that aren't to the connected block - this will make sure only // one duct is connected at a time - BlockPosition ductPosition = new BlockPosition(event.getDuct().getBlock()); - BlockPosition thisPosition = new BlockPosition(getBlock()); - BlockFace connectedFace = PylonUtils.vectorToBlockFace(ductPosition.minus(thisPosition).getVector3i()); for (BlockFace face : getCargoLogisticGroups().keySet()) { - if (face != connectedFace) { + if (!getBlock().getRelative(face).equals(event.getBlock1().getBlock()) && !getBlock().getRelative(face).equals(event.getBlock2().getBlock())) { removeCargoLogisticGroup(face); } } } @Override - public void onDuctDisconnected(@NotNull PylonCargoDuctDisconnectEvent event) { + public void onDuctDisconnected(@NotNull PylonCargoDisconnectEvent event) { // Allow connecting to all faces now that there are zero connections List faces = PylonUtils.perpendicularImmediateFaces(facing); faces.add(facing.getOppositeFace()); diff --git a/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoInserter.java b/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoInserter.java index 3db77b414..918037229 100644 --- a/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoInserter.java +++ b/src/main/java/io/github/pylonmc/pylon/base/content/machines/cargo/CargoInserter.java @@ -9,15 +9,14 @@ import io.github.pylonmc.pylon.core.datatypes.PylonSerializers; import io.github.pylonmc.pylon.core.entity.display.ItemDisplayBuilder; import io.github.pylonmc.pylon.core.entity.display.transform.TransformBuilder; -import io.github.pylonmc.pylon.core.event.PylonCargoDuctConnectEvent; -import io.github.pylonmc.pylon.core.event.PylonCargoDuctDisconnectEvent; +import io.github.pylonmc.pylon.core.event.PylonCargoConnectEvent; +import io.github.pylonmc.pylon.core.event.PylonCargoDisconnectEvent; import io.github.pylonmc.pylon.core.i18n.PylonArgument; import io.github.pylonmc.pylon.core.item.PylonItem; import io.github.pylonmc.pylon.core.item.builder.ItemStackBuilder; import io.github.pylonmc.pylon.core.logistics.LogisticGroup; import io.github.pylonmc.pylon.core.util.PylonUtils; import io.github.pylonmc.pylon.core.util.gui.unit.UnitFormat; -import io.github.pylonmc.pylon.core.util.position.BlockPosition; import io.github.pylonmc.pylon.core.util.position.ChunkPosition; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -79,7 +78,7 @@ public CargoInserter(@NotNull Block block, @NotNull BlockCreateContext context) throw new IllegalArgumentException("Cargo inserter can only be placed by player"); } - facing = playerPlaceContext.getPlayer().getFacing(); + facing = PylonUtils.rotateToPlayerFacing(playerPlaceContext.getPlayer(), BlockFace.NORTH, true).getOppositeFace(); addCargoLogisticGroup(facing.getOppositeFace(), "input"); for (BlockFace face : PylonUtils.perpendicularImmediateFaces(facing)) { @@ -157,26 +156,23 @@ public boolean isPartOfMultiblock(@NotNull Block otherBlock) { public void setupLogisticGroups() {} @Override - public void onDuctConnected(@NotNull PylonCargoDuctConnectEvent event) { + public void onDuctConnected(@NotNull PylonCargoConnectEvent event) { // Remove all faces that aren't to the connected block - this will make sure only // one duct is connected at a time - BlockPosition ductPosition = new BlockPosition(event.getDuct().getBlock()); - BlockPosition thisPosition = new BlockPosition(getBlock()); - BlockFace connectedFace = PylonUtils.vectorToBlockFace(ductPosition.minus(thisPosition).getVector3i()); for (BlockFace face : getCargoLogisticGroups().keySet()) { - if (face != connectedFace) { + if (!getBlock().getRelative(face).equals(event.getBlock1().getBlock()) && !getBlock().getRelative(face).equals(event.getBlock2().getBlock())) { removeCargoLogisticGroup(face); } } } @Override - public void onDuctDisconnected(@NotNull PylonCargoDuctDisconnectEvent event) { + public void onDuctDisconnected(@NotNull PylonCargoDisconnectEvent event) { // Allow connecting to all faces now that there are zero connections List faces = PylonUtils.perpendicularImmediateFaces(facing); faces.add(facing.getOppositeFace()); for (BlockFace face : faces) { - addCargoLogisticGroup(face, "input"); + addCargoLogisticGroup(face, "output"); } for (BlockFace face : faces) { if (BlockStorage.get(getBlock().getRelative(face)) instanceof CargoDuct duct) {