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 aa68d450..a1a9d9d1 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java +++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftProtocol.java @@ -103,9 +103,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; @@ -372,10 +372,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); @@ -562,10 +562,10 @@ public class MinecraftProtocol extends PacketProtocol { this.registerIncoming(0x2C, ClientPlayerPlaceBlockPacket.class); this.registerIncoming(0x2D, 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 74a74ac7..07186ea6 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; @@ -381,146 +380,110 @@ 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.ZOMBIE_PIGMAN, 57); - register(MobType.POLAR_BEAR, 58); - register(MobType.PRIMED_TNT, 59); - register(MobType.RABBIT, 60); - register(MobType.SALMON, 61); - register(MobType.SHEEP, 62); - register(MobType.SHULKER, 63); - register(MobType.SHULKER_BULLET, 64); - register(MobType.SILVERFISH, 65); - register(MobType.SKELETON, 66); - register(MobType.SKELETON_HORSE, 67); - register(MobType.SLIME, 68); - register(MobType.SMALL_FIREBALL, 69); - register(MobType.SNOW_GOLEM, 70); - register(MobType.SNOWBALL, 71); - register(MobType.SPECTRAL_ARROW, 72); - register(MobType.SPIDER, 73); - register(MobType.SQUID, 74); - register(MobType.STRAY, 75); - register(MobType.TRADER_LLAMA, 76); - register(MobType.TROPICAL_FISH, 77); - register(MobType.TURTLE, 78); - register(MobType.THROWN_EGG, 79); - register(MobType.THROWN_ENDERPEARL, 80); - register(MobType.THROWN_EXP_BOTTLE, 81); - register(MobType.THROWN_POTION, 82); - register(MobType.TRIDENT, 83); - register(MobType.VEX, 84); - register(MobType.VILLAGER, 85); - register(MobType.IRON_GOLEM, 86); - register(MobType.VINDICATOR, 87); - register(MobType.PILLAGER, 88); - register(MobType.WANDERING_TRADER, 89); - register(MobType.WITCH, 90); - register(MobType.WITHER, 91); - register(MobType.WITHER_SKELETON, 92); - register(MobType.WITHER_SKULL, 93); - register(MobType.WOLF, 94); - register(MobType.ZOMBIE, 95); - register(MobType.ZOMBIE_HORSE, 96); - register(MobType.ZOMBIE_VILLAGER, 97); - register(MobType.PHANTOM, 98); - register(MobType.RAVAGER, 99); - register(MobType.PLAYER, 101); - register(MobType.FISHING_BOBBER, 102); - - 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, 59); - register(ObjectType.SHULKER_BULLET, 64); - register(ObjectType.SMALL_FIREBALL, 69); - register(ObjectType.SNOWBALL, 71); - register(ObjectType.SPECTRAL_ARROW, 72); - register(ObjectType.EGG, 79); - register(ObjectType.ENDER_PEARL, 80); - register(ObjectType.EXPERIENCE_BOTTLE, 81); - register(ObjectType.POTION, 82); - register(ObjectType.TRIDENT, 83); - register(ObjectType.WITHER_SKULL, 93); - register(ObjectType.FISHING_BOBBER, 102); + 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.ZOMBIE_PIGMAN, 57); + register(EntityType.POLAR_BEAR, 58); + register(EntityType.PRIMED_TNT, 59); + register(EntityType.RABBIT, 60); + register(EntityType.SALMON, 61); + register(EntityType.SHEEP, 62); + register(EntityType.SHULKER, 63); + register(EntityType.SHULKER_BULLET, 64); + register(EntityType.SILVERFISH, 65); + register(EntityType.SKELETON, 66); + register(EntityType.SKELETON_HORSE, 67); + register(EntityType.SLIME, 68); + register(EntityType.SMALL_FIREBALL, 69); + register(EntityType.SNOW_GOLEM, 70); + register(EntityType.SNOWBALL, 71); + register(EntityType.SPECTRAL_ARROW, 72); + register(EntityType.SPIDER, 73); + register(EntityType.SQUID, 74); + register(EntityType.STRAY, 75); + register(EntityType.TRADER_LLAMA, 76); + register(EntityType.TROPICAL_FISH, 77); + register(EntityType.TURTLE, 78); + register(EntityType.THROWN_EGG, 79); + register(EntityType.THROWN_ENDERPEARL, 80); + register(EntityType.THROWN_EXP_BOTTLE, 81); + register(EntityType.THROWN_POTION, 82); + register(EntityType.TRIDENT, 83); + register(EntityType.VEX, 84); + register(EntityType.VILLAGER, 85); + register(EntityType.IRON_GOLEM, 86); + register(EntityType.VINDICATOR, 87); + register(EntityType.PILLAGER, 88); + register(EntityType.WANDERING_TRADER, 89); + register(EntityType.WITCH, 90); + register(EntityType.WITHER, 91); + register(EntityType.WITHER_SKELETON, 92); + register(EntityType.WITHER_SKULL, 93); + register(EntityType.WOLF, 94); + register(EntityType.ZOMBIE, 95); + register(EntityType.ZOMBIE_HORSE, 96); + register(EntityType.ZOMBIE_VILLAGER, 97); + register(EntityType.PHANTOM, 98); + register(EntityType.RAVAGER, 99); + register(EntityType.PLAYER, 101); + register(EntityType.FISHING_BOBBER, 102); register(MinecartType.NORMAL, 0); register(MinecartType.CHEST, 1); @@ -1213,7 +1176,7 @@ public class MagicValues { // Handle some protocol version translators that may send -1 for untranslatable IDs. // Choics are based on what (I think?) vanilla would default to. - register(MobType.PIG, -1); + register(EntityType.PIG, -1); register(BuiltinSound.ENTITY_ITEM_PICKUP, -1); } 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 c841a94d..89217e3f 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/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/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java b/src/test/java/com/github/steveice10/mc/protocol/data/MagicValuesTest.java index 5834186f..4e5cad33 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; @@ -145,9 +144,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);