From eee8573395ed11af3d41dbed3ec042f9cad79fe0 Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Wed, 29 Aug 2018 20:00:33 -0700 Subject: [PATCH] Update to 1.13.1, fix entity IDs. --- pom.xml | 2 +- .../mc/protocol/MinecraftConstants.java | 4 +- .../mc/protocol/data/MagicValues.java | 108 ++++++++++-------- .../data/game/entity/type/MobType.java | 97 ++++++++-------- .../game/entity/type/object/ObjectType.java | 3 +- .../ingame/server/ServerBossBarPacket.java | 30 +++-- 6 files changed, 136 insertions(+), 108 deletions(-) diff --git a/pom.xml b/pom.xml index 1b586b18..5e40d4a7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.steveice10 mcprotocollib - 1.13-1-SNAPSHOT + 1.13.1-1-SNAPSHOT jar MCProtocolLib diff --git a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java index 4118f9ef..69276591 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java +++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java @@ -2,8 +2,8 @@ package com.github.steveice10.mc.protocol; public class MinecraftConstants { // General Constants - public static final String GAME_VERSION = "1.13"; - public static final int PROTOCOL_VERSION = 393; + public static final String GAME_VERSION = "1.13.1"; + public static final int PROTOCOL_VERSION = 401; // General Key Constants public static final String PROFILE_KEY = "profile"; 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 ca9a35d7..85b27c7b 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 @@ -334,56 +334,63 @@ public class MagicValues { register(GlobalEntityType.LIGHTNING_BOLT, 1); - register(MobType.ELDER_GUARDIAN, 4); - register(MobType.WITHER_SKELETON, 5); - register(MobType.STRAY, 6); - register(MobType.HUSK, 23); - register(MobType.ZOMBIE_VILLAGER, 27); - register(MobType.SKELETON_HORSE, 28); - register(MobType.ZOMBIE_HORSE, 29); - register(MobType.ARMOR_STAND, 30); - register(MobType.DONKEY, 31); - register(MobType.MULE, 32); - register(MobType.EVOCATION_ILLAGER, 34); - register(MobType.VEX, 35); - register(MobType.VINDICATION_ILLAGER, 36); - register(MobType.ILLUSION_ILLAGER, 37); - register(MobType.CREEPER, 50); - register(MobType.SKELETON, 51); - register(MobType.SPIDER, 52); - register(MobType.GIANT_ZOMBIE, 53); - register(MobType.ZOMBIE, 54); - register(MobType.SLIME, 55); - register(MobType.GHAST, 56); - register(MobType.ZOMBIE_PIGMAN, 57); - register(MobType.ENDERMAN, 58); - register(MobType.CAVE_SPIDER, 59); - register(MobType.SILVERFISH, 60); - register(MobType.BLAZE, 61); - register(MobType.MAGMA_CUBE, 62); - register(MobType.ENDER_DRAGON, 63); - register(MobType.WITHER, 64); - register(MobType.BAT, 65); - 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); - register(MobType.CHICKEN, 93); - register(MobType.SQUID, 94); - register(MobType.WOLF, 95); - register(MobType.MOOSHROOM, 96); - register(MobType.SNOWMAN, 97); - register(MobType.OCELOT, 98); - register(MobType.IRON_GOLEM, 99); - register(MobType.HORSE, 100); - register(MobType.RABBIT, 101); - register(MobType.POLAR_BEAR, 102); - register(MobType.LLAMA, 103); - register(MobType.PARROT, 105); - register(MobType.VILLAGER, 120); + register(MobType.BAT, 3); + register(MobType.BLAZE, 4); + register(MobType.CAVE_SPIDER, 6); + register(MobType.CHICKEN, 7); + register(MobType.COD, 8); + register(MobType.COW, 9); + register(MobType.CREEPER, 10); + register(MobType.DONKEY, 11); + register(MobType.DOLPHIN, 12); + register(MobType.DROWNED, 14); + register(MobType.ELDER_GUARDIAN, 15); + register(MobType.ENDER_DRAGON, 17); + register(MobType.ENDERMAN, 18); + register(MobType.ENDERMITE, 19); + register(MobType.EVOCATION_ILLAGER, 21); + register(MobType.GHAST, 26); + register(MobType.GIANT_ZOMBIE, 27); + register(MobType.GUARDIAN, 28); + register(MobType.HORSE, 29); + register(MobType.HUSK, 30); + register(MobType.ILLUSION_ILLAGER, 31); + register(MobType.LLAMA, 36); + register(MobType.MAGMA_CUBE, 38); + register(MobType.MULE, 46); + register(MobType.MOOSHROOM, 47); + register(MobType.OCELOT, 48); + register(MobType.PARROT, 50); + register(MobType.PIG, 51); + register(MobType.PUFFERFISH, 52); + register(MobType.ZOMBIE_PIGMAN, 53); + register(MobType.POLAR_BEAR, 54); + register(MobType.RABBIT, 56); + register(MobType.SALMON, 57); + register(MobType.SHEEP, 58); + register(MobType.SHULKER, 59); + register(MobType.SILVERFISH, 61); + register(MobType.SKELETON, 62); + register(MobType.SKELETON_HORSE, 63); + register(MobType.SLIME, 64); + register(MobType.SNOWMAN, 66); + register(MobType.SPIDER, 69); + register(MobType.SQUID, 70); + register(MobType.STRAY, 71); + register(MobType.TROPICAL_FISH, 72); + register(MobType.TURTLE, 73); + register(MobType.VEX, 78); + register(MobType.VILLAGER, 79); + register(MobType.IRON_GOLEM, 80); + register(MobType.VINDICATION_ILLAGER, 81); + register(MobType.WITCH, 82); + register(MobType.WITHER, 83); + register(MobType.WITHER_SKELETON, 84); + register(MobType.WOLF, 86); + register(MobType.ZOMBIE, 87); + register(MobType.ZOMBIE_HORSE, 88); + register(MobType.ZOMBIE_VILLAGER, 89); + register(MobType.PHANTOM, 90); register(ObjectType.BOAT, 1); register(ObjectType.ITEM, 2); @@ -412,6 +419,7 @@ public class MagicValues { register(ObjectType.FISH_HOOK, 90); register(ObjectType.SPECTRAL_ARROW, 91); register(ObjectType.DRAGON_FIREBALL, 93); + register(ObjectType.TRIDENT, 94); register(MinecartType.NORMAL, 0); register(MinecartType.CHEST, 1); 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/MobType.java index de3d28a8..4b214178 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/MobType.java @@ -1,54 +1,61 @@ package com.github.steveice10.mc.protocol.data.game.entity.type; public enum MobType { - ELDER_GUARDIAN, - WITHER_SKELETON, - STRAY, - HUSK, - ZOMBIE_VILLAGER, - SKELETON_HORSE, - ZOMBIE_HORSE, - ARMOR_STAND, - DONKEY, - MULE, - EVOCATION_ILLAGER, - VEX, - VINDICATION_ILLAGER, - ILLUSION_ILLAGER, - CREEPER, - SKELETON, - SPIDER, - GIANT_ZOMBIE, - ZOMBIE, - SLIME, - GHAST, - ZOMBIE_PIGMAN, - ENDERMAN, - CAVE_SPIDER, - SILVERFISH, - BLAZE, - MAGMA_CUBE, - ENDER_DRAGON, - WITHER, BAT, - WITCH, - ENDERMITE, - GUARDIAN, - SHULKER, - PIG, - SHEEP, - COW, + BLAZE, + CAVE_SPIDER, CHICKEN, - SQUID, - WOLF, - MOOSHROOM, - SNOWMAN, - OCELOT, - IRON_GOLEM, + COD, + COW, + CREEPER, + DONKEY, + DOLPHIN, + DROWNED, + ELDER_GUARDIAN, + ENDER_DRAGON, + ENDERMAN, + ENDERMITE, + EVOCATION_ILLAGER, + GHAST, + GIANT_ZOMBIE, + GUARDIAN, HORSE, - RABBIT, - POLAR_BEAR, + HUSK, + ILLUSION_ILLAGER, LLAMA, + MAGMA_CUBE, + MULE, + MOOSHROOM, + OCELOT, PARROT, - VILLAGER; + PIG, + PUFFERFISH, + ZOMBIE_PIGMAN, + POLAR_BEAR, + RABBIT, + SALMON, + SHEEP, + SHULKER, + SILVERFISH, + SKELETON, + SKELETON_HORSE, + SLIME, + SNOWMAN, + SPIDER, + SQUID, + STRAY, + TROPICAL_FISH, + TURTLE, + VEX, + VILLAGER, + IRON_GOLEM, + VINDICATION_ILLAGER, + WITCH, + WITHER, + WITHER_SKELETON, + WOLF, + ZOMBIE, + ZOMBIE_HORSE, + ZOMBIE_VILLAGER, + PHANTOM; } 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 index fdcac8fe..31cffb62 100644 --- 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 @@ -27,5 +27,6 @@ public enum ObjectType { FISH_HOOK, SPECTRAL_ARROW, TIPPED_ARROW, - DRAGON_FIREBALL; + DRAGON_FIREBALL, + TRIDENT; } diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerBossBarPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerBossBarPacket.java index 31be52e2..9b53d308 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerBossBarPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerBossBarPacket.java @@ -21,13 +21,14 @@ public class ServerBossBarPacket extends MinecraftPacket { private BossBarColor color; private BossBarDivision division; private boolean darkenSky; - private boolean dragonBar; + private boolean playEndMusic; + private boolean showFog; @SuppressWarnings("unused") private ServerBossBarPacket() { } - public ServerBossBarPacket(UUID uuid, BossBarAction action, Message title, float health, BossBarColor color, BossBarDivision division, boolean darkenSky, boolean dragonBar) { + public ServerBossBarPacket(UUID uuid, BossBarAction action, Message title, float health, BossBarColor color, BossBarDivision division, boolean darkenSky, boolean playEndMusic, boolean showFog) { this.uuid = uuid; this.action = BossBarAction.ADD; @@ -36,7 +37,8 @@ public class ServerBossBarPacket extends MinecraftPacket { this.color = color; this.division = division; this.darkenSky = darkenSky; - this.dragonBar = dragonBar; + this.playEndMusic = playEndMusic; + this.showFog = showFog; } public ServerBossBarPacket(UUID uuid) { @@ -66,12 +68,13 @@ public class ServerBossBarPacket extends MinecraftPacket { this.division = division; } - public ServerBossBarPacket(UUID uuid, BossBarAction action, boolean darkenSky, boolean dragonBar) { + public ServerBossBarPacket(UUID uuid, BossBarAction action, boolean darkenSky, boolean playEndMusic, boolean showFog) { this.uuid = uuid; this.action = BossBarAction.UPDATE_FLAGS; this.darkenSky = darkenSky; - this.dragonBar = dragonBar; + this.playEndMusic = playEndMusic; + this.showFog = showFog; } public UUID getUUID() { @@ -102,8 +105,12 @@ public class ServerBossBarPacket extends MinecraftPacket { return this.darkenSky; } - public boolean isDragonBar() { - return this.dragonBar; + public boolean shouldPlayEndMusic() { + return this.playEndMusic; + } + + public boolean shouldShowFog() { + return this.showFog; } @Override @@ -127,7 +134,8 @@ public class ServerBossBarPacket extends MinecraftPacket { if(this.action == BossBarAction.ADD || this.action == BossBarAction.UPDATE_FLAGS) { int flags = in.readUnsignedByte(); this.darkenSky = (flags & 0x1) == 0x1; - this.dragonBar = (flags & 0x2) == 0x2; + this.playEndMusic = (flags & 0x2) == 0x2; + this.showFog = (flags & 0x4) == 0x4; } } @@ -155,10 +163,14 @@ public class ServerBossBarPacket extends MinecraftPacket { flags |= 0x1; } - if(this.dragonBar) { + if(this.playEndMusic) { flags |= 0x2; } + if(this.showFog) { + flags |= 0x4; + } + out.writeByte(flags); } }