添加载具拾取物品配置

This commit is contained in:
17146 2025-03-09 23:00:47 +08:00
parent 08af375dc8
commit 45e99ab220
2 changed files with 6 additions and 0 deletions

View file

@ -8,6 +8,7 @@ public class VehicleConfig {
public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_BLOCKS; public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_BLOCKS;
public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_HARD_BLOCKS; public static ForgeConfigSpec.BooleanValue COLLISION_DESTROY_HARD_BLOCKS;
public static ForgeConfigSpec.BooleanValue VEHICLE_ITEM_PICKUP;
public static ForgeConfigSpec.ConfigValue<List<? extends String>> COLLISION_ENTITY_BLACKLIST; public static ForgeConfigSpec.ConfigValue<List<? extends String>> COLLISION_ENTITY_BLACKLIST;
@ -81,6 +82,9 @@ public class VehicleConfig {
builder.comment("Allows vehicles to destroy hard blocks via collision"); builder.comment("Allows vehicles to destroy hard blocks via collision");
COLLISION_DESTROY_HARD_BLOCKS = builder.define("collision_destroy_hard_blocks", false); 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"); builder.comment("List of entities that cannot be damaged by collision");
COLLISION_ENTITY_BLACKLIST = builder.defineList("collision_entity_blacklist", COLLISION_ENTITY_BLACKLIST = builder.defineList("collision_entity_blacklist",
DEFAULT_COLLISION_ENTITY_BLACKLIST, DEFAULT_COLLISION_ENTITY_BLACKLIST,

View file

@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.capability.LaserCapability; import com.atsuishio.superbwarfare.capability.LaserCapability;
import com.atsuishio.superbwarfare.capability.ModCapabilities; import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.config.common.GameplayConfig; 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.ICustomKnockback;
import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
@ -743,6 +744,7 @@ public class LivingEventHandler {
@SubscribeEvent @SubscribeEvent
public static void onPickup(EntityItemPickupEvent event) { public static void onPickup(EntityItemPickupEvent event) {
if (!VehicleConfig.VEHICLE_ITEM_PICKUP.get()) return;
if (event.getEntity().getVehicle() instanceof ContainerMobileVehicleEntity containerMobileVehicleEntity) { if (event.getEntity().getVehicle() instanceof ContainerMobileVehicleEntity containerMobileVehicleEntity) {
var pickUp = event.getItem(); var pickUp = event.getItem();
if (!containerMobileVehicleEntity.level().isClientSide) { if (!containerMobileVehicleEntity.level().isClientSide) {