Fix: Geyser-Spigot not loading on 1.16.5, remove unused code

This commit is contained in:
onebeastchris 2024-12-16 10:54:36 +08:00
parent a5c77a7072
commit 64c7adcacf
4 changed files with 16 additions and 33 deletions

View file

@ -32,8 +32,6 @@ import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions; 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.network.GameProtocol;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractionResult;
@ -220,10 +218,6 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
return leashHolderBedrockId; return leashHolderBedrockId;
} }
public Item getPickItem() {
return variant.pickItem;
}
private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) { private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) {
AnimatePacket packet = new AnimatePacket(); AnimatePacket packet = new AnimatePacket();
packet.setRuntimeEntityId(rower.getGeyserId()); packet.setRuntimeEntityId(rower.getGeyserId());
@ -236,23 +230,17 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
* Ordered by Bedrock ordinal * Ordered by Bedrock ordinal
*/ */
public enum BoatVariant { public enum BoatVariant {
OAK(Items.OAK_BOAT, Items.OAK_CHEST_BOAT), OAK,
SPRUCE(Items.SPRUCE_BOAT, Items.SPRUCE_CHEST_BOAT), SPRUCE,
BIRCH(Items.BIRCH_BOAT, Items.BIRCH_CHEST_BOAT), BIRCH,
JUNGLE(Items.JUNGLE_BOAT, Items.JUNGLE_CHEST_BOAT), JUNGLE,
ACACIA(Items.ACACIA_BOAT, Items.ACACIA_CHEST_BOAT), ACACIA,
DARK_OAK(Items.DARK_OAK_BOAT, Items.DARK_OAK_CHEST_BOAT), DARK_OAK,
MANGROVE(Items.MANGROVE_BOAT, Items.MANGROVE_CHEST_BOAT), MANGROVE,
BAMBOO(Items.BAMBOO_RAFT, Items.BAMBOO_CHEST_RAFT), BAMBOO,
CHERRY(Items.CHERRY_BOAT, Items.CHERRY_CHEST_BOAT), CHERRY,
PALE_OAK(Items.PALE_OAK_BOAT, Items.PALE_OAK_CHEST_BOAT); PALE_OAK;
private final Item pickItem; BoatVariant() {}
final Item chestPickItem;
BoatVariant(Item pickItem, Item chestPickItem) {
this.pickItem = pickItem;
this.chestPickItem = chestPickItem;
}
} }
} }

View file

@ -27,7 +27,6 @@ package org.geysermc.geyser.entity.type;
import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractionResult;
import org.geysermc.geyser.util.InteractiveTag; import org.geysermc.geyser.util.InteractiveTag;
@ -49,9 +48,4 @@ public class ChestBoatEntity extends BoatEntity {
public InteractionResult interact(Hand hand) { public InteractionResult interact(Hand hand) {
return passengers.isEmpty() && !session.isSneaking() ? super.interact(hand) : InteractionResult.SUCCESS; return passengers.isEmpty() && !session.isSneaking() ? super.interact(hand) : InteractionResult.SUCCESS;
} }
@Override
public Item getPickItem() {
return this.variant.chestPickItem;
}
} }

View file

@ -55,7 +55,8 @@ public final class DataComponentRegistryPopulator {
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
List<DataComponents> defaultComponents; List<DataComponents> defaultComponents;
try (InputStream stream = bootstrap.getResourceOrThrow("java/item_data_components.json")) { 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(); JsonArray jsonArray = rootElement.getAsJsonArray();
defaultComponents = new ObjectArrayList<>(jsonArray.size()); defaultComponents = new ObjectArrayList<>(jsonArray.size());

View file

@ -10,9 +10,9 @@ netty-io-uring = "0.0.25.Final-SNAPSHOT"
guava = "29.0-jre" guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8 gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1" websocket = "1.5.1"
protocol-connection = "3.0.0.Beta5-20241203.200249-19" protocol-connection = "3.0.0.Beta5-20241213.160944-20"
protocol-common = "3.0.0.Beta5-20241203.200249-19" protocol-common = "3.0.0.Beta5-20241213.160944-20"
protocol-codec = "3.0.0.Beta5-20241203.200249-19" protocol-codec = "3.0.0.Beta5-20241213.160944-20"
raknet = "1.0.0.CR3-20240416.144209-1" raknet = "1.0.0.CR3-20240416.144209-1"
minecraftauth = "4.1.1" minecraftauth = "4.1.1"
mcprotocollib = "1.21.4-SNAPSHOT" mcprotocollib = "1.21.4-SNAPSHOT"