From a988fbf2908cfd33de13b267842387cc57f1129b Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Wed, 14 Dec 2022 17:23:33 -0500 Subject: [PATCH 1/5] Update inventory translators --- .../world/GeyserFabricWorldManager.java | 5 +- .../manager/GeyserSpigotWorldManager.java | 6 +- .../geyser/entity/type/FireworkEntity.java | 6 +- .../geyser/entity/type/ItemFrameEntity.java | 4 +- .../type/living/animal/horse/CamelEntity.java | 6 +- .../type/living/monster/EndermanEntity.java | 5 +- .../type/player/SessionPlayerEntity.java | 5 +- .../geyser/inventory/LecternContainer.java | 2 +- .../holder/BlockInventoryHolder.java | 2 +- .../updater/AnvilInventoryUpdater.java | 4 +- .../item/components/ToolBreakSpeedsUtils.java | 6 +- .../geyser/item/components/WearableSlot.java | 2 +- .../geyser/level/GeyserWorldManager.java | 4 +- .../geysermc/geyser/level/WorldManager.java | 2 +- .../geysermc/geyser/network/GameProtocol.java | 5 +- .../geyser/network/netty/LocalSession.java | 2 +- .../ping/GeyserLegacyPingPassthrough.java | 2 +- .../geysermc/geyser/registry/Registries.java | 8 +- .../geysermc/geyser/registry/Registry.java | 1 + .../registry/loader/NbtRegistryLoader.java | 6 +- .../loader/PotionMixRegistryLoader.java | 2 +- .../populator/BlockRegistryPopulator.java | 10 +- .../CreativeItemRegistryPopulator.java | 4 +- .../CustomItemRegistryPopulator.java | 6 +- .../populator/ItemRegistryPopulator.java | 6 +- .../populator/RecipeRegistryPopulator.java | 6 +- .../geyser/registry/type/BlockMappings.java | 7 +- .../geyser/session/GeyserSession.java | 5 +- .../geysermc/geyser/text/ChatTypeEntry.java | 2 +- .../inventory/AnvilInventoryTranslator.java | 20 ++-- .../inventory/BaseInventoryTranslator.java | 4 +- .../inventory/BeaconInventoryTranslator.java | 24 ++--- .../inventory/BrewingInventoryTranslator.java | 4 +- .../CartographyInventoryTranslator.java | 4 +- .../CraftingInventoryTranslator.java | 4 +- .../EnchantingInventoryTranslator.java | 20 ++-- .../GrindstoneInventoryTranslator.java | 4 +- .../inventory/InventoryTranslator.java | 98 ++++++++++--------- .../inventory/LecternInventoryTranslator.java | 6 +- .../inventory/LoomInventoryTranslator.java | 34 +++---- .../MerchantInventoryTranslator.java | 16 +-- .../inventory/PlayerInventoryTranslator.java | 42 ++++---- .../inventory/ShulkerInventoryTranslator.java | 4 +- .../SmithingInventoryTranslator.java | 4 +- .../StonecutterInventoryTranslator.java | 20 ++-- .../chest/DoubleChestInventoryTranslator.java | 4 +- .../ChestedHorseInventoryTranslator.java | 4 +- .../horse/HorseInventoryTranslator.java | 4 +- .../inventory/item/ItemTranslator.java | 10 +- .../inventory/item/nbt/BannerTranslator.java | 6 +- .../entity/BannerBlockEntityTranslator.java | 2 +- .../entity/BeaconBlockEntityTranslator.java | 2 +- .../entity/BedBlockEntityTranslator.java | 2 +- .../block/entity/BedrockOnlyBlockEntity.java | 6 +- .../block/entity/BlockEntityTranslator.java | 4 +- .../entity/CampfireBlockEntityTranslator.java | 4 +- .../CommandBlockBlockEntityTranslator.java | 2 +- .../DoubleChestBlockEntityTranslator.java | 2 +- .../entity/EmptyBlockEntityTranslator.java | 2 +- .../EndGatewayBlockEntityTranslator.java | 6 +- .../FlowerPotBlockEntityTranslator.java | 6 +- .../JigsawBlockBlockEntityTranslator.java | 2 +- .../level/block/entity/PistonBlockEntity.java | 4 +- .../entity/PistonBlockEntityTranslator.java | 2 +- .../ShulkerBoxBlockEntityTranslator.java | 2 +- .../entity/SignBlockEntityTranslator.java | 2 +- .../entity/SkullBlockEntityTranslator.java | 2 +- .../entity/SpawnerBlockEntityTranslator.java | 2 +- .../BedrockBlockEntityDataTranslator.java | 2 +- ...BedrockInventoryTransactionTranslator.java | 6 +- ...tionTrackingDBClientRequestTranslator.java | 6 +- .../java/JavaDisguisedChatTranslator.java | 4 +- .../java/JavaUpdateRecipesTranslator.java | 2 +- .../JavaPlayerInfoRemoveTranslator.java | 2 +- .../JavaPlayerInfoUpdateTranslator.java | 4 +- .../JavaContainerSetSlotTranslator.java | 2 +- .../JavaHorseScreenOpenTranslator.java | 6 +- .../JavaMerchantOffersTranslator.java | 6 +- .../java/level/JavaBlockEventTranslator.java | 4 +- .../java/level/JavaExplodeTranslator.java | 8 +- .../JavaLevelChunkWithLightTranslator.java | 9 +- .../java/level/JavaLevelEventTranslator.java | 8 +- .../level/JavaLevelParticlesTranslator.java | 2 +- .../translator/text/MessageTranslator.java | 2 +- .../geyser/util/BlockEntityUtils.java | 2 +- .../geysermc/geyser/util/DimensionUtils.java | 3 + .../geysermc/geyser/util/InventoryUtils.java | 16 +-- .../util/collection/LecternHasBookMap.java | 2 +- core/src/main/resources/mappings | 2 +- 89 files changed, 314 insertions(+), 305 deletions(-) diff --git a/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java b/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java index b685a85bf..b9440c3da 100644 --- a/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java +++ b/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java @@ -26,9 +26,6 @@ package org.geysermc.geyser.platform.fabric.world; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; import me.lucko.fabric.api.permissions.v0.Permissions; import net.minecraft.core.BlockPos; import net.minecraft.nbt.ListTag; @@ -39,6 +36,8 @@ import net.minecraft.world.item.WritableBookItem; import net.minecraft.world.item.WrittenBookItem; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.LecternBlockEntity; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.GeyserWorldManager; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 1d24b0627..0bad9f5fa 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -26,9 +26,6 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.block.Block; @@ -37,6 +34,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.geysermc.geyser.level.GameRule; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.level.block.BlockStateValues; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java index 8c88f4bce..7a544f23c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java @@ -31,9 +31,9 @@ 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.cloudburstmc.math.vector.Vector3f; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.floodgate.util.DeviceOs; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java index cfec93c15..378385cfa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java @@ -33,8 +33,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java index 408e2ec21..f6cdf451f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -46,7 +46,7 @@ public class CamelEntity extends AbstractHorseEntity { @Override protected void initializeMetadata() { super.initializeMetadata(); - this.dirtyMetadata.put(EntityData.VARIANT, 2); // Closest llama colour to camel + this.dirtyMetadata.put(EntityDataTypes.VARIANT, 2); // Closest llama colour to camel } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java index 6df788056..a7730bdfe 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java @@ -28,7 +28,6 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.OptionalIntMetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; @@ -51,10 +50,10 @@ public class EndermanEntity extends MonsterEntity { if (entityMetadata.getValue().isPresent()) { bedrockBlockId = session.getBlockMappings().getBedrockBlockId(entityMetadata.getValue().getAsInt()); } else { - bedrockBlockId = session.getBlockMappings().getBedrockAirId(); + bedrockBlockId = session.getBlockMappings().getBedrockAir().getRuntimeId(); } - dirtyMetadata.put(EntityData.BLOCK, bedrockBlockId); + dirtyMetadata.put(EntityDataTypes.BLOCK, bedrockBlockId); } /** diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index 1edba02b1..f7d333b3a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -47,7 +47,6 @@ import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.UUID; /** * The entity class specifically for a {@link GeyserSession}'s player. @@ -125,8 +124,8 @@ public class SessionPlayerEntity extends PlayerEntity { * See https://github.com/GeyserMC/Geyser/issues/3370 */ public void updateBoundingBox() { - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, getBoundingBoxHeight()); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, getBoundingBoxWidth()); + dirtyMetadata.put(EntityDataTypes.HEIGHT, getBoundingBoxHeight()); + dirtyMetadata.put(EntityDataTypes.WIDTH, getBoundingBoxWidth()); updateBedrockMetadata(); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java index 4de320101..f5aa7b0d6 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; import lombok.Getter; import lombok.Setter; +import org.cloudburstmc.nbt.NbtMap; public class LecternContainer extends Container { @Getter @Setter diff --git a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java index 1152418cc..42ee6c519 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.inventory.holder; import com.google.common.collect.ImmutableSet; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket; 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 224cb1ff2..6fde01e6b 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 @@ -31,8 +31,8 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; diff --git a/core/src/main/java/org/geysermc/geyser/item/components/ToolBreakSpeedsUtils.java b/core/src/main/java/org/geysermc/geyser/item/components/ToolBreakSpeedsUtils.java index 6330043e5..248d4f7ba 100644 --- a/core/src/main/java/org/geysermc/geyser/item/components/ToolBreakSpeedsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/item/components/ToolBreakSpeedsUtils.java @@ -25,8 +25,10 @@ package org.geysermc.geyser.item.components; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtType; + + +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/item/components/WearableSlot.java b/core/src/main/java/org/geysermc/geyser/item/components/WearableSlot.java index a4479f871..7ce488a51 100644 --- a/core/src/main/java/org/geysermc/geyser/item/components/WearableSlot.java +++ b/core/src/main/java/org/geysermc/geyser/item/components/WearableSlot.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.item.components; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index f19060c65..210269876 100644 --- a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -25,10 +25,10 @@ package org.geysermc.geyser.level; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.ChunkCache; diff --git a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java index bd9d893c1..036507848 100644 --- a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.level; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java index 2e0eb912c..9bd6c42b9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java @@ -28,12 +28,11 @@ package org.geysermc.geyser.network; import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.PacketCodec; import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; -import org.cloudburstmc.protocol.bedrock.codec.v527.Bedrock_v527; -import org.cloudburstmc.protocol.bedrock.codec.v534.Bedrock_v534; import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544; import org.cloudburstmc.protocol.bedrock.codec.v545.Bedrock_v545; import org.cloudburstmc.protocol.bedrock.codec.v554.Bedrock_v554; import org.cloudburstmc.protocol.bedrock.codec.v557.Bedrock_v557; +import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560; import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec; import org.geysermc.geyser.session.GeyserSession; @@ -98,7 +97,7 @@ public final class GameProtocol { } public static boolean supports1_19_50(GeyserSession session) { - return session.getUpstream().getProtocolVersion() >= Bedrock_v560.V560_CODEC.getProtocolVersion(); + return session.getUpstream().getProtocolVersion() >= Bedrock_v560.CODEC.getProtocolVersion(); } /** diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index 551bc1deb..0057fb7a2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -53,7 +53,7 @@ public final class LocalSession extends TcpSession { private final String clientIp; private final PacketCodecHelper codecHelper; - public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, MinecraftCodecHelper codecHelper) { + public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, PacketCodecHelper codecHelper) { super(host, port, protocol); this.targetAddress = targetAddress; this.clientIp = clientIp; diff --git a/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java index a69d9bc3e..af030eb00 100644 --- a/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java +++ b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.ping; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import com.nukkitx.nbt.util.VarInts; +import org.cloudburstmc.nbt.util.VarInts; import io.netty.handler.codec.haproxy.HAProxyCommand; import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol; import io.netty.util.NetUtil; diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java index 095f0dbfe..4b892c819 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -31,15 +31,15 @@ import com.github.steveice10.mc.protocol.data.game.level.event.LevelEvent; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.packetlib.packet.Packet; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; -import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData; +import org.cloudburstmc.nbt.NbtMap; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registry.java b/core/src/main/java/org/geysermc/geyser/registry/Registry.java index f5412fd6d..afee87b08 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registry.java @@ -25,6 +25,7 @@ package org.geysermc.geyser.registry; +import org.cloudburstmc.nbt.NbtMap; import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.function.Consumer; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java index ee8a0723c..8b3ed1be9 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.registry.loader; -import com.nukkitx.nbt.NBTInputStream; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtUtils; +import org.cloudburstmc.nbt.NBTInputStream; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtUtils; import org.geysermc.geyser.GeyserImpl; /** diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java index c2588ad5f..246777aed 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.registry.loader; -import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.registry.Registries; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 986f3f8c6..217766b4f 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -28,11 +28,11 @@ package org.geysermc.geyser.registry.populator; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.common.collect.ImmutableMap; -import com.nukkitx.nbt.NBTInputStream; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NBTInputStream; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/CreativeItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/CreativeItemRegistryPopulator.java index 578c83f49..f40e66c47 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/CreativeItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/CreativeItemRegistryPopulator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.registry.populator; import com.fasterxml.jackson.databind.JsonNode; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtUtils; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtUtils; import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserBootstrap; 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 95cd7c379..75b74b0a3 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 @@ -26,9 +26,9 @@ package org.geysermc.geyser.registry.populator; import com.google.common.collect.Multimap; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.checkerframework.checker.nullness.qual.NonNull; import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; 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 787acb38e..04089e61f 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 @@ -28,9 +28,9 @@ package org.geysermc.geyser.registry.populator; import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java index 75526f06a..3a6ec08ff 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java @@ -29,13 +29,13 @@ import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtUtils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtUtils; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.recipe.GeyserRecipe; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java index 5f32d7f73..a068a0d37 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java @@ -25,14 +25,11 @@ package org.geysermc.geyser.registry.type; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMap; -import it.unimi.dsi.fastutil.ints.IntSet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Builder; import lombok.Value; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; -import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.cloudburstmc.protocol.common.DefinitionRegistry; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 172a2ae94..f95f3472d 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -25,7 +25,6 @@ package org.geysermc.geyser.session; -import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; import com.github.steveice10.mc.auth.exception.request.RequestException; @@ -67,7 +66,6 @@ import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpClientSession; import com.github.steveice10.packetlib.tcp.TcpSession; import com.nimbusds.jwt.SignedJWT; -import com.nukkitx.nbt.NbtMap; import io.netty.channel.Channel; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.ints.Int2IntMap; @@ -93,10 +91,10 @@ import org.cloudburstmc.math.vector.Vector2i; import org.cloudburstmc.math.vector.Vector3d; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.BedrockServerSession; import org.cloudburstmc.protocol.bedrock.data.Ability; import org.cloudburstmc.protocol.bedrock.data.AbilityLayer; -import org.cloudburstmc.protocol.bedrock.data.AdventureSetting; import org.cloudburstmc.protocol.bedrock.data.AttributeData; import org.cloudburstmc.protocol.bedrock.data.AuthoritativeMovementMode; import org.cloudburstmc.protocol.bedrock.data.ChatRestrictionLevel; @@ -174,6 +172,7 @@ import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; +import java.util.BitSet; import java.util.Collections; import java.util.HashSet; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java b/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java index 476ec22a1..41528c1e4 100644 --- a/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java +++ b/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.text; -import com.github.steveice10.mc.protocol.data.game.BuiltinChatType; +import com.github.steveice10.mc.protocol.data.game.chat.BuiltinChatType; import org.cloudburstmc.protocol.bedrock.packet.TextPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java index f4c1ef971..ab75c4868 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java @@ -27,12 +27,12 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeOptionalStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftRecipeOptionalAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; @@ -49,14 +49,14 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { - return action.getType() == StackRequestActionType.CRAFT_RECIPE_OPTIONAL; + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { + return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE_OPTIONAL; } @Override protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Guarded by shouldHandleRequestFirst check - CraftRecipeOptionalStackRequestActionData data = (CraftRecipeOptionalStackRequestActionData) request.getActions()[0]; + CraftRecipeOptionalAction data = (CraftRecipeOptionalAction) request.getActions()[0]; AnvilContainer container = (AnvilContainer) inventory; if (request.getFilterStrings().length != 0) { @@ -71,7 +71,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case ANVIL_INPUT -> 0; case ANVIL_MATERIAL -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java index 3fa121963..0f8fa4ca7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; @@ -46,7 +46,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { int slotnum = slotInfoData.getSlot(); switch (slotInfoData.getContainer()) { case HOTBAR_AND_INVENTORY: diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java index 55919099f..001404c9f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java @@ -27,17 +27,17 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.ints.IntSets; import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.BeaconPaymentAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.inventory.BeaconContainer; import org.geysermc.geyser.inventory.BedrockContainerSlot; @@ -105,14 +105,14 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { - return action.getType() == StackRequestActionType.BEACON_PAYMENT; + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { + return action.getType() == ItemStackRequestActionType.BEACON_PAYMENT; } @Override public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Input a beacon payment - BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0]; + BeaconPaymentAction beaconPayment = (BeaconPaymentAction) request.getActions()[0]; ServerboundSetBeaconPacket packet = new ServerboundSetBeaconPacket(toJava(beaconPayment.getPrimaryEffect()), toJava(beaconPayment.getSecondaryEffect())); session.sendDownstreamPacket(packet); return acceptRequest(request, makeContainerEntries(session, inventory, IntSets.emptySet())); @@ -123,7 +123,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.BEACON_PAYMENT) { return 0; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java index eb291d30c..a2c45384d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.cloudburstmc.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; @@ -68,7 +68,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) { // Ingredient return 3; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java index 2c71d659d..ad05af38b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.*; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; import org.geysermc.geyser.session.GeyserSession; @@ -53,7 +53,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case CARTOGRAPHY_INPUT -> 0; case CARTOGRAPHY_ADDITIONAL -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java index 34dc73a9b..f814188c1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -62,7 +62,7 @@ public class CraftingInventoryTranslator extends AbstractBlockInventoryTranslato } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT) { // Java goes from 1 - 9, left to right then up to down // Bedrock is the same, but it starts from 32. diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java index 8cc581321..db35595d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java @@ -30,12 +30,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import it.unimi.dsi.fastutil.ints.IntSets; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.EnchantOptionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.RecipeItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.cloudburstmc.protocol.bedrock.packet.PlayerEnchantOptionsPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.EnchantingContainer; @@ -107,14 +107,14 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { - return action.getType() == StackRequestActionType.CRAFT_RECIPE; + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { + return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE; } @Override public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Client has requested an item to be enchanted - CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0]; + RecipeItemStackRequestAction craftRecipeData = (RecipeItemStackRequestAction) request.getActions()[0]; EnchantingContainer enchantingInventory = (EnchantingContainer) inventory; int javaSlot = -1; for (int i = 0; i < enchantingInventory.getEnchantOptions().length; i++) { @@ -137,7 +137,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.ENCHANTING_INPUT) { return 0; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java index 0616fcde5..135f64978 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -37,7 +37,7 @@ public class GrindstoneInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case GRINDSTONE_INPUT -> 0; case GRINDSTONE_ADDITIONAL -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 5330faa14..0d329799a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -30,14 +30,20 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerEntry; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemEntry; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.ResponseStatus; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.*; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.AutoCraftRecipeAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ConsumeAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftResultsDeprecatedAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseContainer; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseSlot; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseStatus; import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; @@ -111,7 +117,7 @@ public abstract class InventoryTranslator { public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value); public abstract void updateInventory(GeyserSession session, Inventory inventory); public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot); - public abstract int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData); + public abstract int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData); public abstract int javaSlotToBedrock(int javaSlot); public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot); public abstract SlotType getSlotType(int javaSlot); @@ -141,12 +147,12 @@ public abstract class InventoryTranslator { * Should be overrided if this request matches a certain criteria and shouldn't be treated normally. * E.G. anvil renaming or enchanting */ - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { return false; } /** - * If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called + * If {@link #shouldHandleRequestFirst(ItemStackRequestAction, Inventory)} returns true, this will be called */ protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { return rejectRequest(request); @@ -158,7 +164,7 @@ public abstract class InventoryTranslator { for (ItemStackRequest request : requests) { ItemStackResponse response; if (request.getActions().length > 0) { - StackRequestActionData firstAction = request.getActions()[0]; + ItemStackRequestAction firstAction = request.getActions()[0]; if (shouldHandleRequestFirst(firstAction, inventory)) { // Some special request that shouldn't be processed normally response = translateSpecialRequest(session, inventory, request); @@ -176,7 +182,7 @@ public abstract class InventoryTranslator { response = rejectRequest(request); } - if (response.getResult() != ResponseStatus.OK) { + if (response.getResult() != ItemStackResponseStatus.OK) { // Sync our copy of the inventory with Bedrock's to prevent desyncs refresh = true; } @@ -197,12 +203,12 @@ public abstract class InventoryTranslator { public ItemStackResponse translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { ClickPlan plan = new ClickPlan(session, this, inventory); IntSet affectedSlots = new IntOpenHashSet(); - for (StackRequestActionData action : request.getActions()) { + for (ItemStackRequestAction action : request.getActions()) { GeyserItemStack cursor = session.getPlayerInventory().getCursor(); switch (action.getType()) { case TAKE: case PLACE: { - TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action; if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) { if (session.getGeyser().getConfig().isDebugMode()) { session.getGeyser().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.bedrockUsername()); @@ -290,9 +296,9 @@ public abstract class InventoryTranslator { break; } case SWAP: { - SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; - StackRequestSlotInfoData source = swapAction.getSource(); - StackRequestSlotInfoData destination = swapAction.getDestination(); + SwapAction swapAction = (SwapAction) action; + ItemStackRequestSlotData source = swapAction.getSource(); + ItemStackRequestSlotData destination = swapAction.getDestination(); if (!(checkNetId(session, inventory, source) && checkNetId(session, inventory, destination))) { if (session.getGeyser().getConfig().isDebugMode()) { @@ -352,7 +358,7 @@ public abstract class InventoryTranslator { break; } case DROP: { - DropStackRequestActionData dropAction = (DropStackRequestActionData) action; + DropAction dropAction = (DropAction) action; if (!checkNetId(session, inventory, dropAction.getSource())) return rejectRequest(request); @@ -381,7 +387,7 @@ public abstract class InventoryTranslator { case CONSUME: { // Tends to be called for UI inventories if (inventory instanceof CartographyContainer) { // TODO add this for more inventories? Only seems to glitch out the cartography table, though. - ConsumeStackRequestActionData consumeData = (ConsumeStackRequestActionData) action; + ConsumeAction consumeData = (ConsumeAction) action; int sourceSlot = bedrockSlotToJava(consumeData.getSource()); if ((sourceSlot == 0 && inventory.getItem(1).isEmpty()) || (sourceSlot == 1 && inventory.getItem(0).isEmpty())) { @@ -436,7 +442,7 @@ public abstract class InventoryTranslator { ClickPlan plan = new ClickPlan(session, this, inventory); // Track all the crafting table slots to report back the contents of the slots after crafting IntSet affectedSlots = new IntOpenHashSet(); - for (StackRequestActionData action : request.getActions()) { + for (ItemStackRequestAction action : request.getActions()) { switch (action.getType()) { case CRAFT_RECIPE: { if (craftState != CraftState.START) { @@ -446,7 +452,7 @@ public abstract class InventoryTranslator { break; } case CRAFT_RESULTS_DEPRECATED: { - CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action; + CraftResultsDeprecatedAction deprecatedCraftAction = (CraftResultsDeprecatedAction) action; if (craftState != CraftState.RECIPE_ID) { return rejectRequest(request); } @@ -467,12 +473,12 @@ public abstract class InventoryTranslator { return rejectRequest(request); } craftState = CraftState.INGREDIENTS; - affectedSlots.add(bedrockSlotToJava(((ConsumeStackRequestActionData) action).getSource())); + affectedSlots.add(bedrockSlotToJava(((ConsumeAction) action).getSource())); break; } case TAKE: case PLACE: { - TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action; if (craftState != CraftState.INGREDIENTS && craftState != CraftState.TRANSFER) { return rejectRequest(request); } @@ -556,10 +562,10 @@ public abstract class InventoryTranslator { ClickPlan plan = new ClickPlan(session, this, inventory); requestLoop: - for (StackRequestActionData action : request.getActions()) { + for (ItemStackRequestAction action : request.getActions()) { switch (action.getType()) { case CRAFT_RECIPE_AUTO: { - AutoCraftRecipeStackRequestActionData autoCraftAction = (AutoCraftRecipeStackRequestActionData) action; + AutoCraftRecipeAction autoCraftAction = (AutoCraftRecipeAction) action; // TODO autoCraftAction#getTimesCrafted 1.17.10 ??? if (craftState != CraftState.START) { return rejectRequest(request); @@ -601,7 +607,7 @@ public abstract class InventoryTranslator { break; } case CRAFT_RESULTS_DEPRECATED: { - CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action; + CraftResultsDeprecatedAction deprecatedCraftAction = (CraftResultsDeprecatedAction) action; if (craftState != CraftState.RECIPE_ID) { return rejectRequest(request); } @@ -618,7 +624,7 @@ public abstract class InventoryTranslator { break; } case CONSUME: { - ConsumeStackRequestActionData consumeAction = (ConsumeStackRequestActionData) action; + ConsumeAction consumeAction = (ConsumeAction) action; if (craftState != CraftState.DEPRECATED && craftState != CraftState.INGREDIENTS) { return rejectRequest(request); } @@ -647,7 +653,7 @@ public abstract class InventoryTranslator { } case TAKE: case PLACE: { - TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action; if (craftState != CraftState.INGREDIENTS && craftState != CraftState.TRANSFER) { return rejectRequest(request); } @@ -754,8 +760,8 @@ public abstract class InventoryTranslator { } } - protected static ItemStackResponse acceptRequest(ItemStackRequest request, List containerEntries) { - return new ItemStackResponse(ResponseStatus.OK, request.getRequestId(), containerEntries); + protected static ItemStackResponse acceptRequest(ItemStackRequest request, List containerEntries) { + return new ItemStackResponse(ItemStackResponseStatus.OK, request.getRequestId(), containerEntries); } /** @@ -775,20 +781,20 @@ public abstract class InventoryTranslator { if (throwError && GeyserImpl.getInstance().getConfig().isDebugMode()) { new Throwable("DEBUGGING: ItemStackRequest rejected " + request.toString()).printStackTrace(); } - return new ItemStackResponse(ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList()); + return new ItemStackResponse(ItemStackResponseStatus.ERROR, request.getRequestId(), Collections.emptyList()); } /** * Print out the contents of an ItemStackRequest, should the net ID check fail. */ - protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { + protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, ItemStackRequestSlotData source, ItemStackRequestSlotData destination) { session.getGeyser().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source)); session.getGeyser().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination)); session.getGeyser().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source))); session.getGeyser().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination))); } - public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { + public boolean checkNetId(GeyserSession session, Inventory inventory, ItemStackRequestSlotData slotInfoData) { int netId = slotInfoData.getStackNetworkId(); // "In my testing, sometimes the client thinks the netId of an item in the crafting grid is 1, even though we never said it was. // I think it only happens when we manually set the grid but that was my quick fix" @@ -846,30 +852,30 @@ public abstract class InventoryTranslator { return -1; } - protected final List makeContainerEntries(GeyserSession session, Inventory inventory, IntSet affectedSlots) { - Map> containerMap = new HashMap<>(); + protected final List makeContainerEntries(GeyserSession session, Inventory inventory, IntSet affectedSlots) { + Map> containerMap = new HashMap<>(); // Manually call iterator to prevent Integer boxing IntIterator it = affectedSlots.iterator(); while (it.hasNext()) { int slot = it.nextInt(); BedrockContainerSlot bedrockSlot = javaSlotToBedrockContainer(slot); - List list = containerMap.computeIfAbsent(bedrockSlot.container(), k -> new ArrayList<>()); + List list = containerMap.computeIfAbsent(bedrockSlot.container(), k -> new ArrayList<>()); list.add(makeItemEntry(session, bedrockSlot.slot(), inventory.getItem(slot))); } - List containerEntries = new ArrayList<>(); - for (Map.Entry> entry : containerMap.entrySet()) { - containerEntries.add(new ContainerEntry(entry.getKey(), entry.getValue())); + List containerEntries = new ArrayList<>(); + for (Map.Entry> entry : containerMap.entrySet()) { + containerEntries.add(new ItemStackResponseContainer(entry.getKey(), entry.getValue())); } - ItemEntry cursorEntry = makeItemEntry(session, 0, session.getPlayerInventory().getCursor()); - containerEntries.add(new ContainerEntry(ContainerSlotType.CURSOR, Collections.singletonList(cursorEntry))); + ItemStackResponseSlot cursorEntry = makeItemEntry(session, 0, session.getPlayerInventory().getCursor()); + containerEntries.add(new ItemStackResponseContainer(ContainerSlotType.CURSOR, Collections.singletonList(cursorEntry))); return containerEntries; } - private static ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) { - ItemEntry itemEntry; + private static ItemStackResponseSlot makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) { + ItemStackResponseSlot itemEntry; if (!itemStack.isEmpty()) { // As of 1.16.210: Bedrock needs confirmation on what the current item durability is. // If 0 is sent, then Bedrock thinks the item is not damaged @@ -881,14 +887,14 @@ public abstract class InventoryTranslator { } } - itemEntry = new ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "", durability); + itemEntry = new ItemStackResponseSlot((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "", durability); } else { - itemEntry = new ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "", 0); + itemEntry = new ItemStackResponseSlot((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "", 0); } return itemEntry; } - protected static boolean isCursor(StackRequestSlotInfoData slotInfoData) { + protected static boolean isCursor(ItemStackRequestSlotData slotInfoData) { return slotInfoData.getContainer() == ContainerSlotType.CURSOR; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java index 9148cbd62..6e9a550dc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java @@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java index df5e3b9de..2a17a0784 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java @@ -28,19 +28,19 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftLoomStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftLoomAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftResultsDeprecatedAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; @@ -117,19 +117,19 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { // If the LOOM_MATERIAL slot is not empty, we are crafting a pattern that does not come from an item - return action.getType() == StackRequestActionType.CRAFT_LOOM && inventory.getItem(2).isEmpty(); + return action.getType() == ItemStackRequestActionType.CRAFT_LOOM && inventory.getItem(2).isEmpty(); } @Override public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { - StackRequestActionData headerData = request.getActions()[0]; - StackRequestActionData data = request.getActions()[1]; - if (!(headerData instanceof CraftLoomStackRequestActionData)) { + ItemStackRequestAction headerData = request.getActions()[0]; + ItemStackRequestAction data = request.getActions()[1]; + if (!(headerData instanceof CraftLoomAction)) { return rejectRequest(request); } - if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { + if (!(data instanceof CraftResultsDeprecatedAction craftData)) { return rejectRequest(request); } @@ -137,7 +137,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { List newBlockEntityTag = craftData.getResultItems()[0].getTag().getList("Patterns", NbtType.COMPOUND); // Get the pattern that the Bedrock client requests - the last pattern in the Patterns list NbtMap pattern = newBlockEntityTag.get(newBlockEntityTag.size() - 1); - String bedrockPattern = ((CraftLoomStackRequestActionData) headerData).getPatternId(); + String bedrockPattern = ((CraftLoomAction) headerData).getPatternId(); // Get the Java index of this pattern int index = PATTERN_TO_INDEX.getOrDefault(bedrockPattern, -1); @@ -181,7 +181,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case LOOM_INPUT -> 0; case LOOM_DYE -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java index ab7b07e86..53b5aaac4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java @@ -31,11 +31,11 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.AutoCraftRecipeStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.AutoCraftRecipeAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftRecipeAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.Entity; @@ -80,7 +80,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case TRADE2_INGREDIENT1 -> 0; case TRADE2_INGREDIENT2 -> 1; @@ -144,7 +144,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { // Behavior as of 1.18.10. // We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to // store a map of net ID to trade index on our end. - int tradeChoice = ((CraftRecipeStackRequestActionData) request.getActions()[0]).getRecipeNetworkId() - 1; + int tradeChoice = ((CraftRecipeAction) request.getActions()[0]).getRecipeNetworkId() - 1; return handleTrade(session, inventory, request, tradeChoice); } @@ -153,7 +153,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { // 1.18.10 update - seems impossible to call without consoles/controller input // We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to // store a map of net ID to trade index on our end. - int tradeChoice = ((AutoCraftRecipeStackRequestActionData) request.getActions()[0]).getRecipeNetworkId() - 1; + int tradeChoice = ((AutoCraftRecipeAction) request.getActions()[0]).getRecipeNetworkId() - 1; return handleTrade(session, inventory, request, tradeChoice); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java index b43585f99..f4302e532 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java @@ -36,15 +36,15 @@ import it.unimi.dsi.fastutil.ints.IntSet; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftCreativeStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.DestroyStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.DropStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.SwapStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.TransferStackRequestActionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftCreativeAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DestroyAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; @@ -174,7 +174,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { int slotnum = slotInfoData.getSlot(); switch (slotInfoData.getContainer()) { case HOTBAR_AND_INVENTORY: @@ -246,10 +246,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator { PlayerInventory playerInv = session.getPlayerInventory(); IntSet affectedSlots = new IntOpenHashSet(); - for (StackRequestActionData action : request.getActions()) { + for (ItemStackRequestAction action : request.getActions()) { switch (action.getType()) { case TAKE, PLACE -> { - TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action; if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) { return rejectRequest(request); } @@ -296,7 +296,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } } case SWAP -> { - SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; + SwapAction swapAction = (SwapAction) action; if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) { return rejectRequest(request); } @@ -336,7 +336,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } } case DROP -> { - DropStackRequestActionData dropAction = (DropStackRequestActionData) action; + DropAction dropAction = (DropAction) action; if (!checkNetId(session, inventory, dropAction.getSource())) { return rejectRequest(request); } @@ -364,7 +364,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } case DESTROY -> { // Only called when a creative client wants to destroy an item... I think - Camotoy - DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action; + DestroyAction destroyAction = (DestroyAction) action; if (!checkNetId(session, inventory, destroyAction.getSource())) { return rejectRequest(request); } @@ -403,10 +403,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator { ItemStack javaCreativeItem = null; IntSet affectedSlots = new IntOpenHashSet(); CraftState craftState = CraftState.START; - for (StackRequestActionData action : request.getActions()) { + for (ItemStackRequestAction action : request.getActions()) { switch (action.getType()) { case CRAFT_CREATIVE: { - CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action; + CraftCreativeAction creativeAction = (CraftCreativeAction) action; if (craftState != CraftState.START) { return rejectRequest(request); } @@ -430,7 +430,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { break; } case DESTROY: { - DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action; + DestroyAction destroyAction = (DestroyAction) action; if (craftState != CraftState.DEPRECATED) { return rejectRequest(request); } @@ -442,7 +442,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } case TAKE: case PLACE: { - TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action; if (!(craftState == CraftState.DEPRECATED || craftState == CraftState.TRANSFER)) { return rejectRequest(request); } @@ -480,7 +480,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { return rejectRequest(request); } - DropStackRequestActionData dropAction = (DropStackRequestActionData) action; + DropAction dropAction = (DropAction) action; if (dropAction.getSource().getContainer() != ContainerSlotType.CREATIVE_OUTPUT || dropAction.getSource().getSlot() != 50) { return rejectRequest(request); } @@ -517,7 +517,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { session.sendDownstreamPacket(creativePacket); } - private static boolean isCraftingGrid(StackRequestSlotInfoData slotInfoData) { + private static boolean isCraftingGrid(ItemStackRequestSlotData slotInfoData) { return slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java index 2e131641d..e38a0953c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java index 2326e7491..3035c0812 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -37,7 +37,7 @@ public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslato } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case SMITHING_TABLE_INPUT -> 0; case SMITHING_TABLE_MATERIAL -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index 9b888b1ac..d39cc15cd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; -import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.RecipeItemStackRequestAction; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; @@ -51,14 +51,14 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } @Override - protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { - return action.getType() == StackRequestActionType.CRAFT_RECIPE; + protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) { + return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE; } @Override protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Guarded by shouldHandleRequestFirst - CraftRecipeStackRequestActionData data = (CraftRecipeStackRequestActionData) request.getActions()[0]; + RecipeItemStackRequestAction data = (RecipeItemStackRequestAction) request.getActions()[0]; // Look up all possible options of cutting from this ID GeyserStonecutterData craftingData = session.getStonecutterRecipes().get(data.getRecipeNetworkId()); @@ -86,7 +86,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { return switch (slotInfoData.getContainer()) { case STONECUTTER_INPUT -> 0; case STONECUTTER_RESULT, CREATIVE_OUTPUT -> 1; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java index 52af30bfe..5d0bd12ba 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.inventory.chest; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java index a53acb3f3..9168732a9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.horse; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; @@ -52,7 +52,7 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) { return this.equipSlot; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java index cdfd88f4f..84d7744d1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.horse; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; -import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData; import org.geysermc.geyser.inventory.BedrockContainerSlot; public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator { @@ -35,7 +35,7 @@ public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator { } @Override - public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) { if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) { return slotInfoData.getSlot(); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java index 1515f64c8..0b079fffd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java @@ -39,10 +39,10 @@ import com.github.steveice10.opennbt.tag.builtin.LongTag; import com.github.steveice10.opennbt.tag.builtin.ShortTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.kyori.adventure.text.Component; @@ -380,7 +380,7 @@ public abstract class ItemTranslator { if (tag instanceof LongArrayTag) { //Long array tag does not exist in BE //LongArrayTag longArrayTag = (LongArrayTag) tag; - //return new com.nukkitx.nbt.tag.LongArrayTag(longArrayTag.getName(), longArrayTag.getValue()); + //return new org.cloudburstmc.nbt.tag.LongArrayTag(longArrayTag.getName(), longArrayTag.getValue()); return null; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BannerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BannerTranslator.java index 95dd07f22..1bafabee8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BannerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BannerTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java index 725a17e7a..56602856e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; 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 com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.translator.inventory.item.nbt.BannerTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java index 7d1a8b514..12b050236 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; @BlockEntity(type = BlockEntityType.BEACON) public class BeaconBlockEntityTranslator extends BlockEntityTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java index 4ca9792ad..58d36af56 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; @BlockEntity(type = BlockEntityType.BED) diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java index f8b2b737c..c43dfe8bc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.level.block.entity; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java index 83db13bc6..b89a2a547 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.util.BlockEntityUtils; /** diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java index e36ad2d22..02dc12f71 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; 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 com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java index 9700bd9bb..9e743667f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.*; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.translator.text.MessageTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java index 641d92282..567d3a5e1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java index bafb07753..1a7958c62 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; public class EmptyBlockEntityTranslator extends BlockEntityTranslator { @Override diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java index 9ff449055..da992d0ad 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java @@ -30,9 +30,9 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.LongTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtList; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtList; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java index 7747cf118..89dd7b292 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java @@ -26,8 +26,10 @@ package org.geysermc.geyser.translator.level.block.entity; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java index bb036a1b0..c8dcbc008 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; @BlockEntity(type = BlockEntityType.JIGSAW) diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java index 7f6ffa0c0..d954b2a8a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue import org.cloudburstmc.math.vector.Vector3d; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java index 6e67f46ac..a55fa8a62 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.level.block.entity; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.geysermc.geyser.level.block.BlockStateValues; /** diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java index 83e989f49..db7b3073f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.translator.inventory.ShulkerInventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java index 1b4fd6a10..44f3b7362 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.util.SignUtils; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java index 3377a3207..9f5a93a35 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.skin.SkinProvider; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java index 2a4711e26..d1af70d8d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.Registries; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index d2d6a4ffc..61d40c930 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java index dd310bec1..87db3649b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java @@ -47,10 +47,10 @@ import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.protocol.bedrock.data.LevelEvent; import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; -import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryActionData; -import org.cloudburstmc.protocol.bedrock.data.inventory.InventorySource; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; -import org.cloudburstmc.protocol.bedrock.data.inventory.LegacySetItemSlotData; +import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.InventoryActionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.InventorySource; +import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.LegacySetItemSlotData; import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; import org.cloudburstmc.protocol.bedrock.packet.InventoryTransactionPacket; import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index 81706167a..d1246a0b4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisguisedChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisguisedChatTranslator.java index e9499d966..2ad45fe52 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisguisedChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisguisedChatTranslator.java @@ -25,9 +25,7 @@ package org.geysermc.geyser.translator.protocol.java; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundCustomSoundPacket; -import org.cloudburstmc.math.vector.Vector3f; -import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java index 099f0db5e..5677e1473 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateRecipesTranslator.java @@ -42,8 +42,8 @@ import it.unimi.dsi.fastutil.ints.IntSet; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; -import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.DefaultDescriptor; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoRemoveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoRemoveTranslator.java index 4e9f0ca42..751b18889 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoRemoveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoRemoveTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket; -import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoUpdateTranslator.java index a69c03169..bbdf7ea75 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoUpdateTranslator.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java index 2cf413823..89fc8bf54 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; -import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket; import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java index fd7c46733..02da421d5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.packet.UpdateEquipPacket; import org.geysermc.geyser.entity.type.Entity; 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 04d6a4886..26c1a9069 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 @@ -28,9 +28,9 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundMerchantOffersPacket; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java index 0432ab222..c38db1f79 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.block.value.*; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEventPacket; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.cloudburstmc.protocol.bedrock.packet.BlockEventPacket; import it.unimi.dsi.fastutil.objects.Object2IntMaps; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java index c50746b6b..919e3f596 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.protocol.bedrock.data.LevelEvent; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.packet.LevelEventGenericPacket; import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; @@ -47,7 +47,7 @@ public class JavaExplodeTranslator extends PacketTranslator 0) { - levelEventPacket.setEventId(2037/*LevelEvent.SCULK_CHARGE*/); + levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.SCULK_CHARGE); levelEventPacket.setTag( NbtMap.builder() .putInt("x", packet.getPosition().getX()) @@ -274,7 +274,7 @@ public class JavaLevelEventTranslator extends PacketTranslator { LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket(); - levelEventPacket.setEventId(2035/*LevelEvent.PARTICLE_SCULK_SHRIEK*/); + levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SCULK_SHRIEK); levelEventPacket.setTag( NbtMap.builder() .putInt("originX", packet.getPosition().getX()) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java index 55fb5e294..df7a565dd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java @@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.data.game.level.particle.VibrationParti import com.github.steveice10.mc.protocol.data.game.level.particle.positionsource.BlockPositionSource; import com.github.steveice10.mc.protocol.data.game.level.particle.positionsource.EntityPositionSource; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelParticlesPacket; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.LevelEvent; import org.cloudburstmc.protocol.bedrock.data.ParticleType; diff --git a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java index 3d5f5fe0f..8fe842e1a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.translator.text; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; -import com.nukkitx.protocol.bedrock.packet.TextPacket; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import org.cloudburstmc.protocol.bedrock.packet.TextPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.*; diff --git a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java index bb158bf1c..9964ed08b 100644 --- a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java index cf0c66783..dcf665ddf 100644 --- a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java @@ -27,9 +27,12 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.PlayerActionType; import org.cloudburstmc.protocol.bedrock.packet.ChangeDimensionPacket; import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket; import org.cloudburstmc.protocol.bedrock.packet.MobEffectPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayerActionPacket; import org.cloudburstmc.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.level.BedrockDimension; diff --git a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java index d320cadfa..d374cc8ee 100644 --- a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java @@ -31,14 +31,16 @@ 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; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.cloudburstmc.protocol.bedrock.packet.PlayerHotbarPacket; +import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; @@ -201,14 +203,14 @@ public class InventoryUtils { .tag(root.build()).build(); } - private static int getUnusableSpaceBlockID(int protocolVersion) { + private static ItemDefinition getUnusableSpaceBlockID(int protocolVersion) { String unusableSpaceBlock = GeyserImpl.getInstance().getConfig().getUnusableSpaceBlock(); ItemMapping unusableSpaceBlockID = Registries.ITEMS.forVersion(protocolVersion).getMapping(unusableSpaceBlock); if (unusableSpaceBlockID != null) { - return unusableSpaceBlockID.getBedrockId(); + return unusableSpaceBlockID.getBedrockDefinition(); } else { GeyserImpl.getInstance().getLogger().error("Invalid value" + unusableSpaceBlock + ". Resorting to barrier block."); - return Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockId(); + return Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockDefinition(); } } diff --git a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java index c30f416fe..a50197259 100644 --- a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.util.collection; import org.cloudburstmc.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMap; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index f9d62b3f7..1446e0b3f 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit f9d62b3f73db270bd4e0c833b7728b30d29e1369 +Subproject commit 1446e0b3fc9d702c1b07f194167b599475247fdf From 2d3dd891627753171a96f620845b943d8f1f534b Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Wed, 14 Dec 2022 17:57:08 -0500 Subject: [PATCH 2/5] Some misc fixes --- .../geyser/platform/fabric/world/GeyserFabricWorldManager.java | 1 + .../java/org/geysermc/geyser/network/netty/LocalSession.java | 2 +- .../geyser/registry/populator/BlockRegistryPopulator.java | 2 +- .../geyser/registry/populator/ItemRegistryPopulator.java | 1 + .../protocol/java/level/JavaLevelParticlesTranslator.java | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java b/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java index b9440c3da..218e33079 100644 --- a/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java +++ b/bootstrap/fabric/src/main/java/org/geysermc/geyser/platform/fabric/world/GeyserFabricWorldManager.java @@ -38,6 +38,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.LecternBlockEntity; import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.geysermc.geyser.level.GeyserWorldManager; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index 0057fb7a2..551bc1deb 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -53,7 +53,7 @@ public final class LocalSession extends TcpSession { private final String clientIp; private final PacketCodecHelper codecHelper; - public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, PacketCodecHelper codecHelper) { + public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, MinecraftCodecHelper codecHelper) { super(host, port, protocol); this.targetAddress = targetAddress; this.clientIp = clientIp; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 217766b4f..6f0367238 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -40,8 +40,8 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import org.cloudburstmc.protocol.bedrock.codec.v527.Bedrock_v527; import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544; +import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560; import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; import org.cloudburstmc.protocol.bedrock.data.defintions.SimpleBlockDefinition; import org.cloudburstmc.protocol.bedrock.data.defintions.SimpleDefinitionRegistry; 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 04089e61f..2b86cde1f 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 @@ -46,6 +46,7 @@ import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.cloudburstmc.protocol.bedrock.codec.v527.Bedrock_v527; import org.cloudburstmc.protocol.bedrock.codec.v534.Bedrock_v534; import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544; +import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.cloudburstmc.protocol.bedrock.data.defintions.SimpleDefinitionRegistry; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java index df7a565dd..6adb053d7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java @@ -163,7 +163,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator { LevelEventGenericPacket packet = new LevelEventGenericPacket(); - packet.setEventId(2027/*LevelEvent.PARTICLE_VIBRATION_SIGNAL*/); + packet.setType(LevelEvent.PARTICLE_VIBRATION_SIGNAL); packet.setTag( NbtMap.builder() .putCompound("origin", buildVec3PositionTag(position)) From 3fca39094f6db357d603916ec3cfa860c24a37c2 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Wed, 14 Dec 2022 18:30:57 -0500 Subject: [PATCH 3/5] Apply motd change that wasn't possible during merge --- .../geysermc/geyser/network/netty/GeyserServer.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java index 4be10f896..afb3bff3a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java @@ -166,6 +166,10 @@ public final class GeyserServer { pong.maximumPlayerCount(config.getMaxPlayers()); } + // https://github.com/GeyserMC/Geyser/issues/3388 + pong.motd(pong.motd().replace(';', ':')); + pong.subMotd(pong.subMotd().replace(';', ':')); + // Fallbacks to prevent errors and allow Bedrock to see the server if (pong.motd() == null || pong.motd().isBlank()) { pong.motd(GeyserImpl.NAME); @@ -193,6 +197,14 @@ public final class GeyserServer { } } + if (config.isPassthroughPlayerCounts() && pingInfo != null) { + pong.playerCount(pingInfo.getPlayers().getOnline()); + pong.maximumPlayerCount(pingInfo.getPlayers().getMax()); + } else { + pong.playerCount(geyser.getSessionManager().getSessions().size()); + pong.maximumPlayerCount(config.getMaxPlayers()); + } + //Bedrock will not even attempt a connection if the client thinks the server is full //so we have to fake it not being full if (pong.playerCount() >= pong.maximumPlayerCount()) { From d0bff29d4b09f8271bb9582e97eed25b4dc41ab7 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Thu, 15 Dec 2022 15:41:16 -0500 Subject: [PATCH 4/5] Fix clientData in encryptPlayerConnection --- .../java/org/geysermc/geyser/util/LoginEncryptionUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java index b301d35a9..ec37ca6bd 100644 --- a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -122,7 +122,7 @@ public class LoginEncryptionUtils { } public static void encryptPlayerConnection(GeyserSession session, LoginPacket loginPacket) { - encryptConnectionWithCert(session, loginPacket.getExtra().toString(), loginPacket.getChain()); + encryptConnectionWithCert(session, loginPacket.getExtra().getParsedString(), loginPacket.getChain()); } private static void encryptConnectionWithCert(GeyserSession session, String clientData, List certChainData) { From d4631e63be15ca7cdcb408152dd01ba1b524c387 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Thu, 15 Dec 2022 15:45:27 -0500 Subject: [PATCH 5/5] Fix mistake in 3fca39094f6db357d603916ec3cfa860c24a37c2 --- .../org/geysermc/geyser/network/netty/GeyserServer.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java index afb3bff3a..908fc22d2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java @@ -158,14 +158,6 @@ public final class GeyserServer { pong.subMotd(config.getBedrock().secondaryMotd()); } - if (config.isPassthroughPlayerCounts() && pingInfo != null) { - pong.playerCount(pingInfo.getPlayers().getOnline()); - pong.maximumPlayerCount(pingInfo.getPlayers().getMax()); - } else { - pong.playerCount(geyser.getSessionManager().getSessions().size()); - pong.maximumPlayerCount(config.getMaxPlayers()); - } - // https://github.com/GeyserMC/Geyser/issues/3388 pong.motd(pong.motd().replace(';', ':')); pong.subMotd(pong.subMotd().replace(';', ':'));