From ea99836709d282d85f3dd7ef3da72b2318f9d0c9 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Sat, 22 Aug 2015 16:55:29 -0700 Subject: [PATCH] Update entity types. --- .../mc/protocol/data/game/values/MagicValues.java | 8 ++++++++ .../protocol/data/game/values/entity/MobType.java | 5 +++-- .../data/game/values/entity/ObjectType.java | 9 ++++++--- .../data/game/values/entity/ProjectileData.java | 13 ++----------- .../entity/spawn/ServerSpawnObjectPacket.java | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/values/MagicValues.java b/src/main/java/org/spacehq/mc/protocol/data/game/values/MagicValues.java index bad18422..ed6422db 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/values/MagicValues.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/values/MagicValues.java @@ -282,6 +282,8 @@ public class MagicValues { register(GlobalEntityType.LIGHTNING_BOLT, 1); register(MobType.ARMOR_STAND, 30); + register(MobType.MOB, 48); + register(MobType.MONSTER, 49); register(MobType.CREEPER, 50); register(MobType.SKELETON, 51); register(MobType.SPIDER, 52); @@ -301,6 +303,7 @@ public class MagicValues { register(MobType.WITCH, 66); register(MobType.ENDERMITE, 67); register(MobType.GUARDIAN, 68); + register(MobType.SHULKER, 69); register(MobType.PIG, 90); register(MobType.SHEEP, 91); register(MobType.COW, 92); @@ -317,6 +320,7 @@ public class MagicValues { register(ObjectType.BOAT, 1); register(ObjectType.ITEM, 2); + register(ObjectType.AREA_EFFECT_CLOUD, 3); register(ObjectType.MINECART, 10); register(ObjectType.PRIMED_TNT, 50); register(ObjectType.ENDER_CRYSTAL, 51); @@ -327,6 +331,7 @@ public class MagicValues { register(ObjectType.BLAZE_FIREBALL, 64); register(ObjectType.ENDER_PEARL, 65); register(ObjectType.WITHER_HEAD_PROJECTILE, 66); + register(ObjectType.SHULKER_BULLET, 67); register(ObjectType.FALLING_BLOCK, 70); register(ObjectType.ITEM_FRAME, 71); register(ObjectType.EYE_OF_ENDER, 72); @@ -337,6 +342,9 @@ public class MagicValues { register(ObjectType.LEASH_KNOT, 77); register(ObjectType.ARMOR_STAND, 78); register(ObjectType.FISH_HOOK, 90); + register(ObjectType.SPECTRAL_ARROW, 91); + register(ObjectType.TIPPED_ARROW, 92); + register(ObjectType.DRAGON_FIREBALL, 93); register(MinecartType.NORMAL, 0); register(MinecartType.CHEST, 1); diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/MobType.java b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/MobType.java index df52a97b..fdbb5033 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/MobType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/MobType.java @@ -1,8 +1,9 @@ package org.spacehq.mc.protocol.data.game.values.entity; public enum MobType { - ARMOR_STAND, + MOB, + MONSTER, CREEPER, SKELETON, SPIDER, @@ -22,6 +23,7 @@ public enum MobType { WITCH, ENDERMITE, GUARDIAN, + SHULKER, PIG, SHEEP, COW, @@ -35,5 +37,4 @@ public enum MobType { HORSE, RABBIT, VILLAGER; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ObjectType.java b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ObjectType.java index 20770ce1..bd07d768 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ObjectType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ObjectType.java @@ -1,9 +1,9 @@ package org.spacehq.mc.protocol.data.game.values.entity; public enum ObjectType { - BOAT, ITEM, + AREA_EFFECT_CLOUD, MINECART, PRIMED_TNT, ENDER_CRYSTAL, @@ -14,6 +14,7 @@ public enum ObjectType { BLAZE_FIREBALL, ENDER_PEARL, WITHER_HEAD_PROJECTILE, + SHULKER_BULLET, FALLING_BLOCK, ITEM_FRAME, EYE_OF_ENDER, @@ -23,6 +24,8 @@ public enum ObjectType { FIREWORK_ROCKET, LEASH_KNOT, ARMOR_STAND, - FISH_HOOK; - + FISH_HOOK, + SPECTRAL_ARROW, + TIPPED_ARROW, + DRAGON_FIREBALL; } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ProjectileData.java b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ProjectileData.java index 2594a344..4f1ad95e 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ProjectileData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/values/entity/ProjectileData.java @@ -1,7 +1,6 @@ package org.spacehq.mc.protocol.data.game.values.entity; public class ProjectileData implements ObjectData { - private int ownerId; public ProjectileData(int ownerId) { @@ -14,19 +13,11 @@ public class ProjectileData implements ObjectData { @Override public boolean equals(Object o) { - if(this == o) return true; - if(o == null || getClass() != o.getClass()) return false; - - ProjectileData that = (ProjectileData) o; - - if(ownerId != that.ownerId) return false; - - return true; + return this == o || (o instanceof ProjectileData && this.ownerId == ((ProjectileData) o).ownerId); } @Override public int hashCode() { - return ownerId; + return this.ownerId; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java index dd1a06f0..d962e1b3 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java @@ -130,7 +130,7 @@ public class ServerSpawnObjectPacket implements Packet { this.data = new FallingBlockData(data & 65535, data >> 16); } else if(this.type == ObjectType.POTION) { this.data = new SplashPotionData(data); - } else if(this.type == ObjectType.ARROW || this.type == ObjectType.BLAZE_FIREBALL || this.type == ObjectType.FISH_HOOK || this.type == ObjectType.GHAST_FIREBALL || this.type == ObjectType.WITHER_HEAD_PROJECTILE) { + } else if(this.type == ObjectType.ARROW || this.type == ObjectType.SPECTRAL_ARROW || this.type == ObjectType.TIPPED_ARROW || this.type == ObjectType.GHAST_FIREBALL || this.type == ObjectType.BLAZE_FIREBALL || this.type == ObjectType.DRAGON_FIREBALL || this.type == ObjectType.WITHER_HEAD_PROJECTILE || this.type == ObjectType.FISH_HOOK) { this.data = new ProjectileData(data); } else { this.data = new ObjectData() {