mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-23 08:59:27 +00:00
@@ -392,31 +392,32 @@ public class InteractUtils {
|
||||
registerEntityInteraction(EntityTypeKeys.SKELETON_HORSE, (player, entity, item) ->
|
||||
entity instanceof Tameable tameable && tameable.isTamed());
|
||||
registerEntityInteraction(EntityTypeKeys.PIG, (player, entity, item) ->
|
||||
canFeed(entity, item) || (hasSaddle(player, entity) && !player.isSneaking()));
|
||||
canFeed(entity, item) || (item != null && item.vanillaId().equals(ItemKeys.SADDLE) && !hasSaddle(player, entity)) || (hasSaddle(player, entity) && !player.isSneaking()));
|
||||
registerEntityInteraction(EntityTypeKeys.STRIDER, (player, entity, item) ->
|
||||
canFeed(entity, item) || (hasSaddle(player, entity) && !player.isSneaking()));
|
||||
canFeed(entity, item) || (item != null && item.vanillaId().equals(ItemKeys.SADDLE) && !hasSaddle(player, entity)) || (hasSaddle(player, entity) && !player.isSneaking()));
|
||||
registerEntityInteraction(EntityTypeKeys.WOLF, (player, entity, item) -> canFeed(entity, item) || isPetOwner(player, entity));
|
||||
registerEntityInteraction(EntityTypeKeys.CAT, (player, entity, item) -> canFeed(entity, item) || isPetOwner(player, entity));
|
||||
registerEntityInteraction(EntityTypeKeys.ACACIA_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.BAMBOO_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.BIRCH_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.CHERRY_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.DARK_OAK_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.JUNGLE_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.MANGROVE_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.OAK_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.SPRUCE_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.BIRCH_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.JUNGLE_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.ACACIA_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.DARK_OAK_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.MANGROVE_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.CHERRY_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.PALE_OAK_BOAT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.BAMBOO_RAFT, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.MINECART, (player, entity, item) -> !player.isSneaking());
|
||||
registerEntityInteraction(EntityTypeKeys.PARROT, (player, entity, item) -> {
|
||||
if (item != null && item.is(Key.of("parrot_poisonous_food"))) return true;
|
||||
return canFeed(entity, item) || isPetOwner(player, entity);
|
||||
});
|
||||
registerEntityInteraction(EntityTypeKeys.HAPPY_GHAST, (player, entity, item) -> {
|
||||
if (!VersionHelper.isOrAbove1_21_6()) return false;
|
||||
if (item != null && item.vanillaId().equals(ItemKeys.HARNESS)) return true;
|
||||
if (entity instanceof HappyGhast happyGhast && !player.isSneaking()) {
|
||||
ItemStack bodyItem = happyGhast.getEquipment().getItem(EquipmentSlot.BODY);
|
||||
Item<ItemStack> wrap = BukkitItemManager.instance().wrap(bodyItem);
|
||||
return wrap.is(Key.of("harnesses"));
|
||||
return BukkitItemManager.instance().wrap(bodyItem).is(Key.of("harnesses"));
|
||||
}
|
||||
return canFeed(entity, item);
|
||||
});
|
||||
@@ -432,24 +433,21 @@ public class InteractUtils {
|
||||
registerEntityInteraction(EntityTypeKeys.ITEM_FRAME, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.GLOW_ITEM_FRAME, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.INTERACTION, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.ACACIA_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.BAMBOO_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.BIRCH_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.CHERRY_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.DARK_OAK_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.JUNGLE_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.MANGROVE_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.OAK_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.SPRUCE_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.BIRCH_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.JUNGLE_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.ACACIA_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.DARK_OAK_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.MANGROVE_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.CHERRY_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.PALE_OAK_CHEST_BOAT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.BAMBOO_CHEST_RAFT, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.CHEST_MINECART, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.FURNACE_MINECART, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.HOPPER_MINECART, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.COMMAND_BLOCK_MINECART, (player, entity, item) -> true);
|
||||
//<1.20.5
|
||||
registerEntityInteraction(EntityTypeKeys.MINECART_CHEST, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.MINECART_HOPPER, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.MINECART_FURNACE, (player, entity, item) -> true);
|
||||
registerEntityInteraction(EntityTypeKeys.MINECART_COMMAND, (player, entity, item) -> true);
|
||||
}
|
||||
|
||||
private static void registerInteraction(Key key, QuadFunction<org.bukkit.entity.Player, Item<ItemStack>, BlockData, BlockHitResult, Boolean> function) {
|
||||
|
||||
@@ -5,77 +5,80 @@ import net.momirealms.craftengine.core.util.Key;
|
||||
public class EntityTypeKeys {
|
||||
private EntityTypeKeys() {}
|
||||
|
||||
public static final Key BEE = Key.of("minecraft:BEE");
|
||||
public static final Key FOX = Key.of("minecraft:FOX");
|
||||
public static final Key FROG = Key.of("minecraft:FROG");
|
||||
public static final Key PANDA = Key.of("minecraft:PANDA");
|
||||
public static final Key SHEEP = Key.of("minecraft:SHEEP");
|
||||
public static final Key BOGGED = Key.of("minecraft:BOGGED");
|
||||
public static final Key SNOW_GOLEM = Key.of("minecraft:SNOW_GOLEM");
|
||||
public static final Key HOGLIN = Key.of("minecraft:HOGLIN");
|
||||
public static final Key OCELOT = Key.of("minecraft:OCELOT");
|
||||
public static final Key RABBIT = Key.of("minecraft:RABBIT");
|
||||
public static final Key TURTLE = Key.of("minecraft:TURTLE");
|
||||
public static final Key AXOLOTL = Key.of("minecraft:AXOLOTL");
|
||||
public static final Key CHICKEN = Key.of("minecraft:CHICKEN");
|
||||
public static final Key SNIFFER = Key.of("minecraft:SNIFFER");
|
||||
public static final Key ARMADILLO = Key.of("minecraft:ARMADILLO");
|
||||
public static final Key COD = Key.of("minecraft:COD");
|
||||
public static final Key SALMON = Key.of("minecraft:SALMON");
|
||||
public static final Key TROPICAL_FISH = Key.of("minecraft:TROPICAL_FISH");
|
||||
public static final Key PUFFERFISH = Key.of("minecraft:PUFFERFISH");
|
||||
public static final Key TADPOLE = Key.of("minecraft:TADPOLE");
|
||||
public static final Key COW = Key.of("minecraft:COW");
|
||||
public static final Key MOOSHROOM = Key.of("minecraft:MOOSHROOM");
|
||||
public static final Key GOAT = Key.of("minecraft:GOAT");
|
||||
public static final Key PIG = Key.of("minecraft:PIG");
|
||||
public static final Key STRIDER = Key.of("minecraft:STRIDER");
|
||||
public static final Key WOLF = Key.of("minecraft:WOLF");
|
||||
public static final Key CAT = Key.of("minecraft:CAT");
|
||||
public static final Key PARROT = Key.of("minecraft:PARROT");
|
||||
public static final Key ACACIA_BOAT = Key.of("minecraft:ACACIA_BOAT");
|
||||
public static final Key BAMBOO_BOAT = Key.of("minecraft:BAMBOO_BOAT");
|
||||
public static final Key BIRCH_BOAT = Key.of("minecraft:BIRCH_BOAT");
|
||||
public static final Key CHERRY_BOAT = Key.of("minecraft:CHERRY_BOAT");
|
||||
public static final Key DARK_OAK_BOAT = Key.of("minecraft:DARK_OAK_BOAT");
|
||||
public static final Key JUNGLE_BOAT = Key.of("minecraft:JUNGLE_BOAT");
|
||||
public static final Key MANGROVE_BOAT = Key.of("minecraft:MANGROVE_BOAT");
|
||||
public static final Key OAK_BOAT = Key.of("minecraft:OAK_BOAT");
|
||||
public static final Key SPRUCE_BOAT = Key.of("minecraft:SPRUCE_BOAT");
|
||||
public static final Key MINECART = Key.of("minecraft:MINECART");
|
||||
public static final Key HAPPY_GHAST = Key.of("minecraft:HAPPY_GHAST");
|
||||
public static final Key PIGLIN = Key.of("minecraft:PIGLIN");
|
||||
public static final Key CREEPER = Key.of("minecraft:CREEPER");
|
||||
public static final Key ALLAY = Key.of("minecraft:ALLAY");
|
||||
public static final Key HORSE = Key.of("minecraft:HORSE");
|
||||
public static final Key ZOMBIE_HORSE = Key.of("minecraft:ZOMBIE_HORSE");
|
||||
public static final Key SKELETON_HORSE = Key.of("minecraft:SKELETON_HORSE");
|
||||
public static final Key DONKEY = Key.of("minecraft:DONKEY");
|
||||
public static final Key MULE = Key.of("minecraft:MULE");
|
||||
public static final Key VILLAGER = Key.of("minecraft:VILLAGER");
|
||||
public static final Key WANDERING_TRADER = Key.of("minecraft:WANDERING_TRADER");
|
||||
public static final Key LLAMA = Key.of("minecraft:LLAMA");
|
||||
public static final Key TRADER_LLAMA = Key.of("minecraft:TRADER_LLAMA");
|
||||
public static final Key CAMEL = Key.of("minecraft:CAMEL");
|
||||
public static final Key ITEM_FRAME = Key.of("minecraft:ITEM_FRAME");
|
||||
public static final Key GLOW_ITEM_FRAME = Key.of("minecraft:GLOW_ITEM_FRAME");
|
||||
public static final Key INTERACTION = Key.of("minecraft:INTERACTION");
|
||||
public static final Key ACACIA_CHEST_BOAT = Key.of("minecraft:ACACIA_CHEST_BOAT");
|
||||
public static final Key BAMBOO_CHEST_BOAT = Key.of("minecraft:BAMBOO_CHEST_BOAT");
|
||||
public static final Key BIRCH_CHEST_BOAT = Key.of("minecraft:BIRCH_CHEST_BOAT");
|
||||
public static final Key CHERRY_CHEST_BOAT = Key.of("minecraft:CHERRY_CHEST_BOAT");
|
||||
public static final Key DARK_OAK_CHEST_BOAT = Key.of("minecraft:DARK_OAK_CHEST_BOAT");
|
||||
public static final Key JUNGLE_CHEST_BOAT = Key.of("minecraft:JUNGLE_CHEST_BOAT");
|
||||
public static final Key MANGROVE_CHEST_BOAT = Key.of("minecraft:MANGROVE_CHEST_BOAT");
|
||||
public static final Key OAK_CHEST_BOAT = Key.of("minecraft:OAK_CHEST_BOAT");
|
||||
public static final Key SPRUCE_CHEST_BOAT = Key.of("minecraft:SPRUCE_CHEST_BOAT");
|
||||
public static final Key CHEST_MINECART = Key.of("minecraft:CHEST_MINECART");
|
||||
public static final Key FURNACE_MINECART = Key.of("minecraft:FURNACE_MINECART");
|
||||
public static final Key HOPPER_MINECART = Key.of("minecraft:HOPPER_MINECART");
|
||||
public static final Key COMMAND_BLOCK_MINECART = Key.of("minecraft:COMMAND_BLOCK_MINECART");
|
||||
//<1.20.5
|
||||
public static final Key MINECART_CHEST = Key.of("minecraft:MINECART_CHEST");
|
||||
public static final Key MINECART_FURNACE = Key.of("minecraft:MINECART_FURNACE");
|
||||
public static final Key MINECART_HOPPER = Key.of("minecraft:MINECART_HOPPER");
|
||||
public static final Key MINECART_COMMAND = Key.of("minecraft:MINECART_COMMAND");
|
||||
}
|
||||
public static final Key BEE = Key.of("minecraft:bee");
|
||||
public static final Key FOX = Key.of("minecraft:fox");
|
||||
public static final Key FROG = Key.of("minecraft:frog");
|
||||
public static final Key PANDA = Key.of("minecraft:panda");
|
||||
public static final Key SHEEP = Key.of("minecraft:sheep");
|
||||
public static final Key BOGGED = Key.of("minecraft:bogged");
|
||||
public static final Key SNOW_GOLEM = Key.of("minecraft:snow_golem");
|
||||
public static final Key HOGLIN = Key.of("minecraft:hoglin");
|
||||
public static final Key OCELOT = Key.of("minecraft:ocelot");
|
||||
public static final Key RABBIT = Key.of("minecraft:rabbit");
|
||||
public static final Key TURTLE = Key.of("minecraft:turtle");
|
||||
public static final Key AXOLOTL = Key.of("minecraft:axolotl");
|
||||
public static final Key CHICKEN = Key.of("minecraft:chicken");
|
||||
public static final Key SNIFFER = Key.of("minecraft:sniffer");
|
||||
public static final Key ARMADILLO = Key.of("minecraft:armadillo");
|
||||
public static final Key COD = Key.of("minecraft:cod");
|
||||
public static final Key SALMON = Key.of("minecraft:salmon");
|
||||
public static final Key TROPICAL_FISH = Key.of("minecraft:tropical_fish");
|
||||
public static final Key PUFFERFISH = Key.of("minecraft:pufferfish");
|
||||
public static final Key TADPOLE = Key.of("minecraft:tadpole");
|
||||
public static final Key COW = Key.of("minecraft:cow");
|
||||
public static final Key MOOSHROOM = Key.of("minecraft:mooshroom");
|
||||
public static final Key GOAT = Key.of("minecraft:goat");
|
||||
public static final Key PIG = Key.of("minecraft:pig");
|
||||
public static final Key STRIDER = Key.of("minecraft:strider");
|
||||
public static final Key WOLF = Key.of("minecraft:wolf");
|
||||
public static final Key CAT = Key.of("minecraft:cat");
|
||||
public static final Key PARROT = Key.of("minecraft:parrot");
|
||||
|
||||
public static final Key HAPPY_GHAST = Key.of("minecraft:happy_ghast");
|
||||
public static final Key PIGLIN = Key.of("minecraft:piglin");
|
||||
public static final Key CREEPER = Key.of("minecraft:creeper");
|
||||
public static final Key ALLAY = Key.of("minecraft:allay");
|
||||
public static final Key HORSE = Key.of("minecraft:horse");
|
||||
public static final Key ZOMBIE_HORSE = Key.of("minecraft:zombie_horse");
|
||||
public static final Key SKELETON_HORSE = Key.of("minecraft:skeleton_horse");
|
||||
public static final Key DONKEY = Key.of("minecraft:donkey");
|
||||
public static final Key MULE = Key.of("minecraft:mule");
|
||||
public static final Key VILLAGER = Key.of("minecraft:villager");
|
||||
public static final Key WANDERING_TRADER = Key.of("minecraft:wandering_trader");
|
||||
public static final Key LLAMA = Key.of("minecraft:llama");
|
||||
public static final Key TRADER_LLAMA = Key.of("minecraft:trader_llama");
|
||||
public static final Key CAMEL = Key.of("minecraft:camel");
|
||||
public static final Key ITEM_FRAME = Key.of("minecraft:item_frame");
|
||||
public static final Key GLOW_ITEM_FRAME = Key.of("minecraft:glow_item_frame");
|
||||
public static final Key INTERACTION = Key.of("minecraft:interaction");
|
||||
|
||||
public static final Key BOAT = Key.of("minecraft:boat");
|
||||
public static final Key OAK_BOAT = Key.of("minecraft:oak_boat");
|
||||
public static final Key SPRUCE_BOAT = Key.of("minecraft:spruce_boat");
|
||||
public static final Key BIRCH_BOAT = Key.of("minecraft:birch_boat");
|
||||
public static final Key JUNGLE_BOAT = Key.of("minecraft:jungle_boat");
|
||||
public static final Key ACACIA_BOAT = Key.of("minecraft:acacia_boat");
|
||||
public static final Key DARK_OAK_BOAT = Key.of("minecraft:dark_oak_boat");
|
||||
public static final Key MANGROVE_BOAT = Key.of("minecraft:mangrove_boat");
|
||||
public static final Key CHERRY_BOAT = Key.of("minecraft:cherry_boat");
|
||||
public static final Key PALE_OAK_BOAT = Key.of("minecraft:pale_oak_boat");
|
||||
public static final Key BAMBOO_RAFT = Key.of("minecraft:bamboo_raft");
|
||||
|
||||
public static final Key CHEST_BOAT = Key.of("minecraft:chest_boat");
|
||||
public static final Key OAK_CHEST_BOAT = Key.of("minecraft:oak_chest_boat");
|
||||
public static final Key SPRUCE_CHEST_BOAT = Key.of("minecraft:spruce_chest_boat");
|
||||
public static final Key BIRCH_CHEST_BOAT = Key.of("minecraft:birch_chest_boat");
|
||||
public static final Key JUNGLE_CHEST_BOAT = Key.of("minecraft:jungle_chest_boat");
|
||||
public static final Key ACACIA_CHEST_BOAT = Key.of("minecraft:acacia_chest_boat");
|
||||
public static final Key DARK_OAK_CHEST_BOAT = Key.of("minecraft:dark_oak_chest_boat");
|
||||
public static final Key MANGROVE_CHEST_BOAT = Key.of("minecraft:mangrove_chest_boat");
|
||||
public static final Key CHERRY_CHEST_BOAT = Key.of("minecraft:cherry_chest_boat");
|
||||
public static final Key PALE_OAK_CHEST_BOAT = Key.of("minecraft:pale_oak_chest_boat");
|
||||
public static final Key BAMBOO_CHEST_RAFT = Key.of("minecraft:bamboo_chest_raft");
|
||||
|
||||
public static final Key MINECART = Key.of("minecraft:minecart");
|
||||
public static final Key CHEST_MINECART = Key.of("minecraft:chest_minecart");
|
||||
public static final Key FURNACE_MINECART = Key.of("minecraft:furnace_minecart");
|
||||
public static final Key HOPPER_MINECART = Key.of("minecraft:hopper_minecart");
|
||||
public static final Key COMMAND_BLOCK_MINECART = Key.of("minecraft:command_block_minecart");
|
||||
}
|
||||
@@ -42,6 +42,8 @@ public class ItemKeys {
|
||||
public static final Key GLASS_BOTTLE = Key.of("minecraft:glass_bottle");
|
||||
public static final Key LIGHT = Key.of("minecraft:light");
|
||||
public static final Key GLOWSTONE = Key.of("minecraft:glowstone");
|
||||
public static final Key SADDLE = Key.of("minecraft:saddle");
|
||||
public static final Key HARNESS = Key.of("minecraft:harness");
|
||||
|
||||
public static final Key[] AXES = new Key[] {
|
||||
WOODEN_AXE, STONE_AXE, IRON_AXE, GOLDEN_AXE, DIAMOND_AXE, NETHERITE_AXE
|
||||
|
||||
Reference in New Issue
Block a user