Fixed bugs, updated Blacklist

This commit is contained in:
Tschipp 2025-12-26 15:56:13 +01:00
parent 3352c497e2
commit 08bc465d82
3 changed files with 23 additions and 4 deletions

View File

@ -40,8 +40,11 @@ import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.level.storage.TagValueOutput; import net.minecraft.world.level.storage.TagValueOutput;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import tschipp.carryon.CarryOnCommon; import tschipp.carryon.CarryOnCommon;
@ -108,6 +111,10 @@ public class PickupHandler {
if(!ListHandler.isPermitted(state.getBlock())) if(!ListHandler.isPermitted(state.getBlock()))
return false; return false;
// Reject pickup of Double blocks, if they use the vanilla property
if(hasPropertyType(state, DoorBlock.HALF))
return false;
if(state.getDestroySpeed(level, pos) == -1 && !player.isCreative() && !Constants.COMMON_CONFIG.settings.pickupUnbreakableBlocks) if(state.getDestroySpeed(level, pos) == -1 && !player.isCreative() && !Constants.COMMON_CONFIG.settings.pickupUnbreakableBlocks)
return false; return false;
@ -207,7 +214,7 @@ public class PickupHandler {
return false; return false;
} }
boolean doPickup = pickupCallback == null ? true : pickupCallback.apply(entity); boolean doPickup = pickupCallback == null || pickupCallback.apply(entity);
if(!doPickup) if(!doPickup)
return false; return false;
@ -275,4 +282,12 @@ public class PickupHandler {
return true; return true;
} }
private static <T extends Comparable<T>> boolean hasPropertyType(BlockState state, Property<T> prop) {
for (var p : state.getProperties()) {
if(p.getValueClass().equals(prop.getValueClass()))
return true;
}
return false;
}
} }

View File

@ -94,6 +94,9 @@ public class PlacementHandler
if (!doPlace) if (!doPlace)
return false; return false;
if(level.isOutsideBuildHeight(pos))
return false;
if (carry.getActiveScript().isPresent()) { if (carry.getActiveScript().isPresent()) {
ScriptEffects effects = carry.getActiveScript().get().scriptEffects(); ScriptEffects effects = carry.getActiveScript().get().scriptEffects();
String cmd = effects.commandPlace(); String cmd = effects.commandPlace();

View File

@ -285,7 +285,7 @@ public class CarryConfig
"modern_industrialization:fluid_pipe", "modern_industrialization:fluid_pipe",
"modern_industrialization:*_fluid_pipe", "modern_industrialization:*_fluid_pipe",
"yigd:*", "domum_ornamentum:*", "connectiblechains:*", "yigd:*", "domum_ornamentum:*", "connectiblechains:*",
"cobblemon:*", "snowrealmagic:*", "forbidden_arcanus:black_hole", "domum_ornamentum:*", "sgjourney:*", "copycats:*", "expandedstorage:*" "cobblemon:*", "snowrealmagic:*", "forbidden_arcanus:black_hole", "domum_ornamentum:*", "sgjourney:*", "copycats:*", "expandedstorage:*", "replication:*"
}; };
@Property( @Property(
@ -302,7 +302,7 @@ public class CarryConfig
"animania:hamster", "animania:ferret*", "animania:hedgehog*", "animania:cart", "animania:hamster", "animania:ferret*", "animania:hedgehog*", "animania:cart",
"animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*", "animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*",
"securitycraft:*", "taterzens:npc", "easy_npc:*", "bodiesbodies:dead_body", "littletiles:*", "securitycraft:*", "taterzens:npc", "easy_npc:*", "bodiesbodies:dead_body", "littletiles:*",
"connectiblechains:*", "cobblemon:*", "create:*", "swem:*" "connectiblechains:*", "cobblemon:*", "create:*", "swem:*", "toms_mobs:*"
}; };
@Property( @Property(
@ -311,7 +311,8 @@ public class CarryConfig
validationRegex = "(#?[a-zA-Z0-9_*]+:[a-zA-Z0-9_*]*(?:\\*|[a-zA-Z0-9_]*)(?:\\*|[a-zA-Z0-9_]*)?)" validationRegex = "(#?[a-zA-Z0-9_*]+:[a-zA-Z0-9_*]*(?:\\*|[a-zA-Z0-9_]*)(?:\\*|[a-zA-Z0-9_]*)?)"
) )
public String[] forbiddenStacking = { public String[] forbiddenStacking = {
"minecraft:horse" "minecraft:horse",
"minecraft:ender_dragon"
}; };
} }