From 64c7adcacfb1ad39c7035ab0c9ccf81468e75485 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Mon, 16 Dec 2024 10:54:36 +0800 Subject: [PATCH] Fix: Geyser-Spigot not loading on 1.16.5, remove unused code --- .../geyser/entity/type/BoatEntity.java | 34 ++++++------------- .../geyser/entity/type/ChestBoatEntity.java | 6 ---- .../DataComponentRegistryPopulator.java | 3 +- gradle/libs.versions.toml | 6 ++-- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index 04df96361..7d789fb2a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -32,8 +32,6 @@ import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.item.Items; -import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -220,10 +218,6 @@ public class BoatEntity extends Entity implements Leashable, Tickable { return leashHolderBedrockId; } - public Item getPickItem() { - return variant.pickItem; - } - private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) { AnimatePacket packet = new AnimatePacket(); packet.setRuntimeEntityId(rower.getGeyserId()); @@ -236,23 +230,17 @@ public class BoatEntity extends Entity implements Leashable, Tickable { * Ordered by Bedrock ordinal */ public enum BoatVariant { - OAK(Items.OAK_BOAT, Items.OAK_CHEST_BOAT), - SPRUCE(Items.SPRUCE_BOAT, Items.SPRUCE_CHEST_BOAT), - BIRCH(Items.BIRCH_BOAT, Items.BIRCH_CHEST_BOAT), - JUNGLE(Items.JUNGLE_BOAT, Items.JUNGLE_CHEST_BOAT), - ACACIA(Items.ACACIA_BOAT, Items.ACACIA_CHEST_BOAT), - DARK_OAK(Items.DARK_OAK_BOAT, Items.DARK_OAK_CHEST_BOAT), - MANGROVE(Items.MANGROVE_BOAT, Items.MANGROVE_CHEST_BOAT), - BAMBOO(Items.BAMBOO_RAFT, Items.BAMBOO_CHEST_RAFT), - CHERRY(Items.CHERRY_BOAT, Items.CHERRY_CHEST_BOAT), - PALE_OAK(Items.PALE_OAK_BOAT, Items.PALE_OAK_CHEST_BOAT); + OAK, + SPRUCE, + BIRCH, + JUNGLE, + ACACIA, + DARK_OAK, + MANGROVE, + BAMBOO, + CHERRY, + PALE_OAK; - private final Item pickItem; - final Item chestPickItem; - - BoatVariant(Item pickItem, Item chestPickItem) { - this.pickItem = pickItem; - this.chestPickItem = chestPickItem; - } + BoatVariant() {} } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java index 967da41df..5475ca772 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java @@ -27,7 +27,6 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractiveTag; @@ -49,9 +48,4 @@ public class ChestBoatEntity extends BoatEntity { public InteractionResult interact(Hand hand) { return passengers.isEmpty() && !session.isSneaking() ? super.interact(hand) : InteractionResult.SUCCESS; } - - @Override - public Item getPickItem() { - return this.variant.chestPickItem; - } } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/DataComponentRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/DataComponentRegistryPopulator.java index 386c795d2..d8547bbfc 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/DataComponentRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/DataComponentRegistryPopulator.java @@ -55,7 +55,8 @@ public final class DataComponentRegistryPopulator { GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); List defaultComponents; try (InputStream stream = bootstrap.getResourceOrThrow("java/item_data_components.json")) { - JsonElement rootElement = JsonParser.parseReader(new InputStreamReader(stream)); + //noinspection deprecation - 1.16.5 breaks otherwise + JsonElement rootElement = new JsonParser().parse(new InputStreamReader(stream)); JsonArray jsonArray = rootElement.getAsJsonArray(); defaultComponents = new ObjectArrayList<>(jsonArray.size()); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1166bab35..b90436644 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,9 +10,9 @@ netty-io-uring = "0.0.25.Final-SNAPSHOT" guava = "29.0-jre" gson = "2.3.1" # Provided by Spigot 1.8.8 websocket = "1.5.1" -protocol-connection = "3.0.0.Beta5-20241203.200249-19" -protocol-common = "3.0.0.Beta5-20241203.200249-19" -protocol-codec = "3.0.0.Beta5-20241203.200249-19" +protocol-connection = "3.0.0.Beta5-20241213.160944-20" +protocol-common = "3.0.0.Beta5-20241213.160944-20" +protocol-codec = "3.0.0.Beta5-20241213.160944-20" raknet = "1.0.0.CR3-20240416.144209-1" minecraftauth = "4.1.1" mcprotocollib = "1.21.4-SNAPSHOT"