mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Update the non-item parts (#4586)
* Update the non-item parts * Add MaceItem * Fix registry data loading
This commit is contained in:
parent
909139326d
commit
6d8021f155
24 changed files with 255 additions and 201 deletions
|
@ -118,7 +118,7 @@ public enum Enchantment {
|
|||
KNOCKBACK,
|
||||
FIRE_ASPECT,
|
||||
LOOTING,
|
||||
SWEEPING,
|
||||
SWEEPING_EDGE,
|
||||
EFFICIENCY,
|
||||
SILK_TOUCH,
|
||||
UNBREAKING,
|
||||
|
@ -136,6 +136,9 @@ public enum Enchantment {
|
|||
MULTISHOT,
|
||||
QUICK_CHARGE,
|
||||
PIERCING,
|
||||
DENSITY,
|
||||
BREACH,
|
||||
WIND_BURST,
|
||||
MENDING,
|
||||
VANISHING_CURSE;
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
|||
if (enchantment == JavaEnchantment.IMPALING) {
|
||||
// Multiplier is halved on Bedrock for some reason
|
||||
rarityMultiplier /= 2;
|
||||
} else if (enchantment == JavaEnchantment.SWEEPING) {
|
||||
} else if (enchantment == JavaEnchantment.SWEEPING_EDGE) {
|
||||
// Doesn't exist on Bedrock
|
||||
rarityMultiplier = 0;
|
||||
}
|
||||
|
|
|
@ -31,12 +31,13 @@ import java.util.function.Supplier;
|
|||
|
||||
public enum ArmorMaterial {
|
||||
LEATHER(() -> Items.LEATHER),
|
||||
CHAIN(() -> Items.IRON_INGOT),
|
||||
CHAINMAIL(() -> Items.IRON_INGOT),
|
||||
IRON(() -> Items.IRON_INGOT),
|
||||
GOLD(() -> Items.GOLD_INGOT),
|
||||
DIAMOND(() -> Items.DIAMOND),
|
||||
TURTLE(() -> Items.SCUTE),
|
||||
NETHERITE(() -> Items.NETHERITE_INGOT);
|
||||
TURTLE(() -> Items.TURTLE_SCUTE),
|
||||
NETHERITE(() -> Items.NETHERITE_INGOT),
|
||||
ARMADILLO(() -> Items.ARMADILLO_SCUTE);
|
||||
|
||||
private final Supplier<Item> repairIngredient;
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ public final class Items {
|
|||
public static final Item RAW_IRON_BLOCK = register(new BlockItem("raw_iron_block", builder()));
|
||||
public static final Item RAW_COPPER_BLOCK = register(new BlockItem("raw_copper_block", builder()));
|
||||
public static final Item RAW_GOLD_BLOCK = register(new BlockItem("raw_gold_block", builder()));
|
||||
public static final Item HEAVY_CORE = register(new BlockItem("heavy_core", builder()));
|
||||
public static final Item AMETHYST_BLOCK = register(new BlockItem("amethyst_block", builder()));
|
||||
public static final Item BUDDING_AMETHYST = register(new BlockItem("budding_amethyst", builder()));
|
||||
public static final Item IRON_BLOCK = register(new BlockItem("iron_block", builder()));
|
||||
|
@ -832,7 +833,9 @@ public final class Items {
|
|||
public static final Item STRUCTURE_BLOCK = register(new BlockItem("structure_block", builder()));
|
||||
public static final Item JIGSAW = register(new BlockItem("jigsaw", builder()));
|
||||
public static final Item TURTLE_HELMET = register(new ArmorItem("turtle_helmet", ArmorMaterial.TURTLE, builder().stackSize(1).maxDamage(275)));
|
||||
public static final Item SCUTE = register(new Item("scute", 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 ArmorItem("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 APPLE = register(new Item("apple", builder()));
|
||||
public static final Item BOW = register(new Item("bow", builder().stackSize(1).maxDamage(384)));
|
||||
|
@ -852,36 +855,36 @@ 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).attackDamage(4).maxDamage(59)));
|
||||
public static final Item WOODEN_SHOVEL = register(new TieredItem("wooden_shovel", ToolTier.WOODEN, builder().stackSize(1).attackDamage(2.5).maxDamage(59)));
|
||||
public static final Item WOODEN_PICKAXE = register(new TieredItem("wooden_pickaxe", ToolTier.WOODEN, builder().stackSize(1).attackDamage(2).maxDamage(59)));
|
||||
public static final Item WOODEN_AXE = register(new TieredItem("wooden_axe", ToolTier.WOODEN, builder().stackSize(1).attackDamage(7).maxDamage(59)));
|
||||
public static final Item WOODEN_HOE = register(new TieredItem("wooden_hoe", ToolTier.WOODEN, builder().stackSize(1).attackDamage(1).maxDamage(59)));
|
||||
public static final Item STONE_SWORD = register(new TieredItem("stone_sword", ToolTier.STONE, builder().stackSize(1).attackDamage(5).maxDamage(131)));
|
||||
public static final Item STONE_SHOVEL = register(new TieredItem("stone_shovel", ToolTier.STONE, builder().stackSize(1).attackDamage(3.5).maxDamage(131)));
|
||||
public static final Item STONE_PICKAXE = register(new TieredItem("stone_pickaxe", ToolTier.STONE, builder().stackSize(1).attackDamage(3).maxDamage(131)));
|
||||
public static final Item STONE_AXE = register(new TieredItem("stone_axe", ToolTier.STONE, builder().stackSize(1).attackDamage(9).maxDamage(131)));
|
||||
public static final Item STONE_HOE = register(new TieredItem("stone_hoe", ToolTier.STONE, builder().stackSize(1).attackDamage(1).maxDamage(131)));
|
||||
public static final Item GOLDEN_SWORD = register(new TieredItem("golden_sword", ToolTier.GOLDEN, builder().stackSize(1).attackDamage(4).maxDamage(32)));
|
||||
public static final Item GOLDEN_SHOVEL = register(new TieredItem("golden_shovel", ToolTier.GOLDEN, builder().stackSize(1).attackDamage(2.5).maxDamage(32)));
|
||||
public static final Item GOLDEN_PICKAXE = register(new TieredItem("golden_pickaxe", ToolTier.GOLDEN, builder().stackSize(1).attackDamage(2).maxDamage(32)));
|
||||
public static final Item GOLDEN_AXE = register(new TieredItem("golden_axe", ToolTier.GOLDEN, builder().stackSize(1).attackDamage(7).maxDamage(32)));
|
||||
public static final Item GOLDEN_HOE = register(new TieredItem("golden_hoe", ToolTier.GOLDEN, builder().stackSize(1).attackDamage(1).maxDamage(32)));
|
||||
public static final Item IRON_SWORD = register(new TieredItem("iron_sword", ToolTier.IRON, builder().stackSize(1).attackDamage(6).maxDamage(250)));
|
||||
public static final Item IRON_SHOVEL = register(new TieredItem("iron_shovel", ToolTier.IRON, builder().stackSize(1).attackDamage(4.5).maxDamage(250)));
|
||||
public static final Item IRON_PICKAXE = register(new TieredItem("iron_pickaxe", ToolTier.IRON, builder().stackSize(1).attackDamage(4).maxDamage(250)));
|
||||
public static final Item IRON_AXE = register(new TieredItem("iron_axe", ToolTier.IRON, builder().stackSize(1).attackDamage(9).maxDamage(250)));
|
||||
public static final Item IRON_HOE = register(new TieredItem("iron_hoe", ToolTier.IRON, builder().stackSize(1).attackDamage(1).maxDamage(250)));
|
||||
public static final Item DIAMOND_SWORD = register(new TieredItem("diamond_sword", ToolTier.DIAMOND, builder().stackSize(1).attackDamage(7).maxDamage(1561)));
|
||||
public static final Item DIAMOND_SHOVEL = register(new TieredItem("diamond_shovel", ToolTier.DIAMOND, builder().stackSize(1).attackDamage(5.5).maxDamage(1561)));
|
||||
public static final Item DIAMOND_PICKAXE = register(new TieredItem("diamond_pickaxe", ToolTier.DIAMOND, builder().stackSize(1).attackDamage(5).maxDamage(1561)));
|
||||
public static final Item DIAMOND_AXE = register(new TieredItem("diamond_axe", ToolTier.DIAMOND, builder().stackSize(1).attackDamage(9).maxDamage(1561)));
|
||||
public static final Item DIAMOND_HOE = register(new TieredItem("diamond_hoe", ToolTier.DIAMOND, builder().stackSize(1).attackDamage(1).maxDamage(1561)));
|
||||
public static final Item NETHERITE_SWORD = register(new TieredItem("netherite_sword", ToolTier.NETHERITE, builder().stackSize(1).attackDamage(8).maxDamage(2031)));
|
||||
public static final Item NETHERITE_SHOVEL = register(new TieredItem("netherite_shovel", ToolTier.NETHERITE, builder().stackSize(1).attackDamage(6.5).maxDamage(2031)));
|
||||
public static final Item NETHERITE_PICKAXE = register(new TieredItem("netherite_pickaxe", ToolTier.NETHERITE, builder().stackSize(1).attackDamage(6).maxDamage(2031)));
|
||||
public static final Item NETHERITE_AXE = register(new TieredItem("netherite_axe", ToolTier.NETHERITE, builder().stackSize(1).attackDamage(10).maxDamage(2031)));
|
||||
public static final Item NETHERITE_HOE = register(new TieredItem("netherite_hoe", ToolTier.NETHERITE, builder().stackSize(1).attackDamage(1).maxDamage(2031)));
|
||||
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 STICK = register(new Item("stick", builder()));
|
||||
public static final Item BOWL = register(new Item("bowl", builder()));
|
||||
public static final Item MUSHROOM_STEW = register(new Item("mushroom_stew", builder().stackSize(1)));
|
||||
|
@ -891,14 +894,14 @@ public final class Items {
|
|||
public static final Item WHEAT_SEEDS = register(new BlockItem("wheat_seeds", builder()));
|
||||
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.CHAIN, builder().stackSize(1).maxDamage(165)));
|
||||
public static final Item CHAINMAIL_CHESTPLATE = register(new ArmorItem("chainmail_chestplate", ArmorMaterial.CHAIN, builder().stackSize(1).maxDamage(240)));
|
||||
public static final Item CHAINMAIL_LEGGINGS = register(new ArmorItem("chainmail_leggings", ArmorMaterial.CHAIN, builder().stackSize(1).maxDamage(225)));
|
||||
public static final Item CHAINMAIL_BOOTS = register(new ArmorItem("chainmail_boots", ArmorMaterial.CHAIN, builder().stackSize(1).maxDamage(195)));
|
||||
public static final Item LEATHER_HELMET = register(new ArmorItem("leather_helmet", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(55)));
|
||||
public static final Item LEATHER_CHESTPLATE = register(new ArmorItem("leather_chestplate", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(80)));
|
||||
public static final Item LEATHER_LEGGINGS = register(new ArmorItem("leather_leggings", ArmorMaterial.LEATHER, builder().stackSize(1).maxDamage(75)));
|
||||
public static final Item LEATHER_BOOTS = register(new ArmorItem("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)));
|
||||
|
@ -1043,11 +1046,13 @@ public final class Items {
|
|||
public static final Item CAULDRON = register(new BlockItem("cauldron", builder()));
|
||||
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()));
|
||||
public static final Item ALLAY_SPAWN_EGG = register(new SpawnEggItem("allay_spawn_egg", builder()));
|
||||
public static final Item AXOLOTL_SPAWN_EGG = register(new SpawnEggItem("axolotl_spawn_egg", builder()));
|
||||
public static final Item BAT_SPAWN_EGG = register(new SpawnEggItem("bat_spawn_egg", builder()));
|
||||
public static final Item BEE_SPAWN_EGG = register(new SpawnEggItem("bee_spawn_egg", builder()));
|
||||
public static final Item BLAZE_SPAWN_EGG = register(new SpawnEggItem("blaze_spawn_egg", builder()));
|
||||
public static final Item BOGGED_SPAWN_EGG = register(new SpawnEggItem("bogged_spawn_egg", builder()));
|
||||
public static final Item BREEZE_SPAWN_EGG = register(new SpawnEggItem("breeze_spawn_egg", builder()));
|
||||
public static final Item CAT_SPAWN_EGG = register(new SpawnEggItem("cat_spawn_egg", builder()));
|
||||
public static final Item CAMEL_SPAWN_EGG = register(new SpawnEggItem("camel_spawn_egg", builder()));
|
||||
|
@ -1123,8 +1128,10 @@ public final class Items {
|
|||
public static final Item ZOMBIFIED_PIGLIN_SPAWN_EGG = register(new SpawnEggItem("zombified_piglin_spawn_egg", builder()));
|
||||
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 MACE = register(new MaceItem("mace", builder().stackSize(1).maxDamage(250)));
|
||||
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("flower_pot", builder()));
|
||||
|
@ -1155,10 +1162,10 @@ public final class Items {
|
|||
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 DyeableHorseArmorItem("leather_horse_armor", builder().stackSize(1)));
|
||||
public static final Item IRON_HORSE_ARMOR = register(new ArmorItem("iron_horse_armor", ArmorMaterial.IRON, builder().stackSize(1)));
|
||||
public static final Item GOLDEN_HORSE_ARMOR = register(new ArmorItem("golden_horse_armor", ArmorMaterial.GOLD, builder().stackSize(1)));
|
||||
public static final Item DIAMOND_HORSE_ARMOR = register(new ArmorItem("diamond_horse_armor", ArmorMaterial.DIAMOND, builder().stackSize(1)));
|
||||
public static final Item LEATHER_HORSE_ARMOR = register(new ArmorItem("leather_horse_armor", ArmorMaterial.LEATHER, builder().stackSize(1)));
|
||||
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)));
|
||||
|
@ -1216,7 +1223,7 @@ public final class Items {
|
|||
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 DISC_FRAGMENT_5 = register(new Item("disc_fragment_5", builder()));
|
||||
public static final Item TRIDENT = register(new Item("trident", builder().stackSize(1).attackDamage(9).maxDamage(250)));
|
||||
public static final Item TRIDENT = register(new Item("trident", builder().stackSize(1).maxDamage(250).attackDamage(9.0)));
|
||||
public static final Item PHANTOM_MEMBRANE = register(new Item("phantom_membrane", builder()));
|
||||
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()));
|
||||
|
@ -1229,6 +1236,8 @@ public final class Items {
|
|||
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 GOAT_HORN = register(new GoatHornItem("goat_horn", builder().stackSize(1)));
|
||||
public static final Item COMPOSTER = register(new BlockItem("composter", builder()));
|
||||
public static final Item BARREL = register(new ChestItem("barrel", builder()));
|
||||
|
@ -1312,6 +1321,8 @@ public final class Items {
|
|||
public static final Item SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("silence_armor_trim_smithing_template", builder()));
|
||||
public static final Item RAISER_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("raiser_armor_trim_smithing_template", builder()));
|
||||
public static final Item HOST_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("host_armor_trim_smithing_template", builder()));
|
||||
public static final Item FLOW_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("flow_armor_trim_smithing_template", builder()));
|
||||
public static final Item BOLT_ARMOR_TRIM_SMITHING_TEMPLATE = register(new Item("bolt_armor_trim_smithing_template", builder()));
|
||||
public static final Item ANGLER_POTTERY_SHERD = register(new Item("angler_pottery_sherd", builder()));
|
||||
public static final Item ARCHER_POTTERY_SHERD = register(new Item("archer_pottery_sherd", builder()));
|
||||
public static final Item ARMS_UP_POTTERY_SHERD = register(new Item("arms_up_pottery_sherd", builder()));
|
||||
|
@ -1320,7 +1331,9 @@ public final class Items {
|
|||
public static final Item BURN_POTTERY_SHERD = register(new Item("burn_pottery_sherd", builder()));
|
||||
public static final Item DANGER_POTTERY_SHERD = register(new Item("danger_pottery_sherd", builder()));
|
||||
public static final Item EXPLORER_POTTERY_SHERD = register(new Item("explorer_pottery_sherd", builder()));
|
||||
public static final Item FLOW_POTTERY_SHERD = register(new Item("flow_pottery_sherd", builder()));
|
||||
public static final Item FRIEND_POTTERY_SHERD = register(new Item("friend_pottery_sherd", builder()));
|
||||
public static final Item GUSTER_POTTERY_SHERD = register(new Item("guster_pottery_sherd", builder()));
|
||||
public static final Item HEART_POTTERY_SHERD = register(new Item("heart_pottery_sherd", builder()));
|
||||
public static final Item HEARTBREAK_POTTERY_SHERD = register(new Item("heartbreak_pottery_sherd", builder()));
|
||||
public static final Item HOWL_POTTERY_SHERD = register(new Item("howl_pottery_sherd", builder()));
|
||||
|
@ -1328,6 +1341,7 @@ public final class Items {
|
|||
public static final Item MOURNER_POTTERY_SHERD = register(new Item("mourner_pottery_sherd", builder()));
|
||||
public static final Item PLENTY_POTTERY_SHERD = register(new Item("plenty_pottery_sherd", builder()));
|
||||
public static final Item PRIZE_POTTERY_SHERD = register(new Item("prize_pottery_sherd", builder()));
|
||||
public static final Item SCRAPE_POTTERY_SHERD = register(new Item("scrape_pottery_sherd", builder()));
|
||||
public static final Item SHEAF_POTTERY_SHERD = register(new Item("sheaf_pottery_sherd", builder()));
|
||||
public static final Item SHELTER_POTTERY_SHERD = register(new Item("shelter_pottery_sherd", builder()));
|
||||
public static final Item SKULL_POTTERY_SHERD = register(new Item("skull_pottery_sherd", builder()));
|
||||
|
@ -1350,6 +1364,10 @@ public final class Items {
|
|||
public static final Item WAXED_OXIDIZED_COPPER_BULB = register(new BlockItem("waxed_oxidized_copper_bulb", builder()));
|
||||
public static final Item TRIAL_SPAWNER = register(new BlockItem("trial_spawner", builder()));
|
||||
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("vault", builder()));
|
||||
public static final Item OMINOUS_BOTTLE = register(new Item("ominous_bottle", builder()));
|
||||
public static final Item BREEZE_ROD = register(new Item("breeze_rod", builder()));
|
||||
|
||||
public static final int AIR_ID = AIR.javaId();
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.item.type;
|
||||
|
||||
import org.geysermc.geyser.item.Items;
|
||||
|
||||
public class MaceItem extends Item {
|
||||
public MaceItem(String javaIdentifier, Builder builder) {
|
||||
super(javaIdentifier, builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidRepairItem(Item other) {
|
||||
return other == Items.BREEZE_ROD;
|
||||
}
|
||||
}
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
package org.geysermc.geyser.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.RegistryEntry;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import org.geysermc.geyser.util.JavaCodecUtil;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the information we store from the current Java dimension
|
||||
|
@ -38,19 +39,20 @@ import java.util.Map;
|
|||
*/
|
||||
public record JavaDimension(int minY, int maxY, boolean piglinSafe, double worldCoordinateScale) {
|
||||
|
||||
public static void load(CompoundTag tag, Map<String, JavaDimension> map) {
|
||||
for (CompoundTag dimension : JavaCodecUtil.iterateAsTag(tag.get("minecraft:dimension_type"))) {
|
||||
CompoundTag elements = dimension.get("element");
|
||||
int minY = ((IntTag) elements.get("min_y")).getValue();
|
||||
int maxY = ((IntTag) elements.get("height")).getValue();
|
||||
public static void load(List<RegistryEntry> entries, Int2ObjectMap<JavaDimension> map) {
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
RegistryEntry entry = entries.get(i);
|
||||
CompoundTag dimension = entry.getData();
|
||||
int minY = ((IntTag) dimension.get("min_y")).getValue();
|
||||
int maxY = ((IntTag) dimension.get("height")).getValue();
|
||||
// Logical height can be ignored probably - seems to be for artificial limits like the Nether.
|
||||
|
||||
// Set if piglins/hoglins should shake
|
||||
boolean piglinSafe = ((Number) elements.get("piglin_safe").getValue()).byteValue() != (byte) 0;
|
||||
boolean piglinSafe = ((Number) dimension.get("piglin_safe").getValue()).byteValue() != (byte) 0;
|
||||
// Load world coordinate scale for the world border
|
||||
double coordinateScale = ((Number) elements.get("coordinate_scale").getValue()).doubleValue();
|
||||
double coordinateScale = ((Number) dimension.get("coordinate_scale").getValue()).doubleValue();
|
||||
|
||||
map.put((String) dimension.get("name").getValue(), new JavaDimension(minY, maxY, piglinSafe, coordinateScale));
|
||||
map.put(i, new JavaDimension(minY, maxY, piglinSafe, coordinateScale));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public final class LocalSession extends TcpSession {
|
|||
public void initChannel(@NonNull LocalChannelWithRemoteAddress channel) {
|
||||
channel.spoofedRemoteAddress(new InetSocketAddress(clientIp, 0));
|
||||
PacketProtocol protocol = getPacketProtocol();
|
||||
protocol.newClientSession(LocalSession.this);
|
||||
protocol.newClientSession(LocalSession.this, false);
|
||||
|
||||
refreshReadTimeoutHandler(channel);
|
||||
refreshWriteTimeoutHandler(channel);
|
||||
|
|
|
@ -56,13 +56,7 @@ public class EnchantmentRegistryLoader implements RegistryLoader<String, Map<Jav
|
|||
Map.Entry<String, JsonNode> entry = it.next();
|
||||
JavaEnchantment key = JavaEnchantment.getByJavaIdentifier(entry.getKey());
|
||||
JsonNode node = entry.getValue();
|
||||
int rarityMultiplier = switch (node.get("rarity").textValue()) {
|
||||
case "common" -> 1;
|
||||
case "uncommon" -> 2;
|
||||
case "rare" -> 4;
|
||||
case "very_rare" -> 8;
|
||||
default -> throw new IllegalStateException("Unexpected value: " + node.get("rarity").textValue());
|
||||
};
|
||||
int rarityMultiplier = node.get("anvil_cost").asInt();
|
||||
int maxLevel = node.get("max_level").asInt();
|
||||
|
||||
EnumSet<JavaEnchantment> incompatibleEnchantments = EnumSet.noneOf(JavaEnchantment.class);
|
||||
|
|
|
@ -37,9 +37,11 @@ public class Conversion649_630 {
|
|||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
switch (identifer) {
|
||||
case "minecraft:turtle_scute" -> { return mapping.withBedrockIdentifier("minecraft:scute"); }
|
||||
case "minecraft:armadillo_scute", "minecraft:turtle_scute" -> { return mapping.withBedrockIdentifier("minecraft:scute"); }
|
||||
case "minecraft:armadillo_spawn_egg" -> { return mapping.withBedrockIdentifier("minecraft:rabbit_spawn_egg"); }
|
||||
case "minecraft:trial_spawner" -> { return mapping.withBedrockIdentifier("minecraft:mob_spawner"); }
|
||||
case "minecraft:trial_key" -> { return mapping.withBedrockIdentifier("minecraft:echo_shard"); }
|
||||
case "minecraft:wolf_armor" -> { return mapping.withBedrockIdentifier("minecraft:leather_horse_armor"); }
|
||||
default -> { return mapping; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.stream.Stream;
|
|||
|
||||
public class Conversion662_649 {
|
||||
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:grass_block", "minecraft:trial_spawner");
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:grass_block", "minecraft:vault");
|
||||
private static final List<String> NEW_WOODS = List.of("minecraft:oak_wood", "minecraft:spruce_wood", "minecraft:birch_wood", "minecraft:jungle_wood", "minecraft:acacia_wood", "minecraft:dark_oak_wood", "minecraft:stripped_oak_wood", "minecraft:stripped_spruce_wood", "minecraft:stripped_birch_wood", "minecraft:stripped_jungle_wood", "minecraft:stripped_acacia_wood", "minecraft:stripped_dark_oak_wood");
|
||||
private static final List<String> NEW_LEAVES = List.of("minecraft:oak_leaves", "minecraft:spruce_leaves", "minecraft:birch_leaves", "minecraft:jungle_leaves");
|
||||
private static final List<String> NEW_LEAVES2 = List.of("minecraft:acacia_leaves", "minecraft:dark_oak_leaves");
|
||||
|
@ -48,9 +48,12 @@ public class Conversion662_649 {
|
|||
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
if (identifer.equals("minecraft:grass_block")) {
|
||||
return mapping.withBedrockIdentifier("minecraft:grass");
|
||||
}
|
||||
switch (identifer) {
|
||||
case "minecraft:bogged_spawn_egg" -> { return mapping.withBedrockIdentifier("minecraft:creeper_spawn_egg"); }
|
||||
case "minecraft:grass_block" -> { return mapping.withBedrockIdentifier("minecraft:grass"); }
|
||||
case "minecraft:vault" -> { return mapping.withBedrockIdentifier("minecraft:trial_spawner"); }
|
||||
case "minecraft:wind_charge" -> { return mapping.withBedrockIdentifier("minecraft:snowball"); }
|
||||
};
|
||||
|
||||
if (NEW_WOODS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
|
@ -114,6 +117,19 @@ public class Conversion662_649 {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
if (name.equals("minecraft:vault")) {
|
||||
replacement = "minecraft:trial_spawner";
|
||||
|
||||
NbtMapBuilder statesBuilder = NbtMap.builder()
|
||||
.putInt("trial_spawner_state", 0);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
builder.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_WOODS.contains(name)) {
|
||||
replacement = "minecraft:wood";
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
|
@ -33,11 +34,12 @@ import java.util.List;
|
|||
import java.util.stream.Stream;
|
||||
|
||||
public class Conversion671_662 {
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:heavy_core", "minecraft:mace", "minecraft:flow_banner_pattern", "minecraft:guster_banner_pattern", "minecraft:flow_armor_trim_smithing_template", "minecraft:bolt_armor_trim_smithing_template", "minecraft:flow_pottery_sherd", "minecraft:guster_pottery_sherd", "minecraft:scrape_pottery_sherd", "minecraft:breeze_rod");
|
||||
private static final List<String> NEW_CORAL_FANS = List.of("minecraft:tube_coral_fan", "minecraft:brain_coral_fan", "minecraft:bubble_coral_fan", "minecraft:fire_coral_fan", "minecraft:horn_coral_fan");
|
||||
private static final List<String> NEW_DEAD_CORAL_FANS = List.of("minecraft:dead_tube_coral_fan", "minecraft:dead_brain_coral_fan", "minecraft:dead_bubble_coral_fan", "minecraft:dead_fire_coral_fan", "minecraft:dead_horn_coral_fan");
|
||||
private static final List<String> NEW_FLOWERS = List.of("minecraft:poppy", "minecraft:blue_orchid", "minecraft:allium", "minecraft:azure_bluet", "minecraft:red_tulip", "minecraft:orange_tulip", "minecraft:white_tulip", "minecraft:pink_tulip", "minecraft:oxeye_daisy", "minecraft:cornflower", "minecraft:lily_of_the_valley");
|
||||
private static final List<String> NEW_SAPLINGS = List.of("minecraft:oak_sapling", "minecraft:spruce_sapling", "minecraft:birch_sapling", "minecraft:jungle_sapling", "minecraft:acacia_sapling", "minecraft:dark_oak_sapling", "minecraft:bamboo_sapling");
|
||||
private static final List<String> NEW_BLOCKS = Stream.of(NEW_CORAL_FANS, NEW_DEAD_CORAL_FANS, NEW_FLOWERS, NEW_SAPLINGS).flatMap(List::stream).toList();
|
||||
private static final List<String> NEW_BLOCKS = Stream.of(NEW_MISC, NEW_CORAL_FANS, NEW_DEAD_CORAL_FANS, NEW_FLOWERS, NEW_SAPLINGS).flatMap(List::stream).toList();
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
@ -46,6 +48,18 @@ public class Conversion671_662 {
|
|||
return mapping;
|
||||
}
|
||||
|
||||
switch (identifer) {
|
||||
case "minecraft:bolt_armor_trim_smithing_template" -> { return mapping.withBedrockIdentifier("minecraft:wayfinder_armor_trim_smithing_template"); }
|
||||
case "minecraft:breeze_rod" -> { return mapping.withBedrockIdentifier("minecraft:blaze_rod"); }
|
||||
case "minecraft:flow_armor_trim_smithing_template" -> { return mapping.withBedrockIdentifier("minecraft:spire_armor_trim_smithing_template"); }
|
||||
case "minecraft:flow_banner_pattern", "minecraft:guster_banner_pattern" -> { return mapping.withBedrockIdentifier("minecraft:globe_banner_pattern"); }
|
||||
case "minecraft:flow_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:skull_pottery_sherd"); }
|
||||
case "minecraft:guster_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:shelter_pottery_sherd"); }
|
||||
case "minecraft:scrape_pottery_sherd" -> { return mapping.withBedrockIdentifier("minecraft:heartbreak_pottery_sherd"); }
|
||||
case "minecraft:heavy_core" -> { return mapping.withBedrockIdentifier("minecraft:conduit"); }
|
||||
case "minecraft:mace" -> { return mapping.withBedrockIdentifier("minecraft:netherite_axe"); }
|
||||
}
|
||||
|
||||
if (NEW_FLOWERS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:poppy" -> { return mapping.withBedrockIdentifier("minecraft:red_flower").withBedrockData(0); }
|
||||
|
@ -114,6 +128,15 @@ public class Conversion671_662 {
|
|||
|
||||
String replacement;
|
||||
|
||||
if (name.equals("minecraft:heavy_core")) {
|
||||
replacement = "minecraft:conduit";
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_SAPLINGS.contains(name)) {
|
||||
replacement = "minecraft:sapling";
|
||||
String saplingType = name.replaceAll("minecraft:|_sapling", "");;
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.github.steveice10.mc.protocol.data.game.statistic.Statistic;
|
|||
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatCommandSignedPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket;
|
||||
|
@ -360,7 +361,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
* As all entities are in the same world, this can be safely applied to all other entities.
|
||||
*/
|
||||
@Setter
|
||||
private String dimension = DimensionUtils.OVERWORLD;
|
||||
private int dimension = DimensionUtils.OVERWORLD;
|
||||
@MonotonicNonNull
|
||||
@Setter
|
||||
private JavaDimension dimensionType = null;
|
||||
|
@ -1464,7 +1465,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
* Sends a command to the Java server.
|
||||
*/
|
||||
public void sendCommand(String command) {
|
||||
sendDownstreamGamePacket(new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0L, Collections.emptyList(), 0, new BitSet()));
|
||||
sendDownstreamGamePacket(new ServerboundChatCommandSignedPacket(command, Instant.now().toEpochMilli(), 0L, Collections.emptyList(), 0, new BitSet()));
|
||||
}
|
||||
|
||||
public void setServerRenderDistance(int renderDistance) {
|
||||
|
|
|
@ -360,7 +360,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
return rejectRequest(request);
|
||||
}
|
||||
|
||||
ServerboundSetCreativeModeSlotPacket creativeDropPacket = new ServerboundSetCreativeModeSlotPacket(-1, sourceItem.getItemStack(dropAction.getCount()));
|
||||
ServerboundSetCreativeModeSlotPacket creativeDropPacket = new ServerboundSetCreativeModeSlotPacket((short)-1, sourceItem.getItemStack(dropAction.getCount()));
|
||||
session.sendDownstreamGamePacket(creativeDropPacket);
|
||||
|
||||
sourceItem.sub(dropAction.getCount());
|
||||
|
@ -493,9 +493,9 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
dropStack = javaCreativeItem;
|
||||
} else {
|
||||
// Specify custom count
|
||||
dropStack = new ItemStack(javaCreativeItem.getId(), dropAction.getCount(), javaCreativeItem.getNbt());
|
||||
dropStack = new ItemStack(javaCreativeItem.getId(), dropAction.getCount(), javaCreativeItem.getDataComponents());
|
||||
}
|
||||
ServerboundSetCreativeModeSlotPacket creativeDropPacket = new ServerboundSetCreativeModeSlotPacket(-1, dropStack);
|
||||
ServerboundSetCreativeModeSlotPacket creativeDropPacket = new ServerboundSetCreativeModeSlotPacket((short)-1, dropStack);
|
||||
session.sendDownstreamGamePacket(creativeDropPacket);
|
||||
break;
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
GeyserItemStack item = inventory.getItem(slot);
|
||||
ItemStack itemStack = item.isEmpty() ? new ItemStack(-1, 0, null) : item.getItemStack();
|
||||
|
||||
ServerboundSetCreativeModeSlotPacket creativePacket = new ServerboundSetCreativeModeSlotPacket(slot, itemStack);
|
||||
ServerboundSetCreativeModeSlotPacket creativePacket = new ServerboundSetCreativeModeSlotPacket((short)slot, itemStack);
|
||||
session.sendDownstreamGamePacket(creativePacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,15 +25,13 @@
|
|||
|
||||
package org.geysermc.geyser.translator.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.RegistryEntry;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.palette.SingletonPalette;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import org.geysermc.geyser.level.chunk.BlockStorage;
|
||||
import org.geysermc.geyser.level.chunk.bitarray.BitArray;
|
||||
|
@ -41,24 +39,24 @@ import org.geysermc.geyser.level.chunk.bitarray.BitArrayVersion;
|
|||
import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.util.JavaCodecUtil;
|
||||
import org.geysermc.geyser.util.MathUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// Array index formula by https://wiki.vg/Chunk_Format
|
||||
public class BiomeTranslator {
|
||||
|
||||
public static void loadServerBiomes(GeyserSession session, CompoundTag codec) {
|
||||
public static void loadServerBiomes(GeyserSession session, List<RegistryEntry> entries) {
|
||||
Int2IntMap biomeTranslations = new Int2IntOpenHashMap();
|
||||
|
||||
CompoundTag worldGen = codec.get("minecraft:worldgen/biome");
|
||||
ListTag serverBiomes = worldGen.get("value");
|
||||
session.setBiomeGlobalPalette(MathUtils.getGlobalPaletteForSize(serverBiomes.size()));
|
||||
session.setBiomeGlobalPalette(MathUtils.getGlobalPaletteForSize(entries.size()));
|
||||
|
||||
int greatestBiomeId = 0;
|
||||
for (CompoundTag biomeTag : JavaCodecUtil.iterateAsTag(worldGen)) {
|
||||
String javaIdentifier = ((StringTag) biomeTag.get("name")).getValue();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
RegistryEntry entry = entries.get(i);
|
||||
String javaIdentifier = entry.getId();
|
||||
int bedrockId = Registries.BIOME_IDENTIFIERS.get().getOrDefault(javaIdentifier, 0);
|
||||
int javaId = ((IntTag) biomeTag.get("id")).getValue();
|
||||
int javaId = i;
|
||||
if (javaId > greatestBiomeId) {
|
||||
greatestBiomeId = javaId;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ import java.util.*;
|
|||
public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommandsPacket> {
|
||||
|
||||
private static final String[] ALL_EFFECT_IDENTIFIERS = EntityUtils.getAllEffectIdentifiers();
|
||||
private static final String[] ATTRIBUTES = AttributeType.Builtin.BUILTIN.keySet().toArray(new String[0]);
|
||||
private static final String[] ATTRIBUTES = AttributeType.Builtin.BUILTIN.values().stream().map(AttributeType::getIdentifier).toList().toArray(new String[0]);
|
||||
private static final String[] ENUM_BOOLEAN = {"true", "false"};
|
||||
private static final String[] VALID_COLORS;
|
||||
private static final String[] VALID_SCOREBOARD_SLOTS;
|
||||
|
|
|
@ -63,7 +63,7 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||
// If the player is already initialized and a join game packet is sent, they
|
||||
// are swapping servers
|
||||
if (session.isSpawned()) {
|
||||
String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), spawnInfo.getDimension());
|
||||
int fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), spawnInfo.getDimension());
|
||||
DimensionUtils.switchDimension(session, fakeDim);
|
||||
|
||||
session.getWorldCache().removeScoreboard();
|
||||
|
@ -97,7 +97,7 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||
session.setWorldName(spawnInfo.getWorldName());
|
||||
session.setLevels(packet.getWorldNames());
|
||||
session.setGameMode(spawnInfo.getGameMode());
|
||||
String newDimension = spawnInfo.getDimension();
|
||||
int newDimension = spawnInfo.getDimension();
|
||||
|
||||
boolean needsSpawnPacket = !session.isSentSpawnPacket();
|
||||
if (needsSpawnPacket) {
|
||||
|
@ -135,9 +135,9 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket("minecraft:register", PluginMessageChannels.getFloodgateRegisterData()));
|
||||
}
|
||||
|
||||
if (!newDimension.equals(session.getDimension())) {
|
||||
if (newDimension != session.getDimension()) {
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
} else if (DimensionUtils.isCustomBedrockNetherId() && newDimension.equalsIgnoreCase(DimensionUtils.NETHER)) {
|
||||
} else if (DimensionUtils.isCustomBedrockNetherId() && newDimension == DimensionUtils.NETHER) {
|
||||
// If the player is spawning into the "fake" nether, send them some fog
|
||||
session.camera().sendFog(DimensionUtils.BEDROCK_FOG_HELL);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
package org.geysermc.geyser.translator.protocol.java;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.RegistryEntry;
|
||||
import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import org.geysermc.geyser.level.JavaDimension;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -35,33 +35,39 @@ import org.geysermc.geyser.text.TextDecoration;
|
|||
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
import org.geysermc.geyser.util.JavaCodecUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@Translator(packet = ClientboundRegistryDataPacket.class)
|
||||
public class JavaRegistryDataTranslator extends PacketTranslator<ClientboundRegistryDataPacket> {
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundRegistryDataPacket packet) {
|
||||
Map<String, JavaDimension> dimensions = session.getDimensions();
|
||||
if (packet.getRegistry().equals("minecraft:dimension_type")) {
|
||||
Int2ObjectMap<JavaDimension> dimensions = session.getDimensions();
|
||||
dimensions.clear();
|
||||
JavaDimension.load(packet.getRegistry(), dimensions);
|
||||
JavaDimension.load(packet.getEntries(), dimensions);
|
||||
}
|
||||
|
||||
if (packet.getRegistry().equals("minecraft:chat_type")) {
|
||||
Int2ObjectMap<TextDecoration> chatTypes = session.getChatTypes();
|
||||
chatTypes.clear();
|
||||
for (CompoundTag tag : JavaCodecUtil.iterateAsTag(packet.getRegistry().get("minecraft:chat_type"))) {
|
||||
List<RegistryEntry> entries = packet.getEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
// The ID is NOT ALWAYS THE SAME! ViaVersion as of 1.19 adds two registry entries that do NOT match vanilla.
|
||||
int id = ((IntTag) tag.get("id")).getValue();
|
||||
CompoundTag element = tag.get("element");
|
||||
CompoundTag chat = element.get("chat");
|
||||
RegistryEntry entry = entries.get(i);
|
||||
CompoundTag tag = entry.getData();
|
||||
CompoundTag chat = tag.get("chat");
|
||||
TextDecoration textDecoration = null;
|
||||
if (chat != null) {
|
||||
textDecoration = new TextDecoration(chat);
|
||||
}
|
||||
chatTypes.put(id, textDecoration);
|
||||
chatTypes.put(i, textDecoration);
|
||||
}
|
||||
}
|
||||
|
||||
BiomeTranslator.loadServerBiomes(session, packet.getRegistry());
|
||||
if (packet.getRegistry().equals("minecraft:worldgen/biome")) {
|
||||
BiomeTranslator.loadServerBiomes(session, packet.getEntries());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,11 +92,11 @@ public class JavaRespawnTranslator extends PacketTranslator<ClientboundRespawnPa
|
|||
session.setThunder(false);
|
||||
}
|
||||
|
||||
String newDimension = spawnInfo.getDimension();
|
||||
if (!session.getDimension().equals(newDimension) || !spawnInfo.getWorldName().equals(session.getWorldName())) {
|
||||
int newDimension = spawnInfo.getDimension();
|
||||
if (session.getDimension() != newDimension || !spawnInfo.getWorldName().equals(session.getWorldName())) {
|
||||
// Switching to a new world (based off the world name change or new dimension); send a fake dimension change
|
||||
if (DimensionUtils.javaToBedrock(session.getDimension()) == DimensionUtils.javaToBedrock(newDimension)) {
|
||||
String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension);
|
||||
int fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension);
|
||||
DimensionUtils.switchDimension(session, fakeDim);
|
||||
}
|
||||
session.setWorldName(spawnInfo.getWorldName());
|
||||
|
|
|
@ -28,7 +28,6 @@ package org.geysermc.geyser.translator.protocol.java.level;
|
|||
import com.github.steveice10.mc.protocol.data.game.item.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.BlockParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.DustParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.FallingDustParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.ItemParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.Particle;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.VibrationParticleData;
|
||||
|
@ -106,7 +105,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator<ClientboundLe
|
|||
};
|
||||
}
|
||||
case FALLING_DUST -> {
|
||||
int blockState = session.getBlockMappings().getBedrockBlockId(((FallingDustParticleData) particle.getData()).getBlockState());
|
||||
int blockState = session.getBlockMappings().getBedrockBlockId(((BlockParticleData) particle.getData()).getBlockState());
|
||||
return (position) -> {
|
||||
LevelEventPacket packet = new LevelEventPacket();
|
||||
// In fact, FallingDustParticle should have data like DustParticle,
|
||||
|
|
|
@ -45,12 +45,12 @@ public class AttributeUtils {
|
|||
}
|
||||
double value = base;
|
||||
for (AttributeModifier modifier : attribute.getModifiers()) {
|
||||
if (modifier.getOperation() == ModifierOperation.ADD_MULTIPLIED) {
|
||||
if (modifier.getOperation() == ModifierOperation.ADD_MULTIPLIED_BASE) {
|
||||
value += base * modifier.getAmount();
|
||||
}
|
||||
}
|
||||
for (AttributeModifier modifier : attribute.getModifiers()) {
|
||||
if (modifier.getOperation() == ModifierOperation.MULTIPLY) {
|
||||
if (modifier.getOperation() == ModifierOperation.ADD_MULTIPLIED_TOTAL) {
|
||||
value *= 1.0D + modifier.getAmount();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,19 +50,19 @@ public class DimensionUtils {
|
|||
/**
|
||||
* String reference to vanilla Java overworld dimension identifier
|
||||
*/
|
||||
public static final String OVERWORLD = "minecraft:overworld";
|
||||
public static final int OVERWORLD = 0;
|
||||
/**
|
||||
* String reference to vanilla Java nether dimension identifier
|
||||
*/
|
||||
public static final String NETHER = "minecraft:the_nether";
|
||||
public static final int NETHER = 3;
|
||||
/**
|
||||
* String reference to vanilla Java end dimension identifier
|
||||
*/
|
||||
public static final String THE_END = "minecraft:the_end";
|
||||
public static final int THE_END = 2;
|
||||
|
||||
public static void switchDimension(GeyserSession session, String javaDimension) {
|
||||
public static void switchDimension(GeyserSession session, int javaDimension) {
|
||||
int bedrockDimension = javaToBedrock(javaDimension); // new bedrock dimension
|
||||
String previousDimension = session.getDimension(); // previous java dimension
|
||||
int previousDimension = session.getDimension(); // previous java dimension
|
||||
|
||||
Entity player = session.getPlayerEntity();
|
||||
|
||||
|
@ -142,15 +142,15 @@ public class DimensionUtils {
|
|||
// we check if the player is entering the nether and apply the nether fog to fake the fact that the client
|
||||
// thinks they are in the end dimension.
|
||||
if (isCustomBedrockNetherId()) {
|
||||
if (NETHER.equals(javaDimension)) {
|
||||
if (NETHER == javaDimension) {
|
||||
session.camera().sendFog(BEDROCK_FOG_HELL);
|
||||
} else if (NETHER.equals(previousDimension)) {
|
||||
} else if (NETHER == previousDimension) {
|
||||
session.camera().removeFog(BEDROCK_FOG_HELL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBedrockDimension(GeyserSession session, String javaDimension) {
|
||||
public static void setBedrockDimension(GeyserSession session, int javaDimension) {
|
||||
session.getChunkCache().setBedrockDimension(switch (javaDimension) {
|
||||
case DimensionUtils.THE_END -> BedrockDimension.THE_END;
|
||||
case DimensionUtils.NETHER -> DimensionUtils.isCustomBedrockNetherId() ? BedrockDimension.THE_END : BedrockDimension.THE_NETHER;
|
||||
|
@ -174,7 +174,7 @@ public class DimensionUtils {
|
|||
* @param javaDimension Dimension ID to convert
|
||||
* @return Converted Bedrock edition dimension ID
|
||||
*/
|
||||
public static int javaToBedrock(String javaDimension) {
|
||||
public static int javaToBedrock(int javaDimension) {
|
||||
return switch (javaDimension) {
|
||||
case NETHER -> BEDROCK_NETHER_ID;
|
||||
case THE_END -> 2;
|
||||
|
@ -182,6 +182,20 @@ public class DimensionUtils {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the Java edition dimension IDs to Bedrock edition
|
||||
*
|
||||
* @param javaDimension Dimension ID to convert
|
||||
* @return Converted Bedrock edition dimension ID
|
||||
*/
|
||||
public static int javaToBedrock(String javaDimension) {
|
||||
return switch (javaDimension) {
|
||||
case "minecraft:the_nether" -> BEDROCK_NETHER_ID;
|
||||
case "minecraft:the_end" -> 2;
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The Nether dimension in Bedrock does not permit building above Y128 - the Bedrock above the dimension.
|
||||
* This workaround sets the Nether as the End dimension to ignore this limit.
|
||||
|
@ -201,7 +215,7 @@ public class DimensionUtils {
|
|||
* @param newDimension the new dimension that the player will be transferred to
|
||||
* @return the fake dimension to transfer to
|
||||
*/
|
||||
public static String getTemporaryDimension(String currentDimension, String newDimension) {
|
||||
public static int getTemporaryDimension(int currentDimension, int newDimension) {
|
||||
if (isCustomBedrockNetherId()) {
|
||||
// Prevents rare instances of Bedrock locking up
|
||||
return javaToBedrock(newDimension) == 2 ? OVERWORLD : NETHER;
|
||||
|
|
|
@ -27,6 +27,7 @@ package org.geysermc.geyser.util;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.item.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.item.component.DataComponents;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
|
@ -66,6 +67,7 @@ import org.jetbrains.annotations.Contract;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.IntFunction;
|
||||
|
@ -77,7 +79,7 @@ public class InventoryUtils {
|
|||
*/
|
||||
public static int LAST_RECIPE_NET_ID;
|
||||
|
||||
public static final ItemStack REFRESH_ITEM = new ItemStack(1, 127, new CompoundTag(""));
|
||||
public static final ItemStack REFRESH_ITEM = new ItemStack(1, 127, new DataComponents(new HashMap<>()));
|
||||
|
||||
public static void openInventory(GeyserSession session, Inventory inventory) {
|
||||
session.setOpenInventory(inventory);
|
||||
|
@ -279,7 +281,7 @@ public class InventoryUtils {
|
|||
if (session.getGameMode() == GameMode.CREATIVE) {
|
||||
int slot = findEmptyHotbarSlot(inventory);
|
||||
|
||||
ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot,
|
||||
ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket((short) slot,
|
||||
itemStack);
|
||||
if ((slot - 36) != inventory.getHeldItemSlot()) {
|
||||
setHotbarItem(session, slot);
|
||||
|
@ -345,7 +347,7 @@ public class InventoryUtils {
|
|||
|
||||
ItemMapping mapping = session.getItemMappings().getMapping(itemName); // TODO
|
||||
if (mapping != null) {
|
||||
ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot,
|
||||
ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket((short)slot,
|
||||
new ItemStack(mapping.getJavaItem().javaId()));
|
||||
if ((slot - 36) != inventory.getHeldItemSlot()) {
|
||||
setHotbarItem(session, slot);
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.util;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public final class JavaCodecUtil {
|
||||
|
||||
/**
|
||||
* Iterate over a Java Edition codec and return each entry as a CompoundTag
|
||||
*/
|
||||
public static Iterable<CompoundTag> iterateAsTag(CompoundTag tag) {
|
||||
ListTag value = tag.get("value");
|
||||
Iterator<Tag> originalIterator = value.iterator();
|
||||
return new Iterable<>() {
|
||||
@NonNull
|
||||
@Override
|
||||
public Iterator<CompoundTag> iterator() {
|
||||
return new Iterator<>() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return originalIterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag next() {
|
||||
return (CompoundTag) originalIterator.next();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private JavaCodecUtil() {
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ protocol-connection = "3.0.0.Beta1-20240411.165033-128"
|
|||
raknet = "1.0.0.CR3-20240416.144209-1"
|
||||
blockstateupdater="1.20.80-20240411.142413-1"
|
||||
mcauthlib = "d9d773e"
|
||||
mcprotocollib = "1.20.4-2-20240116.220521-7"
|
||||
mcprotocollib = "b2e93c520a" # Revert from jitpack after release
|
||||
adventure = "4.14.0"
|
||||
adventure-platform = "4.3.0"
|
||||
junit = "5.9.2"
|
||||
|
@ -107,7 +107,7 @@ guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
|||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
|
||||
mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" }
|
||||
mcprotocollib = { group = "com.github.geysermc", name = "mcprotocollib", version.ref = "mcprotocollib" }
|
||||
raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }
|
||||
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
|
||||
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||
|
|
Loading…
Reference in a new issue