From eae7d7069472a09708512588f6d2d12dc2ab72df Mon Sep 17 00:00:00 2001 From: Maurycy J Date: Sat, 10 Dec 2022 17:15:44 +0100 Subject: [PATCH] Add survivalContraptionPickup option to config --- .../structureMovement/mounted/MinecartContraptionItem.java | 5 +++++ .../com/simibubi/create/foundation/config/CKinetics.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java index 794ed4858..fe061a5fe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java @@ -5,6 +5,8 @@ import java.util.List; import javax.annotation.Nullable; +import com.simibubi.create.foundation.config.AllConfigs; + import org.apache.commons.lang3.tuple.MutablePair; import com.google.common.io.ByteArrayDataOutput; @@ -203,6 +205,9 @@ public class MinecartContraptionItem extends Item { public static void wrenchCanBeUsedToPickUpMinecartContraptions(PlayerInteractEvent.EntityInteract event) { Entity entity = event.getTarget(); Player player = event.getPlayer(); + if (!AllConfigs.SERVER.kinetics.survivalContraptionPickup.get() && !player.isCreative()) { + return; + } if (player == null || entity == null) return; diff --git a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java index 6ccec6f4b..7bc195cf0 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java @@ -34,6 +34,7 @@ public class CKinetics extends ConfigBase { public final ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles); public final ConfigInt maxRopeLength = i(256, 1, "maxRopeLength", Comments.maxRopeLength); public final ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength); + public final ConfigBool survivalContraptionPickup = b(true, "survivalContraptionPickup", Comments.survivalContraptionPickup); public final ConfigEnum spawnerMovement = e(ContraptionMovementSetting.NO_PICKUP, "movableSpawners", Comments.spawnerMovement); public final ConfigEnum amethystMovement = @@ -105,6 +106,7 @@ public class CKinetics extends ConfigBase { static String maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw"; static String ejectorScanInterval = "Time in ticks until the next item launched by an ejector scans blocks for potential collisions"; + static String survivalContraptionPickup = "Allow for minecart contartaption pickup in survival mode."; static String spawnerMovement = "Configure how Spawner blocks can be moved by contraptions."; static String amethystMovement = "Configure how Budding Amethyst can be moved by contraptions."; static String obsidianMovement = "Configure how Obsidian blocks can be moved by contraptions.";