Merge ObjectType and EntityType and bring spawn packet naming in line with latest wiki info.

This commit is contained in:
Steveice10 2020-05-23 00:10:53 -07:00
parent aae3a9d276
commit 8e6bc6386b
18 changed files with 164 additions and 242 deletions

View file

@ -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.ServerPlayerPositionRotationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket; 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.ServerSpawnExpOrbPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnWeatherEntityPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnLivingEntityPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnObjectPacket; 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.ServerSpawnPaintingPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; 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) { private void initClientGame(Session session) {
this.registerIncoming(0x00, ServerSpawnObjectPacket.class); this.registerIncoming(0x00, ServerSpawnEntityPacket.class);
this.registerIncoming(0x01, ServerSpawnExpOrbPacket.class); this.registerIncoming(0x01, ServerSpawnExpOrbPacket.class);
this.registerIncoming(0x02, ServerSpawnGlobalEntityPacket.class); this.registerIncoming(0x02, ServerSpawnWeatherEntityPacket.class);
this.registerIncoming(0x03, ServerSpawnMobPacket.class); this.registerIncoming(0x03, ServerSpawnLivingEntityPacket.class);
this.registerIncoming(0x04, ServerSpawnPaintingPacket.class); this.registerIncoming(0x04, ServerSpawnPaintingPacket.class);
this.registerIncoming(0x05, ServerSpawnPlayerPacket.class); this.registerIncoming(0x05, ServerSpawnPlayerPacket.class);
this.registerIncoming(0x06, ServerEntityAnimationPacket.class); this.registerIncoming(0x06, ServerEntityAnimationPacket.class);
@ -562,10 +562,10 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(0x2C, ClientPlayerPlaceBlockPacket.class); this.registerIncoming(0x2C, ClientPlayerPlaceBlockPacket.class);
this.registerIncoming(0x2D, ClientPlayerUseItemPacket.class); this.registerIncoming(0x2D, ClientPlayerUseItemPacket.class);
this.registerOutgoing(0x00, ServerSpawnObjectPacket.class); this.registerOutgoing(0x00, ServerSpawnEntityPacket.class);
this.registerOutgoing(0x01, ServerSpawnExpOrbPacket.class); this.registerOutgoing(0x01, ServerSpawnExpOrbPacket.class);
this.registerOutgoing(0x02, ServerSpawnGlobalEntityPacket.class); this.registerOutgoing(0x02, ServerSpawnWeatherEntityPacket.class);
this.registerOutgoing(0x03, ServerSpawnMobPacket.class); this.registerOutgoing(0x03, ServerSpawnLivingEntityPacket.class);
this.registerOutgoing(0x04, ServerSpawnPaintingPacket.class); this.registerOutgoing(0x04, ServerSpawnPaintingPacket.class);
this.registerOutgoing(0x05, ServerSpawnPlayerPacket.class); this.registerOutgoing(0x05, ServerSpawnPlayerPacket.class);
this.registerOutgoing(0x06, ServerEntityAnimationPacket.class); this.registerOutgoing(0x06, ServerEntityAnimationPacket.class);

View file

@ -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.PlayerAction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; 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.player.PositionElement;
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.mc.protocol.data.game.entity.type.MobType; 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.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.mc.protocol.data.game.entity.type.object.MinecartType; import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType;
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; 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.CollisionRule;
import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility;
@ -381,146 +380,110 @@ public class MagicValues {
register(PositionElement.PITCH, 3); register(PositionElement.PITCH, 3);
register(PositionElement.YAW, 4); register(PositionElement.YAW, 4);
register(GlobalEntityType.LIGHTNING_BOLT, 1); register(WeatherEntityType.LIGHTNING_BOLT, 1);
register(MobType.AREA_EFFECT_CLOUD, 0); register(EntityType.AREA_EFFECT_CLOUD, 0);
register(MobType.ARMOR_STAND, 1); register(EntityType.ARMOR_STAND, 1);
register(MobType.ARROW, 2); register(EntityType.ARROW, 2);
register(MobType.BAT, 3); register(EntityType.BAT, 3);
register(MobType.BEE, 4); register(EntityType.BEE, 4);
register(MobType.BLAZE, 5); register(EntityType.BLAZE, 5);
register(MobType.BOAT, 6); register(EntityType.BOAT, 6);
register(MobType.CAT, 7); register(EntityType.CAT, 7);
register(MobType.CAVE_SPIDER, 8); register(EntityType.CAVE_SPIDER, 8);
register(MobType.CHICKEN, 9); register(EntityType.CHICKEN, 9);
register(MobType.COD, 10); register(EntityType.COD, 10);
register(MobType.COW, 11); register(EntityType.COW, 11);
register(MobType.CREEPER, 12); register(EntityType.CREEPER, 12);
register(MobType.DONKEY, 13); register(EntityType.DONKEY, 13);
register(MobType.DOLPHIN, 14); register(EntityType.DOLPHIN, 14);
register(MobType.DRAGON_FIREBALL, 15); register(EntityType.DRAGON_FIREBALL, 15);
register(MobType.DROWNED, 16); register(EntityType.DROWNED, 16);
register(MobType.ELDER_GUARDIAN, 17); register(EntityType.ELDER_GUARDIAN, 17);
register(MobType.END_CRYSTAL, 18); register(EntityType.END_CRYSTAL, 18);
register(MobType.ENDER_DRAGON, 19); register(EntityType.ENDER_DRAGON, 19);
register(MobType.ENDERMAN, 20); register(EntityType.ENDERMAN, 20);
register(MobType.ENDERMITE, 21); register(EntityType.ENDERMITE, 21);
register(MobType.EVOKER_FANGS, 22); register(EntityType.EVOKER_FANGS, 22);
register(MobType.EVOKER, 23); register(EntityType.EVOKER, 23);
register(MobType.EXPERIENCE_ORB, 24); register(EntityType.EXPERIENCE_ORB, 24);
register(MobType.EYE_OF_ENDER, 25); register(EntityType.EYE_OF_ENDER, 25);
register(MobType.FALLING_BLOCK, 26); register(EntityType.FALLING_BLOCK, 26);
register(MobType.FIREWORK_ROCKET, 27); register(EntityType.FIREWORK_ROCKET, 27);
register(MobType.FOX, 28); register(EntityType.FOX, 28);
register(MobType.GHAST, 29); register(EntityType.GHAST, 29);
register(MobType.GIANT, 30); register(EntityType.GIANT, 30);
register(MobType.GUARDIAN, 31); register(EntityType.GUARDIAN, 31);
register(MobType.HORSE, 32); register(EntityType.HORSE, 32);
register(MobType.HUSK, 33); register(EntityType.HUSK, 33);
register(MobType.ILLUSIONER, 34); register(EntityType.ILLUSIONER, 34);
register(MobType.ITEM, 35); register(EntityType.ITEM, 35);
register(MobType.ITEM_FRAME, 36); register(EntityType.ITEM_FRAME, 36);
register(MobType.FIREBALL, 37); register(EntityType.FIREBALL, 37);
register(MobType.LEASH_KNOT, 38); register(EntityType.LEASH_KNOT, 38);
register(MobType.LLAMA, 39); register(EntityType.LLAMA, 39);
register(MobType.LLAMA_SPIT, 40); register(EntityType.LLAMA_SPIT, 40);
register(MobType.MAGMA_CUBE, 41); register(EntityType.MAGMA_CUBE, 41);
register(MobType.MINECART, 42); register(EntityType.MINECART, 42);
register(MobType.MINECART_CHEST, 43); register(EntityType.MINECART_CHEST, 43);
register(MobType.MINECART_COMMAND_BLOCK, 44); register(EntityType.MINECART_COMMAND_BLOCK, 44);
register(MobType.MINECART_FURNACE, 45); register(EntityType.MINECART_FURNACE, 45);
register(MobType.MINECART_HOPPER, 46); register(EntityType.MINECART_HOPPER, 46);
register(MobType.MINECART_SPAWNER, 47); register(EntityType.MINECART_SPAWNER, 47);
register(MobType.MINECART_TNT, 48); register(EntityType.MINECART_TNT, 48);
register(MobType.MULE, 49); register(EntityType.MULE, 49);
register(MobType.MOOSHROOM, 50); register(EntityType.MOOSHROOM, 50);
register(MobType.OCELOT, 51); register(EntityType.OCELOT, 51);
register(MobType.PAINTING, 52); register(EntityType.PAINTING, 52);
register(MobType.PANDA, 53); register(EntityType.PANDA, 53);
register(MobType.PARROT, 54); register(EntityType.PARROT, 54);
register(MobType.PIG, 55); register(EntityType.PIG, 55);
register(MobType.PUFFERFISH, 56); register(EntityType.PUFFERFISH, 56);
register(MobType.ZOMBIE_PIGMAN, 57); register(EntityType.ZOMBIE_PIGMAN, 57);
register(MobType.POLAR_BEAR, 58); register(EntityType.POLAR_BEAR, 58);
register(MobType.PRIMED_TNT, 59); register(EntityType.PRIMED_TNT, 59);
register(MobType.RABBIT, 60); register(EntityType.RABBIT, 60);
register(MobType.SALMON, 61); register(EntityType.SALMON, 61);
register(MobType.SHEEP, 62); register(EntityType.SHEEP, 62);
register(MobType.SHULKER, 63); register(EntityType.SHULKER, 63);
register(MobType.SHULKER_BULLET, 64); register(EntityType.SHULKER_BULLET, 64);
register(MobType.SILVERFISH, 65); register(EntityType.SILVERFISH, 65);
register(MobType.SKELETON, 66); register(EntityType.SKELETON, 66);
register(MobType.SKELETON_HORSE, 67); register(EntityType.SKELETON_HORSE, 67);
register(MobType.SLIME, 68); register(EntityType.SLIME, 68);
register(MobType.SMALL_FIREBALL, 69); register(EntityType.SMALL_FIREBALL, 69);
register(MobType.SNOW_GOLEM, 70); register(EntityType.SNOW_GOLEM, 70);
register(MobType.SNOWBALL, 71); register(EntityType.SNOWBALL, 71);
register(MobType.SPECTRAL_ARROW, 72); register(EntityType.SPECTRAL_ARROW, 72);
register(MobType.SPIDER, 73); register(EntityType.SPIDER, 73);
register(MobType.SQUID, 74); register(EntityType.SQUID, 74);
register(MobType.STRAY, 75); register(EntityType.STRAY, 75);
register(MobType.TRADER_LLAMA, 76); register(EntityType.TRADER_LLAMA, 76);
register(MobType.TROPICAL_FISH, 77); register(EntityType.TROPICAL_FISH, 77);
register(MobType.TURTLE, 78); register(EntityType.TURTLE, 78);
register(MobType.THROWN_EGG, 79); register(EntityType.THROWN_EGG, 79);
register(MobType.THROWN_ENDERPEARL, 80); register(EntityType.THROWN_ENDERPEARL, 80);
register(MobType.THROWN_EXP_BOTTLE, 81); register(EntityType.THROWN_EXP_BOTTLE, 81);
register(MobType.THROWN_POTION, 82); register(EntityType.THROWN_POTION, 82);
register(MobType.TRIDENT, 83); register(EntityType.TRIDENT, 83);
register(MobType.VEX, 84); register(EntityType.VEX, 84);
register(MobType.VILLAGER, 85); register(EntityType.VILLAGER, 85);
register(MobType.IRON_GOLEM, 86); register(EntityType.IRON_GOLEM, 86);
register(MobType.VINDICATOR, 87); register(EntityType.VINDICATOR, 87);
register(MobType.PILLAGER, 88); register(EntityType.PILLAGER, 88);
register(MobType.WANDERING_TRADER, 89); register(EntityType.WANDERING_TRADER, 89);
register(MobType.WITCH, 90); register(EntityType.WITCH, 90);
register(MobType.WITHER, 91); register(EntityType.WITHER, 91);
register(MobType.WITHER_SKELETON, 92); register(EntityType.WITHER_SKELETON, 92);
register(MobType.WITHER_SKULL, 93); register(EntityType.WITHER_SKULL, 93);
register(MobType.WOLF, 94); register(EntityType.WOLF, 94);
register(MobType.ZOMBIE, 95); register(EntityType.ZOMBIE, 95);
register(MobType.ZOMBIE_HORSE, 96); register(EntityType.ZOMBIE_HORSE, 96);
register(MobType.ZOMBIE_VILLAGER, 97); register(EntityType.ZOMBIE_VILLAGER, 97);
register(MobType.PHANTOM, 98); register(EntityType.PHANTOM, 98);
register(MobType.RAVAGER, 99); register(EntityType.RAVAGER, 99);
register(MobType.PLAYER, 101); register(EntityType.PLAYER, 101);
register(MobType.FISHING_BOBBER, 102); register(EntityType.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(MinecartType.NORMAL, 0); register(MinecartType.NORMAL, 0);
register(MinecartType.CHEST, 1); register(MinecartType.CHEST, 1);
@ -1213,7 +1176,7 @@ public class MagicValues {
// Handle some protocol version translators that may send -1 for untranslatable IDs. // Handle some protocol version translators that may send -1 for untranslatable IDs.
// Choics are based on what (I think?) vanilla would default to. // 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); register(BuiltinSound.ENTITY_ITEM_PICKUP, -1);
} }

View file

@ -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.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View file

@ -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.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View file

@ -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 { public enum HangingDirection implements ObjectData {
DOWN, DOWN,

View file

@ -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 { public enum MinecartType implements ObjectData {
NORMAL, NORMAL,

View file

@ -0,0 +1,4 @@
package com.github.steveice10.mc.protocol.data.game.entity.object;
public interface ObjectData {
}

View file

@ -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.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View file

@ -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.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View file

@ -1,6 +1,6 @@
package com.github.steveice10.mc.protocol.data.game.entity.type; package com.github.steveice10.mc.protocol.data.game.entity.type;
public enum MobType { public enum EntityType {
AREA_EFFECT_CLOUD, AREA_EFFECT_CLOUD,
ARMOR_STAND, ARMOR_STAND,
ARROW, ARROW,

View file

@ -1,5 +1,5 @@
package com.github.steveice10.mc.protocol.data.game.entity.type; package com.github.steveice10.mc.protocol.data.game.entity.type;
public enum GlobalEntityType { public enum WeatherEntityType {
LIGHTNING_BOLT; LIGHTNING_BOLT;
} }

View file

@ -1,4 +0,0 @@
package com.github.steveice10.mc.protocol.data.game.entity.type.object;
public interface ObjectData {
}

View file

@ -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,
}

View file

@ -1,14 +1,14 @@
package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; 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.MagicValues;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.FallingBlockData; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.GenericObjectData; import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockData;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.HangingDirection; import com.github.steveice10.mc.protocol.data.game.entity.object.GenericObjectData;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.MinecartType; import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectData; import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType; import com.github.steveice10.mc.protocol.data.game.entity.object.ObjectData;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.SplashPotionData; import com.github.steveice10.mc.protocol.data.game.entity.object.SplashPotionData;
import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
@ -26,10 +26,10 @@ import java.util.UUID;
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor @AllArgsConstructor
public class ServerSpawnObjectPacket implements Packet { public class ServerSpawnEntityPacket implements Packet {
private int entityId; private int entityId;
private @NonNull UUID uuid; private @NonNull UUID uuid;
private @NonNull ObjectType type; private @NonNull EntityType type;
private @NonNull ObjectData data; private @NonNull ObjectData data;
private double x; private double x;
private double y; private double y;
@ -40,17 +40,17 @@ public class ServerSpawnObjectPacket implements Packet {
private double motionY; private double motionY;
private double motionZ; 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) { 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); 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) { double x, double y, double z, float yaw, float pitch) {
this(entityId, uuid, type, data, x, y, z, yaw, pitch, 0, 0, 0); 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 x, double y, double z, float yaw, float pitch,
double motionX, double motionY, double motionZ) { double motionX, double motionY, double motionZ) {
this(entityId, uuid, type, new GenericObjectData(0), x, y, z, yaw, pitch, motionX, motionY, 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 { public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt(); this.entityId = in.readVarInt();
this.uuid = in.readUUID(); 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.x = in.readDouble();
this.y = in.readDouble(); this.y = in.readDouble();
this.z = in.readDouble(); this.z = in.readDouble();
@ -68,16 +68,16 @@ public class ServerSpawnObjectPacket implements Packet {
this.yaw = in.readByte() * 360 / 256f; this.yaw = in.readByte() * 360 / 256f;
int data = in.readInt(); int data = in.readInt();
if(this.type == ObjectType.MINECART) { if(this.type == EntityType.MINECART) {
this.data = MagicValues.key(MinecartType.class, data); 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); 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); 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); this.data = new SplashPotionData(data);
} else if(this.type == ObjectType.SPECTRAL_ARROW || this.type == ObjectType.FIREBALL || this.type == ObjectType.SMALL_FIREBALL } else if(this.type == EntityType.SPECTRAL_ARROW || this.type == EntityType.FIREBALL || this.type == EntityType.SMALL_FIREBALL
|| this.type == ObjectType.DRAGON_FIREBALL || this.type == ObjectType.WITHER_SKULL || this.type == ObjectType.FISHING_BOBBER) { || this.type == EntityType.DRAGON_FIREBALL || this.type == EntityType.WITHER_SKULL || this.type == EntityType.FISHING_BOBBER) {
this.data = new ProjectileData(data); this.data = new ProjectileData(data);
} else { } else {
this.data = new GenericObjectData(data); this.data = new GenericObjectData(data);

View file

@ -1,7 +1,7 @@
package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; 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.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.NetInput;
import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
@ -19,10 +19,10 @@ import java.util.UUID;
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor @AllArgsConstructor
public class ServerSpawnMobPacket implements Packet { public class ServerSpawnLivingEntityPacket implements Packet {
private int entityId; private int entityId;
private @NonNull UUID uuid; private @NonNull UUID uuid;
private @NonNull MobType type; private @NonNull EntityType type;
private double x; private double x;
private double y; private double y;
private double z; private double z;
@ -37,7 +37,7 @@ public class ServerSpawnMobPacket implements Packet {
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt(); this.entityId = in.readVarInt();
this.uuid = in.readUUID(); 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.x = in.readDouble();
this.y = in.readDouble(); this.y = in.readDouble();
this.z = in.readDouble(); this.z = in.readDouble();

View file

@ -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.MagicValues;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; 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.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.NetInput;
import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;

View file

@ -1,7 +1,7 @@
package com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn; 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.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.NetInput;
import com.github.steveice10.packetlib.io.NetOutput; import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
@ -18,9 +18,9 @@ import java.io.IOException;
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor @AllArgsConstructor
public class ServerSpawnGlobalEntityPacket implements Packet { public class ServerSpawnWeatherEntityPacket implements Packet {
private int entityId; private int entityId;
private @NonNull GlobalEntityType type; private @NonNull WeatherEntityType type;
private double x; private double x;
private double y; private double y;
private double z; private double z;
@ -28,7 +28,7 @@ public class ServerSpawnGlobalEntityPacket implements Packet {
@Override @Override
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt(); 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.x = in.readDouble();
this.y = in.readDouble(); this.y = in.readDouble();
this.z = in.readDouble(); this.z = in.readDouble();

View file

@ -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.PlayerAction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; 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.player.PositionElement;
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.mc.protocol.data.game.entity.type.MobType; 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.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.mc.protocol.data.game.entity.type.object.MinecartType; import com.github.steveice10.mc.protocol.data.game.entity.object.MinecartType;
import com.github.steveice10.mc.protocol.data.game.entity.type.object.ObjectType;
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; 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.CollisionRule;
import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; 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(Effect.class, Integer.class);
this.register(EntityStatus.class, Integer.class); this.register(EntityStatus.class, Integer.class);
this.register(PositionElement.class, Integer.class); this.register(PositionElement.class, Integer.class);
this.register(GlobalEntityType.class, Integer.class); this.register(WeatherEntityType.class, Integer.class);
this.register(MobType.class, Integer.class); this.register(EntityType.class, Integer.class);
this.register(ObjectType.class, Integer.class);
this.register(MinecartType.class, Integer.class); this.register(MinecartType.class, Integer.class);
this.register(HangingDirection.class, Integer.class); this.register(HangingDirection.class, Integer.class);
this.register(PaintingType.class, Integer.class); this.register(PaintingType.class, Integer.class);