mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
分开潜行判断
This commit is contained in:
@@ -338,20 +338,22 @@ public class InteractUtils {
|
||||
}
|
||||
|
||||
public static boolean isEntityInteractable(Player player, Entity entity, Item<ItemStack> item) {
|
||||
boolean isSneaking = player.isSneaking();
|
||||
if (EntityUtils.isPiglinWithGoldIngot(entity, item)) {
|
||||
return true;
|
||||
}
|
||||
if (EntityUtils.isHappyGhastRideable(entity) && !isSneaking) {
|
||||
return true;
|
||||
if (!player.isSneaking()) {
|
||||
if (EntityUtils.isHappyGhastRideable(entity)) {
|
||||
return true;
|
||||
}
|
||||
return switch (entity) {
|
||||
case Boat ignored -> true;
|
||||
case RideableMinecart ignored -> true;
|
||||
case Steerable steerable -> steerable.hasSaddle();
|
||||
default -> INTERACTABLE_ENTITIES.contains(entity.getType());
|
||||
};
|
||||
}
|
||||
return switch (entity) {
|
||||
case ChestBoat ignored -> true;
|
||||
case Boat ignored -> !isSneaking;
|
||||
case RideableMinecart ignored -> !isSneaking;
|
||||
case Steerable steerable -> !isSneaking && steerable.hasSaddle();
|
||||
default -> INTERACTABLE_ENTITIES.contains(entity.getType());
|
||||
};
|
||||
return entity instanceof ChestBoat
|
||||
|| INTERACTABLE_ENTITIES.contains(entity.getType());
|
||||
}
|
||||
|
||||
public static boolean willConsume(Player player, BlockData state, BlockHitResult hit, @Nullable Item<ItemStack> item) {
|
||||
|
||||
Reference in New Issue
Block a user