From feecc47092e79a5e5a69b009b528c25d0242f003 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Sun, 1 Dec 2024 03:22:34 +0800 Subject: [PATCH] More work on 1.21.4 changes --- .../updater/AnvilInventoryUpdater.java | 9 +- .../java/org/geysermc/geyser/item/Items.java | 516 +++++++++--------- .../item/type/BedrockRequiresTagItem.java | 8 +- .../geyser/item/type/FireworkRocketItem.java | 17 - .../org/geysermc/geyser/item/type/Item.java | 59 +- .../CustomItemRegistryPopulator.java | 15 +- .../populator/ItemRegistryPopulator.java | 2 +- .../translator/item/CustomItemTranslator.java | 2 +- .../translator/item/ItemTranslator.java | 67 +-- .../BedrockBlockPickRequestTranslator.java | 42 +- .../BedrockEntityPickRequestTranslator.java | 37 +- .../JavaMerchantOffersTranslator.java | 2 +- .../geysermc/geyser/util/InventoryUtils.java | 170 ------ 13 files changed, 337 insertions(+), 609 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java index 0ffb74082..00270e47a 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java @@ -52,7 +52,6 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.S import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.stream.IntStream; public class AnvilInventoryUpdater extends InventoryUpdater { public static final AnvilInventoryUpdater INSTANCE = new AnvilInventoryUpdater(); @@ -266,14 +265,14 @@ public class AnvilInventoryUpdater extends InventoryUpdater { */ private int calcRepairLevelCost(GeyserItemStack input, GeyserItemStack material) { int newDamage = getDamage(input); - int unitRepair = Math.min(newDamage, input.asItem().maxDamage() / 4); + int unitRepair = Math.min(newDamage, input.asItem().defaultMaxDamage() / 4); if (unitRepair <= 0) { // No damage to repair return -1; } for (int i = 0; i < material.getAmount(); i++) { newDamage -= unitRepair; - unitRepair = Math.min(newDamage, input.asItem().maxDamage() / 4); + unitRepair = Math.min(newDamage, input.asItem().defaultMaxDamage() / 4); if (unitRepair <= 0) { return i + 1; } @@ -290,7 +289,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { */ private int calcMergeRepairCost(GeyserItemStack input, GeyserItemStack material) { // If the material item is damaged 112% or more, then the input item will not be repaired - if (getDamage(input) > 0 && getDamage(material) < (material.asItem().maxDamage() * 112 / 100)) { + if (getDamage(input) > 0 && getDamage(material) < (material.asItem().defaultMaxDamage() * 112 / 100)) { return 2; } return 0; @@ -419,7 +418,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { } private boolean hasDurability(GeyserItemStack itemStack) { - if (itemStack.asItem().maxDamage() > 0) { + if (itemStack.asItem().defaultMaxDamage() > 0) { return itemStack.getComponent(DataComponentType.UNBREAKABLE, false); } return false; diff --git a/core/src/main/java/org/geysermc/geyser/item/Items.java b/core/src/main/java/org/geysermc/geyser/item/Items.java index c7ab076b4..d2ae08ec4 100644 --- a/core/src/main/java/org/geysermc/geyser/item/Items.java +++ b/core/src/main/java/org/geysermc/geyser/item/Items.java @@ -301,6 +301,8 @@ public final class Items { public static final Item RED_WOOL = register(new BlockItem(builder(), Blocks.RED_WOOL)); public static final Item BLACK_WOOL = register(new BlockItem(builder(), Blocks.BLACK_WOOL)); public static final Item DANDELION = register(new BlockItem(builder(), Blocks.DANDELION)); +// TODO public static final Item OPEN_EYEBLOSSOM = register(new BlockItem(builder(), Blocks.OPEN_EYEBLOSSOM)); +// TODO public static final Item CLOSED_EYEBLOSSOM = register(new BlockItem(builder(), Blocks.CLOSED_EYEBLOSSOM)); public static final Item POPPY = register(new BlockItem(builder(), Blocks.POPPY)); public static final Item BLUE_ORCHID = register(new BlockItem(builder(), Blocks.BLUE_ORCHID)); public static final Item ALLIUM = register(new BlockItem(builder(), Blocks.ALLIUM)); @@ -449,6 +451,13 @@ public final class Items { public static final Item MELON = register(new BlockItem(builder(), Blocks.MELON)); public static final Item VINE = register(new BlockItem(builder(), Blocks.VINE)); public static final Item GLOW_LICHEN = register(new BlockItem(builder(), Blocks.GLOW_LICHEN)); + //TODO public static final Item RESIN_CLUMP = register(new BlockItem(builder(), Blocks.RESIN_CLUMP)); + //TODO public static final Item RESIN_BLOCK = register(new BlockItem(builder(), Blocks.RESIN_BLOCK)); + //TODO public static final Item RESIN_BRICKS = register(new BlockItem(builder(), Blocks.RESIN_BRICKS)); + //TODO public static final Item RESIN_BRICK_STAIRS = register(new BlockItem(builder(), Blocks.RESIN_BRICK_STAIRS)); + //TODO public static final Item RESIN_BRICK_SLAB = register(new BlockItem(builder(), Blocks.RESIN_BRICK_SLAB)); + //TODO public static final Item RESIN_BRICK_WALL = register(new BlockItem(builder(), Blocks.RESIN_BRICK_WALL)); + //TODO public static final Item CHISELED_RESIN_BRICKS = register(new BlockItem(builder(), Blocks.CHISELED_RESIN_BRICKS)); public static final Item BRICK_STAIRS = register(new BlockItem(builder(), Blocks.BRICK_STAIRS)); public static final Item STONE_BRICK_STAIRS = register(new BlockItem(builder(), Blocks.STONE_BRICK_STAIRS)); public static final Item MUD_BRICK_STAIRS = register(new BlockItem(builder(), Blocks.MUD_BRICK_STAIRS)); @@ -533,7 +542,7 @@ public final class Items { public static final Item RED_TERRACOTTA = register(new BlockItem(builder(), Blocks.RED_TERRACOTTA)); public static final Item BLACK_TERRACOTTA = register(new BlockItem(builder(), Blocks.BLACK_TERRACOTTA)); public static final Item BARRIER = register(new BlockItem(builder(), Blocks.BARRIER)); - public static final Item LIGHT = register(new LightItem(builder(), Blocks.LIGHT)); + public static final Item LIGHT = register(new BlockItem(builder(), Blocks.LIGHT)); public static final Item HAY_BLOCK = register(new BlockItem(builder(), Blocks.HAY_BLOCK)); public static final Item WHITE_CARPET = register(new BlockItem(builder(), Blocks.WHITE_CARPET)); public static final Item ORANGE_CARPET = register(new BlockItem(builder(), Blocks.ORANGE_CARPET)); @@ -611,23 +620,23 @@ public final class Items { public static final Item RED_NETHER_BRICKS = register(new BlockItem(builder(), Blocks.RED_NETHER_BRICKS)); public static final Item BONE_BLOCK = register(new BlockItem(builder(), Blocks.BONE_BLOCK)); public static final Item STRUCTURE_VOID = register(new BlockItem(builder(), Blocks.STRUCTURE_VOID)); - public static final Item SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.SHULKER_BOX)); - public static final Item WHITE_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.WHITE_SHULKER_BOX)); - public static final Item ORANGE_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.ORANGE_SHULKER_BOX)); - public static final Item MAGENTA_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.MAGENTA_SHULKER_BOX)); - public static final Item LIGHT_BLUE_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.LIGHT_BLUE_SHULKER_BOX)); - public static final Item YELLOW_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.YELLOW_SHULKER_BOX)); - public static final Item LIME_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.LIME_SHULKER_BOX)); - public static final Item PINK_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.PINK_SHULKER_BOX)); - public static final Item GRAY_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.GRAY_SHULKER_BOX)); - public static final Item LIGHT_GRAY_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.LIGHT_GRAY_SHULKER_BOX)); - public static final Item CYAN_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.CYAN_SHULKER_BOX)); - public static final Item PURPLE_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.PURPLE_SHULKER_BOX)); - public static final Item BLUE_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.BLUE_SHULKER_BOX)); - public static final Item BROWN_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.BROWN_SHULKER_BOX)); - public static final Item GREEN_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.GREEN_SHULKER_BOX)); - public static final Item RED_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.RED_SHULKER_BOX)); - public static final Item BLACK_SHULKER_BOX = register(new ShulkerBoxItem(builder().stackSize(1), Blocks.BLACK_SHULKER_BOX)); + public static final Item SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.SHULKER_BOX)); + public static final Item WHITE_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.WHITE_SHULKER_BOX)); + public static final Item ORANGE_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.ORANGE_SHULKER_BOX)); + public static final Item MAGENTA_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.MAGENTA_SHULKER_BOX)); + public static final Item LIGHT_BLUE_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.LIGHT_BLUE_SHULKER_BOX)); + public static final Item YELLOW_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.YELLOW_SHULKER_BOX)); + public static final Item LIME_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.LIME_SHULKER_BOX)); + public static final Item PINK_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.PINK_SHULKER_BOX)); + public static final Item GRAY_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.GRAY_SHULKER_BOX)); + public static final Item LIGHT_GRAY_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.LIGHT_GRAY_SHULKER_BOX)); + public static final Item CYAN_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.CYAN_SHULKER_BOX)); + public static final Item PURPLE_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.PURPLE_SHULKER_BOX)); + public static final Item BLUE_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.BLUE_SHULKER_BOX)); + public static final Item BROWN_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.BROWN_SHULKER_BOX)); + public static final Item GREEN_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.GREEN_SHULKER_BOX)); + public static final Item RED_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.RED_SHULKER_BOX)); + public static final Item BLACK_SHULKER_BOX = register(new ShulkerBoxItem(builder(), Blocks.BLACK_SHULKER_BOX)); public static final Item WHITE_GLAZED_TERRACOTTA = register(new BlockItem(builder(), Blocks.WHITE_GLAZED_TERRACOTTA)); public static final Item ORANGE_GLAZED_TERRACOTTA = register(new BlockItem(builder(), Blocks.ORANGE_GLAZED_TERRACOTTA)); public static final Item MAGENTA_GLAZED_TERRACOTTA = register(new BlockItem(builder(), Blocks.MAGENTA_GLAZED_TERRACOTTA)); @@ -859,46 +868,46 @@ public final class Items { public static final Item DETECTOR_RAIL = register(new BlockItem(builder(), Blocks.DETECTOR_RAIL)); public static final Item RAIL = register(new BlockItem(builder(), Blocks.RAIL)); public static final Item ACTIVATOR_RAIL = register(new BlockItem(builder(), Blocks.ACTIVATOR_RAIL)); - public static final Item SADDLE = register(new Item("saddle", builder().stackSize(1))); - public static final Item MINECART = register(new Item("minecart", builder().stackSize(1))); - public static final Item CHEST_MINECART = register(new Item("chest_minecart", builder().stackSize(1))); - public static final Item FURNACE_MINECART = register(new Item("furnace_minecart", builder().stackSize(1))); - public static final Item TNT_MINECART = register(new Item("tnt_minecart", builder().stackSize(1))); - public static final Item HOPPER_MINECART = register(new Item("hopper_minecart", builder().stackSize(1))); - public static final Item CARROT_ON_A_STICK = register(new Item("carrot_on_a_stick", builder().stackSize(1).maxDamage(25))); - public static final Item WARPED_FUNGUS_ON_A_STICK = register(new Item("warped_fungus_on_a_stick", builder().stackSize(1).maxDamage(100))); + public static final Item SADDLE = register(new Item("saddle", builder())); + public static final Item MINECART = register(new Item("minecart", builder())); + public static final Item CHEST_MINECART = register(new Item("chest_minecart", builder())); + public static final Item FURNACE_MINECART = register(new Item("furnace_minecart", builder())); + public static final Item TNT_MINECART = register(new Item("tnt_minecart", builder())); + public static final Item HOPPER_MINECART = register(new Item("hopper_minecart", builder())); + public static final Item CARROT_ON_A_STICK = register(new Item("carrot_on_a_stick", builder())); + public static final Item WARPED_FUNGUS_ON_A_STICK = register(new Item("warped_fungus_on_a_stick", builder())); public static final Item PHANTOM_MEMBRANE = register(new Item("phantom_membrane", builder())); - public static final Item ELYTRA = register(new ElytraItem("elytra", builder().stackSize(1).maxDamage(432))); - public static final Item OAK_BOAT = register(new BoatItem("oak_boat", builder().stackSize(1))); - public static final Item OAK_CHEST_BOAT = register(new BoatItem("oak_chest_boat", builder().stackSize(1))); - public static final Item SPRUCE_BOAT = register(new BoatItem("spruce_boat", builder().stackSize(1))); - public static final Item SPRUCE_CHEST_BOAT = register(new BoatItem("spruce_chest_boat", builder().stackSize(1))); - public static final Item BIRCH_BOAT = register(new BoatItem("birch_boat", builder().stackSize(1))); - public static final Item BIRCH_CHEST_BOAT = register(new BoatItem("birch_chest_boat", builder().stackSize(1))); - public static final Item JUNGLE_BOAT = register(new BoatItem("jungle_boat", builder().stackSize(1))); - public static final Item JUNGLE_CHEST_BOAT = register(new BoatItem("jungle_chest_boat", builder().stackSize(1))); - public static final Item ACACIA_BOAT = register(new BoatItem("acacia_boat", builder().stackSize(1))); - public static final Item ACACIA_CHEST_BOAT = register(new BoatItem("acacia_chest_boat", builder().stackSize(1))); - public static final Item CHERRY_BOAT = register(new BoatItem("cherry_boat", builder().stackSize(1))); - public static final Item CHERRY_CHEST_BOAT = register(new BoatItem("cherry_chest_boat", builder().stackSize(1))); - public static final Item DARK_OAK_BOAT = register(new BoatItem("dark_oak_boat", builder().stackSize(1))); - public static final Item DARK_OAK_CHEST_BOAT = register(new BoatItem("dark_oak_chest_boat", builder().stackSize(1))); - public static final Item PALE_OAK_BOAT = register(new BoatItem("pale_oak_boat", builder().stackSize(1))); - public static final Item PALE_OAK_CHEST_BOAT = register(new BoatItem("pale_oak_chest_boat", builder().stackSize(1))); - public static final Item MANGROVE_BOAT = register(new BoatItem("mangrove_boat", builder().stackSize(1))); - public static final Item MANGROVE_CHEST_BOAT = register(new BoatItem("mangrove_chest_boat", builder().stackSize(1))); - public static final Item BAMBOO_RAFT = register(new BoatItem("bamboo_raft", builder().stackSize(1))); - public static final Item BAMBOO_CHEST_RAFT = register(new BoatItem("bamboo_chest_raft", builder().stackSize(1))); + public static final Item ELYTRA = register(new ElytraItem("elytra", builder())); + public static final Item OAK_BOAT = register(new BoatItem("oak_boat", builder())); + public static final Item OAK_CHEST_BOAT = register(new BoatItem("oak_chest_boat", builder())); + public static final Item SPRUCE_BOAT = register(new BoatItem("spruce_boat", builder())); + public static final Item SPRUCE_CHEST_BOAT = register(new BoatItem("spruce_chest_boat", builder())); + public static final Item BIRCH_BOAT = register(new BoatItem("birch_boat", builder())); + public static final Item BIRCH_CHEST_BOAT = register(new BoatItem("birch_chest_boat", builder())); + public static final Item JUNGLE_BOAT = register(new BoatItem("jungle_boat", builder())); + public static final Item JUNGLE_CHEST_BOAT = register(new BoatItem("jungle_chest_boat", builder())); + public static final Item ACACIA_BOAT = register(new BoatItem("acacia_boat", builder())); + public static final Item ACACIA_CHEST_BOAT = register(new BoatItem("acacia_chest_boat", builder())); + public static final Item CHERRY_BOAT = register(new BoatItem("cherry_boat", builder())); + public static final Item CHERRY_CHEST_BOAT = register(new BoatItem("cherry_chest_boat", builder())); + public static final Item DARK_OAK_BOAT = register(new BoatItem("dark_oak_boat", builder())); + public static final Item DARK_OAK_CHEST_BOAT = register(new BoatItem("dark_oak_chest_boat", builder())); + public static final Item PALE_OAK_BOAT = register(new BoatItem("pale_oak_boat", builder())); + public static final Item PALE_OAK_CHEST_BOAT = register(new BoatItem("pale_oak_chest_boat", builder())); + public static final Item MANGROVE_BOAT = register(new BoatItem("mangrove_boat", builder())); + public static final Item MANGROVE_CHEST_BOAT = register(new BoatItem("mangrove_chest_boat", builder())); + public static final Item BAMBOO_RAFT = register(new BoatItem("bamboo_raft", builder())); + public static final Item BAMBOO_CHEST_RAFT = register(new BoatItem("bamboo_chest_raft", builder())); public static final Item STRUCTURE_BLOCK = register(new BlockItem(builder(), Blocks.STRUCTURE_BLOCK)); public static final Item JIGSAW = register(new BlockItem(builder(), Blocks.JIGSAW)); - public static final Item TURTLE_HELMET = register(new ArmorItem("turtle_helmet", ArmorMaterial.TURTLE, builder().stackSize(1).maxDamage(275))); + public static final Item TURTLE_HELMET = register(new ArmorItem("turtle_helmet", ArmorMaterial.TURTLE, builder())); public static final Item TURTLE_SCUTE = register(new Item("turtle_scute", builder())); public static final Item ARMADILLO_SCUTE = register(new Item("armadillo_scute", builder())); - public static final Item WOLF_ARMOR = register(new WolfArmorItem("wolf_armor", ArmorMaterial.ARMADILLO, builder().stackSize(1).maxDamage(64))); - public static final Item FLINT_AND_STEEL = register(new Item("flint_and_steel", builder().stackSize(1).maxDamage(64))); + public static final Item WOLF_ARMOR = register(new WolfArmorItem("wolf_armor", ArmorMaterial.ARMADILLO, builder())); + public static final Item FLINT_AND_STEEL = register(new Item("flint_and_steel", builder())); public static final Item BOWL = register(new Item("bowl", builder())); public static final Item APPLE = register(new Item("apple", builder())); - public static final Item BOW = register(new Item("bow", builder().stackSize(1).maxDamage(384))); + public static final Item BOW = register(new Item("bow", builder())); public static final Item ARROW = register(new ArrowItem("arrow", builder())); public static final Item COAL = register(new Item("coal", builder())); public static final Item CHARCOAL = register(new Item("charcoal", builder())); @@ -915,140 +924,140 @@ public final class Items { public static final Item GOLD_INGOT = register(new Item("gold_ingot", builder())); public static final Item NETHERITE_INGOT = register(new Item("netherite_ingot", builder())); public static final Item NETHERITE_SCRAP = register(new Item("netherite_scrap", builder())); - public static final Item WOODEN_SWORD = register(new TieredItem("wooden_sword", ToolTier.WOODEN, builder().stackSize(1).maxDamage(59).attackDamage(4.0))); - public static final Item WOODEN_SHOVEL = register(new TieredItem("wooden_shovel", ToolTier.WOODEN, builder().stackSize(1).maxDamage(59).attackDamage(2.5))); - public static final Item WOODEN_PICKAXE = register(new TieredItem("wooden_pickaxe", ToolTier.WOODEN, builder().stackSize(1).maxDamage(59).attackDamage(2.0))); - public static final Item WOODEN_AXE = register(new TieredItem("wooden_axe", ToolTier.WOODEN, builder().stackSize(1).maxDamage(59).attackDamage(7.0))); - public static final Item WOODEN_HOE = register(new TieredItem("wooden_hoe", ToolTier.WOODEN, builder().stackSize(1).maxDamage(59).attackDamage(1.0))); - public static final Item STONE_SWORD = register(new TieredItem("stone_sword", ToolTier.STONE, builder().stackSize(1).maxDamage(131).attackDamage(5.0))); - public static final Item STONE_SHOVEL = register(new TieredItem("stone_shovel", ToolTier.STONE, builder().stackSize(1).maxDamage(131).attackDamage(3.5))); - public static final Item STONE_PICKAXE = register(new TieredItem("stone_pickaxe", ToolTier.STONE, builder().stackSize(1).maxDamage(131).attackDamage(3.0))); - public static final Item STONE_AXE = register(new TieredItem("stone_axe", ToolTier.STONE, builder().stackSize(1).maxDamage(131).attackDamage(9.0))); - public static final Item STONE_HOE = register(new TieredItem("stone_hoe", ToolTier.STONE, builder().stackSize(1).maxDamage(131).attackDamage(1.0))); - public static final Item GOLDEN_SWORD = register(new TieredItem("golden_sword", ToolTier.GOLDEN, builder().stackSize(1).maxDamage(32).attackDamage(4.0))); - public static final Item GOLDEN_SHOVEL = register(new TieredItem("golden_shovel", ToolTier.GOLDEN, builder().stackSize(1).maxDamage(32).attackDamage(2.5))); - public static final Item GOLDEN_PICKAXE = register(new TieredItem("golden_pickaxe", ToolTier.GOLDEN, builder().stackSize(1).maxDamage(32).attackDamage(2.0))); - public static final Item GOLDEN_AXE = register(new TieredItem("golden_axe", ToolTier.GOLDEN, builder().stackSize(1).maxDamage(32).attackDamage(7.0))); - public static final Item GOLDEN_HOE = register(new TieredItem("golden_hoe", ToolTier.GOLDEN, builder().stackSize(1).maxDamage(32).attackDamage(1.0))); - public static final Item IRON_SWORD = register(new TieredItem("iron_sword", ToolTier.IRON, builder().stackSize(1).maxDamage(250).attackDamage(6.0))); - public static final Item IRON_SHOVEL = register(new TieredItem("iron_shovel", ToolTier.IRON, builder().stackSize(1).maxDamage(250).attackDamage(4.5))); - public static final Item IRON_PICKAXE = register(new TieredItem("iron_pickaxe", ToolTier.IRON, builder().stackSize(1).maxDamage(250).attackDamage(4.0))); - public static final Item IRON_AXE = register(new TieredItem("iron_axe", ToolTier.IRON, builder().stackSize(1).maxDamage(250).attackDamage(9.0))); - public static final Item IRON_HOE = register(new TieredItem("iron_hoe", ToolTier.IRON, builder().stackSize(1).maxDamage(250).attackDamage(1.0))); - public static final Item DIAMOND_SWORD = register(new TieredItem("diamond_sword", ToolTier.DIAMOND, builder().stackSize(1).maxDamage(1561).attackDamage(7.0))); - public static final Item DIAMOND_SHOVEL = register(new TieredItem("diamond_shovel", ToolTier.DIAMOND, builder().stackSize(1).maxDamage(1561).attackDamage(5.5))); - public static final Item DIAMOND_PICKAXE = register(new TieredItem("diamond_pickaxe", ToolTier.DIAMOND, builder().stackSize(1).maxDamage(1561).attackDamage(5.0))); - public static final Item DIAMOND_AXE = register(new TieredItem("diamond_axe", ToolTier.DIAMOND, builder().stackSize(1).maxDamage(1561).attackDamage(9.0))); - public static final Item DIAMOND_HOE = register(new TieredItem("diamond_hoe", ToolTier.DIAMOND, builder().stackSize(1).maxDamage(1561).attackDamage(1.0))); - public static final Item NETHERITE_SWORD = register(new TieredItem("netherite_sword", ToolTier.NETHERITE, builder().stackSize(1).maxDamage(2031).attackDamage(8.0))); - public static final Item NETHERITE_SHOVEL = register(new TieredItem("netherite_shovel", ToolTier.NETHERITE, builder().stackSize(1).maxDamage(2031).attackDamage(6.5))); - public static final Item NETHERITE_PICKAXE = register(new TieredItem("netherite_pickaxe", ToolTier.NETHERITE, builder().stackSize(1).maxDamage(2031).attackDamage(6.0))); - public static final Item NETHERITE_AXE = register(new TieredItem("netherite_axe", ToolTier.NETHERITE, builder().stackSize(1).maxDamage(2031).attackDamage(10.0))); - public static final Item NETHERITE_HOE = register(new TieredItem("netherite_hoe", ToolTier.NETHERITE, builder().stackSize(1).maxDamage(2031).attackDamage(1.0))); + public static final Item WOODEN_SWORD = register(new Item("wooden_sword", builder().attackDamage(4.0))); + public static final Item WOODEN_SHOVEL = register(new Item("wooden_shovel", builder().attackDamage(2.5))); + public static final Item WOODEN_PICKAXE = register(new Item("wooden_pickaxe", builder().attackDamage(2.0))); + public static final Item WOODEN_AXE = register(new Item("wooden_axe", builder().attackDamage(7.0))); + public static final Item WOODEN_HOE = register(new Item("wooden_hoe", builder().attackDamage(1.0))); + public static final Item STONE_SWORD = register(new Item("stone_sword", builder().attackDamage(5.0))); + public static final Item STONE_SHOVEL = register(new Item("stone_shovel", builder().attackDamage(3.5))); + public static final Item STONE_PICKAXE = register(new Item("stone_pickaxe", builder().attackDamage(3.0))); + public static final Item STONE_AXE = register(new Item("stone_axe", builder().attackDamage(9.0))); + public static final Item STONE_HOE = register(new Item("stone_hoe", builder().attackDamage(1.0))); + public static final Item GOLDEN_SWORD = register(new Item("golden_sword", builder().attackDamage(4.0))); + public static final Item GOLDEN_SHOVEL = register(new Item("golden_shovel", builder().attackDamage(2.5))); + public static final Item GOLDEN_PICKAXE = register(new Item("golden_pickaxe", builder().attackDamage(2.0))); + public static final Item GOLDEN_AXE = register(new Item("golden_axe", builder().attackDamage(7.0))); + public static final Item GOLDEN_HOE = register(new Item("golden_hoe", builder().attackDamage(1.0))); + public static final Item IRON_SWORD = register(new Item("iron_sword", builder().attackDamage(6.0))); + public static final Item IRON_SHOVEL = register(new Item("iron_shovel", builder().attackDamage(4.5))); + public static final Item IRON_PICKAXE = register(new Item("iron_pickaxe", builder().attackDamage(4.0))); + public static final Item IRON_AXE = register(new Item("iron_axe", builder().attackDamage(9.0))); + public static final Item IRON_HOE = register(new Item("iron_hoe", builder().attackDamage(1.0))); + public static final Item DIAMOND_SWORD = register(new Item("diamond_sword", builder().attackDamage(7.0))); + public static final Item DIAMOND_SHOVEL = register(new Item("diamond_shovel", builder().attackDamage(5.5))); + public static final Item DIAMOND_PICKAXE = register(new Item("diamond_pickaxe", builder().attackDamage(5.0))); + public static final Item DIAMOND_AXE = register(new Item("diamond_axe", builder().attackDamage(9.0))); + public static final Item DIAMOND_HOE = register(new Item("diamond_hoe", builder().attackDamage(1.0))); + public static final Item NETHERITE_SWORD = register(new Item("netherite_sword", builder().attackDamage(8.0))); + public static final Item NETHERITE_SHOVEL = register(new Item("netherite_shovel", builder().attackDamage(6.5))); + public static final Item NETHERITE_PICKAXE = register(new Item("netherite_pickaxe", builder().attackDamage(6.0))); + public static final Item NETHERITE_AXE = register(new Item("netherite_axe", builder().attackDamage(10.0))); + public static final Item NETHERITE_HOE = register(new Item("netherite_hoe", builder().attackDamage(1.0))); public static final Item STICK = register(new Item("stick", builder())); - public static final Item MUSHROOM_STEW = register(new Item("mushroom_stew", builder().stackSize(1))); + public static final Item MUSHROOM_STEW = register(new Item("mushroom_stew", builder())); public static final Item STRING = register(new BlockItem("string", builder(), Blocks.TRIPWIRE)); public static final Item FEATHER = register(new Item("feather", builder())); public static final Item GUNPOWDER = register(new Item("gunpowder", builder())); public static final Item WHEAT_SEEDS = register(new BlockItem("wheat_seeds", builder(), Blocks.WHEAT)); public static final Item WHEAT = register(new Item("wheat", builder())); public static final Item BREAD = register(new Item("bread", builder())); - public static final Item LEATHER_HELMET = register(new DyeableArmorItem("leather_helmet", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(55))); - public static final Item LEATHER_CHESTPLATE = register(new DyeableArmorItem("leather_chestplate", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(80))); - public static final Item LEATHER_LEGGINGS = register(new DyeableArmorItem("leather_leggings", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(75))); - public static final Item LEATHER_BOOTS = register(new DyeableArmorItem("leather_boots", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(65))); - public static final Item CHAINMAIL_HELMET = register(new ArmorItem("chainmail_helmet", ArmorMaterial.CHAINMAIL, builder().stackSize(1).maxDamage(165))); - public static final Item CHAINMAIL_CHESTPLATE = register(new ArmorItem("chainmail_chestplate", ArmorMaterial.CHAINMAIL, builder().stackSize(1).maxDamage(240))); - public static final Item CHAINMAIL_LEGGINGS = register(new ArmorItem("chainmail_leggings", ArmorMaterial.CHAINMAIL, builder().stackSize(1).maxDamage(225))); - public static final Item CHAINMAIL_BOOTS = register(new ArmorItem("chainmail_boots", ArmorMaterial.CHAINMAIL, builder().stackSize(1).maxDamage(195))); - public static final Item IRON_HELMET = register(new ArmorItem("iron_helmet", ArmorMaterial.IRON, builder().stackSize(1).maxDamage(165))); - public static final Item IRON_CHESTPLATE = register(new ArmorItem("iron_chestplate", ArmorMaterial.IRON, builder().stackSize(1).maxDamage(240))); - public static final Item IRON_LEGGINGS = register(new ArmorItem("iron_leggings", ArmorMaterial.IRON, builder().stackSize(1).maxDamage(225))); - public static final Item IRON_BOOTS = register(new ArmorItem("iron_boots", ArmorMaterial.IRON, builder().stackSize(1).maxDamage(195))); - public static final Item DIAMOND_HELMET = register(new ArmorItem("diamond_helmet", ArmorMaterial.DIAMOND, builder().stackSize(1).maxDamage(363))); - public static final Item DIAMOND_CHESTPLATE = register(new ArmorItem("diamond_chestplate", ArmorMaterial.DIAMOND, builder().stackSize(1).maxDamage(528))); - public static final Item DIAMOND_LEGGINGS = register(new ArmorItem("diamond_leggings", ArmorMaterial.DIAMOND, builder().stackSize(1).maxDamage(495))); - public static final Item DIAMOND_BOOTS = register(new ArmorItem("diamond_boots", ArmorMaterial.DIAMOND, builder().stackSize(1).maxDamage(429))); - public static final Item GOLDEN_HELMET = register(new ArmorItem("golden_helmet", ArmorMaterial.GOLD, builder().stackSize(1).maxDamage(77))); - public static final Item GOLDEN_CHESTPLATE = register(new ArmorItem("golden_chestplate", ArmorMaterial.GOLD, builder().stackSize(1).maxDamage(112))); - public static final Item GOLDEN_LEGGINGS = register(new ArmorItem("golden_leggings", ArmorMaterial.GOLD, builder().stackSize(1).maxDamage(105))); - public static final Item GOLDEN_BOOTS = register(new ArmorItem("golden_boots", ArmorMaterial.GOLD, builder().stackSize(1).maxDamage(91))); - public static final Item NETHERITE_HELMET = register(new ArmorItem("netherite_helmet", ArmorMaterial.NETHERITE, builder().stackSize(1).maxDamage(407))); - public static final Item NETHERITE_CHESTPLATE = register(new ArmorItem("netherite_chestplate", ArmorMaterial.NETHERITE, builder().stackSize(1).maxDamage(592))); - public static final Item NETHERITE_LEGGINGS = register(new ArmorItem("netherite_leggings", ArmorMaterial.NETHERITE, builder().stackSize(1).maxDamage(555))); - public static final Item NETHERITE_BOOTS = register(new ArmorItem("netherite_boots", ArmorMaterial.NETHERITE, builder().stackSize(1).maxDamage(481))); + public static final Item LEATHER_HELMET = register(new DyeableArmorItem("leather_helmet", ArmorMaterial.LEATHER, builder())); + public static final Item LEATHER_CHESTPLATE = register(new DyeableArmorItem("leather_chestplate", ArmorMaterial.LEATHER, builder())); + public static final Item LEATHER_LEGGINGS = register(new DyeableArmorItem("leather_leggings", ArmorMaterial.LEATHER, builder())); + public static final Item LEATHER_BOOTS = register(new DyeableArmorItem("leather_boots", ArmorMaterial.LEATHER, builder())); + public static final Item CHAINMAIL_HELMET = register(new ArmorItem("chainmail_helmet", ArmorMaterial.CHAINMAIL, builder())); + public static final Item CHAINMAIL_CHESTPLATE = register(new ArmorItem("chainmail_chestplate", ArmorMaterial.CHAINMAIL, builder())); + public static final Item CHAINMAIL_LEGGINGS = register(new ArmorItem("chainmail_leggings", ArmorMaterial.CHAINMAIL, builder())); + public static final Item CHAINMAIL_BOOTS = register(new ArmorItem("chainmail_boots", ArmorMaterial.CHAINMAIL, builder())); + public static final Item IRON_HELMET = register(new ArmorItem("iron_helmet", ArmorMaterial.IRON, builder())); + public static final Item IRON_CHESTPLATE = register(new ArmorItem("iron_chestplate", ArmorMaterial.IRON, builder())); + public static final Item IRON_LEGGINGS = register(new ArmorItem("iron_leggings", ArmorMaterial.IRON, builder())); + public static final Item IRON_BOOTS = register(new ArmorItem("iron_boots", ArmorMaterial.IRON, builder())); + public static final Item DIAMOND_HELMET = register(new ArmorItem("diamond_helmet", ArmorMaterial.DIAMOND, builder())); + public static final Item DIAMOND_CHESTPLATE = register(new ArmorItem("diamond_chestplate", ArmorMaterial.DIAMOND, builder())); + public static final Item DIAMOND_LEGGINGS = register(new ArmorItem("diamond_leggings", ArmorMaterial.DIAMOND, builder())); + public static final Item DIAMOND_BOOTS = register(new ArmorItem("diamond_boots", ArmorMaterial.DIAMOND, builder())); + public static final Item GOLDEN_HELMET = register(new ArmorItem("golden_helmet", ArmorMaterial.GOLD, builder())); + public static final Item GOLDEN_CHESTPLATE = register(new ArmorItem("golden_chestplate", ArmorMaterial.GOLD, builder())); + public static final Item GOLDEN_LEGGINGS = register(new ArmorItem("golden_leggings", ArmorMaterial.GOLD, builder())); + public static final Item GOLDEN_BOOTS = register(new ArmorItem("golden_boots", ArmorMaterial.GOLD, builder())); + public static final Item NETHERITE_HELMET = register(new ArmorItem("netherite_helmet", ArmorMaterial.NETHERITE, builder())); + public static final Item NETHERITE_CHESTPLATE = register(new ArmorItem("netherite_chestplate", ArmorMaterial.NETHERITE, builder())); + public static final Item NETHERITE_LEGGINGS = register(new ArmorItem("netherite_leggings", ArmorMaterial.NETHERITE, builder())); + public static final Item NETHERITE_BOOTS = register(new ArmorItem("netherite_boots", ArmorMaterial.NETHERITE, builder())); public static final Item FLINT = register(new Item("flint", builder())); public static final Item PORKCHOP = register(new Item("porkchop", builder())); public static final Item COOKED_PORKCHOP = register(new Item("cooked_porkchop", builder())); public static final Item PAINTING = register(new Item("painting", builder())); public static final Item GOLDEN_APPLE = register(new Item("golden_apple", builder())); public static final Item ENCHANTED_GOLDEN_APPLE = register(new Item("enchanted_golden_apple", builder())); - public static final Item OAK_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.OAK_SIGN, Blocks.OAK_WALL_SIGN)); - public static final Item SPRUCE_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.SPRUCE_SIGN, Blocks.SPRUCE_WALL_SIGN)); - public static final Item BIRCH_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.BIRCH_SIGN, Blocks.BIRCH_WALL_SIGN)); - public static final Item JUNGLE_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.JUNGLE_SIGN, Blocks.JUNGLE_WALL_SIGN)); - public static final Item ACACIA_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.ACACIA_SIGN, Blocks.ACACIA_WALL_SIGN)); - public static final Item CHERRY_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.CHERRY_SIGN, Blocks.CHERRY_WALL_SIGN)); - public static final Item DARK_OAK_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.DARK_OAK_SIGN, Blocks.DARK_OAK_WALL_SIGN)); - public static final Item PALE_OAK_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.PALE_OAK_SIGN, Blocks.PALE_OAK_WALL_SIGN)); - public static final Item MANGROVE_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.MANGROVE_SIGN, Blocks.MANGROVE_WALL_SIGN)); - public static final Item BAMBOO_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.BAMBOO_SIGN, Blocks.BAMBOO_WALL_SIGN)); - public static final Item CRIMSON_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.CRIMSON_SIGN, Blocks.CRIMSON_WALL_SIGN)); - public static final Item WARPED_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.WARPED_SIGN, Blocks.WARPED_WALL_SIGN)); - public static final Item OAK_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.OAK_HANGING_SIGN, Blocks.OAK_WALL_HANGING_SIGN)); - public static final Item SPRUCE_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.SPRUCE_HANGING_SIGN, Blocks.SPRUCE_WALL_HANGING_SIGN)); - public static final Item BIRCH_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.BIRCH_HANGING_SIGN, Blocks.BIRCH_WALL_HANGING_SIGN)); - public static final Item JUNGLE_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.JUNGLE_HANGING_SIGN, Blocks.JUNGLE_WALL_HANGING_SIGN)); - public static final Item ACACIA_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.ACACIA_HANGING_SIGN, Blocks.ACACIA_WALL_HANGING_SIGN)); - public static final Item CHERRY_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.CHERRY_HANGING_SIGN, Blocks.CHERRY_WALL_HANGING_SIGN)); - public static final Item DARK_OAK_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.DARK_OAK_HANGING_SIGN, Blocks.DARK_OAK_WALL_HANGING_SIGN)); - public static final Item PALE_OAK_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.PALE_OAK_HANGING_SIGN, Blocks.PALE_OAK_WALL_HANGING_SIGN)); - public static final Item MANGROVE_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.MANGROVE_HANGING_SIGN, Blocks.MANGROVE_WALL_HANGING_SIGN)); - public static final Item BAMBOO_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.BAMBOO_HANGING_SIGN, Blocks.BAMBOO_WALL_HANGING_SIGN)); - public static final Item CRIMSON_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.CRIMSON_HANGING_SIGN, Blocks.CRIMSON_WALL_HANGING_SIGN)); - public static final Item WARPED_HANGING_SIGN = register(new BlockItem(builder().stackSize(16), Blocks.WARPED_HANGING_SIGN, Blocks.WARPED_WALL_HANGING_SIGN)); - public static final Item BUCKET = register(new Item("bucket", builder().stackSize(16))); - public static final Item WATER_BUCKET = register(new Item("water_bucket", builder().stackSize(1))); - public static final Item LAVA_BUCKET = register(new Item("lava_bucket", builder().stackSize(1))); - public static final Item POWDER_SNOW_BUCKET = register(new BlockItem("powder_snow_bucket", builder().stackSize(1), Blocks.POWDER_SNOW)); - public static final Item SNOWBALL = register(new Item("snowball", builder().stackSize(16))); + public static final Item OAK_SIGN = register(new BlockItem(builder(), Blocks.OAK_SIGN, Blocks.OAK_WALL_SIGN)); + public static final Item SPRUCE_SIGN = register(new BlockItem(builder(), Blocks.SPRUCE_SIGN, Blocks.SPRUCE_WALL_SIGN)); + public static final Item BIRCH_SIGN = register(new BlockItem(builder(), Blocks.BIRCH_SIGN, Blocks.BIRCH_WALL_SIGN)); + public static final Item JUNGLE_SIGN = register(new BlockItem(builder(), Blocks.JUNGLE_SIGN, Blocks.JUNGLE_WALL_SIGN)); + public static final Item ACACIA_SIGN = register(new BlockItem(builder(), Blocks.ACACIA_SIGN, Blocks.ACACIA_WALL_SIGN)); + public static final Item CHERRY_SIGN = register(new BlockItem(builder(), Blocks.CHERRY_SIGN, Blocks.CHERRY_WALL_SIGN)); + public static final Item DARK_OAK_SIGN = register(new BlockItem(builder(), Blocks.DARK_OAK_SIGN, Blocks.DARK_OAK_WALL_SIGN)); + public static final Item PALE_OAK_SIGN = register(new BlockItem(builder(), Blocks.PALE_OAK_SIGN, Blocks.PALE_OAK_WALL_SIGN)); + public static final Item MANGROVE_SIGN = register(new BlockItem(builder(), Blocks.MANGROVE_SIGN, Blocks.MANGROVE_WALL_SIGN)); + public static final Item BAMBOO_SIGN = register(new BlockItem(builder(), Blocks.BAMBOO_SIGN, Blocks.BAMBOO_WALL_SIGN)); + public static final Item CRIMSON_SIGN = register(new BlockItem(builder(), Blocks.CRIMSON_SIGN, Blocks.CRIMSON_WALL_SIGN)); + public static final Item WARPED_SIGN = register(new BlockItem(builder(), Blocks.WARPED_SIGN, Blocks.WARPED_WALL_SIGN)); + public static final Item OAK_HANGING_SIGN = register(new BlockItem(builder(), Blocks.OAK_HANGING_SIGN, Blocks.OAK_WALL_HANGING_SIGN)); + public static final Item SPRUCE_HANGING_SIGN = register(new BlockItem(builder(), Blocks.SPRUCE_HANGING_SIGN, Blocks.SPRUCE_WALL_HANGING_SIGN)); + public static final Item BIRCH_HANGING_SIGN = register(new BlockItem(builder(), Blocks.BIRCH_HANGING_SIGN, Blocks.BIRCH_WALL_HANGING_SIGN)); + public static final Item JUNGLE_HANGING_SIGN = register(new BlockItem(builder(), Blocks.JUNGLE_HANGING_SIGN, Blocks.JUNGLE_WALL_HANGING_SIGN)); + public static final Item ACACIA_HANGING_SIGN = register(new BlockItem(builder(), Blocks.ACACIA_HANGING_SIGN, Blocks.ACACIA_WALL_HANGING_SIGN)); + public static final Item CHERRY_HANGING_SIGN = register(new BlockItem(builder(), Blocks.CHERRY_HANGING_SIGN, Blocks.CHERRY_WALL_HANGING_SIGN)); + public static final Item DARK_OAK_HANGING_SIGN = register(new BlockItem(builder(), Blocks.DARK_OAK_HANGING_SIGN, Blocks.DARK_OAK_WALL_HANGING_SIGN)); + public static final Item PALE_OAK_HANGING_SIGN = register(new BlockItem(builder(), Blocks.PALE_OAK_HANGING_SIGN, Blocks.PALE_OAK_WALL_HANGING_SIGN)); + public static final Item MANGROVE_HANGING_SIGN = register(new BlockItem(builder(), Blocks.MANGROVE_HANGING_SIGN, Blocks.MANGROVE_WALL_HANGING_SIGN)); + public static final Item BAMBOO_HANGING_SIGN = register(new BlockItem(builder(), Blocks.BAMBOO_HANGING_SIGN, Blocks.BAMBOO_WALL_HANGING_SIGN)); + public static final Item CRIMSON_HANGING_SIGN = register(new BlockItem(builder(), Blocks.CRIMSON_HANGING_SIGN, Blocks.CRIMSON_WALL_HANGING_SIGN)); + public static final Item WARPED_HANGING_SIGN = register(new BlockItem(builder(), Blocks.WARPED_HANGING_SIGN, Blocks.WARPED_WALL_HANGING_SIGN)); + public static final Item BUCKET = register(new Item("bucket", builder())); + public static final Item WATER_BUCKET = register(new Item("water_bucket", builder())); + public static final Item LAVA_BUCKET = register(new Item("lava_bucket", builder())); + public static final Item POWDER_SNOW_BUCKET = register(new BlockItem("powder_snow_bucket", builder(), Blocks.POWDER_SNOW)); + public static final Item SNOWBALL = register(new Item("snowball", builder())); public static final Item LEATHER = register(new Item("leather", builder())); - public static final Item MILK_BUCKET = register(new Item("milk_bucket", builder().stackSize(1))); - public static final Item PUFFERFISH_BUCKET = register(new Item("pufferfish_bucket", builder().stackSize(1))); - public static final Item SALMON_BUCKET = register(new Item("salmon_bucket", builder().stackSize(1))); - public static final Item COD_BUCKET = register(new Item("cod_bucket", builder().stackSize(1))); - public static final Item TROPICAL_FISH_BUCKET = register(new TropicalFishBucketItem("tropical_fish_bucket", builder().stackSize(1))); - public static final Item AXOLOTL_BUCKET = register(new AxolotlBucketItem("axolotl_bucket", builder().stackSize(1))); - public static final Item TADPOLE_BUCKET = register(new Item("tadpole_bucket", builder().stackSize(1))); + public static final Item MILK_BUCKET = register(new Item("milk_bucket", builder())); + public static final Item PUFFERFISH_BUCKET = register(new Item("pufferfish_bucket", builder())); + public static final Item SALMON_BUCKET = register(new Item("salmon_bucket", builder())); + public static final Item COD_BUCKET = register(new Item("cod_bucket", builder())); + public static final Item TROPICAL_FISH_BUCKET = register(new TropicalFishBucketItem("tropical_fish_bucket", builder())); + public static final Item AXOLOTL_BUCKET = register(new AxolotlBucketItem("axolotl_bucket", builder())); + public static final Item TADPOLE_BUCKET = register(new Item("tadpole_bucket", builder())); public static final Item BRICK = register(new Item("brick", builder())); public static final Item CLAY_BALL = register(new Item("clay_ball", builder())); public static final Item DRIED_KELP_BLOCK = register(new BlockItem(builder(), Blocks.DRIED_KELP_BLOCK)); public static final Item PAPER = register(new Item("paper", builder())); public static final Item BOOK = register(new Item("book", builder())); public static final Item SLIME_BALL = register(new Item("slime_ball", builder())); - public static final Item EGG = register(new Item("egg", builder().stackSize(16))); + public static final Item EGG = register(new Item("egg", builder())); public static final Item COMPASS = register(new CompassItem("compass", builder())); public static final Item RECOVERY_COMPASS = register(new Item("recovery_compass", builder())); - public static final Item BUNDLE = register(new Item("bundle", builder().stackSize(1))); - public static final Item WHITE_BUNDLE = register(new Item("white_bundle", builder().stackSize(1))); - public static final Item ORANGE_BUNDLE = register(new Item("orange_bundle", builder().stackSize(1))); - public static final Item MAGENTA_BUNDLE = register(new Item("magenta_bundle", builder().stackSize(1))); - public static final Item LIGHT_BLUE_BUNDLE = register(new Item("light_blue_bundle", builder().stackSize(1))); - public static final Item YELLOW_BUNDLE = register(new Item("yellow_bundle", builder().stackSize(1))); - public static final Item LIME_BUNDLE = register(new Item("lime_bundle", builder().stackSize(1))); - public static final Item PINK_BUNDLE = register(new Item("pink_bundle", builder().stackSize(1))); - public static final Item GRAY_BUNDLE = register(new Item("gray_bundle", builder().stackSize(1))); - public static final Item LIGHT_GRAY_BUNDLE = register(new Item("light_gray_bundle", builder().stackSize(1))); - public static final Item CYAN_BUNDLE = register(new Item("cyan_bundle", builder().stackSize(1))); - public static final Item PURPLE_BUNDLE = register(new Item("purple_bundle", builder().stackSize(1))); - public static final Item BLUE_BUNDLE = register(new Item("blue_bundle", builder().stackSize(1))); - public static final Item BROWN_BUNDLE = register(new Item("brown_bundle", builder().stackSize(1))); - public static final Item GREEN_BUNDLE = register(new Item("green_bundle", builder().stackSize(1))); - public static final Item RED_BUNDLE = register(new Item("red_bundle", builder().stackSize(1))); - public static final Item BLACK_BUNDLE = register(new Item("black_bundle", builder().stackSize(1))); - public static final Item FISHING_ROD = register(new FishingRodItem("fishing_rod", builder().stackSize(1).maxDamage(64))); + public static final Item BUNDLE = register(new Item("bundle", builder())); + public static final Item WHITE_BUNDLE = register(new Item("white_bundle", builder())); + public static final Item ORANGE_BUNDLE = register(new Item("orange_bundle", builder())); + public static final Item MAGENTA_BUNDLE = register(new Item("magenta_bundle", builder())); + public static final Item LIGHT_BLUE_BUNDLE = register(new Item("light_blue_bundle", builder())); + public static final Item YELLOW_BUNDLE = register(new Item("yellow_bundle", builder())); + public static final Item LIME_BUNDLE = register(new Item("lime_bundle", builder())); + public static final Item PINK_BUNDLE = register(new Item("pink_bundle", builder())); + public static final Item GRAY_BUNDLE = register(new Item("gray_bundle", builder())); + public static final Item LIGHT_GRAY_BUNDLE = register(new Item("light_gray_bundle", builder())); + public static final Item CYAN_BUNDLE = register(new Item("cyan_bundle", builder())); + public static final Item PURPLE_BUNDLE = register(new Item("purple_bundle", builder())); + public static final Item BLUE_BUNDLE = register(new Item("blue_bundle", builder())); + public static final Item BROWN_BUNDLE = register(new Item("brown_bundle", builder())); + public static final Item GREEN_BUNDLE = register(new Item("green_bundle", builder())); + public static final Item RED_BUNDLE = register(new Item("red_bundle", builder())); + public static final Item BLACK_BUNDLE = register(new Item("black_bundle", builder())); + public static final Item FISHING_ROD = register(new FishingRodItem("fishing_rod", builder())); public static final Item CLOCK = register(new Item("clock", builder())); - public static final Item SPYGLASS = register(new Item("spyglass", builder().stackSize(1))); + public static final Item SPYGLASS = register(new Item("spyglass", builder())); public static final Item GLOWSTONE_DUST = register(new Item("glowstone_dust", builder())); public static final Item COD = register(new Item("cod", builder())); public static final Item SALMON = register(new Item("salmon", builder())); @@ -1078,27 +1087,27 @@ public final class Items { public static final Item BONE_MEAL = register(new Item("bone_meal", builder())); public static final Item BONE = register(new Item("bone", builder())); public static final Item SUGAR = register(new Item("sugar", builder())); - public static final Item CAKE = register(new BlockItem(builder().stackSize(1), Blocks.CAKE)); - public static final Item WHITE_BED = register(new BlockItem(builder().stackSize(1), Blocks.WHITE_BED)); - public static final Item ORANGE_BED = register(new BlockItem(builder().stackSize(1), Blocks.ORANGE_BED)); - public static final Item MAGENTA_BED = register(new BlockItem(builder().stackSize(1), Blocks.MAGENTA_BED)); - public static final Item LIGHT_BLUE_BED = register(new BlockItem(builder().stackSize(1), Blocks.LIGHT_BLUE_BED)); - public static final Item YELLOW_BED = register(new BlockItem(builder().stackSize(1), Blocks.YELLOW_BED)); - public static final Item LIME_BED = register(new BlockItem(builder().stackSize(1), Blocks.LIME_BED)); - public static final Item PINK_BED = register(new BlockItem(builder().stackSize(1), Blocks.PINK_BED)); - public static final Item GRAY_BED = register(new BlockItem(builder().stackSize(1), Blocks.GRAY_BED)); - public static final Item LIGHT_GRAY_BED = register(new BlockItem(builder().stackSize(1), Blocks.LIGHT_GRAY_BED)); - public static final Item CYAN_BED = register(new BlockItem(builder().stackSize(1), Blocks.CYAN_BED)); - public static final Item PURPLE_BED = register(new BlockItem(builder().stackSize(1), Blocks.PURPLE_BED)); - public static final Item BLUE_BED = register(new BlockItem(builder().stackSize(1), Blocks.BLUE_BED)); - public static final Item BROWN_BED = register(new BlockItem(builder().stackSize(1), Blocks.BROWN_BED)); - public static final Item GREEN_BED = register(new BlockItem(builder().stackSize(1), Blocks.GREEN_BED)); - public static final Item RED_BED = register(new BlockItem(builder().stackSize(1), Blocks.RED_BED)); - public static final Item BLACK_BED = register(new BlockItem(builder().stackSize(1), Blocks.BLACK_BED)); + public static final Item CAKE = register(new BlockItem(builder(), Blocks.CAKE)); + public static final Item WHITE_BED = register(new BlockItem(builder(), Blocks.WHITE_BED)); + public static final Item ORANGE_BED = register(new BlockItem(builder(), Blocks.ORANGE_BED)); + public static final Item MAGENTA_BED = register(new BlockItem(builder(), Blocks.MAGENTA_BED)); + public static final Item LIGHT_BLUE_BED = register(new BlockItem(builder(), Blocks.LIGHT_BLUE_BED)); + public static final Item YELLOW_BED = register(new BlockItem(builder(), Blocks.YELLOW_BED)); + public static final Item LIME_BED = register(new BlockItem(builder(), Blocks.LIME_BED)); + public static final Item PINK_BED = register(new BlockItem(builder(), Blocks.PINK_BED)); + public static final Item GRAY_BED = register(new BlockItem(builder(), Blocks.GRAY_BED)); + public static final Item LIGHT_GRAY_BED = register(new BlockItem(builder(), Blocks.LIGHT_GRAY_BED)); + public static final Item CYAN_BED = register(new BlockItem(builder(), Blocks.CYAN_BED)); + public static final Item PURPLE_BED = register(new BlockItem(builder(), Blocks.PURPLE_BED)); + public static final Item BLUE_BED = register(new BlockItem(builder(), Blocks.BLUE_BED)); + public static final Item BROWN_BED = register(new BlockItem(builder(), Blocks.BROWN_BED)); + public static final Item GREEN_BED = register(new BlockItem(builder(), Blocks.GREEN_BED)); + public static final Item RED_BED = register(new BlockItem(builder(), Blocks.RED_BED)); + public static final Item BLACK_BED = register(new BlockItem(builder(), Blocks.BLACK_BED)); public static final Item COOKIE = register(new Item("cookie", builder())); public static final Item CRAFTER = register(new BlockItem(builder(), Blocks.CRAFTER)); public static final Item FILLED_MAP = register(new FilledMapItem("filled_map", builder())); - public static final Item SHEARS = register(new Item("shears", builder().stackSize(1).maxDamage(238))); + public static final Item SHEARS = register(new Item("shears", builder())); public static final Item MELON_SLICE = register(new Item("melon_slice", builder())); public static final Item DRIED_KELP = register(new Item("dried_kelp", builder())); public static final Item PUMPKIN_SEEDS = register(new BlockItem("pumpkin_seeds", builder(), Blocks.PUMPKIN_STEM)); @@ -1108,19 +1117,19 @@ public final class Items { public static final Item CHICKEN = register(new Item("chicken", builder())); public static final Item COOKED_CHICKEN = register(new Item("cooked_chicken", builder())); public static final Item ROTTEN_FLESH = register(new Item("rotten_flesh", builder())); - public static final Item ENDER_PEARL = register(new Item("ender_pearl", builder().stackSize(16))); + public static final Item ENDER_PEARL = register(new Item("ender_pearl", builder())); public static final Item BLAZE_ROD = register(new Item("blaze_rod", builder())); public static final Item GHAST_TEAR = register(new Item("ghast_tear", builder())); public static final Item GOLD_NUGGET = register(new Item("gold_nugget", builder())); public static final Item NETHER_WART = register(new BlockItem(builder(), Blocks.NETHER_WART)); public static final Item GLASS_BOTTLE = register(new Item("glass_bottle", builder())); - public static final Item POTION = register(new PotionItem("potion", builder().stackSize(1))); + public static final Item POTION = register(new PotionItem("potion", builder())); public static final Item SPIDER_EYE = register(new Item("spider_eye", builder())); public static final Item FERMENTED_SPIDER_EYE = register(new Item("fermented_spider_eye", builder())); public static final Item BLAZE_POWDER = register(new Item("blaze_powder", builder())); public static final Item MAGMA_CREAM = register(new Item("magma_cream", builder())); public static final Item BREWING_STAND = register(new BlockItem(builder(), Blocks.BREWING_STAND)); - public static final Item CAULDRON = register(new BlockItem(builder(), Blocks.CAULDRON, Blocks.LAVA_CAULDRON, Blocks.WATER_CAULDRON, Blocks.POWDER_SNOW_CAULDRON)); + public static final Item CAULDRON = register(new BlockItem(builder(), Blocks.CAULDRON, Blocks.POWDER_SNOW_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.WATER_CAULDRON)); public static final Item ENDER_EYE = register(new Item("ender_eye", builder())); public static final Item GLISTERING_MELON_SLICE = register(new Item("glistering_melon_slice", builder())); public static final Item ARMADILLO_SPAWN_EGG = register(new SpawnEggItem("armadillo_spawn_egg", builder())); @@ -1207,10 +1216,10 @@ public final class Items { public static final Item EXPERIENCE_BOTTLE = register(new Item("experience_bottle", builder())); public static final Item FIRE_CHARGE = register(new Item("fire_charge", builder())); public static final Item WIND_CHARGE = register(new Item("wind_charge", builder())); - public static final Item WRITABLE_BOOK = register(new WritableBookItem("writable_book", builder().stackSize(1))); - public static final Item WRITTEN_BOOK = register(new WrittenBookItem("written_book", builder().stackSize(16))); + public static final Item WRITABLE_BOOK = register(new WritableBookItem("writable_book", builder())); + public static final Item WRITTEN_BOOK = register(new WrittenBookItem("written_book", builder())); public static final Item BREEZE_ROD = register(new Item("breeze_rod", builder())); - public static final Item MACE = register(new MaceItem("mace", builder().stackSize(1).maxDamage(500))); + public static final Item MACE = register(new MaceItem("mace", builder())); public static final Item ITEM_FRAME = register(new Item("item_frame", builder())); public static final Item GLOW_ITEM_FRAME = register(new Item("glow_item_frame", builder())); public static final Item FLOWER_POT = register(new BlockItem(builder(), Blocks.FLOWER_POT)); @@ -1231,41 +1240,42 @@ public final class Items { public static final Item PUMPKIN_PIE = register(new Item("pumpkin_pie", builder())); public static final Item FIREWORK_ROCKET = register(new FireworkRocketItem("firework_rocket", builder())); public static final Item FIREWORK_STAR = register(new FireworkStarItem("firework_star", builder())); - public static final Item ENCHANTED_BOOK = register(new EnchantedBookItem("enchanted_book", builder().stackSize(1))); + public static final Item ENCHANTED_BOOK = register(new EnchantedBookItem("enchanted_book", builder())); public static final Item NETHER_BRICK = register(new Item("nether_brick", builder())); + public static final Item RESIN_BRICK = register(new Item("resin_brick", builder())); public static final Item PRISMARINE_SHARD = register(new Item("prismarine_shard", builder())); public static final Item PRISMARINE_CRYSTALS = register(new Item("prismarine_crystals", builder())); public static final Item RABBIT = register(new Item("rabbit", builder())); public static final Item COOKED_RABBIT = register(new Item("cooked_rabbit", builder())); - public static final Item RABBIT_STEW = register(new Item("rabbit_stew", builder().stackSize(1))); + public static final Item RABBIT_STEW = register(new Item("rabbit_stew", builder())); public static final Item RABBIT_FOOT = register(new Item("rabbit_foot", builder())); public static final Item RABBIT_HIDE = register(new Item("rabbit_hide", builder())); - public static final Item ARMOR_STAND = register(new Item("armor_stand", builder().stackSize(16))); - public static final Item IRON_HORSE_ARMOR = register(new Item("iron_horse_armor", builder().stackSize(1))); - public static final Item GOLDEN_HORSE_ARMOR = register(new Item("golden_horse_armor", builder().stackSize(1))); - public static final Item DIAMOND_HORSE_ARMOR = register(new Item("diamond_horse_armor", builder().stackSize(1))); - public static final Item LEATHER_HORSE_ARMOR = register(new DyeableArmorItem("leather_horse_armor", ArmorMaterial.LEATHER, builder().stackSize(1))); + public static final Item ARMOR_STAND = register(new Item("armor_stand", builder())); + public static final Item IRON_HORSE_ARMOR = register(new Item("iron_horse_armor", builder())); + public static final Item GOLDEN_HORSE_ARMOR = register(new Item("golden_horse_armor", builder())); + public static final Item DIAMOND_HORSE_ARMOR = register(new Item("diamond_horse_armor", builder())); + public static final Item LEATHER_HORSE_ARMOR = register(new Item("leather_horse_armor", builder())); public static final Item LEAD = register(new Item("lead", builder())); public static final Item NAME_TAG = register(new Item("name_tag", builder())); - public static final Item COMMAND_BLOCK_MINECART = register(new Item("command_block_minecart", builder().stackSize(1))); + public static final Item COMMAND_BLOCK_MINECART = register(new Item("command_block_minecart", builder())); public static final Item MUTTON = register(new Item("mutton", builder())); public static final Item COOKED_MUTTON = register(new Item("cooked_mutton", builder())); - public static final Item WHITE_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.WHITE_BANNER, Blocks.WHITE_WALL_BANNER)); - public static final Item ORANGE_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.ORANGE_BANNER, Blocks.ORANGE_WALL_BANNER)); - public static final Item MAGENTA_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.MAGENTA_BANNER, Blocks.MAGENTA_WALL_BANNER)); - public static final Item LIGHT_BLUE_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.LIGHT_BLUE_BANNER, Blocks.LIGHT_BLUE_WALL_BANNER)); - public static final Item YELLOW_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.YELLOW_BANNER, Blocks.YELLOW_WALL_BANNER)); - public static final Item LIME_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.LIME_BANNER, Blocks.LIME_WALL_BANNER)); - public static final Item PINK_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.PINK_BANNER, Blocks.PINK_WALL_BANNER)); - public static final Item GRAY_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.GRAY_BANNER, Blocks.GRAY_WALL_BANNER)); - public static final Item LIGHT_GRAY_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.LIGHT_GRAY_BANNER, Blocks.LIGHT_GRAY_WALL_BANNER)); - public static final Item CYAN_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.CYAN_BANNER, Blocks.CYAN_WALL_BANNER)); - public static final Item PURPLE_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.PURPLE_BANNER, Blocks.PURPLE_WALL_BANNER)); - public static final Item BLUE_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.BLUE_BANNER, Blocks.BLUE_WALL_BANNER)); - public static final Item BROWN_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.BROWN_BANNER, Blocks.BROWN_WALL_BANNER)); - public static final Item GREEN_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.GREEN_BANNER, Blocks.GREEN_WALL_BANNER)); - public static final Item RED_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.RED_BANNER, Blocks.RED_WALL_BANNER)); - public static final Item BLACK_BANNER = register(new BannerItem(builder().stackSize(16), Blocks.BLACK_BANNER, Blocks.BLACK_WALL_BANNER)); + public static final Item WHITE_BANNER = register(new BannerItem(builder(), Blocks.WHITE_BANNER, Blocks.WHITE_WALL_BANNER)); + public static final Item ORANGE_BANNER = register(new BannerItem(builder(), Blocks.ORANGE_BANNER, Blocks.ORANGE_WALL_BANNER)); + public static final Item MAGENTA_BANNER = register(new BannerItem(builder(), Blocks.MAGENTA_BANNER, Blocks.MAGENTA_WALL_BANNER)); + public static final Item LIGHT_BLUE_BANNER = register(new BannerItem(builder(), Blocks.LIGHT_BLUE_BANNER, Blocks.LIGHT_BLUE_WALL_BANNER)); + public static final Item YELLOW_BANNER = register(new BannerItem(builder(), Blocks.YELLOW_BANNER, Blocks.YELLOW_WALL_BANNER)); + public static final Item LIME_BANNER = register(new BannerItem(builder(), Blocks.LIME_BANNER, Blocks.LIME_WALL_BANNER)); + public static final Item PINK_BANNER = register(new BannerItem(builder(), Blocks.PINK_BANNER, Blocks.PINK_WALL_BANNER)); + public static final Item GRAY_BANNER = register(new BannerItem(builder(), Blocks.GRAY_BANNER, Blocks.GRAY_WALL_BANNER)); + public static final Item LIGHT_GRAY_BANNER = register(new BannerItem(builder(), Blocks.LIGHT_GRAY_BANNER, Blocks.LIGHT_GRAY_WALL_BANNER)); + public static final Item CYAN_BANNER = register(new BannerItem(builder(), Blocks.CYAN_BANNER, Blocks.CYAN_WALL_BANNER)); + public static final Item PURPLE_BANNER = register(new BannerItem(builder(), Blocks.PURPLE_BANNER, Blocks.PURPLE_WALL_BANNER)); + public static final Item BLUE_BANNER = register(new BannerItem(builder(), Blocks.BLUE_BANNER, Blocks.BLUE_WALL_BANNER)); + public static final Item BROWN_BANNER = register(new BannerItem(builder(), Blocks.BROWN_BANNER, Blocks.BROWN_WALL_BANNER)); + public static final Item GREEN_BANNER = register(new BannerItem(builder(), Blocks.GREEN_BANNER, Blocks.GREEN_WALL_BANNER)); + public static final Item RED_BANNER = register(new BannerItem(builder(), Blocks.RED_BANNER, Blocks.RED_WALL_BANNER)); + public static final Item BLACK_BANNER = register(new BannerItem(builder(), Blocks.BLACK_BANNER, Blocks.BLACK_WALL_BANNER)); public static final Item END_CRYSTAL = register(new Item("end_crystal", builder())); public static final Item CHORUS_FRUIT = register(new Item("chorus_fruit", builder())); public static final Item POPPED_CHORUS_FRUIT = register(new Item("popped_chorus_fruit", builder())); @@ -1273,55 +1283,55 @@ public final class Items { public static final Item PITCHER_POD = register(new BlockItem("pitcher_pod", builder(), Blocks.PITCHER_CROP)); public static final Item BEETROOT = register(new Item("beetroot", builder())); public static final Item BEETROOT_SEEDS = register(new BlockItem("beetroot_seeds", builder(), Blocks.BEETROOTS)); - public static final Item BEETROOT_SOUP = register(new Item("beetroot_soup", builder().stackSize(1))); + public static final Item BEETROOT_SOUP = register(new Item("beetroot_soup", builder())); public static final Item DRAGON_BREATH = register(new Item("dragon_breath", builder())); - public static final Item SPLASH_POTION = register(new PotionItem("splash_potion", builder().stackSize(1))); + public static final Item SPLASH_POTION = register(new PotionItem("splash_potion", builder())); public static final Item SPECTRAL_ARROW = register(new Item("spectral_arrow", builder())); public static final Item TIPPED_ARROW = register(new TippedArrowItem("tipped_arrow", builder())); - public static final Item LINGERING_POTION = register(new PotionItem("lingering_potion", builder().stackSize(1))); - public static final Item SHIELD = register(new ShieldItem("shield", builder().stackSize(1).maxDamage(336))); - public static final Item TOTEM_OF_UNDYING = register(new Item("totem_of_undying", builder().stackSize(1))); + public static final Item LINGERING_POTION = register(new PotionItem("lingering_potion", builder())); + public static final Item SHIELD = register(new ShieldItem("shield", builder())); + public static final Item TOTEM_OF_UNDYING = register(new Item("totem_of_undying", builder())); public static final Item SHULKER_SHELL = register(new Item("shulker_shell", builder())); public static final Item IRON_NUGGET = register(new Item("iron_nugget", builder())); - public static final Item KNOWLEDGE_BOOK = register(new Item("knowledge_book", builder().stackSize(1))); - public static final Item DEBUG_STICK = register(new Item("debug_stick", builder().stackSize(1))); - public static final Item MUSIC_DISC_13 = register(new Item("music_disc_13", builder().stackSize(1))); - public static final Item MUSIC_DISC_CAT = register(new Item("music_disc_cat", builder().stackSize(1))); - public static final Item MUSIC_DISC_BLOCKS = register(new Item("music_disc_blocks", builder().stackSize(1))); - public static final Item MUSIC_DISC_CHIRP = register(new Item("music_disc_chirp", builder().stackSize(1))); - public static final Item MUSIC_DISC_CREATOR = register(new Item("music_disc_creator", builder().stackSize(1))); - public static final Item MUSIC_DISC_CREATOR_MUSIC_BOX = register(new Item("music_disc_creator_music_box", builder().stackSize(1))); - public static final Item MUSIC_DISC_FAR = register(new Item("music_disc_far", builder().stackSize(1))); - public static final Item MUSIC_DISC_MALL = register(new Item("music_disc_mall", builder().stackSize(1))); - public static final Item MUSIC_DISC_MELLOHI = register(new Item("music_disc_mellohi", builder().stackSize(1))); - public static final Item MUSIC_DISC_STAL = register(new Item("music_disc_stal", builder().stackSize(1))); - public static final Item MUSIC_DISC_STRAD = register(new Item("music_disc_strad", builder().stackSize(1))); - public static final Item MUSIC_DISC_WARD = register(new Item("music_disc_ward", builder().stackSize(1))); - public static final Item MUSIC_DISC_11 = register(new Item("music_disc_11", builder().stackSize(1))); - public static final Item MUSIC_DISC_WAIT = register(new Item("music_disc_wait", builder().stackSize(1))); - public static final Item MUSIC_DISC_OTHERSIDE = register(new Item("music_disc_otherside", builder().stackSize(1))); - public static final Item MUSIC_DISC_RELIC = register(new Item("music_disc_relic", builder().stackSize(1))); - public static final Item MUSIC_DISC_5 = register(new Item("music_disc_5", builder().stackSize(1))); - public static final Item MUSIC_DISC_PIGSTEP = register(new Item("music_disc_pigstep", builder().stackSize(1))); - public static final Item MUSIC_DISC_PRECIPICE = register(new Item("music_disc_precipice", builder().stackSize(1))); + public static final Item KNOWLEDGE_BOOK = register(new Item("knowledge_book", builder())); + public static final Item DEBUG_STICK = register(new Item("debug_stick", builder())); + public static final Item MUSIC_DISC_13 = register(new Item("music_disc_13", builder())); + public static final Item MUSIC_DISC_CAT = register(new Item("music_disc_cat", builder())); + public static final Item MUSIC_DISC_BLOCKS = register(new Item("music_disc_blocks", builder())); + public static final Item MUSIC_DISC_CHIRP = register(new Item("music_disc_chirp", builder())); + public static final Item MUSIC_DISC_CREATOR = register(new Item("music_disc_creator", builder())); + public static final Item MUSIC_DISC_CREATOR_MUSIC_BOX = register(new Item("music_disc_creator_music_box", builder())); + public static final Item MUSIC_DISC_FAR = register(new Item("music_disc_far", builder())); + public static final Item MUSIC_DISC_MALL = register(new Item("music_disc_mall", builder())); + public static final Item MUSIC_DISC_MELLOHI = register(new Item("music_disc_mellohi", builder())); + public static final Item MUSIC_DISC_STAL = register(new Item("music_disc_stal", builder())); + public static final Item MUSIC_DISC_STRAD = register(new Item("music_disc_strad", builder())); + public static final Item MUSIC_DISC_WARD = register(new Item("music_disc_ward", builder())); + public static final Item MUSIC_DISC_11 = register(new Item("music_disc_11", builder())); + public static final Item MUSIC_DISC_WAIT = register(new Item("music_disc_wait", builder())); + public static final Item MUSIC_DISC_OTHERSIDE = register(new Item("music_disc_otherside", builder())); + public static final Item MUSIC_DISC_RELIC = register(new Item("music_disc_relic", builder())); + public static final Item MUSIC_DISC_5 = register(new Item("music_disc_5", builder())); + public static final Item MUSIC_DISC_PIGSTEP = register(new Item("music_disc_pigstep", builder())); + public static final Item MUSIC_DISC_PRECIPICE = register(new Item("music_disc_precipice", builder())); public static final Item DISC_FRAGMENT_5 = register(new Item("disc_fragment_5", builder())); - public static final Item TRIDENT = register(new Item("trident", builder().stackSize(1).maxDamage(250).attackDamage(9.0))); + public static final Item TRIDENT = register(new Item("trident", builder().attackDamage(9.0))); public static final Item NAUTILUS_SHELL = register(new Item("nautilus_shell", builder())); public static final Item HEART_OF_THE_SEA = register(new Item("heart_of_the_sea", builder())); - public static final Item CROSSBOW = register(new CrossbowItem("crossbow", builder().stackSize(1).maxDamage(465))); - public static final Item SUSPICIOUS_STEW = register(new Item("suspicious_stew", builder().stackSize(1))); + public static final Item CROSSBOW = register(new CrossbowItem("crossbow", builder())); + public static final Item SUSPICIOUS_STEW = register(new Item("suspicious_stew", builder())); public static final Item LOOM = register(new BlockItem(builder(), Blocks.LOOM)); - public static final Item FLOWER_BANNER_PATTERN = register(new Item("flower_banner_pattern", builder().stackSize(1))); - public static final Item CREEPER_BANNER_PATTERN = register(new Item("creeper_banner_pattern", builder().stackSize(1))); - public static final Item SKULL_BANNER_PATTERN = register(new Item("skull_banner_pattern", builder().stackSize(1))); - public static final Item MOJANG_BANNER_PATTERN = register(new Item("mojang_banner_pattern", builder().stackSize(1))); - public static final Item GLOBE_BANNER_PATTERN = register(new Item("globe_banner_pattern", builder().stackSize(1))); - public static final Item PIGLIN_BANNER_PATTERN = register(new Item("piglin_banner_pattern", builder().stackSize(1))); - public static final Item FLOW_BANNER_PATTERN = register(new Item("flow_banner_pattern", builder().stackSize(1))); - public static final Item GUSTER_BANNER_PATTERN = register(new Item("guster_banner_pattern", builder().stackSize(1))); - public static final Item FIELD_MASONED_BANNER_PATTERN = register(new Item("field_masoned_banner_pattern", builder().stackSize(1))); - public static final Item BORDURE_INDENTED_BANNER_PATTERN = register(new Item("bordure_indented_banner_pattern", builder().stackSize(1))); - public static final Item GOAT_HORN = register(new GoatHornItem("goat_horn", builder().stackSize(1))); + public static final Item FLOWER_BANNER_PATTERN = register(new Item("flower_banner_pattern", builder())); + public static final Item CREEPER_BANNER_PATTERN = register(new Item("creeper_banner_pattern", builder())); + public static final Item SKULL_BANNER_PATTERN = register(new Item("skull_banner_pattern", builder())); + public static final Item MOJANG_BANNER_PATTERN = register(new Item("mojang_banner_pattern", builder())); + public static final Item GLOBE_BANNER_PATTERN = register(new Item("globe_banner_pattern", builder())); + public static final Item PIGLIN_BANNER_PATTERN = register(new Item("piglin_banner_pattern", builder())); + public static final Item FLOW_BANNER_PATTERN = register(new Item("flow_banner_pattern", builder())); + public static final Item GUSTER_BANNER_PATTERN = register(new Item("guster_banner_pattern", builder())); + public static final Item FIELD_MASONED_BANNER_PATTERN = register(new Item("field_masoned_banner_pattern", builder())); + public static final Item BORDURE_INDENTED_BANNER_PATTERN = register(new Item("bordure_indented_banner_pattern", builder())); + public static final Item GOAT_HORN = register(new GoatHornItem("goat_horn", builder())); public static final Item COMPOSTER = register(new BlockItem(builder(), Blocks.COMPOSTER)); public static final Item BARREL = register(new BlockItem(builder(), Blocks.BARREL)); public static final Item SMOKER = register(new BlockItem(builder(), Blocks.SMOKER)); @@ -1342,7 +1352,7 @@ public final class Items { public static final Item HONEYCOMB = register(new Item("honeycomb", builder())); public static final Item BEE_NEST = register(new BlockItem(builder(), Blocks.BEE_NEST)); public static final Item BEEHIVE = register(new BlockItem(builder(), Blocks.BEEHIVE)); - public static final Item HONEY_BOTTLE = register(new Item("honey_bottle", builder().stackSize(16))); + public static final Item HONEY_BOTTLE = register(new Item("honey_bottle", builder())); public static final Item HONEYCOMB_BLOCK = register(new BlockItem(builder(), Blocks.HONEYCOMB_BLOCK)); public static final Item LODESTONE = register(new BlockItem(builder(), Blocks.LODESTONE)); public static final Item CRYING_OBSIDIAN = register(new BlockItem(builder(), Blocks.CRYING_OBSIDIAN)); @@ -1386,7 +1396,7 @@ public final class Items { public static final Item PEARLESCENT_FROGLIGHT = register(new BlockItem(builder(), Blocks.PEARLESCENT_FROGLIGHT)); public static final Item FROGSPAWN = register(new BlockItem(builder(), Blocks.FROGSPAWN)); public static final Item ECHO_SHARD = register(new Item("echo_shard", builder())); - public static final Item BRUSH = register(new Item("brush", builder().stackSize(1).maxDamage(64))); + public static final Item BRUSH = register(new Item("brush", builder())); public static final Item NETHERITE_UPGRADE_SMITHING_TEMPLATE = register(new Item("netherite_upgrade_smithing_template", builder())); public static final Item SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("sentry_armor_trim_smithing_template", builder())); public static final Item DUNE_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("dune_armor_trim_smithing_template", builder())); @@ -1449,7 +1459,7 @@ public final class Items { public static final Item TRIAL_KEY = register(new Item("trial_key", builder())); public static final Item OMINOUS_TRIAL_KEY = register(new Item("ominous_trial_key", builder())); public static final Item VAULT = register(new BlockItem(builder(), Blocks.VAULT)); - public static final Item OMINOUS_BOTTLE = register(new OminousBottleItem("ominous_bottle", builder())); + public static final Item OMINOUS_BOTTLE = register(new Item("ominous_bottle", builder())); public static final int AIR_ID = AIR.javaId(); diff --git a/core/src/main/java/org/geysermc/geyser/item/type/BedrockRequiresTagItem.java b/core/src/main/java/org/geysermc/geyser/item/type/BedrockRequiresTagItem.java index c41d14396..cd360f564 100644 --- a/core/src/main/java/org/geysermc/geyser/item/type/BedrockRequiresTagItem.java +++ b/core/src/main/java/org/geysermc/geyser/item/type/BedrockRequiresTagItem.java @@ -25,12 +25,6 @@ package org.geysermc.geyser.item.type; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.translator.item.BedrockItemBuilder; -import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; - +// Whether this item should have its NBT data kept in the recipe book. public interface BedrockRequiresTagItem { - - void addRequiredNbt(GeyserSession session, @Nullable DataComponents components, BedrockItemBuilder builder); } diff --git a/core/src/main/java/org/geysermc/geyser/item/type/FireworkRocketItem.java b/core/src/main/java/org/geysermc/geyser/item/type/FireworkRocketItem.java index 2e7848318..862325a90 100644 --- a/core/src/main/java/org/geysermc/geyser/item/type/FireworkRocketItem.java +++ b/core/src/main/java/org/geysermc/geyser/item/type/FireworkRocketItem.java @@ -27,7 +27,6 @@ package org.geysermc.geyser.item.type; import it.unimi.dsi.fastutil.ints.IntArrays; import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.cloudburstmc.nbt.NbtList; import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMapBuilder; @@ -142,20 +141,4 @@ public class FireworkRocketItem extends Item implements BedrockRequiresTagItem { return null; } } - - @Override - public void addRequiredNbt(GeyserSession session, @Nullable DataComponents components, BedrockItemBuilder builder) { - if (components != null) { - Fireworks fireworks = components.get(DataComponentType.FIREWORKS); - if (fireworks != null) { - // Already translated - return; - } - } - - NbtMapBuilder fireworksNbt = NbtMap.builder(); - fireworksNbt.putByte("Flight", (byte) 1); - fireworksNbt.put("Explosions", NbtList.EMPTY); - builder.putCompound("Fireworks", fireworksNbt.build()); - } } diff --git a/core/src/main/java/org/geysermc/geyser/item/type/Item.java b/core/src/main/java/org/geysermc/geyser/item/type/Item.java index 0155c4e35..7f0d9099e 100644 --- a/core/src/main/java/org/geysermc/geyser/item/type/Item.java +++ b/core/src/main/java/org/geysermc/geyser/item/type/Item.java @@ -62,23 +62,16 @@ public class Item { private static final Map BLOCK_TO_ITEM = new HashMap<>(); protected final Key javaIdentifier; private int javaId = -1; - - // TODO remove these - private final int stackSize; private final int attackDamage; - private final int maxDamage; - private final Rarity rarity; - private final boolean glint; + private final DataComponents baseComponents; - private DataComponents dataComponents; + private final List enchantmentGlintPresent = List.of(Items.ENCHANTED_GOLDEN_APPLE, Items.EXPERIENCE_BOTTLE, Items.WRITTEN_BOOK, + Items.NETHER_STAR, Items.ENCHANTED_BOOK, Items.END_CRYSTAL); public Item(String javaIdentifier, Builder builder) { this.javaIdentifier = MinecraftKey.key(javaIdentifier); - this.stackSize = builder.stackSize; - this.maxDamage = builder.maxDamage; + this.baseComponents = builder.components; this.attackDamage = builder.attackDamage; - this.rarity = builder.rarity; - this.glint = builder.glint; } public String javaIdentifier() { @@ -89,24 +82,28 @@ public class Item { return javaId; } - public int maxDamage() { - return dataComponents.getOrDefault(DataComponentType.MAX_DAMAGE, 0); + public int defaultMaxDamage() { + return baseComponents.getOrDefault(DataComponentType.MAX_DAMAGE, 0); } - public int attackDamage() { + public int defaultAttackDamage() { return attackDamage; } - public int maxStackSize() { - return dataComponents.getOrDefault(DataComponentType.MAX_STACK_SIZE, 1); + public int defaultMaxStackSize() { + return baseComponents.getOrDefault(DataComponentType.MAX_STACK_SIZE, 1); } - public Rarity rarity() { - return rarity; + public Rarity defaultRarity() { + return Rarity.fromId(baseComponents.getOrDefault(DataComponentType.RARITY, 0)); } - public boolean glint() { - return glint; + public DataComponents gatherComponents(DataComponents others) { + if (others == null) return baseComponents.clone(); + + DataComponents components = baseComponents.clone(); + components.getDataComponents().putAll(others.getDataComponents()); + return components; } public boolean isValidRepairItem(Item other) { @@ -295,32 +292,28 @@ public class Item { } public static Builder builder() { - return new Builder(); + return new Builder().components(new DataComponents(new HashMap<>())); // TODO actually set components here } public static final class Builder { - private int stackSize = 64; - private int maxDamage; + private DataComponents components; private int attackDamage; - private Rarity rarity = Rarity.COMMON; - private boolean glint = false; - - public Builder stackSize(int stackSize) { - this.stackSize = stackSize; - return this; - } public Builder attackDamage(double attackDamage) { - // TODO properly store/send a double value once Bedrock supports it.. pls + // Bedrock edition does not support attack damage being a double this.attackDamage = (int) attackDamage; return this; } - public Builder maxDamage(int maxDamage) { - this.maxDamage = maxDamage; + public Builder components(DataComponents components) { + this.components = components; return this; } + public DataComponents components() { + return this.components; + } + private Builder() { } } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java index 0a9c93980..ec094ea31 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java @@ -48,6 +48,8 @@ import org.geysermc.geyser.registry.mappings.MappingsConfigReader; import org.geysermc.geyser.registry.type.GeyserMappingItem; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.NonVanillaItemRegistration; +import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType; +import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents; import java.util.*; @@ -129,10 +131,11 @@ public class CustomItemRegistryPopulator { Set repairMaterials = customItemData.repairMaterials(); - Item.Builder itemBuilder = Item.builder() - .stackSize(customItemData.stackSize()) - .maxDamage(customItemData.maxDamage()); - Item item = new Item(customIdentifier, itemBuilder) { + DataComponents components = new DataComponents(new HashMap<>()); + components.put(DataComponentType.MAX_STACK_SIZE, customItemData.stackSize()); + components.put(DataComponentType.MAX_DAMAGE, customItemData.maxDamage()); + + Item item = new Item(customIdentifier, Item.builder().components(components)) { @Override public boolean isValidRepairItem(Item other) { return repairMaterials != null && repairMaterials.contains(other.javaIdentifier()); @@ -167,11 +170,11 @@ public class CustomItemRegistryPopulator { NbtMapBuilder itemProperties = NbtMap.builder(); NbtMapBuilder componentBuilder = NbtMap.builder(); - setupBasicItemInfo(javaItem.maxDamage(), javaItem.maxStackSize(), mapping.getToolType() != null || customItemData.displayHandheld(), customItemData, itemProperties, componentBuilder, protocolVersion); + setupBasicItemInfo(javaItem.defaultMaxDamage(), javaItem.defaultMaxStackSize(), mapping.getToolType() != null || customItemData.displayHandheld(), customItemData, itemProperties, componentBuilder, protocolVersion); boolean canDestroyInCreative = true; if (mapping.getToolType() != null) { // This is not using the isTool boolean because it is not just a render type here. - canDestroyInCreative = computeToolProperties(mapping.getToolType(), itemProperties, componentBuilder, javaItem.attackDamage()); + canDestroyInCreative = computeToolProperties(mapping.getToolType(), itemProperties, componentBuilder, javaItem.defaultAttackDamage()); } itemProperties.putBoolean("can_destroy_in_creative", canDestroyInCreative); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index 1da3b0e66..b4c963578 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -447,7 +447,7 @@ public class ItemRegistryPopulator { } } - if (javaOnlyItems.contains(javaItem) || javaItem.rarity() != Rarity.COMMON) { + if (javaOnlyItems.contains(javaItem) || javaItem.defaultRarity() != Rarity.COMMON) { // These items don't exist on Bedrock, so set up a variable that indicates they should have custom names // Or, ensure that we are translating these at all times to account for rarity colouring mappingBuilder = mappingBuilder.translationString((javaItem instanceof BlockItem ? "block." : "item.") + entry.getKey().replace(":", ".")); diff --git a/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java index b65b06431..fdc90c215 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/item/CustomItemTranslator.java @@ -62,7 +62,7 @@ public final class CustomItemTranslator { } } - boolean checkDamage = mapping.getJavaItem().maxDamage() > 0; + boolean checkDamage = mapping.getJavaItem().defaultMaxDamage() > 0; int damage = !checkDamage ? 0 : components.getOrDefault(DataComponentType.DAMAGE, 0); boolean unbreakable = checkDamage && !isDamaged(components, damage); diff --git a/core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java index 3cfd00233..062666f84 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java @@ -40,7 +40,6 @@ import org.geysermc.geyser.api.block.custom.CustomBlockData; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.components.Rarity; -import org.geysermc.geyser.item.type.BedrockRequiresTagItem; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.level.block.type.Block; import org.geysermc.geyser.registry.BlockRegistries; @@ -150,42 +149,24 @@ public final class ItemTranslator { public static ItemData.@NonNull Builder translateToBedrock(GeyserSession session, Item javaItem, ItemMapping bedrockItem, int count, @Nullable DataComponents components) { BedrockItemBuilder nbtBuilder = new BedrockItemBuilder(); - boolean hideTooltips = false; - if (components != null) { - javaItem.translateComponentsToBedrock(session, components, nbtBuilder); - if (components.get(DataComponentType.HIDE_TOOLTIP) != null) hideTooltips = true; - } + // Populates default components that aren't sent over the network + components = javaItem.gatherComponents(components); - // Fixes fireworks crafting recipe: they always contain a tag - // TODO remove once all items have their default components - if (javaItem instanceof BedrockRequiresTagItem requiresTagItem) { - requiresTagItem.addRequiredNbt(session, components, nbtBuilder); - } - - Rarity rarity = javaItem.rarity(); - boolean enchantmentGlint = javaItem.glint(); - if (components != null) { - Integer rarityIndex = components.get(DataComponentType.RARITY); - if (rarityIndex != null) { - rarity = Rarity.fromId(rarityIndex); - } - Boolean enchantmentGlintOverride = components.get(DataComponentType.ENCHANTMENT_GLINT_OVERRIDE); - if (enchantmentGlintOverride != null) { - enchantmentGlint = enchantmentGlintOverride; - } - } + // Translate item-specific components + javaItem.translateComponentsToBedrock(session, components, nbtBuilder); + Rarity rarity = Rarity.fromId(components.getOrDefault(DataComponentType.RARITY, 0)); String customName = getCustomName(session, components, bedrockItem, rarity.getColor()); if (customName != null) { nbtBuilder.setCustomName(customName); } - if (components != null) { - ItemAttributeModifiers attributeModifiers = components.get(DataComponentType.ATTRIBUTE_MODIFIERS); - if (attributeModifiers != null && attributeModifiers.isShowInTooltip() && !hideTooltips) { - // only add if attribute modifiers do not indicate to hide them - addAttributeLore(attributeModifiers, nbtBuilder, session.locale()); - } + boolean hideTooltips = components.get(DataComponentType.HIDE_TOOLTIP) != null; + + ItemAttributeModifiers attributeModifiers = components.get(DataComponentType.ATTRIBUTE_MODIFIERS); + if (attributeModifiers != null && attributeModifiers.isShowInTooltip() && !hideTooltips) { + // only add if attribute modifiers do not indicate to hide them + addAttributeLore(attributeModifiers, nbtBuilder, session.locale()); } if (session.isAdvancedTooltips() && !hideTooltips) { @@ -193,7 +174,7 @@ public final class ItemTranslator { } // Add enchantment override. We can't remove it - enchantments would stop showing - but we can add it. - if (enchantmentGlint) { + if (components.getOrDefault(DataComponentType.ENCHANTMENT_GLINT_OVERRIDE, false)) { NbtMapBuilder nbtMapBuilder = nbtBuilder.getOrCreateNbt(); nbtMapBuilder.putIfAbsent("ench", NbtList.EMPTY); } @@ -217,18 +198,16 @@ public final class ItemTranslator { translateCustomItem(components, builder, bedrockItem); - if (components != null) { - // Translate the canDestroy and canPlaceOn Java components - AdventureModePredicate canDestroy = components.get(DataComponentType.CAN_BREAK); - AdventureModePredicate canPlaceOn = components.get(DataComponentType.CAN_PLACE_ON); - String[] canBreak = getCanModify(session, canDestroy); - String[] canPlace = getCanModify(session, canPlaceOn); - if (canBreak != null) { - builder.canBreak(canBreak); - } - if (canPlace != null) { - builder.canPlace(canPlace); - } + // Translate the canDestroy and canPlaceOn Java components + AdventureModePredicate canDestroy = components.get(DataComponentType.CAN_BREAK); + AdventureModePredicate canPlaceOn = components.get(DataComponentType.CAN_PLACE_ON); + String[] canBreak = getCanModify(session, canDestroy); + String[] canPlace = getCanModify(session, canPlaceOn); + if (canBreak != null) { + builder.canBreak(canBreak); + } + if (canPlace != null) { + builder.canPlace(canPlace); } return builder; @@ -325,7 +304,7 @@ public final class ItemTranslator { } private static void addAdvancedTooltips(@Nullable DataComponents components, BedrockItemBuilder builder, Item item, String language) { - int maxDurability = item.maxDamage(); + int maxDurability = item.defaultMaxDamage(); if (maxDurability != 0 && components != null) { Integer durabilityComponent = components.get(DataComponentType.DAMAGE); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java index 94368a6d4..ee4d7b3d5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java @@ -27,18 +27,14 @@ package org.geysermc.geyser.translator.protocol.bedrock; import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.protocol.bedrock.packet.BlockPickRequestPacket; -import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; -import org.geysermc.geyser.item.Items; import org.geysermc.geyser.level.block.Blocks; -import org.geysermc.geyser.level.block.type.BannerBlock; import org.geysermc.geyser.level.block.type.BlockState; -import org.geysermc.geyser.level.block.type.SkullBlock; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; -import org.geysermc.geyser.util.InventoryUtils; -import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack; +import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemFromBlockPacket; +import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemFromEntityPacket; @Translator(packet = BlockPickRequestPacket.class) public class BedrockBlockPickRequestTranslator extends PacketTranslator { @@ -52,42 +48,14 @@ public class BedrockBlockPickRequestTranslator extends PacketTranslator session.ensureInEventLoop(() -> { - if (components == null) { - pickItem(session, blockToPick); - return; - } - - ItemStack itemStack = new ItemStack(blockToPick.block().asItem().javaId(), 1, components); - InventoryUtils.findOrCreateItem(session, itemStack); - })); - return; - } - - pickItem(session, blockToPick); - } - - private void pickItem(GeyserSession session, BlockState state) { - InventoryUtils.findOrCreateItem(session, state.block().pickItem(state)); + session.sendDownstreamGamePacket(new ServerboundPickItemFromBlockPacket(vector, addExtraData)); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index acb8573fb..2368e1ad7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -26,15 +26,11 @@ package org.geysermc.geyser.translator.protocol.bedrock; import org.cloudburstmc.protocol.bedrock.packet.EntityPickRequestPacket; -import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; -import org.geysermc.geyser.util.InventoryUtils; - -import java.util.Locale; +import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemFromEntityPacket; /** * Called when the Bedrock user uses the pick block button on an entity @@ -49,35 +45,8 @@ public class BedrockEntityPickRequestTranslator extends PacketTranslator itemName = "lead"; - case CHEST_MINECART, COMMAND_BLOCK_MINECART, FURNACE_MINECART, HOPPER_MINECART, TNT_MINECART -> - // The Bedrock identifier matches the item name which moves MINECART to the end of the name - // TODO test - itemName = entity.getDefinition().identifier(); - case SPAWNER_MINECART -> itemName = "minecart"; // Turns into a normal minecart - //case ITEM_FRAME -> Not an entity in Bedrock Edition - //case GLOW_ITEM_FRAME -> - case ARMOR_STAND, END_CRYSTAL, MINECART, PAINTING -> - // No spawn egg, just an item - itemName = entity.getDefinition().entityType().toString().toLowerCase(Locale.ROOT); - default -> itemName = entity.getDefinition().entityType().toString().toLowerCase(Locale.ROOT) + "_spawn_egg"; - } - - String fullItemName = "minecraft:" + itemName; - ItemMapping mapping = session.getItemMappings().getMapping(fullItemName); - // Verify it is, indeed, an item - if (mapping == null) return; - - InventoryUtils.findOrCreateItem(session, fullItemName); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java index 970061436..e4ff0539f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java @@ -173,7 +173,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator - * This attempts to mimic Java Edition behavior as best as it can. - * @param session the Bedrock client's session - * @param item the Java item to search/select for - */ - public static void findOrCreateItem(GeyserSession session, Item item) { - // Get the inventory to choose a slot to pick - PlayerInventory inventory = session.getPlayerInventory(); - - if (item == Items.AIR) { - return; - } - - // Check hotbar for item - for (int i = 36; i < 45; i++) { - GeyserItemStack geyserItem = inventory.getItem(i); - if (geyserItem.isEmpty()) { - continue; - } - // If this isn't the item we're looking for - if (!geyserItem.asItem().equals(item)) { - continue; - } - - setHotbarItem(session, i); - // Don't check inventory if item was in hotbar - return; - } - - // Check inventory for item - for (int i = 9; i < 36; i++) { - GeyserItemStack geyserItem = inventory.getItem(i); - if (geyserItem.isEmpty()) { - continue; - } - // If this isn't the item we're looking for - if (!geyserItem.asItem().equals(item)) { - continue; - } - - // TODO 1.21.4 - //ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item - //session.sendDownstreamGamePacket(packetToSend); - return; - } - - // If we still have not found the item, and we're in creative, set the item ourselves. - if (session.getGameMode() == GameMode.CREATIVE) { - GeyserItemStack itemStack = item.newItemStack(1, null); - setPickedItem(session, inventory, itemStack); - } - } - - private static void setPickedItem(GeyserSession session, PlayerInventory inventory, GeyserItemStack itemStack) { - // Try to find an empty hotbar slot. - int slot = inventory.getHeldItemSlot() + 36; - if (!inventory.getItemInHand().isEmpty()) { // Otherwise we should just use the current slot - for (int i = 36; i < 45; i++) { - if (inventory.getItem(i).isEmpty()) { - slot = i; - break; - } - } - } - GeyserItemStack existingItem = inventory.getItem(slot); - if (!existingItem.isEmpty()) { - // Try to move the item to another slot. - for (int i = 9; i < 36; i++) { - if (inventory.getItem(i).isEmpty()) { - inventory.setItem(i, existingItem, session); - InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, inventory, i); - - ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket((short) i, - existingItem.getItemStack()); - session.sendDownstreamGamePacket(actionPacket); - break; - } - } - } - - // As of 1.21.3 - the client does this on its own end and the server doesn't send a slot response back. - inventory.setItem(slot, itemStack, session); - InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, inventory, slot); - - ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket((short) slot, - itemStack.getItemStack()); - if ((slot - 36) != inventory.getHeldItemSlot()) { - setHotbarItem(session, slot); - } - session.sendDownstreamGamePacket(actionPacket); - } - - /** - * Changes the held item slot to the specified slot - * @param session GeyserSession - * @param slot inventory slot to be selected - */ - private static void setHotbarItem(GeyserSession session, int slot) { - PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); - hotbarPacket.setContainerId(0); - // Java inventory slot to hotbar slot ID - hotbarPacket.setSelectedHotbarSlot(slot - 36); - hotbarPacket.setSelectHotbarSlot(true); - session.sendUpstreamPacket(hotbarPacket); - // No need to send a Java packet as Bedrock sends a confirmation packet back that we translate - } - @Nullable public static Click getClickForHotbarSwap(int slot) { return switch (slot) {