From 45e99ab220608b85f8b00cdcfec330c3db1521c3 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Sun, 9 Mar 2025 23:00:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=BD=E5=85=B7=E6=8B=BE?= =?UTF-8?q?=E5=8F=96=E7=89=A9=E5=93=81=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atsuishio/superbwarfare/config/server/VehicleConfig.java | 4 ++++ .../com/atsuishio/superbwarfare/event/LivingEventHandler.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java index c549a775e..8425359c6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -8,6 +8,7 @@ public class VehicleConfig { public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_BLOCKS; public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_HARD_BLOCKS; + public static ForgeConfigSpec.BooleanValue VEHICLE_ITEM_PICKUP; public static ForgeConfigSpec.ConfigValue> COLLISION_ENTITY_BLACKLIST; @@ -81,6 +82,9 @@ public class VehicleConfig { builder.comment("Allows vehicles to destroy hard blocks via collision"); COLLISION_DESTROY_HARD_BLOCKS = builder.define("collision_destroy_hard_blocks", false); + builder.comment("Allow vehicles to pick up items"); + VEHICLE_ITEM_PICKUP = builder.define("vehicle_item_pickup", true); + builder.comment("List of entities that cannot be damaged by collision"); COLLISION_ENTITY_BLACKLIST = builder.defineList("collision_entity_blacklist", DEFAULT_COLLISION_ENTITY_BLACKLIST, diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 86824ac07..171b105a7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.capability.LaserCapability; import com.atsuishio.superbwarfare.capability.ModCapabilities; import com.atsuishio.superbwarfare.config.common.GameplayConfig; +import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.ICustomKnockback; import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; @@ -743,6 +744,7 @@ public class LivingEventHandler { @SubscribeEvent public static void onPickup(EntityItemPickupEvent event) { + if (!VehicleConfig.VEHICLE_ITEM_PICKUP.get()) return; if (event.getEntity().getVehicle() instanceof ContainerMobileVehicleEntity containerMobileVehicleEntity) { var pickUp = event.getItem(); if (!containerMobileVehicleEntity.level().isClientSide) {