Fixed bugs, updated Blacklist

This commit is contained in:
Tschipp 2025-12-26 15:56:13 +01:00
parent e649c27feb
commit 7cfb1e3826
3 changed files with 23 additions and 4 deletions

View File

@ -38,8 +38,11 @@ import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType;
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.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.phys.Vec3;
import tschipp.carryon.CarryOnCommon;
@ -106,6 +109,10 @@ public class PickupHandler {
if(!ListHandler.isPermitted(state.getBlock()))
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)
return false;
@ -202,7 +209,7 @@ public class PickupHandler {
return false;
}
boolean doPickup = pickupCallback == null ? true : pickupCallback.apply(entity);
boolean doPickup = pickupCallback == null || pickupCallback.apply(entity);
if(!doPickup)
return false;
@ -270,4 +277,12 @@ public class PickupHandler {
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

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

View File

@ -285,7 +285,7 @@ public class CarryConfig
"modern_industrialization:fluid_pipe",
"modern_industrialization:*_fluid_pipe",
"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(
@ -302,7 +302,7 @@ public class CarryConfig
"animania:hamster", "animania:ferret*", "animania:hedgehog*", "animania:cart",
"animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*",
"securitycraft:*", "taterzens:npc", "easy_npc:*", "bodiesbodies:dead_body", "littletiles:*",
"connectiblechains:*", "cobblemon:*", "create:*", "swem:*"
"connectiblechains:*", "cobblemon:*", "create:*", "swem:*", "toms_mobs:*"
};
@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_]*)?)"
)
public String[] forbiddenStacking = {
"minecraft:horse"
"minecraft:horse",
"minecraft:ender_dragon"
};
}