diff --git a/pom.xml b/pom.xml index 51b72c1e..3efb2af8 100644 --- a/pom.xml +++ b/pom.xml @@ -62,13 +62,13 @@ com.github.steveice10 packetlib - master-SNAPSHOT + 43b394dfdc compile com.github.steveice10 mcauthlib - 1.1 + 401c99c722 compile diff --git a/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java b/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java index c31c9c18..4aa1e0de 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java +++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java @@ -104,9 +104,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.Serv import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnWeatherEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnLivingEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnEntityPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; @@ -373,10 +373,10 @@ public class MinecraftProtocol extends PacketProtocol { } private void initClientGame(Session session) { - this.registerIncoming(0x00, ServerSpawnObjectPacket.class); + this.registerIncoming(0x00, ServerSpawnEntityPacket.class); this.registerIncoming(0x01, ServerSpawnExpOrbPacket.class); - this.registerIncoming(0x02, ServerSpawnGlobalEntityPacket.class); - this.registerIncoming(0x03, ServerSpawnMobPacket.class); + this.registerIncoming(0x02, ServerSpawnWeatherEntityPacket.class); + this.registerIncoming(0x03, ServerSpawnLivingEntityPacket.class); this.registerIncoming(0x04, ServerSpawnPaintingPacket.class); this.registerIncoming(0x05, ServerSpawnPlayerPacket.class); this.registerIncoming(0x06, ServerEntityAnimationPacket.class); @@ -565,10 +565,10 @@ public class MinecraftProtocol extends PacketProtocol { this.registerIncoming(0x2D, ClientPlayerPlaceBlockPacket.class); this.registerIncoming(0x2E, ClientPlayerUseItemPacket.class); - this.registerOutgoing(0x00, ServerSpawnObjectPacket.class); + this.registerOutgoing(0x00, ServerSpawnEntityPacket.class); this.registerOutgoing(0x01, ServerSpawnExpOrbPacket.class); - this.registerOutgoing(0x02, ServerSpawnGlobalEntityPacket.class); - this.registerOutgoing(0x03, ServerSpawnMobPacket.class); + this.registerOutgoing(0x02, ServerSpawnWeatherEntityPacket.class); + this.registerOutgoing(0x03, ServerSpawnLivingEntityPacket.class); this.registerOutgoing(0x04, ServerSpawnPaintingPacket.class); this.registerOutgoing(0x05, ServerSpawnPlayerPacket.class); this.registerOutgoing(0x06, ServerEntityAnimationPacket.class); diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java b/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java index c28f36f7..3f206d3a 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/MagicValues.java @@ -32,12 +32,11 @@ 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.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement; -import com.github.steveice10.mc.protocol.data.game.entity.type.GlobalEntityType; -import com.github.steveice10.mc.protocol.data.game.entity.type.MobType; +import com.github.steveice10.mc.protocol.data.game.entity.type.WeatherEntityType; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.PaintingType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.HangingDirection; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.MinecartType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType; +import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; +import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.mc.protocol.data.game.scoreboard.CollisionRule; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; @@ -371,150 +370,114 @@ public class MagicValues { register(PositionElement.PITCH, 3); register(PositionElement.YAW, 4); - register(GlobalEntityType.LIGHTNING_BOLT, 1); + register(WeatherEntityType.LIGHTNING_BOLT, 1); - register(MobType.AREA_EFFECT_CLOUD, 0); - register(MobType.ARMOR_STAND, 1); - register(MobType.ARROW, 2); - register(MobType.BAT, 3); - register(MobType.BEE, 4); - register(MobType.BLAZE, 5); - register(MobType.BOAT, 6); - register(MobType.CAT, 7); - register(MobType.CAVE_SPIDER, 8); - register(MobType.CHICKEN, 9); - register(MobType.COD, 10); - register(MobType.COW, 11); - register(MobType.CREEPER, 12); - register(MobType.DONKEY, 13); - register(MobType.DOLPHIN, 14); - register(MobType.DRAGON_FIREBALL, 15); - register(MobType.DROWNED, 16); - register(MobType.ELDER_GUARDIAN, 17); - register(MobType.END_CRYSTAL, 18); - register(MobType.ENDER_DRAGON, 19); - register(MobType.ENDERMAN, 20); - register(MobType.ENDERMITE, 21); - register(MobType.EVOKER_FANGS, 22); - register(MobType.EVOKER, 23); - register(MobType.EXPERIENCE_ORB, 24); - register(MobType.EYE_OF_ENDER, 25); - register(MobType.FALLING_BLOCK, 26); - register(MobType.FIREWORK_ROCKET, 27); - register(MobType.FOX, 28); - register(MobType.GHAST, 29); - register(MobType.GIANT, 30); - register(MobType.GUARDIAN, 31); - register(MobType.HORSE, 32); - register(MobType.HUSK, 33); - register(MobType.ILLUSIONER, 34); - register(MobType.ITEM, 35); - register(MobType.ITEM_FRAME, 36); - register(MobType.FIREBALL, 37); - register(MobType.LEASH_KNOT, 38); - register(MobType.LLAMA, 39); - register(MobType.LLAMA_SPIT, 40); - register(MobType.MAGMA_CUBE, 41); - register(MobType.MINECART, 42); - register(MobType.MINECART_CHEST, 43); - register(MobType.MINECART_COMMAND_BLOCK, 44); - register(MobType.MINECART_FURNACE, 45); - register(MobType.MINECART_HOPPER, 46); - register(MobType.MINECART_SPAWNER, 47); - register(MobType.MINECART_TNT, 48); - register(MobType.MULE, 49); - register(MobType.MOOSHROOM, 50); - register(MobType.OCELOT, 51); - register(MobType.PAINTING, 52); - register(MobType.PANDA, 53); - register(MobType.PARROT, 54); - register(MobType.PIG, 55); - register(MobType.PUFFERFISH, 56); - register(MobType.POLAR_BEAR, 57); - register(MobType.PRIMED_TNT, 58); - register(MobType.RABBIT, 59); - register(MobType.SALMON, 60); - register(MobType.SHEEP, 61); - register(MobType.SHULKER, 62); - register(MobType.SHULKER_BULLET, 63); - register(MobType.SILVERFISH, 64); - register(MobType.SKELETON, 65); - register(MobType.SKELETON_HORSE, 66); - register(MobType.SLIME, 67); - register(MobType.SMALL_FIREBALL, 68); - register(MobType.SNOW_GOLEM, 69); - register(MobType.SNOWBALL, 70); - register(MobType.SPECTRAL_ARROW, 71); - register(MobType.SPIDER, 72); - register(MobType.SQUID, 73); - register(MobType.STRAY, 74); - register(MobType.TRADER_LLAMA, 75); - register(MobType.TROPICAL_FISH, 76); - register(MobType.TURTLE, 77); - register(MobType.THROWN_EGG, 78); - register(MobType.THROWN_ENDERPEARL, 79); - register(MobType.THROWN_EXP_BOTTLE, 80); - register(MobType.THROWN_POTION, 81); - register(MobType.TRIDENT, 82); - register(MobType.VEX, 83); - register(MobType.VILLAGER, 84); - register(MobType.IRON_GOLEM, 85); - register(MobType.VINDICATOR, 86); - register(MobType.PILLAGER, 87); - register(MobType.WANDERING_TRADER, 88); - register(MobType.WITCH, 89); - register(MobType.WITHER, 90); - register(MobType.WITHER_SKELETON, 91); - register(MobType.WITHER_SKULL, 92); - register(MobType.WOLF, 93); - register(MobType.ZOMBIE, 94); - register(MobType.ZOMBIFIED_PIGLIN, 95); - register(MobType.ZOMBIE_HORSE, 96); - register(MobType.ZOMBIE_VILLAGER, 97); - register(MobType.PHANTOM, 98); - register(MobType.RAVAGER, 99); - register(MobType.HOGLIN, 100); - register(MobType.PIGLIN, 101); - register(MobType.STRIDER, 102); - register(MobType.ZOGLIN, 103); - register(MobType.PLAYER, 105); - register(MobType.FISHING_BOBBER, 106); - - register(ObjectType.AREA_EFFECT_CLOUD, 0); - register(ObjectType.ARMOR_STAND, 1); - register(ObjectType.ARROW, 2); - register(ObjectType.BOAT, 6); - register(ObjectType.DRAGON_FIREBALL, 15); - register(ObjectType.END_CRYSTAL, 18); - register(ObjectType.EVOKER_FANGS, 22); - register(ObjectType.EXPERIENCE_ORB, 24); - register(ObjectType.EYE_OF_ENDER, 25); - register(ObjectType.FALLING_BLOCK, 26); - register(ObjectType.FIREWORK_ROCKET, 27); - register(ObjectType.ITEM, 35); - register(ObjectType.ITEM_FRAME, 36); - register(ObjectType.FIREBALL, 37); - register(ObjectType.LEASH_KNOT, 38); - register(ObjectType.LLAMA_SPIT, 40); - register(ObjectType.MINECART, 42); - register(ObjectType.CHEST_MINECART, 43); - register(ObjectType.COMMAND_BLOCK_MINECART, 44); - register(ObjectType.FURNACE_MINECART, 45); - register(ObjectType.HOPPER_MINECART, 46); - register(ObjectType.SPAWNER_MINECART, 47); - register(ObjectType.TNT_MINECART, 48); - register(ObjectType.TNT, 58); - register(ObjectType.SHULKER_BULLET, 63); - register(ObjectType.SMALL_FIREBALL, 68); - register(ObjectType.SNOWBALL, 70); - register(ObjectType.SPECTRAL_ARROW, 71); - register(ObjectType.EGG, 78); - register(ObjectType.ENDER_PEARL, 79); - register(ObjectType.EXPERIENCE_BOTTLE, 80); - register(ObjectType.POTION, 81); - register(ObjectType.TRIDENT, 82); - register(ObjectType.WITHER_SKULL, 92); - register(ObjectType.FISHING_BOBBER, 106); + register(EntityType.AREA_EFFECT_CLOUD, 0); + register(EntityType.ARMOR_STAND, 1); + register(EntityType.ARROW, 2); + register(EntityType.BAT, 3); + register(EntityType.BEE, 4); + register(EntityType.BLAZE, 5); + register(EntityType.BOAT, 6); + register(EntityType.CAT, 7); + register(EntityType.CAVE_SPIDER, 8); + register(EntityType.CHICKEN, 9); + register(EntityType.COD, 10); + register(EntityType.COW, 11); + register(EntityType.CREEPER, 12); + register(EntityType.DONKEY, 13); + register(EntityType.DOLPHIN, 14); + register(EntityType.DRAGON_FIREBALL, 15); + register(EntityType.DROWNED, 16); + register(EntityType.ELDER_GUARDIAN, 17); + register(EntityType.END_CRYSTAL, 18); + register(EntityType.ENDER_DRAGON, 19); + register(EntityType.ENDERMAN, 20); + register(EntityType.ENDERMITE, 21); + register(EntityType.EVOKER_FANGS, 22); + register(EntityType.EVOKER, 23); + register(EntityType.EXPERIENCE_ORB, 24); + register(EntityType.EYE_OF_ENDER, 25); + register(EntityType.FALLING_BLOCK, 26); + register(EntityType.FIREWORK_ROCKET, 27); + register(EntityType.FOX, 28); + register(EntityType.GHAST, 29); + register(EntityType.GIANT, 30); + register(EntityType.GUARDIAN, 31); + register(EntityType.HORSE, 32); + register(EntityType.HUSK, 33); + register(EntityType.ILLUSIONER, 34); + register(EntityType.ITEM, 35); + register(EntityType.ITEM_FRAME, 36); + register(EntityType.FIREBALL, 37); + register(EntityType.LEASH_KNOT, 38); + register(EntityType.LLAMA, 39); + register(EntityType.LLAMA_SPIT, 40); + register(EntityType.MAGMA_CUBE, 41); + register(EntityType.MINECART, 42); + register(EntityType.MINECART_CHEST, 43); + register(EntityType.MINECART_COMMAND_BLOCK, 44); + register(EntityType.MINECART_FURNACE, 45); + register(EntityType.MINECART_HOPPER, 46); + register(EntityType.MINECART_SPAWNER, 47); + register(EntityType.MINECART_TNT, 48); + register(EntityType.MULE, 49); + register(EntityType.MOOSHROOM, 50); + register(EntityType.OCELOT, 51); + register(EntityType.PAINTING, 52); + register(EntityType.PANDA, 53); + register(EntityType.PARROT, 54); + register(EntityType.PIG, 55); + register(EntityType.PUFFERFISH, 56); + register(EntityType.POLAR_BEAR, 57); + register(EntityType.PRIMED_TNT, 58); + register(EntityType.RABBIT, 59); + register(EntityType.SALMON, 60); + register(EntityType.SHEEP, 61); + register(EntityType.SHULKER, 62); + register(EntityType.SHULKER_BULLET, 63); + register(EntityType.SILVERFISH, 64); + register(EntityType.SKELETON, 65); + register(EntityType.SKELETON_HORSE, 66); + register(EntityType.SLIME, 67); + register(EntityType.SMALL_FIREBALL, 68); + register(EntityType.SNOW_GOLEM, 69); + register(EntityType.SNOWBALL, 70); + register(EntityType.SPECTRAL_ARROW, 71); + register(EntityType.SPIDER, 72); + register(EntityType.SQUID, 73); + register(EntityType.STRAY, 74); + register(EntityType.TRADER_LLAMA, 75); + register(EntityType.TROPICAL_FISH, 76); + register(EntityType.TURTLE, 77); + register(EntityType.THROWN_EGG, 78); + register(EntityType.THROWN_ENDERPEARL, 79); + register(EntityType.THROWN_EXP_BOTTLE, 80); + register(EntityType.THROWN_POTION, 81); + register(EntityType.TRIDENT, 82); + register(EntityType.VEX, 83); + register(EntityType.VILLAGER, 84); + register(EntityType.IRON_GOLEM, 85); + register(EntityType.VINDICATOR, 86); + register(EntityType.PILLAGER, 87); + register(EntityType.WANDERING_TRADER, 88); + register(EntityType.WITCH, 89); + register(EntityType.WITHER, 90); + register(EntityType.WITHER_SKELETON, 91); + register(EntityType.WITHER_SKULL, 92); + register(EntityType.WOLF, 93); + register(EntityType.ZOMBIE, 94); + register(EntityType.ZOMBIFIED_PIGLIN, 95); + register(EntityType.ZOMBIE_HORSE, 96); + register(EntityType.ZOMBIE_VILLAGER, 97); + register(EntityType.PHANTOM, 98); + register(EntityType.RAVAGER, 99); + register(EntityType.HOGLIN, 100); + register(EntityType.PIGLIN, 101); + register(EntityType.STRIDER, 102); + register(EntityType.ZOGLIN, 103); + register(EntityType.PLAYER, 105); + register(EntityType.FISHING_BOBBER, 106); register(MinecartType.NORMAL, 0); register(MinecartType.CHEST, 1); @@ -1177,7 +1140,6 @@ public class MagicValues { register(SuggestionType.ASK_SERVER, "minecraft:ask_server"); register(SuggestionType.ALL_RECIPES, "minecraft:all_recipes"); - register(SuggestionType.AVAILABLE_BIOMES, "minecraft:available_biomes"); register(SuggestionType.AVAILABLE_SOUNDS, "minecraft:available_sounds"); register(SuggestionType.SUMMONABLE_ENTITIES, "minecraft:summonable_entities"); diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java index dc1954c1..7edf20d9 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/advancement/Advancement.java @@ -34,7 +34,7 @@ public class Advancement { public static class DisplayData { private final @NonNull Message title; private final @NonNull Message description; - private final @NonNull ItemStack icon; + private final ItemStack icon; private final @NonNull FrameType frameType; private final boolean showToast; private final boolean hidden; @@ -42,7 +42,7 @@ public class Advancement { private final float posY; private final String backgroundTexture; - public DisplayData(@NonNull Message title, @NonNull Message description, @NonNull ItemStack icon, @NonNull FrameType frameType, + public DisplayData(@NonNull Message title, @NonNull Message description, ItemStack icon, @NonNull FrameType frameType, boolean showToast, boolean hidden, float posX, float posY) { this(title, description, icon, frameType, showToast, hidden, posX, posY, null); } diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/FallingBlockData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/FallingBlockData.java similarity index 73% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/FallingBlockData.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/FallingBlockData.java index 8d1bf0dd..9cb7fab0 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/FallingBlockData.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/FallingBlockData.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/GenericObjectData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/GenericObjectData.java similarity index 70% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/GenericObjectData.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/GenericObjectData.java index 804da28d..478801b7 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/GenericObjectData.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/GenericObjectData.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/HangingDirection.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/HangingDirection.java similarity index 61% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/HangingDirection.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/HangingDirection.java index 3de1e7f2..0db456c7 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/HangingDirection.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/HangingDirection.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; public enum HangingDirection implements ObjectData { DOWN, diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/MinecartType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/MinecartType.java similarity index 66% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/MinecartType.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/MinecartType.java index e246e0f5..7d57ac73 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/MinecartType.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/MinecartType.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; public enum MinecartType implements ObjectData { NORMAL, diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ObjectData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ObjectData.java new file mode 100644 index 00000000..c5728d85 --- /dev/null +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ObjectData.java @@ -0,0 +1,4 @@ +package com.github.steveice10.mc.protocol.data.game.entity.object; + +public interface ObjectData { +} diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ProjectileData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ProjectileData.java similarity index 69% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ProjectileData.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ProjectileData.java index 0d5aa240..cdacdc2f 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ProjectileData.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/ProjectileData.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/SplashPotionData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/SplashPotionData.java similarity index 70% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/SplashPotionData.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/SplashPotionData.java index 67bf5268..64d6e723 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/SplashPotionData.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/object/SplashPotionData.java @@ -1,4 +1,4 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; +package com.github.steveice10.mc.protocol.data.game.entity.object; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/MobType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/EntityType.java similarity index 98% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/MobType.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/EntityType.java index 43eeb0ce..fa8e73ca 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/MobType.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/EntityType.java @@ -1,6 +1,6 @@ package com.github.steveice10.mc.protocol.data.game.entity.type; -public enum MobType { +public enum EntityType { AREA_EFFECT_CLOUD, ARMOR_STAND, ARROW, diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/GlobalEntityType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/WeatherEntityType.java similarity index 73% rename from src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/GlobalEntityType.java rename to src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/WeatherEntityType.java index e1f76268..0192e304 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/GlobalEntityType.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/WeatherEntityType.java @@ -1,5 +1,5 @@ package com.github.steveice10.mc.protocol.data.game.entity.type; -public enum GlobalEntityType { +public enum WeatherEntityType { LIGHTNING_BOLT; } diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectData.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectData.java deleted file mode 100644 index 417eff41..00000000 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectData.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; - -public interface ObjectData { -} diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectType.java deleted file mode 100644 index 4964c8fe..00000000 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/entity/type/object/ObjectType.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.github.steveice10.mc.protocol.data.game.entity.type.object; - -public enum ObjectType { - EVOKER_FANGS, - AREA_EFFECT_CLOUD, - ARROW, - ARMOR_STAND, - BOAT, - DRAGON_FIREBALL, - END_CRYSTAL, - EXPERIENCE_ORB, - EYE_OF_ENDER, - FALLING_BLOCK, - FIREWORK_ROCKET, - ITEM, - ITEM_FRAME, - FIREBALL, - LEASH_KNOT, - LLAMA_SPIT, - MINECART, - CHEST_MINECART, - COMMAND_BLOCK_MINECART, - FURNACE_MINECART, - HOPPER_MINECART, - SPAWNER_MINECART, - TNT_MINECART, - TNT, - SMALL_FIREBALL, - SNOWBALL, - SPECTRAL_ARROW, - SHULKER_BULLET, - EGG, - ENDER_PEARL, - EXPERIENCE_BOTTLE, - POTION, - TRIDENT, - WITHER_SKULL, - FISHING_BOBBER, -} diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/world/block/UpdatedTileType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/world/block/UpdatedTileType.java index 50e5989e..184a68d1 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/world/block/UpdatedTileType.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/world/block/UpdatedTileType.java @@ -10,6 +10,7 @@ public enum UpdatedTileType { STRUCTURE_BLOCK, END_GATEWAY, SIGN, + SHULKER_BOX, BED, JIGSAW_BLOCK, CAMPFIRE, diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/world/particle/ParticleType.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/world/particle/ParticleType.java index e7b96c1f..f1f0dda2 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/world/particle/ParticleType.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/world/particle/ParticleType.java @@ -58,5 +58,9 @@ public enum ParticleType { NAUTILUS, DOLPHIN, CAMPFIRE_COSY_SMOKE, - CAMPFIRE_SIGNAL_SMOKE; + CAMPFIRE_SIGNAL_SMOKE, + DRIPPING_HONEY, + FALLING_HONEY, + LANDING_HONEY, + FALLING_NECTAR } diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/client/window/ClientEditBookPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/client/window/ClientEditBookPacket.java index 8b3b7a91..199271c3 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/client/window/ClientEditBookPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/client/window/ClientEditBookPacket.java @@ -1,6 +1,8 @@ package com.github.steveice10.mc.protocol.packet.ingame.client.window; +import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; +import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.packet.Packet; @@ -20,17 +22,20 @@ import java.io.IOException; public class ClientEditBookPacket implements Packet { private @NonNull ItemStack book; private boolean signing; + private @NonNull Hand hand; @Override public void read(NetInput in) throws IOException { this.book = ItemStack.read(in); this.signing = in.readBoolean(); + this.hand = MagicValues.key(Hand.class, in.readVarInt()); } @Override public void write(NetOutput out) throws IOException { ItemStack.write(out, this.book); out.writeBoolean(this.signing); + out.writeVarInt(MagicValues.value(Integer.class, hand)); } @Override diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java index 32272a0d..3ab62062 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java @@ -17,6 +17,8 @@ import lombok.NonNull; import lombok.Setter; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; @Data @@ -42,8 +44,9 @@ public class ServerPlayerListEntryPacket implements Packet { PlayerListEntry entry = null; switch(this.action) { - case ADD_PLAYER: + case ADD_PLAYER: { int properties = in.readVarInt(); + List propertyList = new ArrayList<>(); for(int index = 0; index < properties; index++) { String propertyName = in.readString(); String value = in.readString(); @@ -52,11 +55,13 @@ public class ServerPlayerListEntryPacket implements Packet { signature = in.readString(); } - profile.getProperties().add(new GameProfile.Property(propertyName, value, signature)); + propertyList.add(new GameProfile.Property(propertyName, value, signature)); } - int g = in.readVarInt(); - GameMode gameMode = MagicValues.key(GameMode.class, g < 0 ? 0 : g); + profile.setProperties(propertyList); + + int rawGameMode = in.readVarInt(); + GameMode gameMode = MagicValues.key(GameMode.class, rawGameMode < 0 ? 0 : rawGameMode); int ping = in.readVarInt(); Message displayName = null; if(in.readBoolean()) { @@ -65,23 +70,29 @@ public class ServerPlayerListEntryPacket implements Packet { entry = new PlayerListEntry(profile, gameMode, ping, displayName); break; - case UPDATE_GAMEMODE: - g = in.readVarInt(); - GameMode mode = MagicValues.key(GameMode.class, g < 0 ? 0 : g); + } + case UPDATE_GAMEMODE: { + int rawGameMode = in.readVarInt(); + GameMode mode = MagicValues.key(GameMode.class, rawGameMode < 0 ? 0 : rawGameMode); + entry = new PlayerListEntry(profile, mode); break; - case UPDATE_LATENCY: - int png = in.readVarInt(); - entry = new PlayerListEntry(profile, png); + } + case UPDATE_LATENCY: { + int ping = in.readVarInt(); + + entry = new PlayerListEntry(profile, ping); break; - case UPDATE_DISPLAY_NAME: - Message disp = null; + } + case UPDATE_DISPLAY_NAME: { + Message displayName = null; if(in.readBoolean()) { - disp = Message.fromString(in.readString()); + displayName = Message.fromString(in.readString()); } - entry = new PlayerListEntry(profile, disp); + entry = new PlayerListEntry(profile, displayName); break; + } case REMOVE_PLAYER: entry = new PlayerListEntry(profile); break; diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnEntityPacket.java similarity index 71% rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java rename to src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnEntityPacket.java index 3643110b..07572b97 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnEntityPacket.java @@ -1,14 +1,14 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; import com.github.steveice10.mc.protocol.data.MagicValues; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.FallingBlockData; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.GenericObjectData; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.HangingDirection; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.MinecartType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectData; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.ProjectileData; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.SplashPotionData; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; +import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockData; +import com.github.steveice10.mc.protocol.data.game.entity.object.GenericObjectData; +import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; +import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType; +import com.github.steveice10.mc.protocol.data.game.entity.object.ObjectData; +import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; +import com.github.steveice10.mc.protocol.data.game.entity.object.SplashPotionData; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.packet.Packet; @@ -26,10 +26,10 @@ import java.util.UUID; @Setter(AccessLevel.NONE) @NoArgsConstructor(access = AccessLevel.PRIVATE) @AllArgsConstructor -public class ServerSpawnObjectPacket implements Packet { +public class ServerSpawnEntityPacket implements Packet { private int entityId; private @NonNull UUID uuid; - private @NonNull ObjectType type; + private @NonNull EntityType type; private @NonNull ObjectData data; private double x; private double y; @@ -40,17 +40,17 @@ public class ServerSpawnObjectPacket implements Packet { private double motionY; private double motionZ; - public ServerSpawnObjectPacket(int entityId, @NonNull UUID uuid, @NonNull ObjectType type, + public ServerSpawnEntityPacket(int entityId, @NonNull UUID uuid, @NonNull EntityType type, double x, double y, double z, float yaw, float pitch) { this(entityId, uuid, type, new GenericObjectData(0), x, y, z, yaw, pitch, 0, 0, 0); } - public ServerSpawnObjectPacket(int entityId, @NonNull UUID uuid, @NonNull ObjectType type, @NonNull ObjectData data, + public ServerSpawnEntityPacket(int entityId, @NonNull UUID uuid, @NonNull EntityType type, @NonNull ObjectData data, double x, double y, double z, float yaw, float pitch) { this(entityId, uuid, type, data, x, y, z, yaw, pitch, 0, 0, 0); } - public ServerSpawnObjectPacket(int entityId, @NonNull UUID uuid, @NonNull ObjectType type, + public ServerSpawnEntityPacket(int entityId, @NonNull UUID uuid, @NonNull EntityType type, double x, double y, double z, float yaw, float pitch, double motionX, double motionY, double motionZ) { this(entityId, uuid, type, new GenericObjectData(0), x, y, z, yaw, pitch, motionX, motionY, motionZ); @@ -60,7 +60,7 @@ public class ServerSpawnObjectPacket implements Packet { public void read(NetInput in) throws IOException { this.entityId = in.readVarInt(); this.uuid = in.readUUID(); - this.type = MagicValues.key(ObjectType.class, in.readVarInt()); + this.type = MagicValues.key(EntityType.class, in.readVarInt()); this.x = in.readDouble(); this.y = in.readDouble(); this.z = in.readDouble(); @@ -68,16 +68,16 @@ public class ServerSpawnObjectPacket implements Packet { this.yaw = in.readByte() * 360 / 256f; int data = in.readInt(); - if(this.type == ObjectType.MINECART) { + if(this.type == EntityType.MINECART) { this.data = MagicValues.key(MinecartType.class, data); - } else if(this.type == ObjectType.ITEM_FRAME) { + } else if(this.type == EntityType.ITEM_FRAME) { this.data = MagicValues.key(HangingDirection.class, data); - } else if(this.type == ObjectType.FALLING_BLOCK) { + } else if(this.type == EntityType.FALLING_BLOCK) { this.data = new FallingBlockData(data & 65535, data >> 16); - } else if(this.type == ObjectType.POTION) { + } else if(this.type == EntityType.THROWN_POTION) { this.data = new SplashPotionData(data); - } else if(this.type == ObjectType.SPECTRAL_ARROW || this.type == ObjectType.FIREBALL || this.type == ObjectType.SMALL_FIREBALL - || this.type == ObjectType.DRAGON_FIREBALL || this.type == ObjectType.WITHER_SKULL || this.type == ObjectType.FISHING_BOBBER) { + } else if(this.type == EntityType.SPECTRAL_ARROW || this.type == EntityType.FIREBALL || this.type == EntityType.SMALL_FIREBALL + || this.type == EntityType.DRAGON_FIREBALL || this.type == EntityType.WITHER_SKULL || this.type == EntityType.FISHING_BOBBER) { this.data = new ProjectileData(data); } else { this.data = new GenericObjectData(data); diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnLivingEntityPacket.java similarity index 89% rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java rename to src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnLivingEntityPacket.java index 8becea08..e23599e9 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnLivingEntityPacket.java @@ -1,7 +1,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; import com.github.steveice10.mc.protocol.data.MagicValues; -import com.github.steveice10.mc.protocol.data.game.entity.type.MobType; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.packet.Packet; @@ -19,10 +19,10 @@ import java.util.UUID; @Setter(AccessLevel.NONE) @NoArgsConstructor(access = AccessLevel.PRIVATE) @AllArgsConstructor -public class ServerSpawnMobPacket implements Packet { +public class ServerSpawnLivingEntityPacket implements Packet { private int entityId; private @NonNull UUID uuid; - private @NonNull MobType type; + private @NonNull EntityType type; private double x; private double y; private double z; @@ -37,7 +37,7 @@ public class ServerSpawnMobPacket implements Packet { public void read(NetInput in) throws IOException { this.entityId = in.readVarInt(); this.uuid = in.readUUID(); - this.type = MagicValues.key(MobType.class, in.readVarInt()); + this.type = MagicValues.key(EntityType.class, in.readVarInt()); this.x = in.readDouble(); this.y = in.readDouble(); this.z = in.readDouble(); diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java index 14de45d7..66e93886 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java @@ -3,7 +3,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.type.PaintingType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.HangingDirection; +import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.packet.Packet; diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnWeatherEntityPacket.java similarity index 82% rename from src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java rename to src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnWeatherEntityPacket.java index 24a87858..cddd8816 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnWeatherEntityPacket.java @@ -1,7 +1,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; import com.github.steveice10.mc.protocol.data.MagicValues; -import com.github.steveice10.mc.protocol.data.game.entity.type.GlobalEntityType; +import com.github.steveice10.mc.protocol.data.game.entity.type.WeatherEntityType; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.packet.Packet; @@ -18,9 +18,9 @@ import java.io.IOException; @Setter(AccessLevel.NONE) @NoArgsConstructor(access = AccessLevel.PRIVATE) @AllArgsConstructor -public class ServerSpawnGlobalEntityPacket implements Packet { +public class ServerSpawnWeatherEntityPacket implements Packet { private int entityId; - private @NonNull GlobalEntityType type; + private @NonNull WeatherEntityType type; private double x; private double y; private double z; @@ -28,7 +28,7 @@ public class ServerSpawnGlobalEntityPacket implements Packet { @Override public void read(NetInput in) throws IOException { this.entityId = in.readVarInt(); - this.type = MagicValues.key(GlobalEntityType.class, in.readByte()); + this.type = MagicValues.key(WeatherEntityType.class, in.readByte()); this.x = in.readDouble(); this.y = in.readDouble(); this.z = in.readDouble(); diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java index 85d980fc..7d934ad1 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java @@ -19,63 +19,62 @@ import java.io.IOException; public class ServerWorldBorderPacket implements Packet { private @NonNull WorldBorderAction action; - private double radius; + private double newSize; - private double oldRadius; - private double newRadius; - private long speed; + private double oldSize; + private long lerpTime; - private double centerX; - private double centerY; + private double newCenterX; + private double newCenterZ; - private int portalTeleportBoundary; + private int newAbsoluteMaxSize; private int warningTime; private int warningBlocks; - public ServerWorldBorderPacket(double radius) { + public ServerWorldBorderPacket(double newSize) { this.action = WorldBorderAction.SET_SIZE; - this.radius = radius; + this.newSize = newSize; } - public ServerWorldBorderPacket(double oldRadius, double newRadius, long speed) { + public ServerWorldBorderPacket(double oldSize, double newSize, long lerpTime) { this.action = WorldBorderAction.LERP_SIZE; - this.oldRadius = oldRadius; - this.newRadius = newRadius; - this.speed = speed; + this.oldSize = oldSize; + this.newSize = newSize; + this.lerpTime = lerpTime; } - public ServerWorldBorderPacket(double centerX, double centerY) { + public ServerWorldBorderPacket(double newCenterX, double newCenterZ) { this.action = WorldBorderAction.SET_CENTER; - this.centerX = centerX; - this.centerY = centerY; + this.newCenterX = newCenterX; + this.newCenterZ = newCenterZ; } - public ServerWorldBorderPacket(boolean time, int warning) { - if(time) { + public ServerWorldBorderPacket(boolean isTime, int warningValue) { + if(isTime) { this.action = WorldBorderAction.SET_WARNING_TIME; - this.warningTime = warning; + this.warningTime = warningValue; } else { this.action = WorldBorderAction.SET_WARNING_BLOCKS; - this.warningBlocks = warning; + this.warningBlocks = warningValue; } } - public ServerWorldBorderPacket(double centerX, double centerY, double oldRadius, double newRadius, long speed, int portalTeleportBoundary, int warningTime, int warningBlocks) { + public ServerWorldBorderPacket(double newCenterX, double newCenterZ, double oldSize, double newSize, long lerpTime, int newAbsoluteMaxSize, int warningTime, int warningBlocks) { this.action = WorldBorderAction.INITIALIZE; - this.centerX = centerX; - this.centerY = centerY; - this.oldRadius = oldRadius; - this.newRadius = newRadius; - this.speed = speed; - this.portalTeleportBoundary = portalTeleportBoundary; + this.newCenterX = newCenterX; + this.newCenterZ = newCenterZ; + this.oldSize = oldSize; + this.newSize = newSize; + this.lerpTime = lerpTime; + this.newAbsoluteMaxSize = newAbsoluteMaxSize; this.warningTime = warningTime; this.warningBlocks = warningBlocks; } @@ -84,21 +83,21 @@ public class ServerWorldBorderPacket implements Packet { public void read(NetInput in) throws IOException { this.action = MagicValues.key(WorldBorderAction.class, in.readVarInt()); if(this.action == WorldBorderAction.SET_SIZE) { - this.radius = in.readDouble(); + this.newSize = in.readDouble(); } else if(this.action == WorldBorderAction.LERP_SIZE) { - this.oldRadius = in.readDouble(); - this.newRadius = in.readDouble(); - this.speed = in.readVarLong(); + this.oldSize = in.readDouble(); + this.newSize = in.readDouble(); + this.lerpTime = in.readVarLong(); } else if(this.action == WorldBorderAction.SET_CENTER) { - this.centerX = in.readDouble(); - this.centerY = in.readDouble(); + this.newCenterX = in.readDouble(); + this.newCenterZ = in.readDouble(); } else if(this.action == WorldBorderAction.INITIALIZE) { - this.centerX = in.readDouble(); - this.centerY = in.readDouble(); - this.oldRadius = in.readDouble(); - this.newRadius = in.readDouble(); - this.speed = in.readVarLong(); - this.portalTeleportBoundary = in.readVarInt(); + this.newCenterX = in.readDouble(); + this.newCenterZ = in.readDouble(); + this.oldSize = in.readDouble(); + this.newSize = in.readDouble(); + this.lerpTime = in.readVarLong(); + this.newAbsoluteMaxSize = in.readVarInt(); this.warningTime = in.readVarInt(); this.warningBlocks = in.readVarInt(); } else if(this.action == WorldBorderAction.SET_WARNING_TIME) { @@ -112,21 +111,21 @@ public class ServerWorldBorderPacket implements Packet { public void write(NetOutput out) throws IOException { out.writeVarInt(MagicValues.value(Integer.class, this.action)); if(this.action == WorldBorderAction.SET_SIZE) { - out.writeDouble(this.radius); + out.writeDouble(this.newSize); } else if(this.action == WorldBorderAction.LERP_SIZE) { - out.writeDouble(this.oldRadius); - out.writeDouble(this.newRadius); - out.writeVarLong(this.speed); + out.writeDouble(this.oldSize); + out.writeDouble(this.newSize); + out.writeVarLong(this.lerpTime); } else if(this.action == WorldBorderAction.SET_CENTER) { - out.writeDouble(this.centerX); - out.writeDouble(this.centerY); + out.writeDouble(this.newCenterX); + out.writeDouble(this.newCenterZ); } else if(this.action == WorldBorderAction.INITIALIZE) { - out.writeDouble(this.centerX); - out.writeDouble(this.centerY); - out.writeDouble(this.oldRadius); - out.writeDouble(this.newRadius); - out.writeVarLong(this.speed); - out.writeVarInt(this.portalTeleportBoundary); + out.writeDouble(this.newCenterX); + out.writeDouble(this.newCenterZ); + out.writeDouble(this.oldSize); + out.writeDouble(this.newSize); + out.writeVarLong(this.lerpTime); + out.writeVarInt(this.newAbsoluteMaxSize); out.writeVarInt(this.warningTime); out.writeVarInt(this.warningBlocks); } else if(this.action == WorldBorderAction.SET_WARNING_TIME) { diff --git a/src/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java b/src/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java index ce34ef64..29cfc24c 100644 --- a/src/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java +++ b/src/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java @@ -32,12 +32,11 @@ 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.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement; -import com.github.steveice10.mc.protocol.data.game.entity.type.GlobalEntityType; -import com.github.steveice10.mc.protocol.data.game.entity.type.MobType; +import com.github.steveice10.mc.protocol.data.game.entity.type.WeatherEntityType; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.PaintingType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.HangingDirection; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.MinecartType; -import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType; +import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; +import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.mc.protocol.data.game.scoreboard.CollisionRule; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; @@ -143,9 +142,8 @@ public class MagicValuesTest { this.register(Effect.class, Integer.class); this.register(EntityStatus.class, Integer.class); this.register(PositionElement.class, Integer.class); - this.register(GlobalEntityType.class, Integer.class); - this.register(MobType.class, Integer.class); - this.register(ObjectType.class, Integer.class); + this.register(WeatherEntityType.class, Integer.class); + this.register(EntityType.class, Integer.class); this.register(MinecartType.class, Integer.class); this.register(HangingDirection.class, Integer.class); this.register(PaintingType.class, Integer.class);