From 18e7db8c30821edf38410d91e13d1a3690eff066 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 29 Oct 2022 19:23:21 -0500 Subject: [PATCH] Start on update to Protocol 3.0 --- .../world/GeyserFabricWorldManager.java | 2 +- .../spigot/world/GeyserPistonListener.java | 2 +- .../world/GeyserSpigotBlockPlaceListener.java | 6 +- .../manager/GeyserSpigotWorldManager.java | 2 +- core/build.gradle.kts | 4 +- .../geysermc/connector/GeyserConnector.java | 5 - .../network/session/GeyserSession.java | 2 +- .../java/org/geysermc/geyser/GeyserImpl.java | 58 +-- .../command/defaults/OffhandCommand.java | 2 +- .../command/defaults/VersionCommand.java | 2 +- .../org/geysermc/geyser/dump/DumpInfo.java | 2 +- .../geyser/entity/EntityDefinitions.java | 34 +- .../geyser/entity/GeyserDirtyMetadata.java | 8 +- .../entity/attribute/GeyserAttributeType.java | 2 +- .../geyser/entity/factory/EntityFactory.java | 2 +- .../entity/type/AbstractArrowEntity.java | 4 +- .../entity/type/AreaEffectCloudEntity.java | 20 +- .../geyser/entity/type/BoatEntity.java | 18 +- .../geyser/entity/type/ChestBoatEntity.java | 2 +- .../type/CommandBlockMinecartEntity.java | 20 +- .../type/DefaultBlockMinecartEntity.java | 14 +- .../entity/type/EnderCrystalEntity.java | 12 +- .../geysermc/geyser/entity/type/Entity.java | 49 +-- .../geyser/entity/type/EvokerFangsEntity.java | 10 +- .../geyser/entity/type/ExpOrbEntity.java | 6 +- .../entity/type/FallingBlockEntity.java | 8 +- .../geyser/entity/type/FireballEntity.java | 2 +- .../geyser/entity/type/FireworkEntity.java | 8 +- .../geyser/entity/type/FishingHookEntity.java | 10 +- .../entity/type/FurnaceMinecartEntity.java | 8 +- .../geyser/entity/type/ItemEntity.java | 14 +- .../geyser/entity/type/ItemFrameEntity.java | 14 +- .../geyser/entity/type/LeashKnotEntity.java | 2 +- .../geyser/entity/type/LightningEntity.java | 4 +- .../geyser/entity/type/LivingEntity.java | 36 +- .../geyser/entity/type/MinecartEntity.java | 10 +- .../geyser/entity/type/PaintingEntity.java | 4 +- .../entity/type/SpawnerMinecartEntity.java | 8 +- .../geyser/entity/type/TNTEntity.java | 14 +- .../geyser/entity/type/ThrowableEntity.java | 10 +- .../entity/type/ThrowableItemEntity.java | 4 +- .../entity/type/ThrownPotionEntity.java | 12 +- .../geyser/entity/type/TippedArrowEntity.java | 10 +- .../geyser/entity/type/TridentEntity.java | 2 +- .../geyser/entity/type/WitherSkullEntity.java | 2 +- .../type/living/AbstractFishEntity.java | 4 +- .../entity/type/living/AgeableEntity.java | 8 +- .../entity/type/living/AllayEntity.java | 4 +- .../entity/type/living/AmbientEntity.java | 2 +- .../entity/type/living/ArmorStandEntity.java | 38 +- .../geyser/entity/type/living/BatEntity.java | 4 +- .../entity/type/living/CreatureEntity.java | 2 +- .../entity/type/living/DolphinEntity.java | 2 +- .../entity/type/living/FlyingEntity.java | 2 +- .../entity/type/living/GlowSquidEntity.java | 2 +- .../entity/type/living/GolemEntity.java | 2 +- .../entity/type/living/IronGolemEntity.java | 8 +- .../entity/type/living/MagmaCubeEntity.java | 6 +- .../geyser/entity/type/living/MobEntity.java | 8 +- .../entity/type/living/SlimeEntity.java | 6 +- .../entity/type/living/SnowGolemEntity.java | 4 +- .../entity/type/living/SquidEntity.java | 6 +- .../entity/type/living/TadpoleEntity.java | 2 +- .../entity/type/living/WaterEntity.java | 2 +- .../type/living/animal/AnimalEntity.java | 6 +- .../type/living/animal/AxolotlEntity.java | 8 +- .../entity/type/living/animal/BeeEntity.java | 12 +- .../type/living/animal/ChickenEntity.java | 2 +- .../entity/type/living/animal/CowEntity.java | 6 +- .../entity/type/living/animal/FoxEntity.java | 8 +- .../entity/type/living/animal/FrogEntity.java | 12 +- .../entity/type/living/animal/GoatEntity.java | 10 +- .../type/living/animal/HoglinEntity.java | 4 +- .../type/living/animal/MooshroomEntity.java | 6 +- .../type/living/animal/OcelotEntity.java | 4 +- .../type/living/animal/PandaEntity.java | 24 +- .../entity/type/living/animal/PigEntity.java | 4 +- .../type/living/animal/PolarBearEntity.java | 2 +- .../type/living/animal/PufferFishEntity.java | 8 +- .../type/living/animal/RabbitEntity.java | 8 +- .../type/living/animal/SheepEntity.java | 8 +- .../type/living/animal/StriderEntity.java | 4 +- .../living/animal/TropicalFishEntity.java | 12 +- .../type/living/animal/TurtleEntity.java | 4 +- .../animal/horse/AbstractHorseEntity.java | 24 +- .../animal/horse/ChestedHorseEntity.java | 4 +- .../type/living/animal/horse/HorseEntity.java | 8 +- .../type/living/animal/horse/LlamaEntity.java | 10 +- .../animal/horse/SkeletonHorseEntity.java | 2 +- .../animal/horse/TraderLlamaEntity.java | 6 +- .../animal/horse/ZombieHorseEntity.java | 2 +- .../living/animal/tameable/CatEntity.java | 12 +- .../living/animal/tameable/ParrotEntity.java | 4 +- .../animal/tameable/TameableEntity.java | 8 +- .../living/animal/tameable/WolfEntity.java | 14 +- .../merchant/AbstractMerchantEntity.java | 4 +- .../type/living/merchant/VillagerEntity.java | 18 +- .../monster/AbstractSkeletonEntity.java | 6 +- .../type/living/monster/BasePiglinEntity.java | 4 +- .../type/living/monster/BlazeEntity.java | 4 +- .../type/living/monster/CreeperEntity.java | 6 +- .../living/monster/ElderGuardianEntity.java | 4 +- .../living/monster/EnderDragonEntity.java | 10 +- .../living/monster/EnderDragonPartEntity.java | 10 +- .../type/living/monster/EndermanEntity.java | 12 +- .../type/living/monster/GhastEntity.java | 6 +- .../type/living/monster/GiantEntity.java | 6 +- .../type/living/monster/GuardianEntity.java | 8 +- .../type/living/monster/MonsterEntity.java | 2 +- .../type/living/monster/PhantomEntity.java | 6 +- .../type/living/monster/PiglinEntity.java | 8 +- .../type/living/monster/ShulkerEntity.java | 14 +- .../type/living/monster/SkeletonEntity.java | 4 +- .../type/living/monster/SpiderEntity.java | 4 +- .../entity/type/living/monster/VexEntity.java | 6 +- .../type/living/monster/WardenEntity.java | 14 +- .../type/living/monster/WitherEntity.java | 21 +- .../type/living/monster/ZoglinEntity.java | 8 +- .../type/living/monster/ZombieEntity.java | 8 +- .../living/monster/ZombieVillagerEntity.java | 12 +- .../living/monster/ZombifiedPiglinEntity.java | 4 +- .../monster/raid/AbstractIllagerEntity.java | 2 +- .../living/monster/raid/PillagerEntity.java | 8 +- .../monster/raid/RaidParticipantEntity.java | 2 +- .../raid/SpellcasterIllagerEntity.java | 8 +- .../living/monster/raid/VindicatorEntity.java | 4 +- .../entity/type/player/PlayerEntity.java | 36 +- .../type/player/SessionPlayerEntity.java | 20 +- .../entity/type/player/SkullPlayerEntity.java | 20 +- .../inventory/BedrockContainerSlot.java | 2 +- .../geyser/inventory/EnchantingContainer.java | 2 +- .../geyser/inventory/Generic3X3Container.java | 2 +- .../geyser/inventory/GeyserEnchantOption.java | 4 +- .../geyser/inventory/GeyserItemStack.java | 2 +- .../geysermc/geyser/inventory/Inventory.java | 9 +- .../geyser/inventory/LecternContainer.java | 2 +- .../holder/BlockInventoryHolder.java | 12 +- .../inventory/item/StoredItemMappings.java | 73 ++-- .../updater/AnvilInventoryUpdater.java | 6 +- .../updater/ChestInventoryUpdater.java | 6 +- .../updater/ContainerInventoryUpdater.java | 6 +- .../updater/HorseInventoryUpdater.java | 6 +- .../inventory/updater/InventoryUpdater.java | 8 +- .../inventory/updater/UIInventoryUpdater.java | 4 +- .../geyser/item/GeyserCustomMappingData.java | 7 +- .../geysermc/geyser/level/WorldManager.java | 2 +- .../geysermc/geyser/level/physics/Axis.java | 2 +- .../geyser/level/physics/BoundingBox.java | 2 +- .../level/physics/CollisionManager.java | 12 +- .../geyser/level/physics/Direction.java | 2 +- .../geysermc/geyser/network/GameProtocol.java | 39 +- ...dler.java => GeyserServerInitializer.java} | 23 +- .../geyser/network/LoggingPacketHandler.java | 333 +++++++++--------- .../geyser/network/QueryPacketHandler.java | 2 +- .../geyser/network/UpstreamPacketHandler.java | 81 +++-- .../geyser/network/netty/GeyserServer.java | 68 ++++ .../geyser/network/netty/LocalSession.java | 7 +- .../registry/PacketTranslatorRegistry.java | 2 +- .../geysermc/geyser/registry/Registries.java | 10 +- .../loader/ParticleTypesRegistryLoader.java | 2 +- .../loader/PotionMixRegistryLoader.java | 14 +- .../loader/SoundEventsRegistryLoader.java | 4 +- .../populator/BlockRegistryPopulator.java | 91 ++--- .../CustomItemRegistryPopulator.java | 11 +- .../populator/ItemRegistryPopulator.java | 133 +++---- .../populator/PacketRegistryPopulator.java | 2 +- .../populator/RecipeRegistryPopulator.java | 18 +- .../geyser/registry/type/BlockMappings.java | 38 +- .../geyser/registry/type/ItemMapping.java | 23 +- .../geyser/registry/type/ItemMappings.java | 26 +- .../type/NonVanillaItemRegistration.java | 2 +- .../geyser/registry/type/ParticleMapping.java | 2 +- .../org/geysermc/geyser/scoreboard/Score.java | 2 +- .../geyser/scoreboard/Scoreboard.java | 8 +- .../geyser/session/DownstreamSession.java | 64 ++++ .../geyser/session/GeyserSession.java | 105 ++++-- .../geyser/session/UpstreamSession.java | 24 +- .../geyser/session/cache/BossBar.java | 16 +- .../geyser/session/cache/FormCache.java | 6 +- .../geyser/session/cache/PistonCache.java | 8 +- .../geyser/session/cache/SkullCache.java | 4 +- .../geyser/session/cache/TeleportCache.java | 2 +- .../geyser/session/cache/WorldBorder.java | 10 +- .../geyser/session/cache/WorldCache.java | 4 +- .../geyser/skin/FakeHeadProvider.java | 8 +- .../org/geysermc/geyser/skin/SkinManager.java | 6 +- .../geyser/skin/SkullSkinManager.java | 6 +- .../geysermc/geyser/text/ChatTypeEntry.java | 2 +- .../translator/collision/BlockCollision.java | 4 +- .../AbstractBlockInventoryTranslator.java | 2 +- .../inventory/AnvilInventoryTranslator.java | 16 +- .../inventory/BaseInventoryTranslator.java | 4 +- .../inventory/BeaconInventoryTranslator.java | 20 +- .../inventory/BrewingInventoryTranslator.java | 8 +- .../CartographyInventoryTranslator.java | 6 +- .../CraftingInventoryTranslator.java | 6 +- .../EnchantingInventoryTranslator.java | 20 +- .../Generic3X3InventoryTranslator.java | 8 +- .../GrindstoneInventoryTranslator.java | 6 +- .../inventory/HopperInventoryTranslator.java | 4 +- .../inventory/InventoryTranslator.java | 10 +- .../inventory/LecternInventoryTranslator.java | 4 +- .../inventory/LoomInventoryTranslator.java | 18 +- .../MerchantInventoryTranslator.java | 26 +- .../inventory/PlayerInventoryTranslator.java | 10 +- .../inventory/ShulkerInventoryTranslator.java | 8 +- .../SmithingInventoryTranslator.java | 6 +- .../StonecutterInventoryTranslator.java | 16 +- .../chest/ChestInventoryTranslator.java | 2 +- .../chest/DoubleChestInventoryTranslator.java | 12 +- .../chest/SingleChestInventoryTranslator.java | 2 +- .../AbstractFurnaceInventoryTranslator.java | 6 +- .../BlastFurnaceInventoryTranslator.java | 4 +- .../furnace/FurnaceInventoryTranslator.java | 4 +- .../furnace/SmokerInventoryTranslator.java | 4 +- .../ChestedHorseInventoryTranslator.java | 10 +- .../horse/HorseInventoryTranslator.java | 4 +- .../inventory/item/CompassTranslator.java | 2 +- .../inventory/item/CustomItemTranslator.java | 19 +- .../inventory/item/FilledMapTranslator.java | 2 +- .../inventory/item/GoatHornTranslator.java | 2 +- .../inventory/item/ItemTranslator.java | 29 +- .../inventory/item/PotionTranslator.java | 4 +- .../inventory/item/TippedArrowTranslator.java | 4 +- .../item/nbt/CrossbowTranslator.java | 2 +- .../block/entity/BedrockOnlyBlockEntity.java | 2 +- .../DoubleChestBlockEntityTranslator.java | 2 +- .../FlowerPotBlockEntityTranslator.java | 4 +- .../level/block/entity/PistonBlockEntity.java | 12 +- .../entity/PistonBlockEntityTranslator.java | 2 +- .../entity/SkullBlockEntityTranslator.java | 2 +- .../level/event/PlaySoundEventTranslator.java | 4 +- .../event/SoundEventEventTranslator.java | 6 +- .../event/SoundLevelEventTranslator.java | 6 +- .../BedrockAdventureSettingsTranslator.java | 4 +- .../bedrock/BedrockAnimateTranslator.java | 2 +- .../BedrockBlockEntityDataTranslator.java | 4 +- .../BedrockBlockPickRequestTranslator.java | 4 +- .../bedrock/BedrockBookEditTranslator.java | 2 +- .../BedrockCommandBlockUpdateTranslator.java | 2 +- .../BedrockCommandRequestTranslator.java | 2 +- .../BedrockContainerCloseTranslator.java | 2 +- .../bedrock/BedrockEmoteListTranslator.java | 2 +- .../BedrockEntityPickRequestTranslator.java | 2 +- .../bedrock/BedrockFilterTextTranslator.java | 2 +- ...BedrockInventoryTransactionTranslator.java | 81 +++-- .../BedrockItemFrameDropItemTranslator.java | 2 +- .../BedrockItemStackRequestTranslator.java | 2 +- .../BedrockLecternUpdateTranslator.java | 2 +- .../BedrockMapInfoRequestTranslator.java | 4 +- .../BedrockMobEquipmentTranslator.java | 4 +- .../BedrockMoveEntityAbsoluteTranslator.java | 4 +- .../BedrockNetworkStackLatencyTranslator.java | 6 +- ...drockPacketViolationWarningTranslator.java | 2 +- .../bedrock/BedrockPlayerInputTranslator.java | 4 +- ...tionTrackingDBClientRequestTranslator.java | 4 +- .../BedrockRequestAbilityTranslator.java | 6 +- .../BedrockRequestChunkRadiusTranslator.java | 2 +- .../bedrock/BedrockRespawnTranslator.java | 2 +- ...edrockServerSettingsRequestTranslator.java | 4 +- ...SetLocalPlayerAsInitializedTranslator.java | 2 +- .../bedrock/BedrockShowCreditsTranslator.java | 2 +- .../bedrock/BedrockTextTranslator.java | 2 +- .../entity/BedrockEntityEventTranslator.java | 2 +- .../player/BedrockActionTranslator.java | 14 +- .../entity/player/BedrockEmoteTranslator.java | 4 +- .../player/BedrockInteractTranslator.java | 10 +- .../player/BedrockMovePlayerTranslator.java | 6 +- .../player/BedrockRiderJumpTranslator.java | 2 +- .../BedrockSetPlayerGameTypeTranslator.java | 2 +- .../BedrockLevelSoundEventTranslator.java | 4 +- .../java/JavaChangeDifficultyTranslator.java | 2 +- .../protocol/java/JavaCommandsTranslator.java | 10 +- .../java/JavaCustomPayloadTranslator.java | 4 +- .../java/JavaKeepAliveTranslator.java | 2 +- .../protocol/java/JavaLoginTranslator.java | 10 +- .../java/JavaPlayerChatTranslator.java | 2 +- .../protocol/java/JavaRespawnTranslator.java | 8 +- .../java/JavaSystemChatTranslator.java | 2 +- .../JavaUpdateAdvancementsTranslator.java | 2 +- .../java/JavaUpdateRecipesTranslator.java | 12 +- .../java/entity/JavaAnimateTranslator.java | 8 +- .../entity/JavaEntityEventTranslator.java | 27 +- .../entity/JavaMoveVehicleTranslator.java | 2 +- .../entity/JavaRemoveMobEffectTranslator.java | 2 +- .../entity/JavaSetEntityLinkTranslator.java | 6 +- .../entity/JavaSetEntityMotionTranslator.java | 4 +- .../entity/JavaSetEquipmentTranslator.java | 2 +- .../entity/JavaSetPassengersTranslator.java | 8 +- .../entity/JavaTakeItemEntityTranslator.java | 6 +- .../entity/JavaTeleportEntityTranslator.java | 2 +- .../entity/JavaUpdateMobEffectTranslator.java | 2 +- .../JavaPlayerCombatKillTranslator.java | 2 +- .../player/JavaPlayerInfoTranslator.java | 4 +- .../player/JavaPlayerLookAtTranslator.java | 2 +- .../player/JavaPlayerPositionTranslator.java | 12 +- .../player/JavaSetCarriedItemTranslator.java | 2 +- .../player/JavaSetExperienceTranslator.java | 4 +- .../player/JavaSetHealthTranslator.java | 6 +- .../entity/spawn/JavaAddEntityTranslator.java | 2 +- .../spawn/JavaAddExperienceOrbTranslator.java | 2 +- .../entity/spawn/JavaAddPlayerTranslator.java | 2 +- .../JavaContainerSetSlotTranslator.java | 12 +- .../JavaHorseScreenOpenTranslator.java | 4 +- .../JavaMerchantOffersTranslator.java | 14 +- .../level/JavaBlockDestructionTranslator.java | 4 +- .../level/JavaBlockEntityDataTranslator.java | 6 +- .../java/level/JavaBlockEventTranslator.java | 6 +- .../java/level/JavaBlockUpdateTranslator.java | 6 +- .../java/level/JavaCooldownTranslator.java | 2 +- .../java/level/JavaCustomSoundTranslator.java | 4 +- .../java/level/JavaExplodeTranslator.java | 14 +- .../level/JavaForgetLevelChunkTranslator.java | 2 +- .../java/level/JavaGameEventTranslator.java | 10 +- .../JavaLevelChunkWithLightTranslator.java | 22 +- .../java/level/JavaLevelEventTranslator.java | 10 +- .../level/JavaLevelParticlesTranslator.java | 14 +- .../java/level/JavaMapItemDataTranslator.java | 8 +- .../JavaSetChunkCacheCenterTranslator.java | 2 +- ...JavaSetDefaultSpawnPositionTranslator.java | 2 +- .../java/level/JavaSetTimeTranslator.java | 2 +- .../java/level/JavaSoundTranslator.java | 2 +- .../java/level/JavaStopSoundTranslator.java | 2 +- .../JavaInitializeBorderTranslator.java | 2 +- .../border/JavaSetBorderCenterTranslator.java | 2 +- .../scoreboard/JavaSetScoreTranslator.java | 8 +- .../java/title/JavaClearTitlesTranslator.java | 2 +- .../title/JavaSetActionBarTextTranslator.java | 2 +- .../title/JavaSetSubtitleTextTranslator.java | 2 +- .../title/JavaSetTitleTextTranslator.java | 2 +- .../JavaSetTitlesAnimationTranslator.java | 2 +- .../BlockSoundInteractionTranslator.java | 2 +- .../sound/SoundInteractionTranslator.java | 2 +- .../BucketSoundInteractionTranslator.java | 6 +- .../ComparatorSoundInteractionTranslator.java | 6 +- .../block/DoorSoundInteractionTranslator.java | 6 +- .../FlintAndSteelInteractionTranslator.java | 6 +- .../block/GrassPathInteractionTranslator.java | 6 +- .../sound/block/HoeInteractionTranslator.java | 6 +- .../LeverSoundInteractionTranslator.java | 6 +- .../geyser/util/BlockEntityUtils.java | 4 +- .../org/geysermc/geyser/util/BlockUtils.java | 2 +- .../org/geysermc/geyser/util/ChunkUtils.java | 14 +- .../geysermc/geyser/util/CooldownUtils.java | 2 +- .../geysermc/geyser/util/DimensionUtils.java | 10 +- .../org/geysermc/geyser/util/EntityUtils.java | 22 +- .../geysermc/geyser/util/InventoryUtils.java | 10 +- .../geyser/util/LoginEncryptionUtils.java | 6 +- .../org/geysermc/geyser/util/MathUtils.java | 2 +- .../org/geysermc/geyser/util/SoundUtils.java | 12 +- .../util/collection/LecternHasBookMap.java | 2 +- .../inventory/item/CustomItemsTest.java | 62 ++-- gradle/libs.versions.toml | 13 +- 353 files changed, 1957 insertions(+), 1656 deletions(-) rename core/src/main/java/org/geysermc/geyser/network/{ConnectorServerEventHandler.java => GeyserServerInitializer.java} (93%) create mode 100644 core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java create mode 100644 core/src/main/java/org/geysermc/geyser/session/DownstreamSession.java 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 eb4f61c67..b685a85bf 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 @@ -25,7 +25,7 @@ package org.geysermc.geyser.platform.fabric.world; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java index 5eb99e10c..50caf8db2 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.platform.spigot.world; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.bukkit.Bukkit; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index d486501de..0ad269b6d 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.platform.spigot.world; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; import lombok.AllArgsConstructor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; 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 7bb8f1666..b0c5afbe3 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 @@ -25,7 +25,7 @@ package org.geysermc.geyser.platform.spigot.world.manager; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 994325ea0..8e1f65cba 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -20,9 +20,7 @@ dependencies { // Network libraries implementation(libs.websocket) - api(libs.protocol) { - exclude("com.nukkitx.network", "raknet") - } + api(libs.bundles.protocol) api(libs.mcauthlib) api(libs.mcprotocollib) { diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index bd14ebb25..2616b91d3 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -25,7 +25,6 @@ package org.geysermc.connector; -import com.nukkitx.protocol.bedrock.BedrockServer; import org.geysermc.api.Geyser; import org.geysermc.common.PlatformType; import org.geysermc.connector.network.session.GeyserSession; @@ -52,10 +51,6 @@ public class GeyserConnector { return INSTANCE; } - public BedrockServer getBedrockServer() { - return GeyserImpl.getInstance().getBedrockServer(); - } - public boolean isShuttingDown() { return GeyserImpl.getInstance().isShuttingDown(); } diff --git a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 258787e78..6298a41f6 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.session; import com.github.steveice10.packetlib.packet.Packet; -import com.nukkitx.protocol.bedrock.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import org.geysermc.connector.network.session.auth.AuthData; /** diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index a10e54f90..462857111 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -32,7 +32,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.packetlib.tcp.TcpSession; import com.nukkitx.network.raknet.RakNetConstants; import com.nukkitx.network.util.EventLoops; -import com.nukkitx.protocol.bedrock.BedrockServer; import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; import io.netty.util.NettyRuntime; @@ -70,7 +69,7 @@ import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.event.GeyserEventBus; import org.geysermc.geyser.extension.GeyserExtensionManager; import org.geysermc.geyser.level.WorldManager; -import org.geysermc.geyser.network.ConnectorServerEventHandler; +import org.geysermc.geyser.network.netty.GeyserServer; import org.geysermc.geyser.pack.ResourcePack; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; @@ -84,7 +83,12 @@ import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.MinecraftLocale; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.translator.text.MessageTranslator; -import org.geysermc.geyser.util.*; +import org.geysermc.geyser.util.CooldownUtils; +import org.geysermc.geyser.util.DimensionUtils; +import org.geysermc.geyser.util.Metrics; +import org.geysermc.geyser.util.NewsHandler; +import org.geysermc.geyser.util.VersionCheckUtils; +import org.geysermc.geyser.util.WebUtils; import java.io.File; import java.io.FileWriter; @@ -94,7 +98,12 @@ import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.security.Key; import java.text.DecimalFormat; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -142,7 +151,7 @@ public class GeyserImpl implements GeyserApi { private ScheduledExecutorService scheduledThread; - private BedrockServer bedrockServer; + private GeyserServer geyserServer; private final PlatformType platformType; private final GeyserBootstrap bootstrap; @@ -286,13 +295,6 @@ public class GeyserImpl implements GeyserApi { } boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); - bedrockServer = new BedrockServer( - new InetSocketAddress(config.getBedrock().address(), config.getBedrock().port()), - bedrockThreadCount, - EventLoops.commonGroup(), - enableProxyProtocol - ); - if (config.isDebugMode()) { logger.debug("EventLoop type: " + EventLoops.getChannelType()); if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) { @@ -305,23 +307,23 @@ public class GeyserImpl implements GeyserApi { } } - bedrockServer.setHandler(new ConnectorServerEventHandler(this)); - if (shouldStartListener) { - bedrockServer.bind().whenComplete((avoid, throwable) -> { - if (throwable == null) { - logger.info(GeyserLocale.getLocaleStringLog("geyser.core.start", config.getBedrock().address(), - String.valueOf(config.getBedrock().port()))); - } else { - String address = config.getBedrock().address(); - int port = config.getBedrock().port(); - logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", address, String.valueOf(port))); - if (!"0.0.0.0".equals(address)) { - logger.info(Component.text("Suggestion: try setting `address` under `bedrock` in the Geyser config back to 0.0.0.0", NamedTextColor.GREEN)); - logger.info(Component.text("Then, restart this server.", NamedTextColor.GREEN)); - } + try { + this.geyserServer = new GeyserServer(this, bedrockThreadCount); + this.geyserServer.bind(new InetSocketAddress(config.getBedrock().address(), config.getBedrock().port())) + .syncUninterruptibly(); + + logger.info(GeyserLocale.getLocaleStringLog("geyser.core.start", config.getBedrock().address(), + String.valueOf(config.getBedrock().port()))); + } catch (Throwable t) { + String address = config.getBedrock().address(); + int port = config.getBedrock().port(); + logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", address, String.valueOf(port))); + if (!"0.0.0.0".equals(address)) { + logger.info(Component.text("Suggestion: try setting `address` under `bedrock` in the Geyser config back to 0.0.0.0", NamedTextColor.GREEN)); + logger.info(Component.text("Then, restart this server.", NamedTextColor.GREEN)); } - }).join(); + } } if (config.getRemote().authType() == AuthType.FLOODGATE) { @@ -542,7 +544,7 @@ public class GeyserImpl implements GeyserApi { } scheduledThread.shutdown(); - bedrockServer.close(); + geyserServer.shutdown(); if (skinUploader != null) { skinUploader.close(); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java index 0015149be..3258e8d22 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommandSource; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index fbe4fb4f6..a1aeeb75a 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.command.defaults; -import com.nukkitx.protocol.bedrock.BedrockPacketCodec; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacketCodec; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.GeyserCommand; diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index 5197f2107..62c812cfd 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -31,7 +31,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.hash.Hashing; import com.google.common.io.ByteSource; import com.google.common.io.Files; -import com.nukkitx.protocol.bedrock.BedrockPacketCodec; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacketCodec; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import lombok.AllArgsConstructor; diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index a552d0875..7a71a90fc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.*; import org.geysermc.geyser.entity.type.living.*; import org.geysermc.geyser.entity.type.living.animal.*; @@ -196,7 +196,7 @@ public final class EntityDefinitions { .type(EntityType.AREA_EFFECT_CLOUD) .height(0.5f).width(1.0f) .addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius) - .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.EFFECT_COLOR, entityMetadata.getValue())) .addTranslator(null) // Waiting .addTranslator(MetadataType.PARTICLE, AreaEffectCloudEntity::setParticle) .build(); @@ -204,15 +204,15 @@ public final class EntityDefinitions { .type(EntityType.BOAT) .height(0.6f).width(1.6f) .offset(0.35f) - .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_TIME, entityMetadata.getValue())) // Time since last hit - .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Rocking direction + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.HURT_TIME, entityMetadata.getValue())) // Time since last hit + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.HURT_DIRECTION, entityMetadata.getValue())) // Rocking direction .addTranslator(MetadataType.FLOAT, (boatEntity, entityMetadata) -> // 'Health' in Bedrock, damage taken in Java - it makes motion in Bedrock - boatEntity.getDirtyMetadata().put(EntityData.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue()))) + boatEntity.getDirtyMetadata().put(EntityDataTypes.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue()))) .addTranslator(MetadataType.INT, BoatEntity::setVariant) .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingLeft) .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight) - .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything .build(); CHEST_BOAT = EntityDefinition.inherited(ChestBoatEntity::new, BOAT) .type(EntityType.CHEST_BOAT) @@ -367,11 +367,11 @@ public final class EntityDefinitions { .type(EntityType.MINECART) .height(0.7f).width(0.98f) .offset(0.35f) - .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HEALTH, entityMetadata.getValue())) - .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Direction in which the minecart is shaking + .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityDataTypes.HEALTH, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityDataTypes.HURT_DIRECTION, entityMetadata.getValue())) // Direction in which the minecart is shaking .addTranslator(MetadataType.FLOAT, (minecartEntity, entityMetadata) -> // Power in Java, time in Bedrock - minecartEntity.getDirtyMetadata().put(EntityData.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) + minecartEntity.getDirtyMetadata().put(EntityDataTypes.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlock) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) @@ -381,8 +381,8 @@ public final class EntityDefinitions { .build(); COMMAND_BLOCK_MINECART = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) .type(EntityType.COMMAND_BLOCK_MINECART) - .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) - .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) + .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) + .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) .build(); FURNACE_MINECART = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) .type(EntityType.FURNACE_MINECART) @@ -413,9 +413,9 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) .addTranslator(MetadataType.INT, - (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) + (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityDataTypes.EFFECT_COLOR, entityMetadata.getValue())) .addTranslator(MetadataType.BOOLEAN, - (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) + (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityDataTypes.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) .addTranslator(null) // Arrow count .addTranslator(null) // Stinger count .addTranslator(MetadataType.OPTIONAL_POSITION, LivingEntity::setBedPosition) @@ -886,9 +886,9 @@ public final class EntityDefinitions { LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) .type(EntityType.LLAMA) .height(1.87f).width(0.9f) - .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.STRENGTH, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.STRENGTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) - .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue())) .build(); TRADER_LLAMA = EntityDefinition.inherited(TraderLlamaEntity::new, LLAMA) .type(EntityType.TRADER_LLAMA) @@ -911,7 +911,7 @@ public final class EntityDefinitions { PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) .type(EntityType.PARROT) .height(0.9f).width(0.5f) - .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) // Parrot color + .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue())) // Parrot color .build(); WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase) .type(EntityType.WOLF) diff --git a/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java b/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java index c896c239e..c81514eae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java +++ b/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.entity; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataMap; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataType; import java.util.Map; @@ -35,9 +35,9 @@ import java.util.Map; * A write-only wrapper for temporarily storing entity metadata that will be sent to Bedrock. */ public final class GeyserDirtyMetadata { - private final Map metadata = new Object2ObjectLinkedOpenHashMap<>(); + private final Map, Object> metadata = new Object2ObjectLinkedOpenHashMap<>(); - public void put(EntityData entityData, Object value) { + public void put(EntityDataType entityData, Object value) { metadata.put(entityData, value); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java b/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java index ba3117518..92bfb7585 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java +++ b/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.attribute; -import com.nukkitx.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java index 9f23cdc78..7675ea8fd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.factory; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java index 963e0b70a..6828d1020 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java index a38a4dd16..79a2fd6f8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.session.GeyserSession; @@ -47,12 +47,12 @@ public class AreaEffectCloudEntity extends Entity { protected void initializeMetadata() { super.initializeMetadata(); // Without this the cloud doesn't appear, - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, Integer.MAX_VALUE); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_DURATION, Integer.MAX_VALUE); // This disabled client side shrink of the cloud - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f); - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, Float.MIN_VALUE); - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, Float.MIN_VALUE); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_RADIUS, 0.0f); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_CHANGE_RATE, Float.MIN_VALUE); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, Float.MIN_VALUE); setFlag(EntityFlag.FIRE_IMMUNE, true); } @@ -60,15 +60,15 @@ public class AreaEffectCloudEntity extends Entity { public void setRadius(FloatEntityMetadata entityMetadata) { // Anything less than 0.5 will cause the cloud to despawn float value = Math.max(entityMetadata.getPrimitiveValue(), 0.5f); - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_RADIUS, value); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_WIDTH, 2.0f * value); } public void setParticle(EntityMetadata entityMetadata) { Particle particle = entityMetadata.getValue(); int particleId = Registries.PARTICLES.map(particle.getType(), mapping -> mapping.getParticleId(this.session)).orElse(-1); if (particleId != -1) { - dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); + dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index 9fd96f46b..f9e6879da 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -28,10 +28,10 @@ package org.geysermc.geyser.entity.type; 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 com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.packet.AnimatePacket; -import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; @@ -73,8 +73,8 @@ public class BoatEntity extends Entity { super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); // Required to be able to move on land 1.16.200+ or apply gravity not in the water 1.16.100+ - dirtyMetadata.put(EntityData.IS_BUOYANT, (byte) 1); - dirtyMetadata.put(EntityData.BUOYANCY_DATA, BUOYANCY_DATA); + dirtyMetadata.put(EntityDataTypes.IS_BUOYANT, (byte) 1); + dirtyMetadata.put(EntityDataTypes.BUOYANCY_DATA, BUOYANCY_DATA); } @Override @@ -124,7 +124,7 @@ public class BoatEntity extends Entity { public void setVariant(IntEntityMetadata entityMetadata) { variant = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.VARIANT, variant); + dirtyMetadata.put(EntityDataTypes.VARIANT, variant); } public void setPaddlingLeft(BooleanEntityMetadata entityMetadata) { @@ -142,7 +142,7 @@ public class BoatEntity extends Entity { } } else { // Indicate that the row position should be reset - dirtyMetadata.put(EntityData.ROW_TIME_LEFT, 0.0f); + dirtyMetadata.put(EntityDataTypes.ROW_TIME_LEFT, 0.0f); } } @@ -157,7 +157,7 @@ public class BoatEntity extends Entity { } } } else { - dirtyMetadata.put(EntityData.ROW_TIME_RIGHT, 0.0f); + dirtyMetadata.put(EntityDataTypes.ROW_TIME_RIGHT, 0.0f); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java index 724bf921e..675e9517d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java index 251eb98a0..6b0630546 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -47,10 +47,10 @@ public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { @Override protected void initializeMetadata() { // Required, or else the GUI will not open - dirtyMetadata.put(EntityData.CONTAINER_TYPE, (byte) 16); - dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, 1); + dirtyMetadata.put(EntityDataTypes.CONTAINER_TYPE, (byte) 16); + dirtyMetadata.put(EntityDataTypes.CONTAINER_SIZE, 1); // Required, or else the client does not bother to send a packet back with the new information - dirtyMetadata.put(EntityData.COMMAND_BLOCK_ENABLED, (byte) 1); + dirtyMetadata.put(EntityDataTypes.COMMAND_BLOCK_ENABLED, (byte) 1); } /** @@ -58,8 +58,8 @@ public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { */ @Override public void updateDefaultBlockMetadata() { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getCommandBlockRuntimeId()); - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getCommandBlock()); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java index c562df476..3bd9ff26b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type; 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 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.session.GeyserSession; @@ -46,7 +46,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); + dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) 1); } @Override @@ -60,7 +60,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { customBlock = entityMetadata.getPrimitiveValue(); if (showCustomBlock) { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(customBlock)); } } @@ -69,7 +69,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { customBlockOffset = entityMetadata.getPrimitiveValue(); if (showCustomBlock) { - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, customBlockOffset); } } @@ -77,8 +77,8 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { if (entityMetadata.getPrimitiveValue()) { showCustomBlock = true; - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(customBlock)); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, customBlockOffset); } else { showCustomBlock = false; updateDefaultBlockMetadata(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java index f9e4af7c1..225c5b086 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java @@ -26,10 +26,10 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -54,9 +54,9 @@ public class EnderCrystalEntity extends Entity { // Usually performed client-side on Bedrock except for Ender Dragon respawn event Optional optionalPos = entityMetadata.getValue(); if (optionalPos.isPresent()) { - dirtyMetadata.put(EntityData.BLOCK_TARGET, optionalPos.get()); + dirtyMetadata.put(EntityDataTypes.BLOCK_TARGET, optionalPos.get()); } else { - dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); + dirtyMetadata.put(EntityDataTypes.BLOCK_TARGET, Vector3i.ZERO); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index c4046bcf3..945b75605 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -32,16 +32,20 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; -import com.nukkitx.protocol.bedrock.packet.*; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.AddEntityPacket; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; +import org.cloudburstmc.protocol.bedrock.packet.RemoveEntityPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.GeyserDirtyMetadata; import org.geysermc.geyser.session.GeyserSession; @@ -52,6 +56,7 @@ import org.geysermc.geyser.util.InteractiveTag; import org.geysermc.geyser.util.MathUtils; import java.util.Collections; +import java.util.EnumSet; import java.util.List; import java.util.Optional; import java.util.UUID; @@ -110,7 +115,7 @@ public class Entity { * think they are set to false. */ @Getter(AccessLevel.NONE) - protected final EntityFlags flags = new EntityFlags(); + protected final EnumSet flags = EnumSet.noneOf(EntityFlag.class); /** * Indicates if flags have been updated and need to be sent to the client. */ @@ -142,9 +147,9 @@ public class Entity { * Called on entity spawn. Used to populate the entity metadata and flags with default values. */ protected void initializeMetadata() { - dirtyMetadata.put(EntityData.SCALE, 1f); - dirtyMetadata.put(EntityData.COLOR, (byte) 0); - dirtyMetadata.put(EntityData.MAX_AIR_SUPPLY, getMaxAir()); + dirtyMetadata.put(EntityDataTypes.SCALE, 1f); + dirtyMetadata.put(EntityDataTypes.COLOR, (byte) 0); + dirtyMetadata.put(EntityDataTypes.AIR_SUPPLY_MAX, getMaxAir()); setDimensions(Pose.STANDING); setFlag(EntityFlag.HAS_GRAVITY, true); setFlag(EntityFlag.HAS_COLLISION, true); @@ -165,7 +170,7 @@ public class Entity { addEntityPacket.setUniqueEntityId(geyserId); addEntityPacket.setPosition(position); addEntityPacket.setMotion(motion); - addEntityPacket.setRotation(getBedrockRotation()); + addEntityPacket.setRotation(getBedrockRotation().toVector2(false)); // TODO: Check this addEntityPacket.getMetadata().putFlags(flags); dirtyMetadata.apply(addEntityPacket.getMetadata()); addAdditionalSpawnData(addEntityPacket); @@ -320,14 +325,14 @@ public class Entity { } public final boolean getFlag(EntityFlag flag) { - return flags.getFlag(flag); + return this.flags.contains(flag); } /** * Updates a flag value and determines if the flags would need synced with the Bedrock client. */ public final void setFlag(EntityFlag flag, boolean value) { - flagsDirty |= flags.setFlag(flag, value); + flagsDirty |= value ? this.flags.add(flag) : this.flags.remove(flag); } /** @@ -378,7 +383,7 @@ public class Entity { } protected void setAirSupply(int amount) { - dirtyMetadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); + dirtyMetadata.put(EntityDataTypes.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); } protected short getMaxAir() { @@ -389,15 +394,15 @@ public class Entity { Optional name = entityMetadata.getValue(); if (name.isPresent()) { nametag = MessageTranslator.convertMessage(name.get(), session.locale()); - dirtyMetadata.put(EntityData.NAMETAG, nametag); + dirtyMetadata.put(EntityDataTypes.NAME, nametag); } else if (!nametag.isEmpty()) { // Clear nametag - dirtyMetadata.put(EntityData.NAMETAG, ""); + dirtyMetadata.put(EntityDataTypes.NAME, ""); } } public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); + dirtyMetadata.put(EntityDataTypes.NAMETAG_ALWAYS_SHOW, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } public final void setSilent(BooleanEntityMetadata entityMetadata) { @@ -430,7 +435,7 @@ public class Entity { public boolean setBoundingBoxHeight(float height) { if (height != boundingBoxHeight) { boundingBoxHeight = height; - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); + dirtyMetadata.put(EntityDataTypes.HEIGHT, boundingBoxHeight); updatePassengerOffsets(); return true; @@ -441,7 +446,7 @@ public class Entity { public void setBoundingBoxWidth(float width) { if (width != boundingBoxWidth) { boundingBoxWidth = width; - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); + dirtyMetadata.put(EntityDataTypes.WIDTH, boundingBoxWidth); } } @@ -453,12 +458,12 @@ public class Entity { // The Java client caps its freezing tick percentage at 140 int freezingTicks = Math.min(entityMetadata.getPrimitiveValue(), 140); float freezingPercentage = freezingTicks / 140f; - dirtyMetadata.put(EntityData.FREEZING_EFFECT_STRENGTH, freezingPercentage); + dirtyMetadata.put(EntityDataTypes.FREEZING_EFFECT_STRENGTH, freezingPercentage); return freezingPercentage; } public void setRiderSeatPosition(Vector3f position) { - dirtyMetadata.put(EntityData.RIDER_SEAT_POSITION, position); + dirtyMetadata.put(EntityDataTypes.SEAT_OFFSET, position); } /** @@ -518,7 +523,7 @@ public class Entity { break; } } - session.getPlayerEntity().getDirtyMetadata().put(EntityData.INTERACTIVE_TAG, tag.getValue()); + session.getPlayerEntity().getDirtyMetadata().put(EntityDataTypes.INTERACT_TEXT, tag.getValue()); session.getPlayerEntity().updateBedrockMetadata(); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java index af7dca68c..ab6a66b85 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.entity.type; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -42,14 +42,14 @@ public class EvokerFangsEntity extends Entity implements Tickable { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // As of 1.18.2 Bedrock, this line is required for the entity to be visible // 22 is the starting number on Java Edition - dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife); + dirtyMetadata.put(EntityDataTypes.LIMITED_LIFE, this.limitedLife); } @Override public void tick() { if (attackStarted) { if (--this.limitedLife > 0 && this.limitedLife % 2 == 0) { // Matches Bedrock behavior - dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife); + dirtyMetadata.put(EntityDataTypes.LIMITED_LIFE, this.limitedLife); updateBedrockMetadata(); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java index 6000b361e..4f4a657ab 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type; -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.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -35,6 +35,6 @@ public class ExpOrbEntity extends Entity { public ExpOrbEntity(GeyserSession session, int amount, int entityId, long geyserId, Vector3f position) { super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); - this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount); + this.dirtyMetadata.put(EntityDataTypes.EXPERIENCE_VALUE, amount); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java index 3e64cfcea..6f3c99d74 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type; 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 com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -39,7 +39,7 @@ public class FallingBlockEntity extends Entity { public FallingBlockEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, int javaId) { super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, headYaw); - this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); + this.dirtyMetadata.put(EntityDataTypes.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java index 135f58906..3db032f0f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; 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 12498f752..8c88f4bce 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 @@ -30,12 +30,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; 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.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.player.PlayerEntity; @@ -133,7 +133,7 @@ public class FireworkEntity extends Entity { NbtMapBuilder builder = NbtMap.builder(); builder.put("Fireworks", fireworksBuilder.build()); - dirtyMetadata.put(EntityData.DISPLAY_ITEM, builder.build()); + dirtyMetadata.put(EntityDataTypes.DISPLAY_FIREWORK, builder.build()); } public void setPlayerGliding(EntityMetadata entityMetadata) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java index 65662bbe4..2885cfd23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; @@ -66,7 +66,7 @@ public class FishingHookEntity extends ThrowableEntity { setBoundingBoxHeight(128); this.bedrockOwnerId = owner.getGeyserId(); - this.dirtyMetadata.put(EntityData.OWNER_EID, this.bedrockOwnerId); + this.dirtyMetadata.put(EntityDataTypes.OWNER_EID, this.bedrockOwnerId); } public void setHookedEntity(IntEntityMetadata entityMetadata) { @@ -74,7 +74,7 @@ public class FishingHookEntity extends ThrowableEntity { Entity entity = session.getEntityCache().getEntityByJavaId(hookedEntityId); if (entity != null) { bedrockTargetId = entity.getGeyserId(); - dirtyMetadata.put(EntityData.TARGET_EID, bedrockTargetId); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, bedrockTargetId); hooked = true; } else { hooked = false; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java index 8074cd5ab..736c0bfa4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -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.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; @@ -51,8 +51,8 @@ public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { @Override public void updateDefaultBlockMetadata() { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID)); - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID)); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java index 89db9b0c8..19125a0a8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; -import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.AddItemEntityPacket; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; 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 8e4a5323a..cbe70f162 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 @@ -31,13 +31,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -114,7 +114,7 @@ public class ItemFrameEntity extends Entity { this.heldItem = entityMetadata.getValue(); ItemData itemData = ItemTranslator.translateToBedrock(session, heldItem); - String customIdentifier = session.getItemMappings().getCustomIdMappings().get(itemData.getId()); + String customIdentifier = session.getItemMappings().getCustomIdMappings().get(itemData.getDefinition().getRuntimeId()); NbtMapBuilder builder = NbtMap.builder(); @@ -152,7 +152,7 @@ public class ItemFrameEntity extends Entity { UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); updateBlockPacket.setDataLayer(0); updateBlockPacket.setBlockPosition(bedrockPosition); - updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); //TODO maybe set this to the world block or another item frame? + updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAir().getRuntimeId()); //TODO maybe set this to the world block or another item frame? updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java index 4ff1dfe7c..3f0d2ee68 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java index 3adb30e24..6db486f03 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index f7e055417..e4565b111 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -35,16 +35,16 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.AttributeData; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; -import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket; +import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; @@ -88,7 +88,7 @@ public class LivingEntity extends Entity { protected void initializeMetadata() { super.initializeMetadata(); // Matches Bedrock behavior; is always set to this - dirtyMetadata.put(EntityData.HEALTH, 1); + dirtyMetadata.put(EntityDataTypes.HEALTH, 1); } public void setLivingEntityFlags(ByteEntityMetadata entityMetadata) { @@ -125,27 +125,27 @@ public class LivingEntity extends Entity { Optional optionalPos = entityMetadata.getValue(); if (optionalPos.isPresent()) { Vector3i bedPosition = optionalPos.get(); - dirtyMetadata.put(EntityData.BED_POSITION, bedPosition); + dirtyMetadata.put(EntityDataTypes.BED_POSITION, bedPosition); int bed = session.getGeyser().getWorldManager().getBlockAt(session, bedPosition); // Bed has to be updated, or else player is floating in the air ChunkUtils.updateBlock(session, bed, bedPosition); // Indicate that the player should enter the sleep cycle // Has to be a byte or it does not work // (Bed position is what actually triggers sleep - "pose" is only optional) - dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 2); + dirtyMetadata.put(EntityDataTypes.PLAYER_FLAGS, (byte) 2); return bedPosition; } else { // Player is no longer sleeping - dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 0); + dirtyMetadata.put(EntityDataTypes.PLAYER_FLAGS, (byte) 0); return null; } } protected boolean hasShield(boolean offhand, ItemMapping shieldMapping) { if (offhand) { - return offHand.getId() == shieldMapping.getBedrockId(); + return offHand.getId() == shieldMapping.getBedrockDefinition(); } else { - return hand.getId() == shieldMapping.getBedrockId(); + return hand.getId() == shieldMapping.getBedrockDefinition(); } } @@ -219,10 +219,10 @@ public class LivingEntity extends Entity { // If an entity has a banner on them, it will be in the helmet slot in Java but the chestplate spot in Bedrock // But don't overwrite the chestplate if it isn't empty ItemMapping banner = session.getItemMappings().getStoredItems().banner(); - if (chestplate.getId() == ItemData.AIR.getId() && helmet.getId() == banner.getBedrockId()) { + if (chestplate.getId() == ItemData.AIR.getId() && helmet.getId() == banner.getBedrockDefinition()) { chestplate = this.helmet; helmet = ItemData.AIR; - } else if (chestplate.getId() == banner.getBedrockId()) { + } else if (chestplate.getId() == banner.getBedrockDefinition()) { // Prevent chestplate banners from showing erroneously chestplate = ItemData.AIR; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java index 6f722864b..8ec9f7200 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.entity.type; 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 com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -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.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -45,17 +45,17 @@ public class MinecartEntity extends Entity { } public void setCustomBlock(IntEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); } public void setCustomBlockOffset(IntEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getPrimitiveValue()); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, entityMetadata.getPrimitiveValue()); } public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { // If the custom block should be enabled // Needs a byte based off of Java's boolean - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); + dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java index cdd9449e5..4e5fe9d59 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.AddPaintingPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.level.PaintingType; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java index cd5df1bf4..4e6641559 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type; -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.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; @@ -41,7 +41,7 @@ public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { @Override public void updateDefaultBlockMetadata() { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID)); - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); + dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID)); + dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java index 38f4dba25..d4f1ae762 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java @@ -26,10 +26,10 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -45,7 +45,7 @@ public class TNTEntity extends Entity implements Tickable { public void setFuseLength(IntEntityMetadata entityMetadata) { currentTick = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); setFlag(EntityFlag.IGNITED, true); - dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); + dirtyMetadata.put(EntityDataTypes.FUSE_TIME, currentTick); } @Override @@ -56,11 +56,11 @@ public class TNTEntity extends Entity implements Tickable { } if (currentTick % 5 == 0) { - dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); + dirtyMetadata.put(EntityDataTypes.FUSE_TIME, currentTick); SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); - packet.getMetadata().put(EntityData.FUSE_LENGTH, currentTick); + packet.getMetadata().put(EntityDataTypes.FUSE_TIME, currentTick); session.sendUpstreamPacket(packet); } currentTick--; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index 3652860b3..bc095d836 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index 47031e27b..39c8386bd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index fcfc4ff12..8d86572ce 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.item.Potion; @@ -52,7 +52,7 @@ public class ThrownPotionEntity extends ThrowableItemEntity { public void setItem(EntityMetadata entityMetadata) { ItemStack itemStack = entityMetadata.getValue(); if (itemStack == null) { - dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); + dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, 0); setFlag(EntityFlag.ENCHANTED, false); setFlag(EntityFlag.LINGERING, false); } else { @@ -62,10 +62,10 @@ public class ThrownPotionEntity extends ThrowableItemEntity { if (potionTag instanceof StringTag) { Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); if (potion != null) { - dirtyMetadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); + dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, potion.getBedrockId()); setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); } else { - dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); + dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, 0); GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java index 95118f928..27188c79e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.inventory.item.TippedArrowPotion; import org.geysermc.geyser.session.GeyserSession; @@ -47,13 +47,13 @@ public class TippedArrowEntity extends AbstractArrowEntity { int potionColor = entityMetadata.getPrimitiveValue(); // -1 means no color if (potionColor == -1) { - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); + dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, 0); } else { TippedArrowPotion potion = TippedArrowPotion.getByJavaColor(potionColor); if (potion != null && potion.getJavaColor() != -1) { - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) potion.getBedrockId()); + dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) potion.getBedrockId()); } else { - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); + dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, 0); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java index 09d315b19..2167f2c4d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index f70d4afc1..637ca4139 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java index 842c94e95..f5884437c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index 2d1de8ed2..1a3896b36 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living; 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 com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ public class AgeableEntity extends CreatureEntity { public void setBaby(BooleanEntityMetadata entityMetadata) { boolean isBaby = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize()); + dirtyMetadata.put(EntityDataTypes.SCALE, isBaby ? getBabySize() : getAdultSize()); setFlag(EntityFlag.BABY, isBaby); setBoundingBoxHeight(definition.height() * (isBaby ? getBabySize() : getAdultSize())); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java index d37a67938..bf7c05fa9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java index d4c627a8e..8f81125d0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index 8ab882f4b..6efdf5efa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -29,10 +29,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import lombok.Getter; import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; @@ -171,27 +171,27 @@ public class ArmorStandEntity extends LivingEntity { } public void setHeadRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue()); } public void setBodyRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue()); } public void setLeftArmRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue()); } public void setRightArmRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue()); } public void setLeftLegRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue()); } public void setRightLegRotation(EntityMetadata entityMetadata) { - onRotationUpdate(EntityData.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue()); + onRotationUpdate(EntityDataTypes.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue()); } /** @@ -308,7 +308,7 @@ public class ArmorStandEntity extends LivingEntity { if (!isInvisible) { // The armor stand isn't invisible. We good. setFlag(EntityFlag.INVISIBLE, false); - dirtyMetadata.put(EntityData.SCALE, getScale()); + dirtyMetadata.put(EntityDataTypes.SCALE, getScale()); updateOffsetRequirement(false); if (secondEntity != null) { @@ -324,7 +324,7 @@ public class ArmorStandEntity extends LivingEntity { if (!isNametagEmpty && (!helmet.equals(ItemData.AIR) || !chestplate.equals(ItemData.AIR) || !leggings.equals(ItemData.AIR) || !boots.equals(ItemData.AIR) || !hand.equals(ItemData.AIR) || !offHand.equals(ItemData.AIR))) { // Reset scale of the proper armor stand - this.dirtyMetadata.put(EntityData.SCALE, getScale()); + this.dirtyMetadata.put(EntityDataTypes.SCALE, getScale()); // Set the proper armor stand to invisible to show armor setFlag(EntityFlag.INVISIBLE, true); // Update the position of the armor stand @@ -341,23 +341,23 @@ public class ArmorStandEntity extends LivingEntity { secondEntity.isSmall = isSmall; secondEntity.isMarker = isMarker; secondEntity.positionRequiresOffset = true; // Offset should always be applied - secondEntity.getDirtyMetadata().put(EntityData.NAMETAG, nametag); - secondEntity.getDirtyMetadata().put(EntityData.NAMETAG_ALWAYS_SHOW, isNameTagVisible ? (byte) 1 : (byte) 0); + secondEntity.getDirtyMetadata().put(EntityDataTypes.NAMETAG, nametag); + secondEntity.getDirtyMetadata().put(EntityDataTypes.NAMETAG_ALWAYS_SHOW, isNameTagVisible ? (byte) 1 : (byte) 0); secondEntity.flags.merge(this.flags); // Guarantee this copy is NOT invisible secondEntity.setFlag(EntityFlag.INVISIBLE, false); // Scale to 0 to show nametag - secondEntity.getDirtyMetadata().put(EntityData.SCALE, 0.0f); + secondEntity.getDirtyMetadata().put(EntityDataTypes.SCALE, 0.0f); // No bounding box as we don't want to interact with this entity - secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); - secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); + secondEntity.getDirtyMetadata().put(EntityDataTypes.BOUNDING_BOX_WIDTH, 0.0f); + secondEntity.getDirtyMetadata().put(EntityDataTypes.BOUNDING_BOX_HEIGHT, 0.0f); if (!secondEntity.valid) { // Spawn the entity once secondEntity.spawnEntity(); } } else if (isNametagEmpty) { // We can just make an invisible entity // Reset scale of the proper armor stand - dirtyMetadata.put(EntityData.SCALE, getScale()); + dirtyMetadata.put(EntityDataTypes.SCALE, getScale()); // Set the proper armor stand to invisible to show armor setFlag(EntityFlag.INVISIBLE, true); // Update offset @@ -371,7 +371,7 @@ public class ArmorStandEntity extends LivingEntity { // Nametag is not empty and there is no armor // We don't need to make a new entity setFlag(EntityFlag.INVISIBLE, false); - dirtyMetadata.put(EntityData.SCALE, 0.0f); + dirtyMetadata.put(EntityDataTypes.SCALE, 0.0f); // As the above is applied, we need an offset updateOffsetRequirement(!isMarker); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java index f6bfd8e26..644054e72 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java index c19b00b21..fd38bf666 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java index 5d49f3e85..7c1d8efc7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java index 10d9dc417..472a9b3dc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java index 277eee027..58c2f6082 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java index c6f5727a4..12b2ca91d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java index 52e4a6f2f..9618130d1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; @@ -44,7 +44,7 @@ public class IronGolemEntity extends GolemEntity { // Indicate that we should show cracks through a resource pack setFlag(EntityFlag.BRIBED, true); // Required, or else the overlay is black - dirtyMetadata.put(EntityData.COLOR_2, (byte) 0); + dirtyMetadata.put(EntityDataTypes.COLOR_2, (byte) 0); // Default max health. Ensures correct cracked texture is used // Bug reproducible in 1.19.0 JE vanilla/fabric when spawning a new iron golem maxHealth = 100f; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java index 2d988373c..5a66ef36e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living; -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.session.GeyserSession; @@ -53,7 +53,7 @@ public class MagmaCubeEntity extends SlimeEntity { public void updateJump(boolean newOnGround) { if (newOnGround != onGround) { // Add the jumping effect to the magma cube - dirtyMetadata.put(EntityData.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2)); + dirtyMetadata.put(EntityDataTypes.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2)); updateBedrockMetadata(); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java index 723a9c431..44d3034d6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.LivingEntity; @@ -67,7 +67,7 @@ public class MobEntity extends LivingEntity { public void setLeashHolderBedrockId(long bedrockId) { this.leashHolderBedrockId = bedrockId; - dirtyMetadata.put(EntityData.LEASH_HOLDER_EID, bedrockId); + dirtyMetadata.put(EntityDataTypes.LEASH_HOLDER_EID, bedrockId); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java index 26cf2d627..1d2eb95bc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.session.GeyserSession; @@ -40,7 +40,7 @@ public class SlimeEntity extends MobEntity { } public void setScale(IntEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.SCALE, 0.10f + entityMetadata.getPrimitiveValue()); + dirtyMetadata.put(EntityDataTypes.SCALE, 0.10f + entityMetadata.getPrimitiveValue()); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java index b075de882..701da4ee5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java index 6b235a8e5..7e1a39dd5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.level.block.BlockStateValues; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java index 034dffc65..44ee96f33 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java index 44275a7b1..a847c4cd7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java index 16a72a235..6b99cca39 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; import org.geysermc.geyser.inventory.GeyserItemStack; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java index 74652da80..ce21a6836 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.entity.type.living.animal; 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 com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; @@ -52,7 +52,7 @@ public class AxolotlEntity extends AnimalEntity { case 1 -> variant = 3; // Java - "Wild" (brown) case 3 -> variant = 1; // Java - cyan } - dirtyMetadata.put(EntityData.VARIANT, variant); + dirtyMetadata.put(EntityDataTypes.VARIANT, variant); } public void setPlayingDead(BooleanEntityMetadata entityMetadata) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java index ce02905b9..46207ab3a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java @@ -27,11 +27,11 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -55,7 +55,7 @@ public class BeeEntity extends AnimalEntity { session.sendUpstreamPacket(packet); } // If the bee has stung - dirtyMetadata.put(EntityData.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0); + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0); // If the bee has nectar or not setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java index 2185d158b..959a2f791 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living.animal; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java index 3fd55d073..b968f1f6c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java index 8e350e685..417d06444 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -43,7 +43,7 @@ public class FoxEntity extends AnimalEntity { } public void setFoxVariant(IntEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.VARIANT, entityMetadata.getPrimitiveValue()); + dirtyMetadata.put(EntityDataTypes.VARIANT, entityMetadata.getPrimitiveValue()); } public void setFoxFlags(ByteEntityMetadata entityMetadata) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java index 97af056a0..1eee5360d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.registry.type.ItemMapping; @@ -55,7 +55,7 @@ public class FrogEntity extends AnimalEntity { public void setFrogVariant(IntEntityMetadata entityMetadata) { int variant = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.VARIANT, switch (variant) { + dirtyMetadata.put(EntityDataTypes.VARIANT, switch (variant) { case 1 -> 2; // White case 2 -> 1; // Green default -> variant; @@ -67,10 +67,10 @@ public class FrogEntity extends AnimalEntity { if (entityId.isPresent()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId.getAsInt()); if (entity != null) { - dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, entity.getGeyserId()); } } else { - dirtyMetadata.put(EntityData.TARGET_EID, 0L); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, 0L); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java index d50eb74c5..32517b9b0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java @@ -28,10 +28,10 @@ package org.geysermc.geyser.entity.type.living.animal; 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.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; @@ -89,6 +89,6 @@ public class GoatEntity extends AnimalEntity { } private void setHornCount() { - dirtyMetadata.put(EntityData.GOAT_HORN_COUNT, (hasLeftHorn ? 1 : 0) + (hasRightHorn ? 1 : 0)); + dirtyMetadata.put(EntityDataTypes.GOAT_HORN_COUNT, (hasLeftHorn ? 1 : 0) + (hasRightHorn ? 1 : 0)); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java index a96d3072c..d9aeab5ea 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal; 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.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java index d2b8420fd..a1f5affa6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -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.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.item.StoredItemMappings; @@ -48,7 +48,7 @@ public class MooshroomEntity extends AnimalEntity { public void setVariant(ObjectEntityMetadata entityMetadata) { isBrown = entityMetadata.getValue().equals("brown"); - dirtyMetadata.put(EntityData.VARIANT, isBrown ? 1 : 0); + dirtyMetadata.put(EntityDataTypes.VARIANT, isBrown ? 1 : 0); } @Nonnull diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java index a44a0e9f9..5217e26d7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java index 5e8d9c16f..6d2f85e96 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java @@ -28,11 +28,11 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; @@ -55,13 +55,13 @@ public class PandaEntity extends AnimalEntity { public void setEatingCounter(IntEntityMetadata entityMetadata) { int count = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.EATING, count > 0); - dirtyMetadata.put(EntityData.EATING_COUNTER, count); + dirtyMetadata.put(EntityDataTypes.EATING_COUNTER, count); if (count != 0) { // Particles and sound EntityEventPacket packet = new EntityEventPacket(); packet.setRuntimeEntityId(geyserId); packet.setType(EntityEventType.EATING_ITEM); - packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockId() << 16); + packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockDefinition() << 16); session.sendUpstreamPacket(packet); } } @@ -82,8 +82,8 @@ public class PandaEntity extends AnimalEntity { setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04); setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08); // Required to put these both for sitting to actually show - dirtyMetadata.put(EntityData.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f); - dirtyMetadata.put(EntityData.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f); + dirtyMetadata.put(EntityDataTypes.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f); + dirtyMetadata.put(EntityDataTypes.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f); setFlag(EntityFlag.LAYING_DOWN, (xd & 0x10) == 0x10); } @@ -133,14 +133,14 @@ public class PandaEntity extends AnimalEntity { if (mainGene.isRecessive) { if (mainGene == hiddenGene) { // Main and hidden genes match; this is what the panda looks like. - dirtyMetadata.put(EntityData.VARIANT, mainGene.ordinal()); + dirtyMetadata.put(EntityDataTypes.VARIANT, mainGene.ordinal()); } else { // Genes have no effect on appearance - dirtyMetadata.put(EntityData.VARIANT, Gene.NORMAL.ordinal()); + dirtyMetadata.put(EntityDataTypes.VARIANT, Gene.NORMAL.ordinal()); } } else { // No need to worry about hidden gene - dirtyMetadata.put(EntityData.VARIANT, mainGene.ordinal()); + dirtyMetadata.put(EntityDataTypes.VARIANT, mainGene.ordinal()); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java index 3b424b456..d2f2f572c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java index 1c5c47261..24220bb79 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living.animal; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java index 76ba15e09..63587e4a6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.entity.type.living.AbstractFishEntity; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ public class PufferFishEntity extends AbstractFishEntity { public void setPufferfishSize(IntEntityMetadata entityMetadata) { int puffsize = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.PUFFERFISH_SIZE, (byte) puffsize); - dirtyMetadata.put(EntityData.VARIANT, puffsize); + dirtyMetadata.put(EntityDataTypes.PUFFERFISH_SIZE, (byte) puffsize); + dirtyMetadata.put(EntityDataTypes.VARIANT, puffsize); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java index c49c9beb3..6e9f2181c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living.animal; 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 com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -58,7 +58,7 @@ public class RabbitEntity extends AnimalEntity { // Allow the resource pack to adjust to the killer bunny setFlag(EntityFlag.BRIBED, isKillerBunny); - dirtyMetadata.put(EntityData.VARIANT, variant); + dirtyMetadata.put(EntityDataTypes.VARIANT, variant); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java index 0febfdb11..d6621941d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; @@ -51,7 +51,7 @@ public class SheepEntity extends AnimalEntity { byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10); color = xd & 15; - dirtyMetadata.put(EntityData.COLOR, (byte) color); + dirtyMetadata.put(EntityDataTypes.COLOR, (byte) color); } @Nonnull diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java index fdbaad997..f74bfbfd9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.GeyserItemStack; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java index 384ba30d4..b18e55a48 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableList; -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 it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; @@ -55,10 +55,10 @@ public class TropicalFishEntity extends AbstractFishEntity { public void setFishVariant(IntEntityMetadata entityMetadata) { int varNumber = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 - dirtyMetadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 - dirtyMetadata.put(EntityData.COLOR, getBaseColor(varNumber)); // Base color 0-15 - dirtyMetadata.put(EntityData.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 + dirtyMetadata.put(EntityDataTypes.VARIANT, getShape(varNumber)); // Shape 0-1 + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 + dirtyMetadata.put(EntityDataTypes.COLOR, getBaseColor(varNumber)); // Base color 0-15 + dirtyMetadata.put(EntityDataTypes.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 } public static int getShape(int variant) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java index 1aa0d4fc9..c50cf21c5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal; 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.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java index 867d9f799..87d9ccfc2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.google.common.collect.ImmutableSet; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; @@ -60,7 +60,7 @@ public class AbstractHorseEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Specifies the size of the entity's inventory. Required to place slots in the entity. - dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, getContainerBaseSize()); + dirtyMetadata.put(EntityDataTypes.CONTAINER_SIZE, getContainerBaseSize()); setFlag(EntityFlag.WASD_CONTROLLED, true); } @@ -102,8 +102,8 @@ public class AbstractHorseEntity extends AnimalEntity { // Only set eating when we don't have mouth open so a player interaction doesn't trigger the eating animation horseFlags = (xd & 0x10) == 0x10 && (xd & 0x40) != 0x40 ? horseFlags | 0x20 : horseFlags; - // Set the flags into the display item - dirtyMetadata.put(EntityData.DISPLAY_ITEM, horseFlags); + // Set the flags into the horse flags + dirtyMetadata.put(EntityDataTypes.HORSE_FLAGS, horseFlags); // Send the eating particles // We use the wheat metadata as static particles since Java @@ -112,12 +112,12 @@ public class AbstractHorseEntity extends AnimalEntity { EntityEventPacket entityEventPacket = new EntityEventPacket(); entityEventPacket.setRuntimeEntityId(geyserId); entityEventPacket.setType(EntityEventType.EATING_ITEM); - entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockId() << 16); + entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockDefinition().getRuntimeId() << 16); session.sendUpstreamPacket(entityEventPacket); } // Set container type if tamed - dirtyMetadata.put(EntityData.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); + dirtyMetadata.put(EntityDataTypes.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); // Shows the jump meter setFlag(EntityFlag.CAN_POWER_JUMP, saddled); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java index 7d59be713..27b969a0a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.animal.horse; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java index d084ed3e3..dfa6ef30a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.session.GeyserSession; @@ -41,7 +41,7 @@ public class HorseEntity extends AbstractHorseEntity { public void setHorseVariant(IntEntityMetadata entityMetadata) { int value = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.VARIANT, value & 255); - dirtyMetadata.put(EntityData.MARK_VARIANT, (value >> 8) % 5); + dirtyMetadata.put(EntityDataTypes.VARIANT, value & 255); + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, (value >> 8) % 5); } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java index c2548daaf..d3d3e8673 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java @@ -26,10 +26,10 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -41,7 +41,7 @@ public class LlamaEntity extends ChestedHorseEntity { public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength + dirtyMetadata.put(EntityDataTypes.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength } /** diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java index 4d07c7d13..43c76202c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java index ff3fba9b0..4be0ef5e2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.animal.horse; -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.session.GeyserSession; @@ -41,6 +41,6 @@ public class TraderLlamaEntity extends LlamaEntity { @Override protected void initializeMetadata() { super.initializeMetadata(); - this.dirtyMetadata.put(EntityData.MARK_VARIANT, 1); + this.dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, 1); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java index 659a8bad8..423537496 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java index f700f6951..ba46224dd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; @@ -70,7 +70,7 @@ public class CatEntity extends TameableEntity { super.setTameableFlags(entityMetadata); // Update collar color if tamed if (getFlag(EntityFlag.TAMED)) { - dirtyMetadata.put(EntityData.COLOR, collarColor); + dirtyMetadata.put(EntityDataTypes.COLOR, collarColor); } } @@ -84,7 +84,7 @@ public class CatEntity extends TameableEntity { case 10 -> 9; default -> metadataValue; }; - dirtyMetadata.put(EntityData.VARIANT, variantColor); + dirtyMetadata.put(EntityDataTypes.VARIANT, variantColor); } public void setResting(BooleanEntityMetadata entityMetadata) { @@ -95,7 +95,7 @@ public class CatEntity extends TameableEntity { collarColor = (byte) entityMetadata.getPrimitiveValue(); // Needed or else wild cats are a red color if (getFlag(EntityFlag.TAMED)) { - dirtyMetadata.put(EntityData.COLOR, collarColor); + dirtyMetadata.put(EntityDataTypes.COLOR, collarColor); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java index 51582e087..3b71b8997 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java index c95556cb4..5fc8c459d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Entity; @@ -80,7 +80,7 @@ public class TameableEntity extends AnimalEntity { // Reset ownerBedrockId = 0L; } - dirtyMetadata.put(EntityData.OWNER_EID, ownerBedrockId); + dirtyMetadata.put(EntityDataTypes.OWNER_EID, ownerBedrockId); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index d6825e8a1..5ee197c06 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.google.common.collect.ImmutableSet; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.registry.type.ItemMapping; @@ -66,7 +66,7 @@ public class WolfEntity extends TameableEntity { byte xd = entityMetadata.getPrimitiveValue(); boolean angry = (xd & 0x02) == 0x02; if (angry) { - dirtyMetadata.put(EntityData.COLOR, (byte) 0); + dirtyMetadata.put(EntityDataTypes.COLOR, (byte) 0); } } @@ -76,11 +76,11 @@ public class WolfEntity extends TameableEntity { return; } - dirtyMetadata.put(EntityData.COLOR, collarColor); + dirtyMetadata.put(EntityDataTypes.COLOR, collarColor); if (ownerBedrockId == 0) { // If a color is set and there is no owner entity ID, set one. // Otherwise, the entire wolf is set to that color: https://user-images.githubusercontent.com/9083212/99209989-92691200-2792-11eb-911d-9a315c955be9.png - dirtyMetadata.put(EntityData.OWNER_EID, session.getPlayerEntity().getGeyserId()); + dirtyMetadata.put(EntityDataTypes.OWNER_EID, session.getPlayerEntity().getGeyserId()); } } @@ -88,7 +88,7 @@ public class WolfEntity extends TameableEntity { public void setWolfAngerTime(IntEntityMetadata entityMetadata) { int time = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.ANGRY, time != 0); - dirtyMetadata.put(EntityData.COLOR, time != 0 ? (byte) 0 : collarColor); + dirtyMetadata.put(EntityDataTypes.COLOR, time != 0 ? (byte) 0 : collarColor); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java index e6538ebad..37afd3434 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.living.AgeableEntity; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java index e77d34f23..c5d752677 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java @@ -27,11 +27,11 @@ package org.geysermc.geyser.entity.type.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.BlockRegistries; @@ -93,12 +93,12 @@ public class VillagerEntity extends AbstractMerchantEntity { // Profession int profession = getBedrockProfession(villagerData.getProfession()); canTradeWith = profession != 14 && profession != 0; // Not a notwit and not professionless - dirtyMetadata.put(EntityData.VARIANT, profession); - //metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? + dirtyMetadata.put(EntityDataTypes.VARIANT, profession); + //metadata.put(EntityDataTypes.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? // Region - dirtyMetadata.put(EntityData.MARK_VARIANT, getBedrockRegion(villagerData.getType())); + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, getBedrockRegion(villagerData.getType())); // Trade tier - different indexing in Bedrock - dirtyMetadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); + dirtyMetadata.put(EntityDataTypes.TRADE_TIER, villagerData.getLevel() - 1); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java index baa48fcc1..04b3bba1b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -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.session.GeyserSession; @@ -44,6 +44,6 @@ public class AbstractSkeletonEntity extends MonsterEntity { super.setMobFlags(entityMetadata); byte xd = entityMetadata.getPrimitiveValue(); // A bit of a loophole so the hands get raised - set the target ID to its own ID - dirtyMetadata.put(EntityData.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java index e003dd080..5f2647b7a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; 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.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java index 02539b26a..43d78f468 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index f73ab257a..afdf71ff0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.entity.type.living.monster; 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 com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java index 1ac4e9527..8890e72a9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.monster; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java index 6adcb4694..40b616160 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java @@ -27,11 +27,11 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.*; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.*; import lombok.Data; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java index 5631a68c9..33075cc14 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.entity.type.living.monster; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -37,8 +37,8 @@ public class EnderDragonPartEntity extends Entity { public EnderDragonPartEntity(GeyserSession session, int entityId, long geyserId, float width, float height) { super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_WIDTH, width); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_HEIGHT, height); setFlag(EntityFlag.INVISIBLE, true); setFlag(EntityFlag.FIRE_IMMUNE, true); } 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 03492d518..d4a55af3d 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 @@ -27,11 +27,11 @@ package org.geysermc.geyser.entity.type.living.monster; 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 com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEvent2Packet; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -44,7 +44,7 @@ public class EndermanEntity extends MonsterEntity { } public void setCarriedBlock(IntEntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); + dirtyMetadata.put(EntityDataTypes.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); } /** diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java index 511c56ff7..f7b9d17b8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; 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.entity.type.living.FlyingEntity; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ public class GhastEntity extends FlyingEntity { public void setGhastAttacking(BooleanEntityMetadata entityMetadata) { // If the ghast is attacking - dirtyMetadata.put(EntityData.CHARGE_AMOUNT, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); + dirtyMetadata.put(EntityDataTypes.CHARGE_AMOUNT, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java index 12e0966ea..e98c8f120 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.monster; -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.session.GeyserSession; @@ -37,6 +37,6 @@ public class GiantEntity extends MonsterEntity { public GiantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - dirtyMetadata.put(EntityData.SCALE, 6f); + dirtyMetadata.put(EntityDataTypes.SCALE, 6f); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java index e2454123f..92e50d207 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -44,9 +44,9 @@ public class GuardianEntity extends MonsterEntity { int entityId = entityMetadata.getPrimitiveValue(); Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { - dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, entity.getGeyserId()); } else { - dirtyMetadata.put(EntityData.TARGET_EID, (long) 0); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, (long) 0); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java index 92fbeee67..c0edc448c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living.monster; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.CreatureEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index dff79104b..915e34e79 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.entity.type.living.FlyingEntity; import org.geysermc.geyser.session.GeyserSession; @@ -46,7 +46,7 @@ public class PhantomEntity extends FlyingEntity { setBoundingBoxWidth(boundsScale * definition.width()); setBoundingBoxHeight(boundsScale * definition.height()); - dirtyMetadata.put(EntityData.SCALE, modelScale); + dirtyMetadata.put(EntityDataTypes.SCALE, modelScale); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java index 4eb0baa6c..aa89581b5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; @@ -47,7 +47,7 @@ public class PiglinEntity extends BasePiglinEntity { public void setBaby(BooleanEntityMetadata entityMetadata) { boolean isBaby = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); + dirtyMetadata.put(EntityDataTypes.SCALE, isBaby? .55f : 1f); setFlag(EntityFlag.BABY, isBaby); updateMountOffset(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java index ff1ba9ac3..620693ecb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java @@ -28,9 +28,9 @@ 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.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.GolemEntity; import org.geysermc.geyser.session.GeyserSession; @@ -47,22 +47,22 @@ public class ShulkerEntity extends GolemEntity { public void setAttachedFace(EntityMetadata entityMetadata) { Direction direction = entityMetadata.getValue(); - dirtyMetadata.put(EntityData.SHULKER_ATTACH_FACE, (byte) direction.ordinal()); + dirtyMetadata.put(EntityDataTypes.SHULKER_ATTACH_FACE, (byte) direction.ordinal()); } public void setShulkerHeight(ByteEntityMetadata entityMetadata) { int height = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.SHULKER_PEEK_ID, height); + dirtyMetadata.put(EntityDataTypes.SHULKER_PEEK_ID, height); } public void setShulkerColor(ByteEntityMetadata entityMetadata) { byte color = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); if (color == 16) { // 16 is default on both editions - dirtyMetadata.put(EntityData.VARIANT, 16); + dirtyMetadata.put(EntityDataTypes.VARIANT, 16); } else { // Every other shulker color is offset 15 in bedrock edition - dirtyMetadata.put(EntityData.VARIANT, Math.abs(color - 15)); + dirtyMetadata.put(EntityDataTypes.VARIANT, Math.abs(color - 15)); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java index b720f1d4e..da11b2759 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; 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.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java index 0d9a2b37a..03e234911 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java index 545c4bc73..56a0975ae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -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.session.GeyserSession; @@ -43,6 +43,6 @@ public class VexEntity extends MonsterEntity { byte xd = entityMetadata.getPrimitiveValue(); // Set the target to the player to force the attack animation // even if the player isn't the target as we dont get the target on Java - dirtyMetadata.put(EntityData.TARGET_EID, (xd & 0x01) == 0x01 ? session.getPlayerEntity().getGeyserId() : 0); + dirtyMetadata.put(EntityDataTypes.TARGET_EID, (xd & 0x01) == 0x01 ? session.getPlayerEntity().getGeyserId() : 0); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java index ff6eed975..7a0c5e040 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java @@ -27,11 +27,11 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.GenericMath; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.session.GeyserSession; @@ -53,7 +53,7 @@ public class WardenEntity extends MonsterEntity implements Tickable { @Override protected void initializeMetadata() { super.initializeMetadata(); - dirtyMetadata.put(EntityData.HEARTBEAT_INTERVAL_TICKS, heartBeatDelay); + dirtyMetadata.put(EntityDataTypes.HEARTBEAT_INTERVAL_TICKS, heartBeatDelay); } @Override @@ -68,7 +68,7 @@ public class WardenEntity extends MonsterEntity implements Tickable { public void setAngerLevel(IntEntityMetadata entityMetadata) { float anger = (float) entityMetadata.getPrimitiveValue() / 80f; heartBeatDelay = 40 - GenericMath.floor(MathUtils.clamp(anger, 0.0F, 1.0F) * 30F); - dirtyMetadata.put(EntityData.HEARTBEAT_INTERVAL_TICKS, heartBeatDelay); + dirtyMetadata.put(EntityDataTypes.HEARTBEAT_INTERVAL_TICKS, heartBeatDelay); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java index 81aa1ed99..3abb7f122 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java @@ -26,8 +26,9 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; -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.EntityDataType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -43,22 +44,22 @@ public class WitherEntity extends MonsterEntity { @Override protected void initializeMetadata() { super.initializeMetadata(); - dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); + dirtyMetadata.put(EntityDataTypes.WITHER_AERIAL_ATTACK, (short) 1); } public void setTarget1(IntEntityMetadata entityMetadata) { - setTargetId(EntityData.WITHER_TARGET_1, entityMetadata); + setTargetId(EntityDataTypes.WITHER_TARGET_A, entityMetadata); } public void setTarget2(IntEntityMetadata entityMetadata) { - setTargetId(EntityData.WITHER_TARGET_2, entityMetadata); + setTargetId(EntityDataTypes.WITHER_TARGET_B, entityMetadata); } public void setTarget3(IntEntityMetadata entityMetadata) { - setTargetId(EntityData.WITHER_TARGET_3, entityMetadata); + setTargetId(EntityDataTypes.WITHER_TARGET_C, entityMetadata); } - private void setTargetId(EntityData entityData, IntEntityMetadata entityMetadata) { + private void setTargetId(EntityDataType entityData, IntEntityMetadata entityMetadata) { int entityId = entityMetadata.getPrimitiveValue(); Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { @@ -70,13 +71,13 @@ public class WitherEntity extends MonsterEntity { public void setInvulnerableTicks(IntEntityMetadata entityMetadata) { int value = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.WITHER_INVULNERABLE_TICKS, value); + dirtyMetadata.put(EntityDataTypes.WITHER_INVULNERABLE_TICKS, value); // Show the shield for the first few seconds of spawning (like Java) if (value >= 165) { - dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 0); + dirtyMetadata.put(EntityDataTypes.WITHER_AERIAL_ATTACK, (short) 0); } else { - dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); + dirtyMetadata.put(EntityDataTypes.WITHER_AERIAL_ATTACK, (short) 1); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java index dd5acbfb1..6e40573ba 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living.monster; 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 com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -43,7 +43,7 @@ public class ZoglinEntity extends MonsterEntity { public void setBaby(BooleanEntityMetadata entityMetadata) { boolean isBaby = entityMetadata.getPrimitiveValue(); if (isBaby != getFlag(EntityFlag.BABY)) { - dirtyMetadata.put(EntityData.SCALE, isBaby ? .55f : 1f); + dirtyMetadata.put(EntityDataTypes.SCALE, isBaby ? .55f : 1f); setFlag(EntityFlag.BABY, isBaby); updatePassengerOffsets(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java index 0dac50d07..af6a30a10 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living.monster; 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 com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; @@ -43,7 +43,7 @@ public class ZombieEntity extends MonsterEntity { public void setZombieBaby(BooleanEntityMetadata entityMetadata) { boolean isBaby = entityMetadata.getPrimitiveValue(); - dirtyMetadata.put(EntityData.SCALE, isBaby ? .55f : 1.0f); + dirtyMetadata.put(EntityDataTypes.SCALE, isBaby ? .55f : 1.0f); setFlag(EntityFlag.BABY, isBaby); updateMountOffset(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java index bf5180e36..e027a1022 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; import org.geysermc.geyser.inventory.GeyserItemStack; @@ -55,10 +55,10 @@ public class ZombieVillagerEntity extends ZombieEntity { public void setZombieVillagerData(EntityMetadata entityMetadata) { VillagerData villagerData = entityMetadata.getValue(); - dirtyMetadata.put(EntityData.VARIANT, VillagerEntity.getBedrockProfession(villagerData.getProfession())); // Actually works properly with the OptionalPack - dirtyMetadata.put(EntityData.MARK_VARIANT, VillagerEntity.getBedrockRegion(villagerData.getType())); + dirtyMetadata.put(EntityDataTypes.VARIANT, VillagerEntity.getBedrockProfession(villagerData.getProfession())); // Actually works properly with the OptionalPack + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, VillagerEntity.getBedrockRegion(villagerData.getType())); // Used with the OptionalPack - dirtyMetadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); + dirtyMetadata.put(EntityDataTypes.TRADE_TIER, villagerData.getLevel() - 1); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java index a711718d3..0a0fe6306 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.monster; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java index 21395a0ca..90138742f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living.monster.raid; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java index 716c54de1..a484cf561 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.entity.type.living.monster.raid; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -58,8 +58,8 @@ public class PillagerEntity extends AbstractIllagerEntity { */ protected void checkForCrossbow() { ItemMapping crossbow = session.getItemMappings().getStoredItems().crossbow(); - boolean hasCrossbow = this.hand.getId() == crossbow.getBedrockId() - || this.offHand.getId() == crossbow.getBedrockId(); + boolean hasCrossbow = this.hand.getId() == crossbow.getBedrockDefinition() + || this.offHand.getId() == crossbow.getBedrockDefinition(); setFlag(EntityFlag.USING_ITEM, hasCrossbow); setFlag(EntityFlag.CHARGED, hasCrossbow); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java index 458eabf09..05becf490 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.type.living.monster.raid; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.monster.MonsterEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java index 38b8cd9a8..463fc55ef 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -57,6 +57,6 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { case 3 -> WOLOLO_PARTICLE_COLOR; default -> 0; }; - dirtyMetadata.put(EntityData.EVOKER_SPELL_COLOR, rgbData); + dirtyMetadata.put(EntityDataTypes.EVOKER_SPELL_COLOR, rgbData); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java index 199cffff9..ad99dda50 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 8e600b1a8..4fad0c9b4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -33,14 +33,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEnt import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.*; -import com.nukkitx.protocol.bedrock.data.command.CommandPermission; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; -import com.nukkitx.protocol.bedrock.packet.*; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.*; +import org.cloudburstmc.protocol.bedrock.data.command.CommandPermission; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData; +import org.cloudburstmc.protocol.bedrock.packet.*; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; @@ -108,7 +108,7 @@ public class PlayerEntity extends LivingEntity { protected void initializeMetadata() { super.initializeMetadata(); // For the OptionalPack, set all bits as invisible by default as this matches Java Edition behavior - dirtyMetadata.put(EntityData.MARK_VARIANT, 0xff); + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, 0xff); } @Override @@ -255,7 +255,7 @@ public class PlayerEntity extends LivingEntity { // In Java Edition, a bit being set means that part should be enabled // However, to ensure that the pack still works on other servers, we invert the bit so all values by default // are true (0). - dirtyMetadata.put(EntityData.MARK_VARIANT, ~entityMetadata.getPrimitiveValue() & 0xff); + dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, ~entityMetadata.getPrimitiveValue() & 0xff); } public void setLeftParrot(EntityMetadata entityMetadata) { @@ -280,11 +280,11 @@ public class PlayerEntity extends LivingEntity { ParrotEntity parrot = new ParrotEntity(session, 0, session.getEntityCache().getNextEntityId().incrementAndGet(), null, EntityDefinitions.PARROT, position, motion, getYaw(), getPitch(), getHeadYaw()); parrot.spawnEntity(); - parrot.getDirtyMetadata().put(EntityData.VARIANT, tag.get("Variant").getValue()); + parrot.getDirtyMetadata().put(EntityDataTypes.VARIANT, tag.get("Variant").getValue()); // Different position whether the parrot is left or right float offset = isLeft ? 0.4f : -0.4f; - parrot.getDirtyMetadata().put(EntityData.RIDER_SEAT_POSITION, Vector3f.from(offset, -0.22, -0.1)); - parrot.getDirtyMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1); + parrot.getDirtyMetadata().put(EntityDataTypes.RIDER_SEAT_POSITION, Vector3f.from(offset, -0.22, -0.1)); + parrot.getDirtyMetadata().put(EntityDataTypes.RIDER_ROTATION_LOCKED, 1); parrot.updateBedrockMetadata(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); EntityLinkData.Type type = isLeft ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER; @@ -342,11 +342,11 @@ public class PlayerEntity extends LivingEntity { } needsUpdate = useGivenTeam && !newDisplayName.equals(nametag); nametag = newDisplayName; - dirtyMetadata.put(EntityData.NAMETAG, newDisplayName); + dirtyMetadata.put(EntityDataTypes.NAMETAG, newDisplayName); } else if (useGivenTeam) { // The name has reset, if it was previously something else needsUpdate = !newDisplayName.equals(nametag); - dirtyMetadata.put(EntityData.NAMETAG, this.username); + dirtyMetadata.put(EntityDataTypes.NAMETAG, this.username); } else { needsUpdate = false; } @@ -354,7 +354,7 @@ public class PlayerEntity extends LivingEntity { if (needsUpdate) { // Update the metadata as it won't be updated later SetEntityDataPacket packet = new SetEntityDataPacket(); - packet.getMetadata().put(EntityData.NAMETAG, newDisplayName); + packet.getMetadata().put(EntityDataTypes.NAMETAG, newDisplayName); packet.setRuntimeEntityId(geyserId); session.sendUpstreamPacket(packet); } @@ -407,13 +407,13 @@ public class PlayerEntity extends LivingEntity { // providing the information SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); - packet.getMetadata().put(EntityData.SCORE_TAG, displayString); + packet.getMetadata().put(EntityDataTypes.SCORE_TAG, displayString); session.sendUpstreamPacket(packet); } } else if (valid) { SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); - packet.getMetadata().put(EntityData.SCORE_TAG, ""); + packet.getMetadata().put(EntityDataTypes.SCORE_TAG, ""); session.sendUpstreamPacket(packet); } } 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 7a5d34973..69430f456 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 @@ -30,11 +30,11 @@ import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeTyp import com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.AttributeData; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; @@ -167,7 +167,7 @@ public class SessionPlayerEntity extends PlayerEntity { public void addFakeTradeExperience(int tradeXp) { fakeTradeXp += tradeXp; - dirtyMetadata.put(EntityData.TRADE_XP, fakeTradeXp); + dirtyMetadata.put(EntityDataTypes.TRADE_XP, fakeTradeXp); } @Override @@ -233,11 +233,11 @@ public class SessionPlayerEntity extends PlayerEntity { public void setLastDeathPosition(@Nullable GlobalPos pos) { if (pos != null) { - dirtyMetadata.put(EntityData.PLAYER_LAST_DEATH_POS, pos.getPosition()); - dirtyMetadata.put(EntityData.PLAYER_LAST_DEATH_DIMENSION, DimensionUtils.javaToBedrock(pos.getDimension())); - dirtyMetadata.put(EntityData.PLAYER_HAS_DIED, (byte) 1); + dirtyMetadata.put(EntityDataTypes.PLAYER_LAST_DEATH_POS, pos.getPosition()); + dirtyMetadata.put(EntityDataTypes.PLAYER_LAST_DEATH_DIMENSION, DimensionUtils.javaToBedrock(pos.getDimension())); + dirtyMetadata.put(EntityDataTypes.PLAYER_HAS_DIED, (byte) 1); } else { - dirtyMetadata.put(EntityData.PLAYER_HAS_DIED, (byte) 0); + dirtyMetadata.put(EntityDataTypes.PLAYER_HAS_DIED, (byte) 0); } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java index 176d171de..b552c5f46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java @@ -25,13 +25,13 @@ package org.geysermc.geyser.entity.type.player; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.GameType; -import com.nukkitx.protocol.bedrock.data.PlayerPermission; -import com.nukkitx.protocol.bedrock.data.command.CommandPermission; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.GameType; +import org.cloudburstmc.protocol.bedrock.data.PlayerPermission; +import org.cloudburstmc.protocol.bedrock.data.command.CommandPermission; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.AddPlayerPacket; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.SkullCache; @@ -55,9 +55,9 @@ public class SkullPlayerEntity extends PlayerEntity { protected void initializeMetadata() { // Deliberately do not call super // Set bounding box to almost nothing so the skull is able to be broken and not cause entity to cast a shadow - dirtyMetadata.put(EntityData.SCALE, 1.08f); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.001f); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.001f); + dirtyMetadata.put(EntityDataTypes.SCALE, 1.08f); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_HEIGHT, 0.001f); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_WIDTH, 0.001f); setFlag(EntityFlag.CAN_SHOW_NAME, false); setFlag(EntityFlag.INVISIBLE, true); // Until the skin is loaded } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java b/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java index 87c0c92a3..eee351095 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; public record BedrockContainerSlot(ContainerSlotType container, int slot) { } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java index 43aec6f08..ac55aae60 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; public class EnchantingContainer extends Container { diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java index 94012a830..8dbc9b722 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.translator.inventory.Generic3X3InventoryTranslator; public class Generic3X3Container extends Container { /** - * Whether we need to set the container type as {@link com.nukkitx.protocol.bedrock.data.inventory.ContainerType#DROPPER}. + * Whether we need to set the container type as {@link org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType#DROPPER}. * * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} */ diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java index 94462268e..d34ee2cbb 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.EnchantData; -import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.EnchantData; +import org.cloudburstmc.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java index 0fb70a1a2..2b7b9eba3 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import lombok.Data; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java index f01d242ad..a02ce658a 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java @@ -29,10 +29,11 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -143,9 +144,9 @@ public abstract class Inventory { protected void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session) { if (!newItem.isEmpty()) { - int oldMapping = ItemTranslator.getBedrockItemId(session, oldItem); - int newMapping = ItemTranslator.getBedrockItemId(session, newItem); - if (oldMapping == newMapping) { + ItemDefinition oldMapping = ItemTranslator.getBedrockItemDefinition(session, oldItem); + ItemDefinition newMapping = ItemTranslator.getBedrockItemDefinition(session, newItem); + if (oldMapping.equals(newMapping)) { newItem.setNetId(oldItem.getNetId()); } else { newItem.setNetId(session.getNextItemNetId()); 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 5d8c9f110..4de320101 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import lombok.Getter; import lombok.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 379eb2566..c78da3f00 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 @@ -26,13 +26,13 @@ package org.geysermc.geyser.inventory.holder; import com.google.common.collect.ImmutableSet; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket; +import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.registry.BlockRegistries; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java b/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java index b50a9f7d5..8b29252a7 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java @@ -27,6 +27,7 @@ package org.geysermc.geyser.inventory.item; import lombok.Getter; import lombok.experimental.Accessors; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import javax.annotation.Nonnull; @@ -38,70 +39,70 @@ import java.util.Map; @Getter @Accessors(fluent = true) public class StoredItemMappings { - private final int amethystShard; + private final ItemDefinition amethystShard; private final ItemMapping bamboo; private final ItemMapping banner; private final ItemMapping barrier; - private final int bowl; - private final int bucket; - private final int chest; + private final ItemDefinition bowl; + private final ItemDefinition bucket; + private final ItemDefinition chest; private final ItemMapping compass; private final ItemMapping crossbow; private final ItemMapping enchantedBook; private final ItemMapping fishingRod; - private final int flintAndSteel; - private final int frogspawn; - private final int goatHorn; - private final int glassBottle; - private final int goldenApple; - private final int goldIngot; - private final int ironIngot; - private final int lead; - private final int lilyPad; + private final ItemDefinition flintAndSteel; + private final ItemDefinition frogspawn; + private final ItemDefinition goatHorn; + private final ItemDefinition glassBottle; + private final ItemDefinition goldenApple; + private final ItemDefinition goldIngot; + private final ItemDefinition ironIngot; + private final ItemDefinition lead; + private final ItemDefinition lilyPad; private final ItemMapping milkBucket; - private final int nameTag; + private final ItemDefinition nameTag; private final ItemMapping powderSnowBucket; private final ItemMapping playerHead; private final ItemMapping egg; - private final int saddle; - private final int shears; + private final ItemDefinition saddle; + private final ItemDefinition shears; private final ItemMapping shield; - private final int slimeBall; - private final int waterBucket; + private final ItemDefinition slimeBall; + private final ItemDefinition waterBucket; private final ItemMapping wheat; private final ItemMapping writableBook; public StoredItemMappings(Map itemMappings) { - this.amethystShard = load(itemMappings, "amethyst_shard").getJavaId(); + this.amethystShard = load(itemMappings, "amethyst_shard").getBedrockDefinition(); this.bamboo = load(itemMappings, "bamboo"); this.banner = load(itemMappings, "white_banner"); // As of 1.17.10, all banners have the same Bedrock ID this.barrier = load(itemMappings, "barrier"); - this.bowl = load(itemMappings, "bowl").getJavaId(); - this.bucket = load(itemMappings, "bucket").getBedrockId(); - this.chest = load(itemMappings, "chest").getJavaId(); + this.bowl = load(itemMappings, "bowl").getBedrockDefinition(); + this.bucket = load(itemMappings, "bucket").getBedrockDefinition(); + this.chest = load(itemMappings, "chest").getBedrockDefinition(); this.compass = load(itemMappings, "compass"); this.crossbow = load(itemMappings, "crossbow"); this.enchantedBook = load(itemMappings, "enchanted_book"); this.fishingRod = load(itemMappings, "fishing_rod"); - this.flintAndSteel = load(itemMappings, "flint_and_steel").getJavaId(); - this.frogspawn = load(itemMappings, "frogspawn").getBedrockId(); - this.goatHorn = load(itemMappings, "goat_horn").getJavaId(); - this.glassBottle = load(itemMappings, "glass_bottle").getBedrockId(); - this.goldenApple = load(itemMappings, "golden_apple").getJavaId(); - this.goldIngot = load(itemMappings, "gold_ingot").getJavaId(); - this.ironIngot = load(itemMappings, "iron_ingot").getJavaId(); - this.lead = load(itemMappings, "lead").getJavaId(); - this.lilyPad = load(itemMappings, "lily_pad").getBedrockId(); + this.flintAndSteel = load(itemMappings, "flint_and_steel").getBedrockDefinition(); + this.frogspawn = load(itemMappings, "frogspawn").getBedrockDefinition(); + this.goatHorn = load(itemMappings, "goat_horn").getBedrockDefinition(); + this.glassBottle = load(itemMappings, "glass_bottle").getBedrockDefinition(); + this.goldenApple = load(itemMappings, "golden_apple").getBedrockDefinition(); + this.goldIngot = load(itemMappings, "gold_ingot").getBedrockDefinition(); + this.ironIngot = load(itemMappings, "iron_ingot").getBedrockDefinition(); + this.lead = load(itemMappings, "lead").getBedrockDefinition(); + this.lilyPad = load(itemMappings, "lily_pad").getBedrockDefinition(); this.milkBucket = load(itemMappings, "milk_bucket"); - this.nameTag = load(itemMappings, "name_tag").getJavaId(); + this.nameTag = load(itemMappings, "name_tag").getBedrockDefinition(); this.powderSnowBucket = load(itemMappings, "powder_snow_bucket"); this.playerHead = load(itemMappings, "player_head"); this.egg = load(itemMappings, "egg"); - this.saddle = load(itemMappings, "saddle").getJavaId(); - this.shears = load(itemMappings, "shears").getJavaId(); + this.saddle = load(itemMappings, "saddle").getBedrockDefinition(); + this.shears = load(itemMappings, "shears").getBedrockDefinition(); this.shield = load(itemMappings, "shield"); - this.slimeBall = load(itemMappings, "slime_ball").getJavaId(); - this.waterBucket = load(itemMappings, "water_bucket").getJavaId(); + this.slimeBall = load(itemMappings, "slime_ball").getBedrockDefinition(); + this.waterBucket = load(itemMappings, "water_bucket").getBedrockDefinition(); this.wheat = load(itemMappings, "wheat"); this.writableBook = load(itemMappings, "writable_book"); } 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 e83971443..224cb1ff2 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 @@ -33,9 +33,9 @@ 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 com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java index 8a174c2c5..5d6214871 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.inventory.updater; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import lombok.AllArgsConstructor; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java index c943a62b4..c9f313f2a 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.inventory.updater; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java index 20ce7e467..7441e66d0 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.inventory.updater; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java index 421a8101d..68ee334ba 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java @@ -25,10 +25,10 @@ package org.geysermc.geyser.inventory.updater; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java index e86e62d10..a23385b53 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.inventory.updater; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/item/GeyserCustomMappingData.java b/core/src/main/java/org/geysermc/geyser/item/GeyserCustomMappingData.java index 3829db3c3..08a8b387c 100644 --- a/core/src/main/java/org/geysermc/geyser/item/GeyserCustomMappingData.java +++ b/core/src/main/java/org/geysermc/geyser/item/GeyserCustomMappingData.java @@ -25,8 +25,9 @@ package org.geysermc.geyser.item; -import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; -import com.nukkitx.protocol.bedrock.packet.StartGamePacket; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; +import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; +import org.cloudburstmc.protocol.bedrock.packet.StartGamePacket; -public record GeyserCustomMappingData(ComponentItemData componentItemData, StartGamePacket.ItemEntry startGamePacketItemEntry, String stringId, int integerId) { +public record GeyserCustomMappingData(ComponentItemData componentItemData, ItemDefinition itemDefinition, String stringId, int integerId) { } 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 69f5d5beb..105ea7e37 100644 --- a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java @@ -27,7 +27,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 com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java b/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java index 8d2820a54..206c27a81 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.level.physics; -import com.nukkitx.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3d; public enum Axis { X, Y, Z; diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java b/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java index d6913d6c0..8343babd0 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.level.physics; -import com.nukkitx.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3d; import lombok.AllArgsConstructor; import lombok.Data; import lombok.SneakyThrows; diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index 2a830cd70..6410bb6c9 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -25,12 +25,12 @@ package org.geysermc.geyser.level.physics; -import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; +import org.cloudburstmc.math.GenericMath; +import org.cloudburstmc.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinitions; diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java b/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java index 48c50bc69..a05a2f452 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.level.physics; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import lombok.Getter; import javax.annotation.Nonnull; 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 7bba6bb89..b60bbe46f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/GameProtocol.java @@ -27,13 +27,14 @@ package org.geysermc.geyser.network; import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.PacketCodec; -import com.nukkitx.protocol.bedrock.BedrockPacketCodec; -import com.nukkitx.protocol.bedrock.v527.Bedrock_v527; -import com.nukkitx.protocol.bedrock.v534.Bedrock_v534; -import com.nukkitx.protocol.bedrock.v544.Bedrock_v544; -import com.nukkitx.protocol.bedrock.v545.Bedrock_v545; -import com.nukkitx.protocol.bedrock.v554.Bedrock_v554; -import com.nukkitx.protocol.bedrock.v557.Bedrock_v557; +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.netty.codec.packet.BedrockPacketCodec; import org.geysermc.geyser.session.GeyserSession; import java.util.ArrayList; @@ -48,11 +49,11 @@ public final class GameProtocol { * Default Bedrock codec that should act as a fallback. Should represent the latest available * release of the game that Geyser supports. */ - public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v557.V557_CODEC; + public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v557.CODEC; /** * A list of all supported Bedrock versions that can join Geyser */ - public static final List SUPPORTED_BEDROCK_CODECS = new ArrayList<>(); + public static final List SUPPORTED_BEDROCK_CODECS = new ArrayList<>(); /** * Java codec that is supported. We only ever support one version for @@ -61,17 +62,17 @@ public final class GameProtocol { private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC; static { - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v527.V527_CODEC.toBuilder() + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v527.CODEC.toBuilder() .minecraftVersion("1.19.0/1.19.2") .build()); - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v534.V534_CODEC.toBuilder() + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v534.CODEC.toBuilder() .minecraftVersion("1.19.10/1.19.11") .build()); - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v544.V544_CODEC); - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v545.V545_CODEC.toBuilder() + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v544.CODEC); + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v545.CODEC.toBuilder() .minecraftVersion("1.19.21/1.19.22") .build()); - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v554.V554_CODEC.toBuilder() + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v554.CODEC.toBuilder() .minecraftVersion("1.19.30/1.19.31") .build()); SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); @@ -82,8 +83,8 @@ public final class GameProtocol { * @param protocolVersion The protocol version to attempt to find * @return The packet codec, or null if the client's protocol is unsupported */ - public static BedrockPacketCodec getBedrockCodec(int protocolVersion) { - for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { + public static BedrockCodec getBedrockCodec(int protocolVersion) { + for (BedrockCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { if (packetCodec.getProtocolVersion() == protocolVersion) { return packetCodec; } @@ -94,11 +95,11 @@ public final class GameProtocol { /* Bedrock convenience methods to gatekeep features and easily remove the check on version removal */ public static boolean supports1_19_10(GeyserSession session) { - return session.getUpstream().getProtocolVersion() >= Bedrock_v534.V534_CODEC.getProtocolVersion(); + return session.getUpstream().getProtocolVersion() >= Bedrock_v534.CODEC.getProtocolVersion(); } public static boolean supports1_19_30(GeyserSession session) { - return session.getUpstream().getProtocolVersion() >= Bedrock_v554.V554_CODEC.getProtocolVersion(); + return session.getUpstream().getProtocolVersion() >= Bedrock_v554.CODEC.getProtocolVersion(); } /** @@ -142,7 +143,7 @@ public final class GameProtocol { */ public static String getAllSupportedBedrockVersions() { StringJoiner joiner = new StringJoiner(", "); - for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { + for (BedrockCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { joiner.add(packetCodec.getMinecraftVersion()); } diff --git a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/GeyserServerInitializer.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java rename to core/src/main/java/org/geysermc/geyser/network/GeyserServerInitializer.java index c9a3201c1..a811ce9ad 100644 --- a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/GeyserServerInitializer.java @@ -25,10 +25,12 @@ package org.geysermc.geyser.network; -import com.nukkitx.protocol.bedrock.BedrockPong; -import com.nukkitx.protocol.bedrock.BedrockServerEventHandler; -import com.nukkitx.protocol.bedrock.BedrockServerSession; -import com.nukkitx.protocol.bedrock.v554.Bedrock_v554; +import io.netty.channel.Channel; +import org.cloudburstmc.protocol.bedrock.BedrockPong; +import org.cloudburstmc.protocol.bedrock.BedrockServerSession; +import org.cloudburstmc.protocol.bedrock.BedrockSession; +import org.cloudburstmc.protocol.bedrock.codec.v554.Bedrock_v554; +import org.cloudburstmc.protocol.bedrock.netty.initializer.BedrockServerInitializer; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.DefaultEventLoopGroup; @@ -47,7 +49,7 @@ import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.util.List; -public class ConnectorServerEventHandler implements BedrockServerEventHandler { +public class GeyserServerInitializer extends BedrockServerInitializer { private static final boolean PRINT_DEBUG_PINGS = Boolean.parseBoolean(System.getProperty("Geyser.PrintPingsInDebugMode", "true")); /* @@ -64,10 +66,11 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { // There is a constructor that doesn't require inputting threads, but older Netty versions don't have it private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread")); - public ConnectorServerEventHandler(GeyserImpl geyser) { + public GeyserServerInitializer(GeyserImpl geyser) { this.geyser = geyser; } + /* @Override public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) { List allowedProxyIPs = geyser.getConfig().getBedrock().getProxyProtocolWhitelistedIPs(); @@ -169,10 +172,12 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { return pong; } + */ + @Override - public void onSessionCreation(@Nonnull BedrockServerSession bedrockServerSession) { + public void initSession(@Nonnull BedrockServerSession bedrockServerSession) { try { - bedrockServerSession.setPacketCodec(Bedrock_v554.V554_CODEC); // Has the RequestNetworkSettingsPacket + bedrockServerSession.setCodec(Bedrock_v554.CODEC); // Has the RequestNetworkSettingsPacket bedrockServerSession.setLogging(true); bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); @@ -184,6 +189,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } } + /* @Override public void onUnhandledDatagram(@Nonnull ChannelHandlerContext ctx, @Nonnull DatagramPacket packet) { try { @@ -198,4 +204,5 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } } } + */ } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 8d2db081a..59b34af16 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -25,9 +25,8 @@ package org.geysermc.geyser.network; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler; -import com.nukkitx.protocol.bedrock.packet.*; +import org.cloudburstmc.protocol.bedrock.packet.*; +import org.cloudburstmc.protocol.common.PacketSignal; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.GeyserSession; @@ -46,828 +45,828 @@ public class LoggingPacketHandler implements BedrockPacketHandler { this.session = session; } - boolean defaultHandler(BedrockPacket packet) { + PacketSignal defaultHandler(BedrockPacket packet) { geyser.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName()); - return false; + return PacketSignal.HANDLED; } @Override - public boolean handle(LoginPacket packet) { + public PacketSignal handle(LoginPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePackClientResponsePacket packet) { + public PacketSignal handle(ResourcePackClientResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AdventureSettingsPacket packet) { + public PacketSignal handle(AdventureSettingsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AnimatePacket packet) { + public PacketSignal handle(AnimatePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BlockEntityDataPacket packet) { + public PacketSignal handle(BlockEntityDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BlockPickRequestPacket packet) { + public PacketSignal handle(BlockPickRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BookEditPacket packet) { + public PacketSignal handle(BookEditPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ClientCacheBlobStatusPacket packet) { + public PacketSignal handle(ClientCacheBlobStatusPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ClientCacheMissResponsePacket packet) { + public PacketSignal handle(ClientCacheMissResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ClientCacheStatusPacket packet) { + public PacketSignal handle(ClientCacheStatusPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ClientToServerHandshakePacket packet) { + public PacketSignal handle(ClientToServerHandshakePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CommandBlockUpdatePacket packet) { + public PacketSignal handle(CommandBlockUpdatePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CommandRequestPacket packet) { + public PacketSignal handle(CommandRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ContainerClosePacket packet) { + public PacketSignal handle(ContainerClosePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CraftingEventPacket packet) { + public PacketSignal handle(CraftingEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EntityEventPacket packet) { + public PacketSignal handle(EntityEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EntityPickRequestPacket packet) { + public PacketSignal handle(EntityPickRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EventPacket packet) { + public PacketSignal handle(EventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(InteractPacket packet) { + public PacketSignal handle(InteractPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(InventoryContentPacket packet) { + public PacketSignal handle(InventoryContentPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(InventorySlotPacket packet) { + public PacketSignal handle(InventorySlotPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(InventoryTransactionPacket packet) { + public PacketSignal handle(InventoryTransactionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ItemFrameDropItemPacket packet) { + public PacketSignal handle(ItemFrameDropItemPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LabTablePacket packet) { + public PacketSignal handle(LabTablePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LecternUpdatePacket packet) { + public PacketSignal handle(LecternUpdatePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelEventGenericPacket packet) { + public PacketSignal handle(LevelEventGenericPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelSoundEventPacket packet) { + public PacketSignal handle(LevelSoundEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MapInfoRequestPacket packet) { + public PacketSignal handle(MapInfoRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MobArmorEquipmentPacket packet) { + public PacketSignal handle(MobArmorEquipmentPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MobEquipmentPacket packet) { + public PacketSignal handle(MobEquipmentPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ModalFormResponsePacket packet) { + public PacketSignal handle(ModalFormResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MoveEntityAbsolutePacket packet) { + public PacketSignal handle(MoveEntityAbsolutePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MovePlayerPacket packet) { + public PacketSignal handle(MovePlayerPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(NetworkStackLatencyPacket packet) { + public PacketSignal handle(NetworkStackLatencyPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PhotoTransferPacket packet) { + public PacketSignal handle(PhotoTransferPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerActionPacket packet) { + public PacketSignal handle(PlayerActionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerHotbarPacket packet) { + public PacketSignal handle(PlayerHotbarPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerInputPacket packet) { + public PacketSignal handle(PlayerInputPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerSkinPacket packet) { + public PacketSignal handle(PlayerSkinPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PurchaseReceiptPacket packet) { + public PacketSignal handle(PurchaseReceiptPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(RequestChunkRadiusPacket packet) { + public PacketSignal handle(RequestChunkRadiusPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePackChunkRequestPacket packet) { + public PacketSignal handle(ResourcePackChunkRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(RiderJumpPacket packet) { + public PacketSignal handle(RiderJumpPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ServerSettingsRequestPacket packet) { + public PacketSignal handle(ServerSettingsRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetDefaultGameTypePacket packet) { + public PacketSignal handle(SetDefaultGameTypePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetLocalPlayerAsInitializedPacket packet) { + public PacketSignal handle(SetLocalPlayerAsInitializedPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetPlayerGameTypePacket packet) { + public PacketSignal handle(SetPlayerGameTypePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SubClientLoginPacket packet) { + public PacketSignal handle(SubClientLoginPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(TextPacket packet) { + public PacketSignal handle(TextPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddBehaviorTreePacket packet) { + public PacketSignal handle(AddBehaviorTreePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddEntityPacket packet) { + public PacketSignal handle(AddEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddHangingEntityPacket packet) { + public PacketSignal handle(AddHangingEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddItemEntityPacket packet) { + public PacketSignal handle(AddItemEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddPaintingPacket packet) { + public PacketSignal handle(AddPaintingPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AddPlayerPacket packet) { + public PacketSignal handle(AddPlayerPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AvailableCommandsPacket packet) { + public PacketSignal handle(AvailableCommandsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BlockEventPacket packet) { + public PacketSignal handle(BlockEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BossEventPacket packet) { + public PacketSignal handle(BossEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CameraPacket packet) { + public PacketSignal handle(CameraPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ChangeDimensionPacket packet) { + public PacketSignal handle(ChangeDimensionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ChunkRadiusUpdatedPacket packet) { + public PacketSignal handle(ChunkRadiusUpdatedPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ClientboundMapItemDataPacket packet) { + public PacketSignal handle(ClientboundMapItemDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CommandOutputPacket packet) { + public PacketSignal handle(CommandOutputPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ContainerOpenPacket packet) { + public PacketSignal handle(ContainerOpenPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ContainerSetDataPacket packet) { + public PacketSignal handle(ContainerSetDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CraftingDataPacket packet) { + public PacketSignal handle(CraftingDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(DisconnectPacket packet) { + public PacketSignal handle(DisconnectPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ExplodePacket packet) { + public PacketSignal handle(ExplodePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelChunkPacket packet) { + public PacketSignal handle(LevelChunkPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(GameRulesChangedPacket packet) { + public PacketSignal handle(GameRulesChangedPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(GuiDataPickItemPacket packet) { + public PacketSignal handle(GuiDataPickItemPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(HurtArmorPacket packet) { + public PacketSignal handle(HurtArmorPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AutomationClientConnectPacket packet) { + public PacketSignal handle(AutomationClientConnectPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelEventPacket packet) { + public PacketSignal handle(LevelEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MapCreateLockedCopyPacket packet) { + public PacketSignal handle(MapCreateLockedCopyPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MobEffectPacket packet) { + public PacketSignal handle(MobEffectPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ModalFormRequestPacket packet) { + public PacketSignal handle(ModalFormRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MoveEntityDeltaPacket packet) { + public PacketSignal handle(MoveEntityDeltaPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(NpcRequestPacket packet) { + public PacketSignal handle(NpcRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(OnScreenTextureAnimationPacket packet) { + public PacketSignal handle(OnScreenTextureAnimationPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerListPacket packet) { + public PacketSignal handle(PlayerListPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlaySoundPacket packet) { + public PacketSignal handle(PlaySoundPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayStatusPacket packet) { + public PacketSignal handle(PlayStatusPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(RemoveEntityPacket packet) { + public PacketSignal handle(RemoveEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(RemoveObjectivePacket packet) { + public PacketSignal handle(RemoveObjectivePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePackChunkDataPacket packet) { + public PacketSignal handle(ResourcePackChunkDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePackDataInfoPacket packet) { + public PacketSignal handle(ResourcePackDataInfoPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePacksInfoPacket packet) { + public PacketSignal handle(ResourcePacksInfoPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ResourcePackStackPacket packet) { + public PacketSignal handle(ResourcePackStackPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(RespawnPacket packet) { + public PacketSignal handle(RespawnPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ScriptCustomEventPacket packet) { + public PacketSignal handle(ScriptCustomEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ServerSettingsResponsePacket packet) { + public PacketSignal handle(ServerSettingsResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ServerToClientHandshakePacket packet) { + public PacketSignal handle(ServerToClientHandshakePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetCommandsEnabledPacket packet) { + public PacketSignal handle(SetCommandsEnabledPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetDifficultyPacket packet) { + public PacketSignal handle(SetDifficultyPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetDisplayObjectivePacket packet) { + public PacketSignal handle(SetDisplayObjectivePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetEntityDataPacket packet) { + public PacketSignal handle(SetEntityDataPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetEntityLinkPacket packet) { + public PacketSignal handle(SetEntityLinkPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetEntityMotionPacket packet) { + public PacketSignal handle(SetEntityMotionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetHealthPacket packet) { + public PacketSignal handle(SetHealthPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetLastHurtByPacket packet) { + public PacketSignal handle(SetLastHurtByPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetScoreboardIdentityPacket packet) { + public PacketSignal handle(SetScoreboardIdentityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetScorePacket packet) { + public PacketSignal handle(SetScorePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetSpawnPositionPacket packet) { + public PacketSignal handle(SetSpawnPositionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetTimePacket packet) { + public PacketSignal handle(SetTimePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SetTitlePacket packet) { + public PacketSignal handle(SetTitlePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ShowCreditsPacket packet) { + public PacketSignal handle(ShowCreditsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ShowProfilePacket packet) { + public PacketSignal handle(ShowProfilePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ShowStoreOfferPacket packet) { + public PacketSignal handle(ShowStoreOfferPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SimpleEventPacket packet) { + public PacketSignal handle(SimpleEventPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SpawnExperienceOrbPacket packet) { + public PacketSignal handle(SpawnExperienceOrbPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(StartGamePacket packet) { + public PacketSignal handle(StartGamePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(StopSoundPacket packet) { + public PacketSignal handle(StopSoundPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(StructureBlockUpdatePacket packet) { + public PacketSignal handle(StructureBlockUpdatePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(StructureTemplateDataRequestPacket packet) { + public PacketSignal handle(StructureTemplateDataRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(StructureTemplateDataResponsePacket packet) { + public PacketSignal handle(StructureTemplateDataResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(TakeItemEntityPacket packet) { + public PacketSignal handle(TakeItemEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(TransferPacket packet) { + public PacketSignal handle(TransferPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateAttributesPacket packet) { + public PacketSignal handle(UpdateAttributesPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateBlockPacket packet) { + public PacketSignal handle(UpdateBlockPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateBlockPropertiesPacket packet) { + public PacketSignal handle(UpdateBlockPropertiesPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateBlockSyncedPacket packet) { + public PacketSignal handle(UpdateBlockSyncedPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateEquipPacket packet) { + public PacketSignal handle(UpdateEquipPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateSoftEnumPacket packet) { + public PacketSignal handle(UpdateSoftEnumPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdateTradePacket packet) { + public PacketSignal handle(UpdateTradePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AvailableEntityIdentifiersPacket packet) { + public PacketSignal handle(AvailableEntityIdentifiersPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(BiomeDefinitionListPacket packet) { + public PacketSignal handle(BiomeDefinitionListPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelSoundEvent2Packet packet) { + public PacketSignal handle(LevelSoundEvent2Packet packet) { return defaultHandler(packet); } @Override - public boolean handle(NetworkChunkPublisherUpdatePacket packet) { + public PacketSignal handle(NetworkChunkPublisherUpdatePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SpawnParticleEffectPacket packet) { + public PacketSignal handle(SpawnParticleEffectPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(VideoStreamConnectPacket packet) { + public PacketSignal handle(VideoStreamConnectPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EmotePacket packet) { + public PacketSignal handle(EmotePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(TickSyncPacket packet) { + public PacketSignal handle(TickSyncPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AnvilDamagePacket packet) { + public PacketSignal handle(AnvilDamagePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(NetworkSettingsPacket packet) { + public PacketSignal handle(NetworkSettingsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerAuthInputPacket packet) { + public PacketSignal handle(PlayerAuthInputPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(SettingsCommandPacket packet) { + public PacketSignal handle(SettingsCommandPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EducationSettingsPacket packet) { + public PacketSignal handle(EducationSettingsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CompletedUsingItemPacket packet) { + public PacketSignal handle(CompletedUsingItemPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(MultiplayerSettingsPacket packet) { + public PacketSignal handle(MultiplayerSettingsPacket packet) { return defaultHandler(packet); } // 1.16 new packets @Override - public boolean handle(DebugInfoPacket packet) { + public PacketSignal handle(DebugInfoPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(EmoteListPacket packet) { + public PacketSignal handle(EmoteListPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CodeBuilderPacket packet) { + public PacketSignal handle(CodeBuilderPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CreativeContentPacket packet) { + public PacketSignal handle(CreativeContentPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ItemStackRequestPacket packet) { + public PacketSignal handle(ItemStackRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(LevelSoundEvent1Packet packet) { + public PacketSignal handle(LevelSoundEvent1Packet packet) { return defaultHandler(packet); } @Override - public boolean handle(ItemStackResponsePacket packet) { + public PacketSignal handle(ItemStackResponsePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerArmorDamagePacket packet) { + public PacketSignal handle(PlayerArmorDamagePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerEnchantOptionsPacket packet) { + public PacketSignal handle(PlayerEnchantOptionsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(UpdatePlayerGameTypePacket packet) { + public PacketSignal handle(UpdatePlayerGameTypePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PacketViolationWarningPacket packet) { + public PacketSignal handle(PacketViolationWarningPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PositionTrackingDBClientRequestPacket packet) { + public PacketSignal handle(PositionTrackingDBClientRequestPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PositionTrackingDBServerBroadcastPacket packet) { + public PacketSignal handle(PositionTrackingDBServerBroadcastPacket packet) { return defaultHandler(packet); } // 1.16.100 new packets @Override - public boolean handle(MotionPredictionHintsPacket packet) { + public PacketSignal handle(MotionPredictionHintsPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(AnimateEntityPacket packet) { + public PacketSignal handle(AnimateEntityPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CameraShakePacket packet) { + public PacketSignal handle(CameraShakePacket packet) { return defaultHandler(packet); } @Override - public boolean handle(PlayerFogPacket packet) { + public PacketSignal handle(PlayerFogPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(CorrectPlayerMovePredictionPacket packet) { + public PacketSignal handle(CorrectPlayerMovePredictionPacket packet) { return defaultHandler(packet); } @Override - public boolean handle(ItemComponentPacket packet) { + public PacketSignal handle(ItemComponentPacket packet) { return defaultHandler(packet); } // 1.16.200 new packet @Override - public boolean handle(FilterTextPacket packet) { + public PacketSignal handle(FilterTextPacket packet) { return defaultHandler(packet); } // 1.19.0 new packet @Override - public boolean handle(RequestAbilityPacket packet) { + public PacketSignal handle(RequestAbilityPacket packet) { return defaultHandler(packet); } // 1.19.30 new packet @Override - public boolean handle(RequestNetworkSettingsPacket packet) { + public PacketSignal handle(RequestNetworkSettingsPacket packet) { return defaultHandler(packet); } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java index d7daa9260..74e1430a2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java @@ -257,7 +257,7 @@ public class QueryPacketHandler { * @param data packet data */ private void sendPacket(ByteBuf data) { - geyser.getBedrockServer().getRakNet().send(sender, data); + // geyser.getBedrockServer().getRakNet().send(sender, data); } /** diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index c2a91fd75..c06577e42 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -25,12 +25,27 @@ package org.geysermc.geyser.network; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.BedrockPacketCodec; -import com.nukkitx.protocol.bedrock.data.ExperimentData; -import com.nukkitx.protocol.bedrock.data.PacketCompressionAlgorithm; -import com.nukkitx.protocol.bedrock.data.ResourcePackType; -import com.nukkitx.protocol.bedrock.packet.*; +import io.netty.buffer.Unpooled; +import org.cloudburstmc.protocol.bedrock.BedrockDisconnectReasons; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; +import org.cloudburstmc.protocol.bedrock.data.ExperimentData; +import org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm; +import org.cloudburstmc.protocol.bedrock.data.ResourcePackType; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.packet.LoginPacket; +import org.cloudburstmc.protocol.bedrock.packet.ModalFormResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; +import org.cloudburstmc.protocol.bedrock.packet.NetworkSettingsPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayStatusPacket; +import org.cloudburstmc.protocol.bedrock.packet.RequestNetworkSettingsPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackClientResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackDataInfoPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackStackPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePacksInfoPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket; +import org.cloudburstmc.protocol.common.PacketSignal; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.network.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; @@ -53,19 +68,19 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { super(geyser, session); } - private boolean translateAndDefault(BedrockPacket packet) { - return Registries.BEDROCK_PACKET_TRANSLATORS.translate(packet.getClass(), packet, session); + private PacketSignal translateAndDefault(BedrockPacket packet) { + return Registries.BEDROCK_PACKET_TRANSLATORS.translate(packet.getClass(), packet, session) ? PacketSignal.HANDLED : PacketSignal.UNHANDLED; } @Override - boolean defaultHandler(BedrockPacket packet) { + PacketSignal defaultHandler(BedrockPacket packet) { return translateAndDefault(packet); } private boolean newProtocol = false; // TEMPORARY private boolean setCorrectCodec(int protocolVersion) { - BedrockPacketCodec packetCodec = GameProtocol.getBedrockCodec(protocolVersion); + BedrockCodec packetCodec = GameProtocol.getBedrockCodec(protocolVersion); if (packetCodec == null) { String supportedVersions = GameProtocol.getAllSupportedBedrockVersions(); if (protocolVersion > GameProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { @@ -78,16 +93,26 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } } - session.getUpstream().getSession().setPacketCodec(packetCodec); + session.getUpstream().getSession().setCodec(packetCodec); return true; } @Override - public boolean handle(RequestNetworkSettingsPacket packet) { + public void onDisconnect(String reason) { + // Use our own disconnect messages for these reasons + if (BedrockDisconnectReasons.CLOSED.equals(reason)) { + this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.closed_by_remote_peer")); + } else if (BedrockDisconnectReasons.TIMEOUT.equals(reason)) { + this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.timed_out")); + } + } + + @Override + public PacketSignal handle(RequestNetworkSettingsPacket packet) { if (setCorrectCodec(packet.getProtocolVersion())) { newProtocol = true; } else { - return true; + return PacketSignal.HANDLED; } // New since 1.19.30 - sent before login packet @@ -99,20 +124,20 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { session.sendUpstreamPacketImmediately(responsePacket); session.getUpstream().getSession().setCompression(algorithm); - return true; + return PacketSignal.HANDLED; } @Override - public boolean handle(LoginPacket loginPacket) { + public PacketSignal handle(LoginPacket loginPacket) { if (geyser.isShuttingDown()) { // Don't allow new players in if we're no longer operating session.disconnect(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.kick.message")); - return true; + return PacketSignal.HANDLED; } if (!newProtocol) { if (!setCorrectCodec(loginPacket.getProtocolVersion())) { // REMOVE WHEN ONLY 1.19.30 IS SUPPORTED OR 1.20 - return true; + return PacketSignal.HANDLED; } } @@ -124,7 +149,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { if (session.isClosed()) { // Can happen if Xbox validation fails - return true; + return PacketSignal.HANDLED; } PlayStatusPacket playStatus = new PlayStatusPacket(); @@ -144,11 +169,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { session.sendUpstreamPacket(resourcePacksInfo); GeyserLocale.loadGeyserLocale(session.locale()); - return true; + return PacketSignal.HANDLED; } @Override - public boolean handle(ResourcePackClientResponsePacket packet) { + public PacketSignal handle(ResourcePackClientResponsePacket packet) { switch (packet.getStatus()) { case COMPLETED: if (geyser.getConfig().getRemote().authType() != AuthType.ONLINE) { @@ -175,7 +200,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { data.setHash(pack.getSha256()); data.setPackVersion(packID[1]); data.setPremium(false); - data.setType(ResourcePackType.RESOURCE); + data.setType(ResourcePackType.RESOURCES); session.sendUpstreamPacket(data); } @@ -205,13 +230,13 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { break; } - return true; + return PacketSignal.HANDLED; } @Override - public boolean handle(ModalFormResponsePacket packet) { + public PacketSignal handle(ModalFormResponsePacket packet) { session.executeInEventLoop(() -> session.getFormCache().handleResponse(packet)); - return true; + return PacketSignal.HANDLED; } private boolean couldLoginUserByName(String bedrockUsername) { @@ -244,7 +269,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } @Override - public boolean handle(MovePlayerPacket packet) { + public PacketSignal handle(MovePlayerPacket packet) { if (session.isLoggingIn()) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.ACTIONBAR); @@ -261,7 +286,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } @Override - public boolean handle(ResourcePackChunkRequestPacket packet) { + public PacketSignal handle(ResourcePackChunkRequestPacket packet) { ResourcePackChunkDataPacket data = new ResourcePackChunkDataPacket(); ResourcePack pack = ResourcePack.PACKS.get(packet.getPackId().toString()); @@ -280,9 +305,9 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { e.printStackTrace(); } - data.setData(packData); + data.setData(Unpooled.wrappedBuffer(packData)); session.sendUpstreamPacket(data); - return true; + return PacketSignal.HANDLED; } } 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 new file mode 100644 index 000000000..a6f91b164 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.network.netty; + +import com.nukkitx.network.util.EventLoops; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelFuture; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.socket.nio.NioDatagramChannel; +import org.cloudburstmc.netty.channel.raknet.RakChannelFactory; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.GeyserServerInitializer; + +import java.net.InetSocketAddress; + +public final class GeyserServer { + private final GeyserImpl geyser; + private final EventLoopGroup group; + private final ServerBootstrap bootstrap; + + private ChannelFuture future; + + public GeyserServer(GeyserImpl geyser, int threadCount) { + this.geyser = geyser; + this.group = EventLoops.newEventLoopGroup(threadCount); + + this.bootstrap = this.createBootstrap(group); + } + + public ChannelFuture bind(InetSocketAddress address) { + return this.future = this.bootstrap.bind(address); + } + + public void shutdown() { + this.group.shutdownGracefully(); + this.future.channel().closeFuture().syncUninterruptibly(); + } + + private ServerBootstrap createBootstrap(EventLoopGroup group) { + return new ServerBootstrap() + .channelFactory(RakChannelFactory.server(NioDatagramChannel.class)) + .group(group) + .childHandler(new GeyserServerInitializer(this.geyser)); + } +} 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 370604db9..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 @@ -25,6 +25,7 @@ package org.geysermc.geyser.network.netty; +import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.codec.PacketCodecHelper; import com.github.steveice10.packetlib.packet.PacketProtocol; @@ -52,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; @@ -108,8 +109,8 @@ public final class LocalSession extends TcpSession { } @Override - public PacketCodecHelper getCodecHelper() { - return this.codecHelper; + public MinecraftCodecHelper getCodecHelper() { + return (MinecraftCodecHelper) this.codecHelper; } // TODO duplicate code diff --git a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java index bf412bfaf..f3a49400d 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.registry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; -import com.nukkitx.protocol.bedrock.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import io.netty.channel.EventLoop; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; 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 2c1c51baf..ec8de5298 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -33,14 +33,14 @@ 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 com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; -import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; +import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; +import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData; 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.protocol.bedrock.packet.BedrockPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; import org.geysermc.geyser.inventory.recipe.GeyserRecipe; @@ -148,10 +148,10 @@ public final class Registries { public static final VersionedRegistry> RECIPES = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); /** - * A mapped registry holding the available records, with the ID of the record being the key, and the {@link com.nukkitx.protocol.bedrock.data.SoundEvent} + * A mapped registry holding the available records, with the ID of the record being the key, and the {@link org.cloudburstmc.protocol.bedrock.data.SoundEvent} * as the value. */ - public static final IntMappedRegistry RECORDS = IntMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + public static final IntMappedRegistry RECORDS = IntMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); /** * A mapped registry holding sound identifiers to their corresponding {@link SoundMapping}. diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/ParticleTypesRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/ParticleTypesRegistryLoader.java index fc757ca05..ae785c204 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/ParticleTypesRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/ParticleTypesRegistryLoader.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; -import com.nukkitx.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.registry.type.ParticleMapping; 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 8d40edac3..03bbddecd 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 com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; +import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.registry.Registries; @@ -83,9 +83,9 @@ public class PotionMixRegistryLoader implements RegistryLoader { javaEffect = LevelEvent.valueOf(entry.getKey()); - com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText()); + org.cloudburstmc.protocol.bedrock.data.SoundEvent soundEvent = org.cloudburstmc.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText()); String identifier = node.has("identifier") ? node.get("identifier").asText() : ""; int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1; transformer = new SoundEventEventTranslator(soundEvent, identifier, extraData); 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 afc79082a..52719c0fc 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,15 +28,22 @@ 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.*; -import com.nukkitx.protocol.bedrock.v527.Bedrock_v527; -import com.nukkitx.protocol.bedrock.v544.Bedrock_v544; +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 it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +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.data.defintions.BlockDefinition; +import org.cloudburstmc.protocol.bedrock.data.defintions.SimpleBlockDefinition; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.physics.PistonBehavior; @@ -51,6 +58,7 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.function.BiFunction; import java.util.zip.GZIPInputStream; @@ -73,18 +81,18 @@ public final class BlockRegistryPopulator { private static void registerBedrockBlocks() { BiFunction emptyMapper = (bedrockIdentifier, statesBuilder) -> null; ImmutableMap, BiFunction> blockMappers = ImmutableMap., BiFunction>builder() - .put(ObjectIntPair.of("1_19_0", Bedrock_v527.V527_CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> { + .put(ObjectIntPair.of("1_19_0", Bedrock_v527.CODEC.getProtocolVersion()), (bedrockIdentifier, statesBuilder) -> { if (bedrockIdentifier.equals("minecraft:muddy_mangrove_roots")) { statesBuilder.remove("pillar_axis"); } return null; }) - .put(ObjectIntPair.of("1_19_20", Bedrock_v544.V544_CODEC.getProtocolVersion()), emptyMapper).build(); + .put(ObjectIntPair.of("1_19_20", Bedrock_v544.CODEC.getProtocolVersion()), emptyMapper).build(); for (Map.Entry, BiFunction> palette : blockMappers.entrySet()) { NbtList blocksTag; try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key())); - NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { + NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)))) { NbtMap blockPalette = (NbtMap) nbtInputStream.readTag(); blocksTag = (NbtList) blockPalette.getList("blocks", NbtType.COMPOUND); } catch (Exception e) { @@ -92,7 +100,7 @@ public final class BlockRegistryPopulator { } // New since 1.16.100 - find the block runtime ID by the order given to us in the block palette, // as we no longer send a block palette - Object2IntMap blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size()); + Object2ObjectMap blockStateOrderedMap = new Object2ObjectOpenHashMap<>(blocksTag.size()); int stateVersion = -1; for (int i = 0; i < blocksTag.size(); i++) { @@ -102,26 +110,27 @@ public final class BlockRegistryPopulator { if (blockStateOrderedMap.containsKey(tag)) { throw new AssertionError("Duplicate block states in Bedrock palette: " + tag); } - blockStateOrderedMap.put(tag, i); + blockStateOrderedMap.put(tag, new SimpleBlockDefinition(tag.getString("name"), i, tag)); if (stateVersion == -1) { stateVersion = tag.getInt("version"); } } - int airRuntimeId = -1; - int commandBlockRuntimeId = -1; int javaRuntimeId = -1; - int waterRuntimeId = -1; - int movingBlockRuntimeId = -1; + + BlockDefinition airDefinition = null; + BlockDefinition commandBlockDefinition = null; + BlockDefinition waterDefinition = null; + BlockDefinition movingBlockDefinition = null; Iterator> blocksIterator = BLOCKS_JSON.fields(); BiFunction stateMapper = blockMappers.getOrDefault(palette.getKey(), emptyMapper); - int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()]; + BlockDefinition[] javaToBedrockBlocks = new BlockDefinition[BLOCKS_JSON.size()]; Map flowerPotBlocks = new Object2ObjectOpenHashMap<>(); - Object2IntMap itemFrames = new Object2IntOpenHashMap<>(); + Map itemFrames = new Object2ObjectOpenHashMap<>(); - IntSet jigsawStateIds = new IntOpenHashSet(); + Set jigsawDefinitions = new ObjectOpenHashSet<>(); BlockMappings.BlockMappingsBuilder builder = BlockMappings.builder(); while (blocksIterator.hasNext()) { @@ -129,21 +138,21 @@ public final class BlockRegistryPopulator { Map.Entry entry = blocksIterator.next(); String javaId = entry.getKey(); - int bedrockRuntimeId = blockStateOrderedMap.getOrDefault(buildBedrockState(entry.getValue(), stateVersion, stateMapper), -1); - if (bedrockRuntimeId == -1) { - throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Built NBT tag: \n" + + BlockDefinition bedrockDefinition = blockStateOrderedMap.get(buildBedrockState(entry.getValue(), stateVersion, stateMapper)); + if (bedrockDefinition == null) { + throw new RuntimeException("Unable to find " + javaId + " Bedrock BlockDefinition! Built NBT tag: \n" + buildBedrockState(entry.getValue(), stateVersion, stateMapper)); } switch (javaId) { - case "minecraft:air" -> airRuntimeId = bedrockRuntimeId; - case "minecraft:water[level=0]" -> waterRuntimeId = bedrockRuntimeId; - case "minecraft:command_block[conditional=false,facing=north]" -> commandBlockRuntimeId = bedrockRuntimeId; - case "minecraft:moving_piston[facing=north,type=normal]" -> movingBlockRuntimeId = bedrockRuntimeId; + case "minecraft:air" -> airDefinition = bedrockDefinition; + case "minecraft:water[level=0]" -> waterDefinition = bedrockDefinition; + case "minecraft:command_block[conditional=false,facing=north]" -> commandBlockDefinition = bedrockDefinition; + case "minecraft:moving_piston[facing=north,type=normal]" -> movingBlockDefinition = bedrockDefinition; } if (javaId.contains("jigsaw")) { - jigsawStateIds.add(bedrockRuntimeId); + jigsawDefinitions.add(bedrockDefinition); } boolean waterlogged = entry.getKey().contains("waterlogged=true") @@ -158,46 +167,48 @@ public final class BlockRegistryPopulator { // Get the tag needed for non-empty flower pots if (entry.getValue().get("pottable") != null) { - flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); + flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockDefinition.getRuntimeId())); } - javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId; + javaToBedrockBlocks[javaRuntimeId] = bedrockDefinition; } - if (commandBlockRuntimeId == -1) { + if (commandBlockDefinition == null) { throw new AssertionError("Unable to find command block in palette"); } - builder.commandBlockRuntimeId(commandBlockRuntimeId); - if (waterRuntimeId == -1) { + builder.commandBlock(commandBlockDefinition); + + if (waterDefinition == null) { throw new AssertionError("Unable to find water in palette"); } - builder.bedrockWaterId(waterRuntimeId); + builder.bedrockWater(waterDefinition); - if (airRuntimeId == -1) { + if (airDefinition == null) { throw new AssertionError("Unable to find air in palette"); } - builder.bedrockAirId(airRuntimeId); + builder.bedrockAir(airDefinition); - if (movingBlockRuntimeId == -1) { + if (movingBlockDefinition == null) { throw new AssertionError("Unable to find moving block in palette"); } - builder.bedrockMovingBlockId(movingBlockRuntimeId); + builder.bedrockMovingBlock(movingBlockDefinition); // Loop around again to find all item frame runtime IDs - for (Object2IntMap.Entry entry : blockStateOrderedMap.object2IntEntrySet()) { + Object2ObjectMaps.fastForEach(blockStateOrderedMap, entry -> { String name = entry.getKey().getString("name"); if (name.equals("minecraft:frame") || name.equals("minecraft:glow_frame")) { - itemFrames.put(entry.getKey(), entry.getIntValue()); + itemFrames.put(entry.getKey(), entry.getValue()); } - } - builder.bedrockBlockStates(blocksTag); + }); + + builder.bedrockBlockPalette(blocksTag); BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion) .javaToBedrockBlocks(javaToBedrockBlocks) .itemFrames(itemFrames) .flowerPotBlocks(flowerPotBlocks) - .jigsawStateIds(jigsawStateIds) + .jigsawStates(jigsawDefinitions) .build()); } } 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 94e04e972..d570f904e 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 @@ -28,8 +28,9 @@ package org.geysermc.geyser.registry.populator; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; -import com.nukkitx.protocol.bedrock.packet.StartGamePacket; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; +import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; +import org.cloudburstmc.protocol.bedrock.packet.StartGamePacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.item.custom.CustomItemData; import org.geysermc.geyser.api.item.custom.CustomRenderOffsets; @@ -50,12 +51,12 @@ import java.util.OptionalInt; public class CustomItemRegistryPopulator { public static GeyserCustomMappingData registerCustomItem(String customItemName, GeyserMappingItem javaItem, CustomItemData customItemData, int bedrockId) { - StartGamePacket.ItemEntry startGamePacketItemEntry = new StartGamePacket.ItemEntry(customItemName, (short) bedrockId, true); + ItemDefinition itemDefinition = new ItemDefinition(customItemName, bedrockId, true); NbtMapBuilder builder = createComponentNbt(customItemData, javaItem, customItemName, bedrockId); ComponentItemData componentItemData = new ComponentItemData(customItemName, builder.build()); - return new GeyserCustomMappingData(componentItemData, startGamePacketItemEntry, customItemName, bedrockId); + return new GeyserCustomMappingData(componentItemData, itemDefinition, customItemName, bedrockId); } static boolean initialCheck(String identifier, CustomItemData item, Map mappings) { @@ -83,7 +84,7 @@ public class CustomItemRegistryPopulator { .javaIdentifier(customIdentifier) .bedrockIdentifier(customIdentifier) .javaId(customItemData.javaId()) - .bedrockId(customItemId) + .bedrockDefinition(new ItemDefinition(customIdentifier, customItemId, true)) .bedrockData(0) .bedrockBlockId(0) .stackSize(customItemData.stackSize()) 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 f928361cc..335c0afd5 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 @@ -33,19 +33,25 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.nbt.NbtUtils; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.StartGamePacket; -import it.unimi.dsi.fastutil.ints.*; -import com.nukkitx.protocol.bedrock.v527.Bedrock_v527; -import com.nukkitx.protocol.bedrock.v534.Bedrock_v534; -import com.nukkitx.protocol.bedrock.v544.Bedrock_v544; import it.unimi.dsi.fastutil.ints.Int2IntMap; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.*; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectIntPair; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.checkerframework.checker.nullness.qual.NonNull; +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.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; +import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.item.custom.CustomItemData; @@ -57,14 +63,27 @@ import org.geysermc.geyser.item.GeyserCustomMappingData; import org.geysermc.geyser.item.mappings.MappingsConfigReader; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.registry.type.*; +import org.geysermc.geyser.registry.type.BlockMappings; +import org.geysermc.geyser.registry.type.GeyserMappingItem; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.registry.type.NonVanillaItemRegistration; +import org.geysermc.geyser.registry.type.PaletteItem; import org.geysermc.geyser.util.ItemUtils; import org.geysermc.geyser.util.collection.FixedInt2IntMap; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; /** * Populates the item registries. @@ -76,10 +95,10 @@ public class ItemRegistryPopulator { public static void populate() { Map paletteVersions = new Object2ObjectOpenHashMap<>(); - paletteVersions.put("1_19_0", new PaletteVersion(Bedrock_v527.V527_CODEC.getProtocolVersion(), + paletteVersions.put("1_19_0", new PaletteVersion(Bedrock_v527.CODEC.getProtocolVersion(), Collections.singletonMap("minecraft:trader_llama_spawn_egg", "minecraft:llama_spawn_egg"))); - paletteVersions.put("1_19_10", new PaletteVersion(Bedrock_v534.V534_CODEC.getProtocolVersion(), Collections.emptyMap())); - paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.V544_CODEC.getProtocolVersion(), Collections.emptyMap())); + paletteVersions.put("1_19_10", new PaletteVersion(Bedrock_v534.CODEC.getProtocolVersion(), Collections.emptyMap())); + paletteVersions.put("1_19_20", new PaletteVersion(Bedrock_v544.CODEC.getProtocolVersion(), Collections.emptyMap())); GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); @@ -157,8 +176,7 @@ public class ItemRegistryPopulator { TypeReference> paletteEntriesType = new TypeReference<>() {}; // Used to get the Bedrock namespaced ID (in instances where there are small differences) - Object2IntMap bedrockIdentifierToId = new Object2IntOpenHashMap<>(); - bedrockIdentifierToId.defaultReturnValue(Short.MIN_VALUE); + Map bedrockIdentifierToDefinition = new HashMap<>(); List itemNames = new ArrayList<>(); @@ -173,7 +191,7 @@ public class ItemRegistryPopulator { int nextFreeBedrockId = 0; List componentItemData = new ObjectArrayList<>(); - Map entries = new Object2ObjectOpenHashMap<>(); + Map definitions = new Object2ObjectOpenHashMap<>(); for (PaletteItem entry : itemEntries) { int id = entry.getId(); @@ -181,8 +199,9 @@ public class ItemRegistryPopulator { nextFreeBedrockId = id + 1; } - entries.put(entry.getName(), new StartGamePacket.ItemEntry(entry.getName(), (short) id)); - bedrockIdentifierToId.put(entry.getName(), id); + ItemDefinition definition = new ItemDefinition(entry.getName(), id, false); + definitions.put(entry.getName(), definition); + bedrockIdentifierToDefinition.put(entry.getName(), definition); } Object2IntMap bedrockBlockIdOverrides = new Object2IntOpenHashMap<>(); @@ -197,9 +216,9 @@ public class ItemRegistryPopulator { throw new AssertionError("Unable to load creative items", e); } - IntList boats = new IntArrayList(); - IntList buckets = new IntArrayList(); - IntList spawnEggs = new IntArrayList(); + List boats = new ObjectArrayList<>(); + List buckets = new ObjectArrayList<>(); + List spawnEggs = new ObjectArrayList<>(); List carpets = new ObjectArrayList<>(); List mappings = new ObjectArrayList<>(); @@ -247,18 +266,9 @@ public class ItemRegistryPopulator { // Bedrock-only banner patterns continue; } - StartGamePacket.ItemEntry entry = entries.get(identifier); - int id = -1; - if (entry != null) { - id = entry.getId(); - } - - if (id == -1) { - throw new RuntimeException("Unable to find matching Bedrock item for " + identifier); - } - + ItemDefinition definition = definitions.get(identifier); creativeItems.add(ItemData.builder() - .id(id) + .definition(definition) .damage(damage) .count(count) .blockRuntimeId(blockRuntimeId) @@ -318,10 +328,11 @@ public class ItemRegistryPopulator { } String bedrockIdentifier = mappingItem.getBedrockIdentifier(); - int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier); - if (bedrockId == Short.MIN_VALUE) { - throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier); + ItemDefinition definition = bedrockIdentifierToDefinition.get(bedrockIdentifier); + if (definition == null) { + throw new RuntimeException("Missing Bedrock ItemDefinition in mappings: " + bedrockIdentifier); } + int stackSize = mappingItem.getStackSize(); int bedrockBlockId = -1; @@ -344,14 +355,14 @@ public class ItemRegistryPopulator { // as indexed by Bedrock's block palette // There are exceptions! But, ideally, the block ID override should take care of those. NbtMapBuilder requiredBlockStatesBuilder = NbtMap.builder(); - String correctBedrockIdentifier = blockMappings.getBedrockBlockStates().get(aValidBedrockBlockId).getString("name"); + String correctBedrockIdentifier = blockMappings.getBedrockBlockPalette().get(aValidBedrockBlockId).getString("name"); boolean firstPass = true; // Block states are all grouped together. In the mappings, we store the first block runtime ID in order, // and the last, if relevant. We then iterate over all those values and get their Bedrock equivalents Integer lastBlockRuntimeId = entry.getValue().getLastBlockRuntimeId() == null ? firstBlockRuntimeId : entry.getValue().getLastBlockRuntimeId(); for (int i = firstBlockRuntimeId; i <= lastBlockRuntimeId; i++) { int bedrockBlockRuntimeId = blockMappings.getBedrockBlockId(i); - NbtMap blockTag = blockMappings.getBedrockBlockStates().get(bedrockBlockRuntimeId); + NbtMap blockTag = blockMappings.getBedrockBlockPalette().get(bedrockBlockRuntimeId); String bedrockName = blockTag.getString("name"); if (!bedrockName.equals(correctBedrockIdentifier)) { continue; @@ -389,7 +400,7 @@ public class ItemRegistryPopulator { int i = -1; // We need to loop around again (we can't cache the block tags above) because Bedrock can include states that we don't have a pairing for // in it's "preferred" block state - I.E. the first matching block state in the list - for (NbtMap blockTag : blockMappings.getBedrockBlockStates()) { + for (NbtMap blockTag : blockMappings.getBedrockBlockPalette()) { i++; if (blockTag.getString("name").equals(correctBedrockIdentifier)) { NbtMap states = blockTag.getCompound("states"); @@ -416,11 +427,12 @@ public class ItemRegistryPopulator { // That way, creative items work correctly for these blocks for (int j = 0; j < creativeItems.size(); j++) { ItemData itemData = creativeItems.get(j); - if (itemData.getId() == bedrockId) { + if (itemData.getDefinition().equals(definition)) { if (itemData.getDamage() != 0) { break; } - NbtMap states = blockMappings.getBedrockBlockStates().get(itemData.getBlockRuntimeId()).getCompound("states"); + + NbtMap states = blockMappings.getBedrockBlockPalette().get(itemData.getBlockRuntimeId()).getCompound("states"); boolean valid = true; for (Map.Entry nbtEntry : requiredBlockStates.entrySet()) { if (!states.get(nbtEntry.getKey()).equals(nbtEntry.getValue())) { @@ -443,7 +455,7 @@ public class ItemRegistryPopulator { .javaIdentifier(javaIdentifier) .javaId(itemIndex) .bedrockIdentifier(bedrockIdentifier.intern()) - .bedrockId(bedrockId) + .bedrockDefinition(definition) .bedrockData(mappingItem.getBedrockData()) .bedrockBlockId(bedrockBlockId) .stackSize(stackSize) @@ -491,7 +503,7 @@ public class ItemRegistryPopulator { customItemName, mappingItem, customItem, customProtocolId ); // StartGamePacket entry - needed for Bedrock to recognize the item through the protocol - entries.put(customMapping.stringId(), customMapping.startGamePacketItemEntry()); + definitions.put(customMapping.stringId(), customMapping.itemDefinition()); // ComponentItemData - used to register some custom properties componentItemData.add(customMapping.componentItemData()); customItemOptions.add(ObjectIntPair.of(customItem.customItemOptions(), customProtocolId)); @@ -509,13 +521,13 @@ public class ItemRegistryPopulator { ItemMapping mapping = mappingBuilder.build(); if (javaIdentifier.contains("boat")) { - boats.add(bedrockId); + boats.add(definition); } else if (javaIdentifier.contains("bucket") && !javaIdentifier.contains("milk")) { - buckets.add(bedrockId); + buckets.add(definition); } else if (javaIdentifier.contains("_carpet") && !javaIdentifier.contains("moss")) { // This should be the numerical order Java sends as an integer value for llamas carpets.add(ItemData.builder() - .id(mapping.getBedrockId()) + .definition(definition) .damage(mapping.getBedrockData()) .count(1) .blockRuntimeId(mapping.getBedrockBlockId()) @@ -525,7 +537,7 @@ public class ItemRegistryPopulator { Registries.RECORDS.register(itemIndex, SoundEvent.valueOf("RECORD_" + javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH))); } else if (javaIdentifier.endsWith("_spawn_egg")) { - spawnEggs.add(mapping.getBedrockId()); + spawnEggs.add(definition); } mappings.add(mapping); @@ -542,8 +554,8 @@ public class ItemRegistryPopulator { itemNames.add("minecraft:furnace_minecart"); - int lodestoneCompassId = entries.get("minecraft:lodestone_compass").getId(); - if (lodestoneCompassId == 0) { + ItemDefinition lodestoneCompass = definitions.get("minecraft:lodestone_compass"); + if (lodestoneCompass == null) { throw new RuntimeException("Lodestone compass not found in item palette!"); } @@ -552,7 +564,7 @@ public class ItemRegistryPopulator { .javaIdentifier("") .bedrockIdentifier("minecraft:lodestone_compass") .javaId(-1) - .bedrockId(lodestoneCompassId) + .bedrockDefinition(lodestoneCompass) .bedrockData(0) .bedrockBlockId(-1) .stackSize(1) @@ -563,13 +575,14 @@ public class ItemRegistryPopulator { // Add the furnace minecart as a custom item int furnaceMinecartId = nextFreeBedrockId++; - entries.put("geysermc:furnace_minecart", new StartGamePacket.ItemEntry("geysermc:furnace_minecart", (short) furnaceMinecartId, true)); + ItemDefinition definition = new ItemDefinition("geysermc:furnace_minecart", (short) furnaceMinecartId, true); + definitions.put("geysermc:furnace_minecart", definition); mappings.set(javaFurnaceMinecartId, ItemMapping.builder() .javaIdentifier("minecraft:furnace_minecart") .bedrockIdentifier("geysermc:furnace_minecart") .javaId(javaFurnaceMinecartId) - .bedrockId(furnaceMinecartId) + .bedrockDefinition(definition) .bedrockData(0) .bedrockBlockId(-1) .stackSize(1) @@ -578,7 +591,7 @@ public class ItemRegistryPopulator { creativeItems.add(ItemData.builder() .netId(netId++) - .id(furnaceMinecartId) + .definition(definition) .count(1).build()); NbtMapBuilder builder = NbtMap.builder(); @@ -638,7 +651,7 @@ public class ItemRegistryPopulator { if (customItem.creativeGroup() != null || customItem.creativeCategory().isPresent()) { creativeItems.add(ItemData.builder() - .id(customItemId) + .definition(registration.mapping().getBedrockDefinition()) .netId(netId++) .count(1).build()); } @@ -648,13 +661,13 @@ public class ItemRegistryPopulator { ItemMappings itemMappings = ItemMappings.builder() .items(mappings.toArray(new ItemMapping[0])) .creativeItems(creativeItems.toArray(new ItemData[0])) - .itemEntries(List.copyOf(entries.values())) + .itemDefinitions(List.copyOf(definitions.values())) .itemNames(itemNames.toArray(new String[0])) .storedItems(new StoredItemMappings(identifierToMapping)) .javaOnlyItems(javaOnlyItems) - .bucketIds(buckets) - .boatIds(boats) - .spawnEggIds(spawnEggs) + .buckets(buckets) + .boats(boats) + .spawnEggs(spawnEggs) .carpets(carpets) .componentItemData(componentItemData) .lodestoneCompass(lodestoneEntry) diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java index 5aeb3a757..06903465d 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.registry.populator; import com.github.steveice10.packetlib.packet.Packet; -import com.nukkitx.protocol.bedrock.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.translator.protocol.PacketTranslator; 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 920ada5fb..c21938416 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 @@ -31,12 +31,12 @@ 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 com.nukkitx.protocol.bedrock.data.inventory.CraftingData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; 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.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.recipe.GeyserRecipe; import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe; @@ -50,7 +50,15 @@ import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; import static org.geysermc.geyser.util.InventoryUtils.LAST_RECIPE_NET_ID; @@ -221,7 +229,7 @@ public class RecipeRegistryPopulator { } } return ItemData.builder() - .id(mapping.getBedrockId()) + .definition(mapping.getBedrockDefinition()) .damage(damage) .count(count) .blockRuntimeId(mapping.isBlock() ? mapping.getBedrockBlockId() : 0) 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 41318ee64..5ad6399c0 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 @@ -31,41 +31,57 @@ import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Builder; import lombok.Value; +import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; import java.util.Map; +import java.util.Set; @Builder @Value public class BlockMappings { - int bedrockAirId; - int bedrockWaterId; - int bedrockMovingBlockId; + BlockDefinition bedrockAir; + BlockDefinition bedrockWater; + BlockDefinition bedrockMovingBlock; int blockStateVersion; - int[] javaToBedrockBlocks; + BlockDefinition[] javaToBedrockBlocks; - NbtList bedrockBlockStates; + NbtList bedrockBlockPalette; - int commandBlockRuntimeId; + BlockDefinition commandBlock; - Object2IntMap itemFrames; + Map itemFrames; Map flowerPotBlocks; - IntSet jigsawStateIds; + Set jigsawStates; public int getBedrockBlockId(int state) { if (state >= this.javaToBedrockBlocks.length) { - return bedrockAirId; + return bedrockAir.getRuntimeId(); + } + return this.javaToBedrockBlocks[state].getRuntimeId(); + } + + public BlockDefinition getBedrockBlock(int state) { + if (state >= this.javaToBedrockBlocks.length) { + return bedrockAir; } return this.javaToBedrockBlocks[state]; } public int getItemFrame(NbtMap tag) { - return this.itemFrames.getOrDefault(tag, -1); + BlockDefinition definition = this.itemFrames.get(tag); + return definition == null ? -1 : definition.getRuntimeId(); } public boolean isItemFrame(int bedrockBlockRuntimeId) { - return this.itemFrames.values().contains(bedrockBlockRuntimeId); + for (Map.Entry entry : this.itemFrames.entrySet()) { + if (entry.getValue().getRuntimeId() == bedrockBlockRuntimeId) { + return true; + } + } + + return false; } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java index e3d34b0ca..bcc51fdfe 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java @@ -25,11 +25,13 @@ package org.geysermc.geyser.registry.type; +import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Value; import org.checkerframework.checker.nullness.qual.NonNull; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.geysermc.geyser.api.item.custom.CustomItemOptions; import java.util.Collections; @@ -40,14 +42,27 @@ import java.util.Set; @Builder @EqualsAndHashCode public class ItemMapping { - public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0, + public static final ItemMapping AIR = new ItemMapping( + "minecraft:air", + "minecraft:air", + 0, + ItemDefinition.AIR, + 0, 0, // Air is never sent in full over the network for this to serialize. - 64, null, null, null, Collections.emptyList(), 0, null, false); + 64, + null, + null, + null + , Collections.emptyList(), + 0, + null, + false + ); String javaIdentifier; String bedrockIdentifier; int javaId; - int bedrockId; + ItemDefinition bedrockDefinition; int bedrockData; /** @@ -63,7 +78,7 @@ public class ItemMapping { String translationString; @NonNull - List> customItemOptions; + List> customItemOptions; int maxDamage; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java index ce7ac0b07..825c71673 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java @@ -26,13 +26,12 @@ package org.geysermc.geyser.registry.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.IntList; import lombok.Builder; import lombok.Value; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; +import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.item.StoredItemMappings; @@ -56,15 +55,15 @@ public class ItemMappings { ItemMapping lodestoneCompass; ItemData[] creativeItems; - List itemEntries; + List itemDefinitions; StoredItemMappings storedItems; String[] itemNames; Set javaOnlyItems; - IntList bucketIds; - IntList boatIds; - IntList spawnEggIds; + List buckets; + List boats; + List spawnEggs; List carpets; List componentItemData; @@ -118,10 +117,11 @@ public class ItemMappings { * @return an item entry from the given item data */ public ItemMapping getMapping(ItemData data) { - int id = data.getId(); - if (id == 0) { + ItemDefinition definition = data.getDefinition(); + int id = data.getDefinition().getRuntimeId(); + if (ItemDefinition.AIR.equals(definition)) { return ItemMapping.AIR; - } else if (id == lodestoneCompass.getBedrockId()) { + } else if (definition.equals(lodestoneCompass.getBedrockDefinition())) { return lodestoneCompass; } @@ -129,7 +129,7 @@ public class ItemMappings { boolean hasDamage = data.getDamage() != 0; for (ItemMapping mapping : this.items) { - if (mapping.getBedrockId() == id) { + if (mapping.getBedrockDefinition().equals(definition)) { if (isBlock && !hasDamage) { // Pre-1.16.220 will not use block runtime IDs at all, so we shouldn't check either if (data.getBlockRuntimeId() != mapping.getBedrockBlockId()) { continue; @@ -151,7 +151,7 @@ public class ItemMappings { // This will hide the message when the player clicks with an empty hand if (id != 0 && data.getDamage() != 0) { - GeyserImpl.getInstance().getLogger().debug("Missing mapping for bedrock item " + data.getId() + ":" + data.getDamage()); + GeyserImpl.getInstance().getLogger().debug("Missing mapping for bedrock item " + data.getDefinition() + ":" + data.getDamage()); } return ItemMapping.AIR; } diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/NonVanillaItemRegistration.java b/core/src/main/java/org/geysermc/geyser/registry/type/NonVanillaItemRegistration.java index e2063f41a..562c8a6bb 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/NonVanillaItemRegistration.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/NonVanillaItemRegistration.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.registry.type; -import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; /** * The return data of a successful registration of a custom item. diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java index 71feee3de..d10404632 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.registry.type; -import com.nukkitx.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; import org.geysermc.geyser.session.GeyserSession; import javax.annotation.ParametersAreNullableByDefault; diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java index 53537137f..0a6623e97 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.scoreboard; -import com.nukkitx.protocol.bedrock.data.ScoreInfo; +import org.cloudburstmc.protocol.bedrock.data.ScoreInfo; import lombok.Getter; import lombok.experimental.Accessors; diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index a6e80a375..a9f9de483 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -26,10 +26,10 @@ package org.geysermc.geyser.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; -import com.nukkitx.protocol.bedrock.data.ScoreInfo; -import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket; -import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket; -import com.nukkitx.protocol.bedrock.packet.SetScorePacket; +import org.cloudburstmc.protocol.bedrock.data.ScoreInfo; +import org.cloudburstmc.protocol.bedrock.packet.RemoveObjectivePacket; +import org.cloudburstmc.protocol.bedrock.packet.SetDisplayObjectivePacket; +import org.cloudburstmc.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserLogger; diff --git a/core/src/main/java/org/geysermc/geyser/session/DownstreamSession.java b/core/src/main/java/org/geysermc/geyser/session/DownstreamSession.java new file mode 100644 index 000000000..40b685783 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/session/DownstreamSession.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.session; + +import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper; +import com.github.steveice10.packetlib.packet.Packet; +import com.github.steveice10.packetlib.tcp.TcpSession; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.checkerframework.checker.nullness.qual.NonNull; + +@Getter +@RequiredArgsConstructor +public class DownstreamSession { + private final TcpSession session; + + public void sendPacket(@NonNull Packet packet) { + this.session.send(packet); + } + + public void disconnect(String reason) { + this.session.disconnect(reason); + } + + public void disconnect(String reason, Throwable throwable) { + this.session.disconnect(reason, throwable); + } + + public boolean isClosed() { + return !this.session.isConnected(); + } + + /** + * Gets the codec helper for this session. + * + * @return the codec helper for this session + */ + public MinecraftCodecHelper getCodecHelper() { + return (MinecraftCodecHelper) this.session.getCodecHelper(); + } +} 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 67aedec15..c172becb9 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -58,19 +58,15 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.event.session.*; +import com.github.steveice10.packetlib.event.session.ConnectedEvent; +import com.github.steveice10.packetlib.event.session.DisconnectedEvent; +import com.github.steveice10.packetlib.event.session.PacketErrorEvent; +import com.github.steveice10.packetlib.event.session.PacketSendingEvent; +import com.github.steveice10.packetlib.event.session.SessionAdapter; import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpClientSession; import com.github.steveice10.packetlib.tcp.TcpSession; -import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.*; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.BedrockServerSession; -import com.nukkitx.protocol.bedrock.data.*; -import com.nukkitx.protocol.bedrock.data.command.CommandPermission; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.*; import io.netty.channel.Channel; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.bytes.ByteArrays; @@ -91,6 +87,27 @@ import lombok.Setter; import lombok.experimental.Accessors; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.common.value.qual.IntRange; +import org.cloudburstmc.math.GenericMath; +import org.cloudburstmc.math.vector.Vector2f; +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.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; +import org.cloudburstmc.protocol.bedrock.data.GamePublishSetting; +import org.cloudburstmc.protocol.bedrock.data.GameRuleData; +import org.cloudburstmc.protocol.bedrock.data.GameType; +import org.cloudburstmc.protocol.bedrock.data.PlayerPermission; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.data.command.CommandPermission; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.*; import org.geysermc.api.util.BedrockPlatform; import org.geysermc.api.util.InputMode; import org.geysermc.api.util.UiProfile; @@ -127,7 +144,20 @@ import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.geyser.session.auth.AuthData; import org.geysermc.geyser.session.auth.BedrockClientData; -import org.geysermc.geyser.session.cache.*; +import org.geysermc.geyser.session.cache.AdvancementsCache; +import org.geysermc.geyser.session.cache.BookEditCache; +import org.geysermc.geyser.session.cache.ChunkCache; +import org.geysermc.geyser.session.cache.EntityCache; +import org.geysermc.geyser.session.cache.EntityEffectCache; +import org.geysermc.geyser.session.cache.FormCache; +import org.geysermc.geyser.session.cache.LodestoneCache; +import org.geysermc.geyser.session.cache.PistonCache; +import org.geysermc.geyser.session.cache.PreferencesCache; +import org.geysermc.geyser.session.cache.SkullCache; +import org.geysermc.geyser.session.cache.TagCache; +import org.geysermc.geyser.session.cache.TeleportCache; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.skin.FloodgateSkinUploader; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.MinecraftLocale; @@ -143,7 +173,14 @@ import java.net.ConnectException; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.time.Instant; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -152,14 +189,14 @@ import java.util.concurrent.atomic.AtomicInteger; @Getter public class GeyserSession implements GeyserConnection, GeyserCommandSource { - private final @NonNull GeyserImpl geyser; - private final @NonNull UpstreamSession upstream; + private final GeyserImpl geyser; + private final UpstreamSession upstream; + private DownstreamSession downstream; /** * The loop where all packets and ticking is processed to prevent concurrency issues. * If this is manually called, ensure that any exceptions are properly handled. */ - private final @NonNull EventLoop eventLoop; - private TcpSession downstream; + private final EventLoop eventLoop; @Setter private AuthData authData; @Setter @@ -585,17 +622,6 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { this.emotes = null; } - bedrockServerSession.addDisconnectHandler(disconnectReason -> { - String message = switch (disconnectReason) { - // A generic message that just means the player quit normally. - case CLOSED_BY_REMOTE_PEER -> GeyserLocale.getLocaleStringLog("geyser.network.disconnect.closed_by_remote_peer"); - case TIMED_OUT -> GeyserLocale.getLocaleStringLog("geyser.network.disconnect.timed_out"); - default -> disconnectReason.name(); - }; - - disconnect(message); - }); - this.remoteServer = geyser.defaultRemoteServer(); } @@ -607,7 +633,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { sentSpawnPacket = true; // Set the hardcoded shield ID to the ID we just defined in StartGamePacket - upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); + // upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); if (GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) { ItemComponentPacket componentPacket = new ItemComponentPacket(); @@ -855,6 +881,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { // Start ticking tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); + TcpSession downstream; if (geyser.getBootstrap().getSocketAddress() != null) { // We're going to connect through the JVM and not through TCP downstream = new LocalSession(this.remoteServer.address(), this.remoteServer.port(), @@ -865,6 +892,9 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { disableSrvResolving(); } + // Wrap in DownstreamSession + this.downstream = new DownstreamSession(downstream); + if (geyser.getConfig().getRemote().isUseProxyProtocol()) { downstream.setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true); downstream.setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress()); @@ -1323,7 +1353,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { * Will be overwritten for GeyserConnect. */ protected void disableSrvResolving() { - this.downstream.setFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, false); + this.downstream.getSession().setFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, false); } @Override @@ -1458,7 +1488,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { startGamePacket.setEnchantmentSeed(0); startGamePacket.setMultiplayerCorrelationId(""); - startGamePacket.setItemEntries(this.itemMappings.getItemEntries()); + startGamePacket.setItemDefinitions(this.itemMappings.getItemDefinitions()); + startGamePacket.setBlockPalette(this.blockMappings.getBedrockBlockPalette()); startGamePacket.setVanillaVersion("*"); startGamePacket.setInventoriesServerAuthoritative(true); @@ -1469,11 +1500,9 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { startGamePacket.setChatRestrictionLevel(ChatRestrictionLevel.NONE); - SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings(); - settings.setMovementMode(AuthoritativeMovementMode.CLIENT); - settings.setRewindHistorySize(0); - settings.setServerAuthoritativeBlockBreaking(false); - startGamePacket.setPlayerMovementSettings(settings); + startGamePacket.setAuthoritativeMovementMode(AuthoritativeMovementMode.CLIENT); + startGamePacket.setRewindHistorySize(0); + startGamePacket.setServerAuthoritativeBlockBreaking(false); upstream.sendPacket(startGamePacket); } @@ -1530,7 +1559,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { */ public void sendDownstreamPacket(Packet packet) { if (!closed && this.downstream != null) { - Channel channel = this.downstream.getChannel(); + Channel channel = this.downstream.getSession().getChannel(); if (channel == null) { // Channel is only null before the connection has initialized geyser.getLogger().warning("Tried to send a packet to the Java server too early!"); @@ -1551,7 +1580,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { private void sendDownstreamPacket0(Packet packet) { if (protocol.getState().equals(ProtocolState.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { - downstream.send(packet); + downstream.sendPacket(packet); } else { geyser.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); } @@ -1614,7 +1643,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { // Set command permission if OP permission level is high enough // This allows mobile players access to a GUI for doing commands. The commands there do not change above OPERATOR // and all commands there are accessible with OP permission level 2 - CommandPermission commandPermission = opPermissionLevel >= 2 ? CommandPermission.OPERATOR : CommandPermission.NORMAL; + CommandPermission commandPermission = opPermissionLevel >= 2 ? CommandPermission.GAME_DIRECTORS : CommandPermission.ANY; // Required to make command blocks destroyable PlayerPermission playerPermission = opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER; @@ -1652,7 +1681,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { abilities.add(Ability.INSTABUILD); } - if (commandPermission == CommandPermission.OPERATOR) { + if (commandPermission == CommandPermission.GAME_DIRECTORS) { // Fixes a bug? since 1.19.11 where the player can change their gamemode in Bedrock settings and // a packet is not sent to the server. // https://github.com/GeyserMC/Geyser/issues/3191 diff --git a/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java b/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java index 3250faf64..b6d2124c1 100644 --- a/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java @@ -25,14 +25,16 @@ package org.geysermc.geyser.session; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.BedrockServerSession; import lombok.Getter; -import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.Setter; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.cloudburstmc.protocol.bedrock.BedrockServerSession; +import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; import java.net.InetSocketAddress; +import java.net.SocketAddress; import java.util.ArrayDeque; import java.util.Queue; @@ -79,11 +81,12 @@ public class UpstreamSession { } public boolean isClosed() { - return session.isClosed(); + return !session.getPeer().isConnected() && !session.getPeer().isConnecting(); } public InetSocketAddress getAddress() { - return session.getRealAddress(); + // Will always be an InetSocketAddress. See ProxyChannel#remoteAddress + return (InetSocketAddress) session.getSocketAddress(); } /** @@ -92,6 +95,15 @@ public class UpstreamSession { * @return the session's protocol version. */ public int getProtocolVersion() { - return this.session.getPacketCodec().getProtocolVersion(); + return this.session.getCodec().getProtocolVersion(); + } + + /** + * Gets the codec helper for this session. + * + * @return the codec helper for this session + */ + public BedrockCodecHelper getCodecHelper() { + return this.session.getPeer().getCodecHelper(); } } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index cd1bc4c98..55de47513 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -25,11 +25,11 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; -import com.nukkitx.protocol.bedrock.packet.BossEventPacket; -import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.packet.AddEntityPacket; +import org.cloudburstmc.protocol.bedrock.packet.BossEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.RemoveEntityPacket; import lombok.AllArgsConstructor; import net.kyori.adventure.text.Component; import org.geysermc.geyser.session.GeyserSession; @@ -119,9 +119,9 @@ public class BossBar { addEntityPacket.setRotation(Vector3f.ZERO); addEntityPacket.setMotion(Vector3f.ZERO); addEntityPacket.getMetadata() - .putFloat(EntityData.SCALE, 0F) - .putFloat(EntityData.BOUNDING_BOX_WIDTH, 0F) - .putFloat(EntityData.BOUNDING_BOX_HEIGHT, 0F); + .putFloat(EntityDataTypes.SCALE, 0F) + .putFloat(EntityDataTypes.BOUNDING_BOX_WIDTH, 0F) + .putFloat(EntityDataTypes.BOUNDING_BOX_HEIGHT, 0F); session.sendUpstreamPacket(addEntityPacket); } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java index 24acebce0..6ba6a1b7e 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.protocol.bedrock.packet.ModalFormRequestPacket; -import com.nukkitx.protocol.bedrock.packet.ModalFormResponsePacket; -import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; +import org.cloudburstmc.protocol.bedrock.packet.ModalFormRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ModalFormResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.NetworkStackLatencyPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.RequiredArgsConstructor; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java index 07ccd6280..d0a5bc094 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java @@ -25,10 +25,10 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; +import org.cloudburstmc.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.AccessLevel; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/SkullCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/SkullCache.java index f26e1cce3..86b71f948 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/SkullCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/SkullCache.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Data; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java index c65f63111..8d243d3fa 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3d; import lombok.Data; import lombok.RequiredArgsConstructor; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java index 09e7e9234..eebb42647 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java @@ -25,11 +25,11 @@ package org.geysermc.geyser.session.cache; -import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.Vector2d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.math.GenericMath; +import org.cloudburstmc.math.vector.Vector2d; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinitions; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java index b3d0518b3..ba78c903b 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; diff --git a/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java b/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java index 6794af498..33865bfb1 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java @@ -29,10 +29,10 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import com.nukkitx.protocol.bedrock.data.skin.ImageData; -import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; -import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; -import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; +import org.cloudburstmc.protocol.bedrock.data.skin.ImageData; +import org.cloudburstmc.protocol.bedrock.data.skin.SerializedSkin; +import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayerSkinPacket; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 730d46908..79ec59ea6 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -29,9 +29,9 @@ import com.fasterxml.jackson.databind.JsonNode; 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.nukkitx.protocol.bedrock.data.skin.ImageData; -import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; -import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; +import org.cloudburstmc.protocol.bedrock.data.skin.ImageData; +import org.cloudburstmc.protocol.bedrock.data.skin.SerializedSkin; +import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.network.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java index 58054e9c5..c6aa57c55 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.skin; -import com.nukkitx.protocol.bedrock.data.skin.ImageData; -import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; -import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; +import org.cloudburstmc.protocol.bedrock.data.skin.ImageData; +import org.cloudburstmc.protocol.bedrock.data.skin.SerializedSkin; +import org.cloudburstmc.protocol.bedrock.packet.PlayerSkinPacket; 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/text/ChatTypeEntry.java b/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java index c45de8f9f..476ec22a1 100644 --- a/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java +++ b/core/src/main/java/org/geysermc/geyser/text/ChatTypeEntry.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.text; import com.github.steveice10.mc.protocol.data.game.BuiltinChatType; -import com.nukkitx.protocol.bedrock.packet.TextPacket; +import org.cloudburstmc.protocol.bedrock.packet.TextPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import javax.annotation.Nonnull; diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java index 1dc6cd4e9..f7e39718b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.collision; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; import org.geysermc.geyser.level.physics.Axis; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java index c1fabcf0f..9eb369ff8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; 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 956fdeae0..94f959212 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 @@ -26,13 +26,13 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeOptionalStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; +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.packet.ItemStackResponsePacket; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; @@ -44,7 +44,7 @@ import java.util.Objects; public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { public AnvilInventoryTranslator() { - super(3, "minecraft:anvil[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ANVIL, AnvilInventoryUpdater.INSTANCE, + super(3, "minecraft:anvil[facing=north]", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.ANVIL, AnvilInventoryUpdater.INSTANCE, "minecraft:chipped_anvil", "minecraft:damaged_anvil"); } 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 9b6e6df56..5bc1759a4 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 @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.*; import org.geysermc.geyser.session.GeyserSession; 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 304b8ef00..d32cb41b1 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.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; +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.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.IntSets; import org.geysermc.geyser.inventory.BeaconContainer; import org.geysermc.geyser.inventory.BedrockContainerSlot; @@ -52,7 +52,7 @@ import java.util.OptionalInt; public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator { public BeaconInventoryTranslator() { - super(1, new BlockInventoryHolder("minecraft:beacon", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.BEACON) { + super(1, new BlockInventoryHolder("minecraft:beacon", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.BEACON) { @Override protected boolean checkInteractionPosition(GeyserSession session) { // Since we can't fall back to a virtual inventory, let's make opening one easier 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 69ad41f97..eb291d30c 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 @@ -25,10 +25,10 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; +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.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; 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 c796ab5e3..2c71d659d 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 @@ -26,15 +26,15 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.*; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; import org.geysermc.geyser.session.GeyserSession; public class CartographyInventoryTranslator extends AbstractBlockInventoryTranslator { public CartographyInventoryTranslator() { - super(3, "minecraft:cartography_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE); + super(3, "minecraft:cartography_table", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE); } @Override 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 61e2258b6..34dc73a9b 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 @@ -25,9 +25,9 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +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.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; 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 97946b59c..baa29ba72 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 @@ -27,15 +27,15 @@ 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.ServerboundContainerButtonClickPacket; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; -import com.nukkitx.protocol.bedrock.packet.PlayerEnchantOptionsPacket; +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.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.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayerEnchantOptionsPacket; import it.unimi.dsi.fastutil.ints.IntSets; import org.geysermc.geyser.inventory.*; import org.geysermc.geyser.inventory.item.Enchantment; @@ -46,7 +46,7 @@ import java.util.Arrays; public class EnchantingInventoryTranslator extends AbstractBlockInventoryTranslator { public EnchantingInventoryTranslator() { - super(2, "minecraft:enchanting_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE); + super(2, "minecraft:enchanting_table", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java index 3ca8f165f..9e7e45b4f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Generic3X3Container; import org.geysermc.geyser.inventory.Inventory; @@ -40,7 +40,7 @@ import org.geysermc.geyser.session.GeyserSession; */ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTranslator { public Generic3X3InventoryTranslator() { - super(9, "minecraft:dispenser[facing=north,triggered=false]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE, + super(9, "minecraft:dispenser[facing=north,triggered=false]", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE, "minecraft:dropper"); } @@ -54,7 +54,7 @@ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTransla ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getBedrockId()); // Required for opening the real block - otherwise, if the container type is incorrect, it refuses to open - containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DROPPER : com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER); + containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.DROPPER : org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.DISPENSER); containerOpenPacket.setBlockPosition(inventory.getHolderPosition()); containerOpenPacket.setUniqueEntityId(inventory.getHolderId()); session.sendUpstreamPacket(containerOpenPacket); 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 33b00d202..0616fcde5 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 @@ -25,9 +25,9 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +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.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java index 729717a5d..cbdb64139 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; 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 8c7ee1c80..0b7a954eb 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,11 +30,11 @@ 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 com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; +import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.*; +import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; import org.checkerframework.checker.nullness.qual.Nullable; 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 7b2f861f5..36a389c22 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 @@ -30,11 +30,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.LecternContainer; 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 d44ff589a..4209c4b62 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 @@ -30,15 +30,15 @@ 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 com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftLoomStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +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.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.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.inventory.BedrockContainerSlot; 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 5e9c99ae9..2084f319c 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 @@ -27,16 +27,16 @@ 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.ServerboundSelectTradePacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.AutoCraftRecipeStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; +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.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.AutoCraftRecipeStackRequestActionData; +import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; +import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.*; @@ -103,9 +103,9 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { Entity villager = new Entity(session, 0, geyserId, null, EntityDefinitions.VILLAGER, pos, Vector3f.ZERO, 0f, 0f, 0f) { @Override protected void initializeMetadata() { - dirtyMetadata.put(EntityData.SCALE, 0f); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0f); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0f); + dirtyMetadata.put(EntityDataTypes.SCALE, 0f); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_WIDTH, 0f); + dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_HEIGHT, 0f); } }; villager.spawnEntity(); 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 ee7d6a7c6..1d9eed630 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 @@ -30,11 +30,11 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.protocol.bedrock.data.inventory.*; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.*; +import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.*; +import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; +import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.IntIterator; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; 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 a055d3b5d..2e131641d 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 @@ -26,12 +26,12 @@ package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; 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 3aaa5ed07..2326e7491 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 @@ -25,9 +25,9 @@ package org.geysermc.geyser.translator.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +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.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; 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 1668e3a93..a4f17ac4c 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 @@ -28,13 +28,13 @@ package org.geysermc.geyser.translator.inventory; 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 com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; -import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; -import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest; +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.packet.ItemStackResponsePacket; import org.geysermc.geyser.inventory.*; import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -42,7 +42,7 @@ import org.geysermc.geyser.session.GeyserSession; public class StonecutterInventoryTranslator extends AbstractBlockInventoryTranslator { public StonecutterInventoryTranslator() { - super(2, "minecraft:stonecutter[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE); + super(2, "minecraft:stonecutter[facing=north]", org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE); } @Override diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java index 548e9e6e3..d20a15ef0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.inventory.chest; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.updater.ChestInventoryUpdater; 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 0dd8553fd..b46f0d562 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 @@ -25,14 +25,14 @@ package org.geysermc.geyser.translator.inventory.chest; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket; +import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.level.block.BlockStateValues; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java index 41e7bfb9f..863927963 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.inventory.chest; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java index 764ab0a33..fdb26f431 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.translator.inventory.furnace; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.SlotType; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java index 67b4a1fab..0b6e0c674 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.inventory.furnace; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.BedrockContainerSlot; public class BlastFurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java index 756b296e8..95a79a93e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.inventory.furnace; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.BedrockContainerSlot; public class FurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java index 1a6b5ac3e..2f87f3b13 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.inventory.furnace; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.BedrockContainerSlot; public class SmokerInventoryTranslator extends AbstractFurnaceInventoryTranslator { 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 4930c6b60..a53acb3f3 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 @@ -25,11 +25,11 @@ package org.geysermc.geyser.translator.inventory.horse; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; +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.packet.InventoryContentPacket; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; 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 9ca153c5f..cdfd88f4f 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 @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.inventory.horse; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType; +import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.BedrockContainerSlot; public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java index a0da82648..a6750e7d7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; 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/inventory/item/CustomItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CustomItemTranslator.java index 82a8c9de1..3839b37b5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CustomItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CustomItemTranslator.java @@ -28,7 +28,10 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; +import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.objects.ObjectIntPair; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.geysermc.geyser.api.item.custom.CustomItemOptions; import org.geysermc.geyser.api.util.TriState; import org.geysermc.geyser.registry.type.ItemMapping; @@ -41,13 +44,14 @@ import java.util.OptionalInt; */ final class CustomItemTranslator { - static int getCustomItem(CompoundTag nbt, ItemMapping mapping) { + @Nullable + static ItemDefinition getCustomItem(CompoundTag nbt, ItemMapping mapping) { if (nbt == null) { - return -1; + return null; } - List> customMappings = mapping.getCustomItemOptions(); + List> customMappings = mapping.getCustomItemOptions(); if (customMappings.isEmpty()) { - return -1; + return null; } int customModelData = nbt.get("CustomModelData") instanceof IntTag customModelDataTag ? customModelDataTag.getValue() : 0; @@ -55,7 +59,7 @@ final class CustomItemTranslator { int damage = !checkDamage ? 0 : nbt.get("Damage") instanceof IntTag damageTag ? damageTag.getValue() : 0; boolean unbreakable = checkDamage && !isDamaged(nbt, damage); - for (ObjectIntPair mappingTypes : customMappings) { + for (Pair mappingTypes : customMappings) { CustomItemOptions options = mappingTypes.key(); // Code note: there may be two or more conditions that a custom item must follow, hence the "continues" @@ -90,9 +94,10 @@ final class CustomItemTranslator { continue; } - return mappingTypes.valueInt(); + return mappingTypes.value(); } - return -1; + + return null; } /* These two functions are based off their Mojmap equivalents from 1.19.2 */ diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/FilledMapTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/FilledMapTranslator.java index b5dbefc3a..c559fb247 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/FilledMapTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/FilledMapTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; 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/inventory/item/GoatHornTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/GoatHornTranslator.java index 2cb9d7ec7..8f0c9f5f2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/GoatHornTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/GoatHornTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.registry.Registries; 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 ab3feae5f..22e9fac59 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 @@ -31,7 +31,9 @@ import com.nukkitx.nbt.NbtList; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.kyori.adventure.text.Component; @@ -263,22 +265,24 @@ public abstract class ItemTranslator { } /** - * Given an item stack, determine the Bedrock item ID that should be applied to Bedrock players. + * Given an item stack, determine the Bedrock item definition that should be applied to Bedrock players. */ - public static int getBedrockItemId(GeyserSession session, @Nonnull GeyserItemStack itemStack) { + @NonNull + public static ItemDefinition getBedrockItemDefinition(GeyserSession session, @Nonnull GeyserItemStack itemStack) { if (itemStack.isEmpty()) { - return ItemMapping.AIR.getJavaId(); + return ItemDefinition.AIR; } + int javaId = itemStack.getJavaId(); ItemMapping mapping = ITEM_STACK_TRANSLATORS.getOrDefault(javaId, DEFAULT_TRANSLATOR) .getItemMapping(javaId, itemStack.getNbt(), session.getItemMappings()); - int customItemId = CustomItemTranslator.getCustomItem(itemStack.getNbt(), mapping); - if (customItemId == -1) { + ItemDefinition definition = CustomItemTranslator.getCustomItem(itemStack.getNbt(), mapping); + if (definition == null) { // No custom item - return mapping.getBedrockId(); + return mapping.getBedrockDefinition(); } else { - return customItemId; + return definition; } } @@ -295,7 +299,7 @@ public abstract class ItemTranslator { return ItemData.builder(); } ItemData.Builder builder = ItemData.builder() - .id(mapping.getBedrockId()) + .definition(mapping.getBedrockDefinition()) .damage(mapping.getBedrockData()) .count(itemStack.getAmount()); if (itemStack.getNbt() != null) { @@ -504,10 +508,9 @@ public abstract class ItemTranslator { * Translates the custom model data of an item */ private static void translateCustomItem(CompoundTag nbt, ItemData.Builder builder, ItemMapping mapping) { - int bedrockId = CustomItemTranslator.getCustomItem(nbt, mapping); - if (bedrockId != -1) { - builder.id(bedrockId); + ItemDefinition definition = CustomItemTranslator.getCustomItem(nbt, mapping); + if (definition != null) { + builder.definition(definition); } } - } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java index 3e814a098..c69105da1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.network.GameProtocol; @@ -51,7 +51,7 @@ public class PotionTranslator extends ItemTranslator { Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); if (potion != null) { return ItemData.builder() - .id(mapping.getBedrockId()) + .id(mapping.getBedrockDefinition()) .damage(potion.getBedrockId()) .count(itemStack.getAmount()) .tag(translateNbtToBedrock(itemStack.getNbt())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java index bbf598ecd..4be8f054f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.item.TippedArrowPotion; import org.geysermc.geyser.network.GameProtocol; @@ -57,7 +57,7 @@ public class TippedArrowTranslator extends ItemTranslator { TippedArrowPotion tippedArrowPotion = TippedArrowPotion.getByJavaIdentifier(((StringTag) potionTag).getValue()); if (tippedArrowPotion != null) { return ItemData.builder() - .id(mapping.getBedrockId()) + .id(mapping.getBedrockDefinition()) .damage(tippedArrowPotion.getBedrockId()) .count(itemStack.getAmount()) .tag(translateNbtToBedrock(itemStack.getNbt())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java index 642a43123..c393c375f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; 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 9ae3300cd..f8b2b737c 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 @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.level.block.entity; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtList; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtType; 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 0836b1e59..641d92282 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 @@ -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.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; 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 ed1a9e82b..afd9c8d42 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 @@ -25,10 +25,10 @@ package org.geysermc.geyser.translator.level.block.entity; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.BlockEntityUtils; 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 28e30d6be..2a1c519c6 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 @@ -26,12 +26,12 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; +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 com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -598,7 +598,7 @@ public class PistonBlockEntity { updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); updateBlockPacket.setBlockPosition(newPos); - updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockMovingBlockId()); + updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockMovingBlock()); updateBlockPacket.setDataLayer(0); session.sendUpstreamPacket(updateBlockPacket); // Update moving block with correct details @@ -780,7 +780,7 @@ public class PistonBlockEntity { */ private NbtMap buildMovingBlockTag(Vector3i position, int javaId, Vector3i pistonPosition) { // Get Bedrock block state data - NbtMap movingBlock = session.getBlockMappings().getBedrockBlockStates().get(session.getBlockMappings().getBedrockBlockId(javaId)); + NbtMap movingBlock = session.getBlockMappings().getBedrockBlockPalette().get(session.getBlockMappings().getBedrockBlockId(javaId)); NbtMapBuilder builder = NbtMap.builder() .putString("id", "MovingBlock") .putCompound("movingBlock", movingBlock) 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 cf4d52859..6e67f46ac 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 @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.level.block.entity; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import org.geysermc.geyser.level.block.BlockStateValues; 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 94e2d4767..3377a3207 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 @@ -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.StringTag; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; 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/event/PlaySoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java index 820606675..22d5c953d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.session.GeyserSession; import java.util.Random; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java index 1cb3670fb..d1695303d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.session.GeyserSession; public record SoundEventEventTranslator(SoundEvent soundEvent, diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java index f59c5686d..67d43e6a8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; import org.geysermc.geyser.session.GeyserSession; public record SoundLevelEventTranslator(LevelEventType levelEventType, diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java index aabc39e12..9e51b72ce 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.data.AdventureSetting; -import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; +import org.cloudburstmc.protocol.bedrock.data.AdventureSetting; +import org.cloudburstmc.protocol.bedrock.packet.AdventureSettingsPacket; 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/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java index 670e55785..97cadb83e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; -import com.nukkitx.protocol.bedrock.packet.AnimatePacket; +import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket; 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/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index 67f0d0d59..4f555b332 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 @@ -27,9 +27,9 @@ 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 com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; 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/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java index 8d7cbe22b..82a382748 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.packet.BlockPickRequestPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.level.block.BlockStateValues; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java index 3a62ca0e4..597f45b0e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java @@ -31,7 +31,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 com.github.steveice10.opennbt.tag.builtin.Tag; -import com.nukkitx.protocol.bedrock.packet.BookEditPacket; +import org.cloudburstmc.protocol.bedrock.packet.BookEditPacket; import org.geysermc.geyser.inventory.GeyserItemStack; 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/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java index caf85a0fd..42e9277d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; -import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; +import org.cloudburstmc.protocol.bedrock.packet.CommandBlockUpdatePacket; 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/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java index 3301f7b9f..51cc8e0e9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.CommandRequestPacket; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java index 9a1979c23..62dd39b12 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; -import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; +import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java index c47a50c5e..b20f7a2dd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.EmoteListPacket; +import org.cloudburstmc.protocol.bedrock.packet.EmoteListPacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; 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/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index a9ef65fb5..d227ab706 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.nukkitx.protocol.bedrock.packet.EntityPickRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.EntityPickRequestPacket; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java index 4e729bc59..921f24c19 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; +import org.cloudburstmc.protocol.bedrock.packet.FilterTextPacket; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.session.GeyserSession; 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 436f26cb9..3a05461aa 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 @@ -32,19 +32,29 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.*; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.inventory.*; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import org.cloudburstmc.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3f; +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.packet.ContainerOpenPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventoryTransactionPacket; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; @@ -63,7 +73,11 @@ import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; -import org.geysermc.geyser.util.*; +import org.geysermc.geyser.util.BlockUtils; +import org.geysermc.geyser.util.CooldownUtils; +import org.geysermc.geyser.util.EntityUtils; +import org.geysermc.geyser.util.InteractionResult; +import org.geysermc.geyser.util.InventoryUtils; import java.util.List; import java.util.concurrent.TimeUnit; @@ -250,7 +264,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator= 2 && session.getGameMode() == GameMode.CREATIVE) { // Otherwise insufficient permissions - if (session.getBlockMappings().getJigsawStateIds().contains(packet.getBlockRuntimeId())) { + if (session.getBlockMappings().getJigsawStates().contains(packet.getBlockRuntimeId())) { ContainerOpenPacket openPacket = new ContainerOpenPacket(); openPacket.setBlockPosition(packet.getBlockPosition()); openPacket.setId((byte) 1); @@ -329,14 +343,14 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator 0) { InventoryActionData actionData = packet.getActions().get(0); LegacySetItemSlotData slotData = legacySlots.get(0); - if (slotData.getContainerId() == 6 && actionData.getToItem().getId() != 0) { + if (slotData.getContainerId() == 6 && actionData.getToItem().getDefinition() != ItemDefinition.AIR) { // The player is trying to swap out an armor piece that already has an item in it if (session.getGeyser().getConfig().isAlwaysQuickChangeArmor()) { // Java doesn't know when a player is in its own inventory and not, so we @@ -415,7 +429,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator 1) { - if (packet.getItemInHand().getId() == session.getItemMappings().getStoredItems().bucket() || - packet.getItemInHand().getId() == session.getItemMappings().getStoredItems().glassBottle()) { + if (packet.getItemInHand().getDefinition() == session.getItemMappings().getStoredItems().bucket() || + packet.getItemInHand().getDefinition() == session.getItemMappings().getStoredItems().glassBottle()) { // Using a stack of buckets or glass bottles will result in an item being added to the first empty slot. // We need to revert the item in case the interaction fails. The order goes from left to right in the // hotbar. Then left to right and top to bottom in the inventory. diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemFrameDropItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemFrameDropItemTranslator.java index 6f7973f28..908599f51 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemFrameDropItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemFrameDropItemTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; -import com.nukkitx.protocol.bedrock.packet.ItemFrameDropItemPacket; +import org.cloudburstmc.protocol.bedrock.packet.ItemFrameDropItemPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java index 1761a3beb..47cdf9b12 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ItemStackRequestPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java index d7e8b3dea..d28aafcb9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; -import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket; +import org.cloudburstmc.protocol.bedrock.packet.LecternUpdatePacket; import org.geysermc.geyser.inventory.LecternContainer; 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/BedrockMapInfoRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java index ce0e32986..3e885b63f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; -import com.nukkitx.protocol.bedrock.packet.MapInfoRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ClientboundMapItemDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.MapInfoRequestPacket; 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/bedrock/BedrockMobEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java index b8decad78..6a3f3603c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId; +import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket; import org.geysermc.geyser.inventory.GeyserItemStack; 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/BedrockMoveEntityAbsoluteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java index e6390bdba..c35c6c00a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java index 876395114..7e5643d45 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket; -import com.nukkitx.protocol.bedrock.data.AttributeData; -import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.packet.NetworkStackLatencyPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java index 45daddca3..278f51747 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.PacketViolationWarningPacket; +import org.cloudburstmc.protocol.bedrock.packet.PacketViolationWarningPacket; 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/bedrock/BedrockPlayerInputTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java index 88cfcdff7..03faca5f2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPlayerInputPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.PlayerInputPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.PlayerInputPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; 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 f3d0ff344..81706167a 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 @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; -import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; +import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.LodestoneCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestAbilityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestAbilityTranslator.java index fe8150d40..2d0f30d34 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestAbilityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestAbilityTranslator.java @@ -27,9 +27,9 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; -import com.nukkitx.protocol.bedrock.data.Ability; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.RequestAbilityPacket; +import org.cloudburstmc.protocol.bedrock.data.Ability; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.RequestAbilityPacket; import org.geysermc.geyser.network.GameProtocol; 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/BedrockRequestChunkRadiusTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestChunkRadiusTranslator.java index 0a27f7b64..79887e3d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestChunkRadiusTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRequestChunkRadiusTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.RequestChunkRadiusPacket; +import org.cloudburstmc.protocol.bedrock.packet.RequestChunkRadiusPacket; 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/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java index 1631ea4c7..c89f7b6e0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; -import com.nukkitx.protocol.bedrock.packet.RespawnPacket; +import org.cloudburstmc.protocol.bedrock.packet.RespawnPacket; 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/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java index 6cc60dd45..fb02d7e3e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; -import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.ServerSettingsRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ServerSettingsResponsePacket; import org.geysermc.cumulus.form.CustomForm; import org.geysermc.cumulus.form.impl.FormDefinitions; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index 121bfd065..defe58a8e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; import org.geysermc.geyser.api.network.AuthType; 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/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java index 6fa271010..0aec2a5d9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; -import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; +import org.cloudburstmc.protocol.bedrock.packet.ShowCreditsPacket; 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/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java index e52fac371..9c16cfe94 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import com.nukkitx.protocol.bedrock.packet.TextPacket; +import org.cloudburstmc.protocol.bedrock.packet.TextPacket; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.translator.protocol.PacketTranslator; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java index b693b7f3c..f8b65bf9b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket; -import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java index 72f064a55..cdb599e97 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java @@ -31,13 +31,13 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.PlayerActionType; -import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.*; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.PlayerActionType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.*; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java index 43d2d314c..7afa4ab09 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.EmotePacket; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.packet.EmotePacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java index fed8f5ce6..5d8adb67d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java @@ -31,10 +31,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import com.nukkitx.protocol.bedrock.packet.InteractPacket; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; +import org.cloudburstmc.protocol.bedrock.packet.InteractPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; import org.geysermc.geyser.session.GeyserSession; @@ -88,7 +88,7 @@ public class BedrockInteractTranslator extends PacketTranslator if (session.getMouseoverEntity() != null) { // No interactive tag should be sent session.setMouseoverEntity(null); - session.getPlayerEntity().getDirtyMetadata().put(EntityData.INTERACTIVE_TAG, ""); + session.getPlayerEntity().getDirtyMetadata().put(EntityDataTypes.INTERACTIVE_TAG, ""); session.getPlayerEntity().updateBedrockMetadata(); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java index 6078b7ebd..288c1a95a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerRotPacket; import com.github.steveice10.packetlib.packet.Packet; -import com.nukkitx.math.vector.Vector3d; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; +import org.cloudburstmc.math.vector.Vector3d; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.level.BedrockDimension; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java index 698eade86..0d0ec4703 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; -import com.nukkitx.protocol.bedrock.packet.RiderJumpPacket; +import org.cloudburstmc.protocol.bedrock.packet.RiderJumpPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index 2096275cf..70768af34 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity.player; -import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; +import org.cloudburstmc.protocol.bedrock.packet.SetPlayerGameTypePacket; 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/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java index df8cd07c1..3189b3a96 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.translator.protocol.bedrock.world; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; 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/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java index 6504959dc..970c49e23 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; -import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetDifficultyPacket; 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/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index 3fa43c788..409ebfbf0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -30,11 +30,11 @@ import com.github.steveice10.mc.protocol.data.game.command.CommandParser; import com.github.steveice10.mc.protocol.data.game.command.properties.ResourceProperties; import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandsPacket; -import com.nukkitx.protocol.bedrock.data.command.CommandData; -import com.nukkitx.protocol.bedrock.data.command.CommandEnumData; -import com.nukkitx.protocol.bedrock.data.command.CommandParam; -import com.nukkitx.protocol.bedrock.data.command.CommandParamData; -import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket; +import org.cloudburstmc.protocol.bedrock.data.command.CommandData; +import org.cloudburstmc.protocol.bedrock.data.command.CommandEnumData; +import org.cloudburstmc.protocol.bedrock.data.command.CommandParam; +import org.cloudburstmc.protocol.bedrock.data.command.CommandParamData; +import org.cloudburstmc.protocol.bedrock.packet.AvailableCommandsPacket; import it.unimi.dsi.fastutil.Hash; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java index aaedfa443..d50a74394 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; -import com.nukkitx.protocol.bedrock.packet.TransferPacket; -import com.nukkitx.protocol.bedrock.packet.UnknownPacket; +import org.cloudburstmc.protocol.bedrock.packet.TransferPacket; +import org.cloudburstmc.protocol.bedrock.packet.UnknownPacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.geysermc.cumulus.Forms; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java index 5a1715893..2ab82ad5c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; -import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; +import org.cloudburstmc.protocol.bedrock.packet.NetworkStackLatencyPacket; 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/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java index d48d78439..bdada28f0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java @@ -29,11 +29,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLo import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import com.nukkitx.protocol.bedrock.data.GameRuleData; -import com.nukkitx.protocol.bedrock.data.PlayerPermission; -import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; -import com.nukkitx.protocol.bedrock.packet.GameRulesChangedPacket; -import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; +import org.cloudburstmc.protocol.bedrock.data.GameRuleData; +import org.cloudburstmc.protocol.bedrock.data.PlayerPermission; +import org.cloudburstmc.protocol.bedrock.packet.AdventureSettingsPacket; +import org.cloudburstmc.protocol.bedrock.packet.GameRulesChangedPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetPlayerGameTypePacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import org.geysermc.floodgate.pluginmessage.PluginMessageChannels; import org.geysermc.geyser.api.network.AuthType; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPlayerChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPlayerChatTranslator.java index 143fa16a9..7088add8d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPlayerChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPlayerChatTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerChatPacket; -import com.nukkitx.protocol.bedrock.packet.TextPacket; +import org.cloudburstmc.protocol.bedrock.packet.TextPacket; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java index ed429b87d..5e3b87566 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java @@ -26,10 +26,10 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetPlayerGameTypePacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSystemChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSystemChatTranslator.java index d71055a87..a8093ba65 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSystemChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSystemChatTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket; -import com.nukkitx.protocol.bedrock.packet.TextPacket; +import org.cloudburstmc.protocol.bedrock.packet.TextPacket; 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/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java index 94bac62bf..e98e5c1ec 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; -import com.nukkitx.protocol.bedrock.packet.ToastRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ToastRequestPacket; import org.geysermc.geyser.level.GeyserAdvancement; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.AdvancementsCache; 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 90468a9cb..7b05caf60 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 @@ -34,11 +34,11 @@ import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeDa import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingRecipeData; import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket; -import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.data.inventory.descriptor.DefaultDescriptor; -import com.nukkitx.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; -import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +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; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; @@ -226,7 +226,7 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator { - entity.getDirtyMetadata().put(EntityData.RIDER_MAX_ROTATION, 181.0f); + entity.getDirtyMetadata().put(EntityDataTypes.RIDER_MAX_ROTATION, 181.0f); entity.updateBedrockMetadata(); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java index a449ba50a..068f2e3e8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTakeItemEntityPacket; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.TakeItemEntityPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java index 9f835f480..9925bf432 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; 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/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java index 5c7f9c641..a86290100 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; -import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; +import org.cloudburstmc.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.geyser.entity.type.Entity; 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/JavaPlayerCombatKillTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerCombatKillTranslator.java index 89be26e4a..fd6ccd28c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerCombatKillTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerCombatKillTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerCombatKillPacket; -import com.nukkitx.protocol.bedrock.packet.DeathInfoPacket; +import org.cloudburstmc.protocol.bedrock.packet.DeathInfoPacket; import net.kyori.adventure.text.Component; import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java index 1cefb9731..de91810c0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.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.ClientboundPlayerInfoPacket; -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/entity/player/JavaPlayerLookAtTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerLookAtTranslator.java index 81a86311a..7814a6719 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerLookAtTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerLookAtTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerLookAtPacket; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; 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/entity/player/JavaPlayerPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java index 2d2d7279f..e9db53d74 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; -import com.nukkitx.protocol.bedrock.packet.ChunkRadiusUpdatedPacket; -import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData; +import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket; +import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; +import org.cloudburstmc.protocol.bedrock.packet.RespawnPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java index 31f4972ba..97a9e0aae 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; -import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayerHotbarPacket; 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/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java index 796062c98..80dd08eaa 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetExperiencePacket; -import com.nukkitx.protocol.bedrock.data.AttributeData; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java index 67047d00e..decf910ca 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; -import com.nukkitx.protocol.bedrock.data.AttributeData; -import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.cloudburstmc.protocol.bedrock.data.AttributeData; +import org.cloudburstmc.protocol.bedrock.packet.RespawnPacket; +import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java index 49cca79d2..c3efa0bc9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockDat import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.*; import org.geysermc.geyser.entity.type.player.PlayerEntity; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java index 419f99cae..2d5e8fb08 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java index c4b5aae2d..20a5f8213 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; -import com.nukkitx.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; 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 869f0cede..2cf413823 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 @@ -28,12 +28,12 @@ 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.recipe.Ingredient; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; -import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +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.descriptor.ItemDescriptorWithCount; +import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; 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 46b138076..fd7c46733 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 @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.Cli import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.UpdateEquipPacket; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.packet.UpdateEquipPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.ChestedHorseEntity; import org.geysermc.geyser.entity.type.living.animal.horse.LlamaEntity; 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 2ebe48a83..2b38d40d5 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 @@ -31,10 +31,10 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.Cli import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.UpdateTradePacket; +import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; +import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.UpdateTradePacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; @@ -73,9 +73,9 @@ public class JavaMerchantOffersTranslator extends PacketTranslator> 4) - 1; int sectionCount; - byte[] payload; ByteBuf byteBuf = null; GeyserChunkSection[] sections = new GeyserChunkSection[javaChunks.length - (yOffset + (bedrockDimension.minY() >> 4))]; try { ByteBuf in = Unpooled.wrappedBuffer(packet.getChunkData()); for (int sectionY = 0; sectionY < chunkSize; sectionY++) { - ChunkSection javaSection = session.getCodecHelper().readChunkSection(in, biomeGlobalPalette); + ChunkSection javaSection = session.getDownstream().getCodecHelper().readChunkSection(in, biomeGlobalPalette); javaChunks[sectionY] = javaSection.getChunkData(); javaBiomes[sectionY] = javaSection.getBiomeData(); @@ -129,7 +128,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator entry : session.getItemFrameCache().entrySet()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java index 797699e2b..907a85e29 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.level.event.*; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.packet.*; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.packet.*; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.session.GeyserSession; 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 94466a1ab..96562e8a0 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 @@ -30,14 +30,14 @@ import com.github.steveice10.mc.protocol.data.game.level.particle.*; 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.math.vector.Vector3f; +import org.cloudburstmc.math.vector.Vector3f; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.LevelEventGenericPacket; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventGenericPacket; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.SpawnParticleEffectPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ParticleMapping; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java index 4685cf115..cf2956f87 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.map.MapData; import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.MapDecoration; -import com.nukkitx.protocol.bedrock.data.MapTrackedObject; +import org.cloudburstmc.math.vector.Vector3i; +import org.cloudburstmc.protocol.bedrock.data.MapDecoration; +import org.cloudburstmc.protocol.bedrock.data.MapTrackedObject; import org.geysermc.geyser.level.BedrockMapIcon; import org.geysermc.geyser.level.MapColor; import org.geysermc.geyser.session.GeyserSession; @@ -43,7 +43,7 @@ public class JavaMapItemDataTranslator extends PacketTranslator ItemData.builder() - .id(Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockId()) + .id(Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockDefinition()) .count(1) .tag(root.build()).build(); } 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 8d832f8fa..b2f8e2a56 100644 --- a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -34,9 +34,9 @@ import com.nimbusds.jose.JWSObject; import com.nimbusds.jose.shaded.json.JSONObject; import com.nimbusds.jose.shaded.json.JSONValue; import com.nukkitx.network.util.Preconditions; -import com.nukkitx.protocol.bedrock.packet.LoginPacket; -import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; -import com.nukkitx.protocol.bedrock.util.EncryptionUtils; +import org.cloudburstmc.protocol.bedrock.packet.LoginPacket; +import org.cloudburstmc.protocol.bedrock.packet.ServerToClientHandshakePacket; +import org.cloudburstmc.protocol.bedrock.util.EncryptionUtils; import org.geysermc.cumulus.form.CustomForm; import org.geysermc.cumulus.form.ModalForm; import org.geysermc.cumulus.form.SimpleForm; diff --git a/core/src/main/java/org/geysermc/geyser/util/MathUtils.java b/core/src/main/java/org/geysermc/geyser/util/MathUtils.java index f1e262bc6..df9ee533b 100644 --- a/core/src/main/java/org/geysermc/geyser/util/MathUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/MathUtils.java @@ -103,7 +103,7 @@ public class MathUtils { /** * Clamps the value between the low and high boundaries - * Copied from {@link com.nukkitx.math.GenericMath} with floats instead. + * Copied from {@link org.cloudburstmc.math.GenericMath} with floats instead. * * @param value The value to clamp * @param low The low bound of the clamp diff --git a/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java b/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java index 15348939c..e483e3a4c 100644 --- a/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; import com.github.steveice10.mc.protocol.data.game.level.sound.Sound; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.SoundEvent; -import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.protocol.bedrock.data.LevelEventType; +import org.cloudburstmc.protocol.bedrock.data.SoundEvent; +import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; 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 913ea44d5..c30f416fe 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 @@ -25,7 +25,7 @@ package org.geysermc.geyser.util.collection; -import com.nukkitx.math.vector.Vector3i; +import org.cloudburstmc.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.session.GeyserSession; diff --git a/core/src/test/java/org/geysermc/geyser/translator/inventory/item/CustomItemsTest.java b/core/src/test/java/org/geysermc/geyser/translator/inventory/item/CustomItemsTest.java index 145f46369..7af330ef7 100644 --- a/core/src/test/java/org/geysermc/geyser/translator/inventory/item/CustomItemsTest.java +++ b/core/src/test/java/org/geysermc/geyser/translator/inventory/item/CustomItemsTest.java @@ -28,10 +28,8 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectIntPair; +import it.unimi.dsi.fastutil.Pair; +import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition; import org.geysermc.geyser.api.item.custom.CustomItemOptions; import org.geysermc.geyser.api.util.TriState; import org.geysermc.geyser.item.GeyserCustomItemOptions; @@ -40,14 +38,16 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.OptionalInt; public class CustomItemsTest { private ItemMapping testMappingWithDamage; - private Object2IntMap tagToCustomItemWithDamage; + private Map tagToCustomItemWithDamage; private ItemMapping testMappingWithNoDamage; - private Object2IntMap tagToCustomItemWithNoDamage; + private Map tagToCustomItemWithNoDamage; @Before public void setup() { @@ -59,57 +59,57 @@ public class CustomItemsTest { CustomItemOptions f = new GeyserCustomItemOptions(TriState.FALSE, OptionalInt.of(8), OptionalInt.of(6)); CustomItemOptions g = new GeyserCustomItemOptions(TriState.NOT_SET, OptionalInt.of(20), OptionalInt.empty()); - Object2IntMap optionsToId = new Object2IntArrayMap<>(); + Map optionsToId = new HashMap<>(); // Order here is important, hence why we're using an array map - optionsToId.put(g, 7); - optionsToId.put(f, 6); - optionsToId.put(e, 5); - optionsToId.put(d, 4); - optionsToId.put(c, 3); - optionsToId.put(b, 2); - optionsToId.put(a, 1); + optionsToId.put(g, new ItemDefinition("geyser:test_item_7", 7, true)); + optionsToId.put(f, new ItemDefinition("geyser:test_item_6", 6, true)); + optionsToId.put(e, new ItemDefinition("geyser:test_item_5", 5, true)); + optionsToId.put(d, new ItemDefinition("geyser:test_item_4", 4, true)); + optionsToId.put(c, new ItemDefinition("geyser:test_item_3", 3, true)); + optionsToId.put(b, new ItemDefinition("geyser:test_item_2", 2, true)); + optionsToId.put(a, new ItemDefinition("geyser:test_item_1", 1, true)); - tagToCustomItemWithDamage = new Object2IntOpenHashMap<>(); + tagToCustomItemWithDamage = new HashMap<>(); CompoundTag tag = new CompoundTag(""); addCustomModelData(6, tag); // Test item with no damage should be treated as unbreakable - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(a)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(a)); tag = new CompoundTag(""); addCustomModelData(20, tag); // Test that an unbreakable item isn't tested for Damaged if there is no damaged predicate - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(g)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(g)); tag = new CompoundTag(""); addCustomModelData(3, tag); setUnbreakable(true, tag); - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(a)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(a)); tag = new CompoundTag(""); addDamage(16, tag); setUnbreakable(false, tag); - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(e)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(e)); tag = new CompoundTag(""); addCustomModelData(7, tag); addDamage(6, tag); setUnbreakable(false, tag); - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(c)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(c)); tag = new CompoundTag(""); addCustomModelData(9, tag); addDamage(6, tag); setUnbreakable(true, tag); - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(a)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(a)); tag = new CompoundTag(""); addCustomModelData(9, tag); addDamage(6, tag); setUnbreakable(false, tag); - tagToCustomItemWithDamage.put(tag, optionsToId.getInt(f)); + tagToCustomItemWithDamage.put(tag, optionsToId.get(f)); - List> customItemOptions = optionsToId.object2IntEntrySet().stream().map(entry -> ObjectIntPair.of(entry.getKey(), entry.getIntValue())).toList(); + List> customItemOptions = optionsToId.entrySet().stream().map(entry -> Pair.of(entry.getKey(), entry.getValue())).toList(); testMappingWithDamage = ItemMapping.builder() .customItemOptions(customItemOptions) @@ -118,12 +118,12 @@ public class CustomItemsTest { // Test differences with items with no max damage - tagToCustomItemWithNoDamage = new Object2IntOpenHashMap<>(); + tagToCustomItemWithNoDamage = new HashMap<>(); tag = new CompoundTag(""); addCustomModelData(2, tag); // Damage predicates existing mean an item will never match if the item mapping has no max damage - tagToCustomItemWithNoDamage.put(tag, -1); + tagToCustomItemWithNoDamage.put(tag, null); testMappingWithNoDamage = ItemMapping.builder() .customItemOptions(customItemOptions) @@ -145,14 +145,14 @@ public class CustomItemsTest { @Test public void testCustomItems() { - for (Object2IntMap.Entry entry : this.tagToCustomItemWithDamage.object2IntEntrySet()) { - int id = CustomItemTranslator.getCustomItem(entry.getKey(), this.testMappingWithDamage); - Assert.assertEquals(entry.getKey() + " did not produce the correct custom item", entry.getIntValue(), id); + for (Map.Entry entry : this.tagToCustomItemWithDamage.entrySet()) { + ItemDefinition id = CustomItemTranslator.getCustomItem(entry.getKey(), this.testMappingWithDamage); + Assert.assertEquals(entry.getKey() + " did not produce the correct custom item", entry.getValue(), id); } - for (Object2IntMap.Entry entry : this.tagToCustomItemWithNoDamage.object2IntEntrySet()) { - int id = CustomItemTranslator.getCustomItem(entry.getKey(), this.testMappingWithNoDamage); - Assert.assertEquals(entry.getKey() + " did not produce the correct custom item", entry.getIntValue(), id); + for (Map.Entry entry : this.tagToCustomItemWithNoDamage.entrySet()) { + ItemDefinition id = CustomItemTranslator.getCustomItem(entry.getKey(), this.testMappingWithNoDamage); + Assert.assertEquals(entry.getKey() + " did not produce the correct custom item", entry.getValue(), id); } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3724836d9..2ddac533a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,10 +5,10 @@ netty = "4.1.80.Final" guava = "29.0-jre" gson = "2.3.1" # Provided by Spigot 1.8.8 websocket = "1.5.1" -protocol = "2.9.14-20221025.193624-1" +protocol = "3.0.0.Beta2-SNAPSHOT" raknet = "1.6.28-20220125.214016-6" mcauthlib = "d9d773e" -mcprotocollib = "9f78bd5" +mcprotocollib = "1.19.2-SNAPSHOT" packetlib = "3.0" adventure = "4.12.0-20220629.025215-9" adventure-platform = "4.1.2" @@ -80,9 +80,8 @@ guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } junit = { group = "junit", name = "junit", version.ref = "junit" } mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" } -mcprotocollib = { group = "com.github.GeyserMC", name = "MCProtocolLib", version.ref = "mcprotocollib" } +mcprotocollib = { group = "com.github.steveice10", name = "mcprotocollib", version.ref = "mcprotocollib" } packetlib = { group = "com.github.steveice10", name = "packetlib", version.ref = "packetlib" } -protocol = { group = "com.nukkitx.protocol", name = "bedrock-v557", version.ref = "protocol" } raknet = { group = "com.nukkitx.network", name = "raknet", version.ref = "raknet" } sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" } terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" } @@ -90,9 +89,13 @@ velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.r viaversion = { group = "com.viaversion", name = "viaversion", version.ref = "viaversion" } websocket = { group = "org.java-websocket", name = "Java-WebSocket", version.ref = "websocket" } +protocol-codec = { group = "org.cloudburstmc.protocol", name = "bedrock-codec", version.ref = "protocol" } +protocol-connection = { group = "org.cloudburstmc.protocol", name = "bedrock-connection", version.ref = "protocol" } + [bundles] jackson = [ "jackson-annotations", "jackson-core", "jackson-dataformat-yaml" ] fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ] adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ] log4j = [ "log4j-api", "log4j-core", "log4j-slf4j18-impl" ] -jline = [ "jline-terminal", "jline-terminal-jna", "jline-reader" ] \ No newline at end of file +jline = [ "jline-terminal", "jline-terminal-jna", "jline-reader" ] +protocol = [ "protocol-codec", "protocol-connection" ] \ No newline at end of file