This commit is contained in:
Steven Smith 2016-03-03 18:32:08 -08:00
parent 0adb269ae1
commit 97c0a69294
33 changed files with 1200 additions and 238 deletions

View file

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.spacehq</groupId>
<artifactId>mcprotocollib</artifactId>
<version>15w39c-SNAPSHOT</version>
<version>1.9-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MCProtocolLib</name>

View file

@ -2,8 +2,8 @@ package org.spacehq.mc.protocol;
public class MinecraftConstants {
// General Constants
public static final String GAME_VERSION = "15w39c";
public static final int PROTOCOL_VERSION = 74;
public static final String GAME_VERSION = "1.9";
public static final int PROTOCOL_VERSION = 107;
// General Key Constants
public static final String PROFILE_KEY = "profile";

View file

@ -12,9 +12,9 @@ import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket;
import org.spacehq.mc.protocol.packet.ingame.client.ClientResourcePackStatusPacket;
import org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket;
import org.spacehq.mc.protocol.packet.ingame.client.ClientTabCompletePacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
@ -22,16 +22,19 @@ import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionP
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientSpectatePacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientSteerVehiclePacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientEnchantItemPacket;
import org.spacehq.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientSpectatePacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientSteerBoatPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientSteerVehiclePacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
import org.spacehq.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerBossBarPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerCombatPacket;
@ -44,16 +47,15 @@ import org.spacehq.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerResourcePackSendPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerRespawnPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerSetCompressionPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerSetCooldownPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerStatisticsPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerSwitchCameraPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerTabCompletePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerTitlePacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityAnimationPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityCollectItemPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityDestroyPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket;
@ -64,15 +66,17 @@ import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionR
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerVehicleMovePacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerUseBedPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerUseBedPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnGlobalEntityPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket;
@ -99,6 +103,7 @@ import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiBlockChange
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundEventPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
@ -336,23 +341,23 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(22, ServerSetSlotPacket.class);
this.registerIncoming(23, ServerSetCooldownPacket.class);
this.registerIncoming(24, ServerPluginMessagePacket.class);
this.registerIncoming(25, ServerDisconnectPacket.class);
this.registerIncoming(26, ServerEntityStatusPacket.class);
this.registerIncoming(27, ServerExplosionPacket.class);
this.registerIncoming(28, ServerUnloadChunkPacket.class);
this.registerIncoming(29, ServerSetCompressionPacket.class);
this.registerIncoming(25, ServerPlaySoundPacket.class);
this.registerIncoming(26, ServerDisconnectPacket.class);
this.registerIncoming(27, ServerEntityStatusPacket.class);
this.registerIncoming(28, ServerExplosionPacket.class);
this.registerIncoming(29, ServerUnloadChunkPacket.class);
this.registerIncoming(30, ServerNotifyClientPacket.class);
this.registerIncoming(31, ServerKeepAlivePacket.class);
this.registerIncoming(32, ServerChunkDataPacket.class);
this.registerIncoming(33, ServerPlayEffectPacket.class);
this.registerIncoming(34, ServerSpawnParticlePacket.class);
this.registerIncoming(35, ServerPlaySoundPacket.class);
this.registerIncoming(36, ServerJoinGamePacket.class);
this.registerIncoming(37, ServerMapDataPacket.class);
this.registerIncoming(38, ServerEntityPositionPacket.class);
this.registerIncoming(39, ServerEntityPositionRotationPacket.class);
this.registerIncoming(40, ServerEntityRotationPacket.class);
this.registerIncoming(41, ServerEntityMovementPacket.class);
this.registerIncoming(35, ServerJoinGamePacket.class);
this.registerIncoming(36, ServerMapDataPacket.class);
this.registerIncoming(37, ServerEntityPositionPacket.class);
this.registerIncoming(38, ServerEntityPositionRotationPacket.class);
this.registerIncoming(39, ServerEntityRotationPacket.class);
this.registerIncoming(40, ServerEntityMovementPacket.class);
this.registerIncoming(41, ServerVehicleMovePacket.class);
this.registerIncoming(42, ServerOpenTileEntityEditorPacket.class);
this.registerIncoming(43, ServerPlayerAbilitiesPacket.class);
this.registerIncoming(44, ServerCombatPacket.class);
@ -375,75 +380,83 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(61, ServerPlayerSetExperiencePacket.class);
this.registerIncoming(62, ServerPlayerHealthPacket.class);
this.registerIncoming(63, ServerScoreboardObjectivePacket.class);
this.registerIncoming(64, ServerTeamPacket.class);
this.registerIncoming(65, ServerUpdateScorePacket.class);
this.registerIncoming(66, ServerSpawnPositionPacket.class);
this.registerIncoming(67, ServerUpdateTimePacket.class);
this.registerIncoming(68, ServerTitlePacket.class);
this.registerIncoming(69, ServerUpdateSignPacket.class);
this.registerIncoming(70, ServerPlayerListDataPacket.class);
this.registerIncoming(71, ServerEntityCollectItemPacket.class);
this.registerIncoming(72, ServerEntityTeleportPacket.class);
this.registerIncoming(73, ServerEntityPropertiesPacket.class);
this.registerIncoming(74, ServerEntityEffectPacket.class);
this.registerIncoming(64, ServerEntitySetPassengersPacket.class);
this.registerIncoming(65, ServerTeamPacket.class);
this.registerIncoming(66, ServerUpdateScorePacket.class);
this.registerIncoming(67, ServerSpawnPositionPacket.class);
this.registerIncoming(68, ServerUpdateTimePacket.class);
this.registerIncoming(69, ServerTitlePacket.class);
this.registerIncoming(70, ServerUpdateSignPacket.class);
this.registerIncoming(71, ServerPlaySoundEventPacket.class);
this.registerIncoming(72, ServerPlayerListDataPacket.class);
this.registerIncoming(73, ServerEntityCollectItemPacket.class);
this.registerIncoming(74, ServerEntityTeleportPacket.class);
this.registerIncoming(75, ServerEntityPropertiesPacket.class);
this.registerIncoming(76, ServerEntityEffectPacket.class);
this.registerOutgoing(0, ClientTabCompletePacket.class);
this.registerOutgoing(1, ClientChatPacket.class);
this.registerOutgoing(2, ClientRequestPacket.class);
this.registerOutgoing(3, ClientSettingsPacket.class);
this.registerOutgoing(4, ClientConfirmTransactionPacket.class);
this.registerOutgoing(5, ClientEnchantItemPacket.class);
this.registerOutgoing(6, ClientWindowActionPacket.class);
this.registerOutgoing(7, ClientCloseWindowPacket.class);
this.registerOutgoing(8, ClientPluginMessagePacket.class);
this.registerOutgoing(9, ClientPlayerInteractEntityPacket.class);
this.registerOutgoing(10, ClientKeepAlivePacket.class);
this.registerOutgoing(11, ClientPlayerPositionPacket.class);
this.registerOutgoing(12, ClientPlayerPositionRotationPacket.class);
this.registerOutgoing(13, ClientPlayerRotationPacket.class);
this.registerOutgoing(14, ClientPlayerMovementPacket.class);
this.registerOutgoing(15, ClientPlayerAbilitiesPacket.class);
this.registerOutgoing(16, ClientPlayerActionPacket.class);
this.registerOutgoing(17, ClientPlayerStatePacket.class);
this.registerOutgoing(18, ClientSteerVehiclePacket.class);
this.registerOutgoing(19, ClientResourcePackStatusPacket.class);
this.registerOutgoing(20, ClientPlayerChangeHeldItemPacket.class);
this.registerOutgoing(21, ClientCreativeInventoryActionPacket.class);
this.registerOutgoing(22, ClientUpdateSignPacket.class);
this.registerOutgoing(23, ClientPlayerSwingArmPacket.class);
this.registerOutgoing(24, ClientSpectatePacket.class);
this.registerOutgoing(25, ClientPlayerPlaceBlockPacket.class);
this.registerOutgoing(26, ClientPlayerUseItemPacket.class);
this.registerOutgoing(0, ClientTeleportConfirmPacket.class);
this.registerOutgoing(1, ClientTabCompletePacket.class);
this.registerOutgoing(2, ClientChatPacket.class);
this.registerOutgoing(3, ClientRequestPacket.class);
this.registerOutgoing(4, ClientSettingsPacket.class);
this.registerOutgoing(5, ClientConfirmTransactionPacket.class);
this.registerOutgoing(6, ClientEnchantItemPacket.class);
this.registerOutgoing(7, ClientWindowActionPacket.class);
this.registerOutgoing(8, ClientCloseWindowPacket.class);
this.registerOutgoing(9, ClientPluginMessagePacket.class);
this.registerOutgoing(10, ClientPlayerInteractEntityPacket.class);
this.registerOutgoing(11, ClientKeepAlivePacket.class);
this.registerOutgoing(12, ClientPlayerPositionPacket.class);
this.registerOutgoing(13, ClientPlayerPositionRotationPacket.class);
this.registerOutgoing(14, ClientPlayerRotationPacket.class);
this.registerOutgoing(15, ClientPlayerMovementPacket.class);
this.registerOutgoing(16, ClientVehicleMovePacket.class);
this.registerOutgoing(17, ClientSteerBoatPacket.class);
this.registerOutgoing(18, ClientPlayerAbilitiesPacket.class);
this.registerOutgoing(19, ClientPlayerActionPacket.class);
this.registerOutgoing(20, ClientPlayerStatePacket.class);
this.registerOutgoing(21, ClientSteerVehiclePacket.class);
this.registerOutgoing(22, ClientResourcePackStatusPacket.class);
this.registerOutgoing(23, ClientPlayerChangeHeldItemPacket.class);
this.registerOutgoing(24, ClientCreativeInventoryActionPacket.class);
this.registerOutgoing(25, ClientUpdateSignPacket.class);
this.registerOutgoing(26, ClientPlayerSwingArmPacket.class);
this.registerOutgoing(27, ClientSpectatePacket.class);
this.registerOutgoing(28, ClientPlayerPlaceBlockPacket.class);
this.registerOutgoing(29, ClientPlayerUseItemPacket.class);
}
private void initServerGame(Session session) {
this.registerIncoming(0, ClientTabCompletePacket.class);
this.registerIncoming(1, ClientChatPacket.class);
this.registerIncoming(2, ClientRequestPacket.class);
this.registerIncoming(3, ClientSettingsPacket.class);
this.registerIncoming(4, ClientConfirmTransactionPacket.class);
this.registerIncoming(5, ClientEnchantItemPacket.class);
this.registerIncoming(6, ClientWindowActionPacket.class);
this.registerIncoming(7, ClientCloseWindowPacket.class);
this.registerIncoming(8, ClientPluginMessagePacket.class);
this.registerIncoming(9, ClientPlayerInteractEntityPacket.class);
this.registerIncoming(10, ClientKeepAlivePacket.class);
this.registerIncoming(11, ClientPlayerPositionPacket.class);
this.registerIncoming(12, ClientPlayerPositionRotationPacket.class);
this.registerIncoming(13, ClientPlayerRotationPacket.class);
this.registerIncoming(14, ClientPlayerMovementPacket.class);
this.registerIncoming(15, ClientPlayerAbilitiesPacket.class);
this.registerIncoming(16, ClientPlayerActionPacket.class);
this.registerIncoming(17, ClientPlayerStatePacket.class);
this.registerIncoming(18, ClientSteerVehiclePacket.class);
this.registerIncoming(19, ClientResourcePackStatusPacket.class);
this.registerIncoming(20, ClientPlayerChangeHeldItemPacket.class);
this.registerIncoming(21, ClientCreativeInventoryActionPacket.class);
this.registerIncoming(22, ClientUpdateSignPacket.class);
this.registerIncoming(23, ClientPlayerSwingArmPacket.class);
this.registerIncoming(24, ClientSpectatePacket.class);
this.registerIncoming(25, ClientPlayerPlaceBlockPacket.class);
this.registerIncoming(26, ClientPlayerUseItemPacket.class);
this.registerIncoming(0, ClientTeleportConfirmPacket.class);
this.registerIncoming(1, ClientTabCompletePacket.class);
this.registerIncoming(2, ClientChatPacket.class);
this.registerIncoming(3, ClientRequestPacket.class);
this.registerIncoming(4, ClientSettingsPacket.class);
this.registerIncoming(5, ClientConfirmTransactionPacket.class);
this.registerIncoming(6, ClientEnchantItemPacket.class);
this.registerIncoming(7, ClientWindowActionPacket.class);
this.registerIncoming(8, ClientCloseWindowPacket.class);
this.registerIncoming(9, ClientPluginMessagePacket.class);
this.registerIncoming(10, ClientPlayerInteractEntityPacket.class);
this.registerIncoming(11, ClientKeepAlivePacket.class);
this.registerIncoming(12, ClientPlayerPositionPacket.class);
this.registerIncoming(13, ClientPlayerPositionRotationPacket.class);
this.registerIncoming(14, ClientPlayerRotationPacket.class);
this.registerIncoming(15, ClientPlayerMovementPacket.class);
this.registerIncoming(16, ClientVehicleMovePacket.class);
this.registerIncoming(17, ClientSteerBoatPacket.class);
this.registerIncoming(18, ClientPlayerAbilitiesPacket.class);
this.registerIncoming(19, ClientPlayerActionPacket.class);
this.registerIncoming(20, ClientPlayerStatePacket.class);
this.registerIncoming(21, ClientSteerVehiclePacket.class);
this.registerIncoming(22, ClientResourcePackStatusPacket.class);
this.registerIncoming(23, ClientPlayerChangeHeldItemPacket.class);
this.registerIncoming(24, ClientCreativeInventoryActionPacket.class);
this.registerIncoming(25, ClientUpdateSignPacket.class);
this.registerIncoming(26, ClientPlayerSwingArmPacket.class);
this.registerIncoming(27, ClientSpectatePacket.class);
this.registerIncoming(28, ClientPlayerPlaceBlockPacket.class);
this.registerIncoming(29, ClientPlayerUseItemPacket.class);
this.registerOutgoing(0, ServerSpawnObjectPacket.class);
this.registerOutgoing(1, ServerSpawnExpOrbPacket.class);
@ -470,23 +483,23 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(22, ServerSetSlotPacket.class);
this.registerOutgoing(23, ServerSetCooldownPacket.class);
this.registerOutgoing(24, ServerPluginMessagePacket.class);
this.registerOutgoing(25, ServerDisconnectPacket.class);
this.registerOutgoing(26, ServerEntityStatusPacket.class);
this.registerOutgoing(27, ServerExplosionPacket.class);
this.registerOutgoing(28, ServerUnloadChunkPacket.class);
this.registerOutgoing(29, ServerSetCompressionPacket.class);
this.registerOutgoing(25, ServerPlaySoundPacket.class);
this.registerOutgoing(26, ServerDisconnectPacket.class);
this.registerOutgoing(27, ServerEntityStatusPacket.class);
this.registerOutgoing(28, ServerExplosionPacket.class);
this.registerOutgoing(29, ServerUnloadChunkPacket.class);
this.registerOutgoing(30, ServerNotifyClientPacket.class);
this.registerOutgoing(31, ServerKeepAlivePacket.class);
this.registerOutgoing(32, ServerChunkDataPacket.class);
this.registerOutgoing(33, ServerPlayEffectPacket.class);
this.registerOutgoing(34, ServerSpawnParticlePacket.class);
this.registerOutgoing(35, ServerPlaySoundPacket.class);
this.registerOutgoing(36, ServerJoinGamePacket.class);
this.registerOutgoing(37, ServerMapDataPacket.class);
this.registerOutgoing(38, ServerEntityPositionPacket.class);
this.registerOutgoing(39, ServerEntityPositionRotationPacket.class);
this.registerOutgoing(40, ServerEntityRotationPacket.class);
this.registerOutgoing(41, ServerEntityMovementPacket.class);
this.registerOutgoing(35, ServerJoinGamePacket.class);
this.registerOutgoing(36, ServerMapDataPacket.class);
this.registerOutgoing(37, ServerEntityPositionPacket.class);
this.registerOutgoing(38, ServerEntityPositionRotationPacket.class);
this.registerOutgoing(39, ServerEntityRotationPacket.class);
this.registerOutgoing(40, ServerEntityMovementPacket.class);
this.registerOutgoing(41, ServerVehicleMovePacket.class);
this.registerOutgoing(42, ServerOpenTileEntityEditorPacket.class);
this.registerOutgoing(43, ServerPlayerAbilitiesPacket.class);
this.registerOutgoing(44, ServerCombatPacket.class);
@ -509,17 +522,19 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(61, ServerPlayerSetExperiencePacket.class);
this.registerOutgoing(62, ServerPlayerHealthPacket.class);
this.registerOutgoing(63, ServerScoreboardObjectivePacket.class);
this.registerOutgoing(64, ServerTeamPacket.class);
this.registerOutgoing(65, ServerUpdateScorePacket.class);
this.registerOutgoing(66, ServerSpawnPositionPacket.class);
this.registerOutgoing(67, ServerUpdateTimePacket.class);
this.registerOutgoing(68, ServerTitlePacket.class);
this.registerOutgoing(69, ServerUpdateSignPacket.class);
this.registerOutgoing(70, ServerPlayerListDataPacket.class);
this.registerOutgoing(71, ServerEntityCollectItemPacket.class);
this.registerOutgoing(72, ServerEntityTeleportPacket.class);
this.registerOutgoing(73, ServerEntityPropertiesPacket.class);
this.registerOutgoing(74, ServerEntityEffectPacket.class);
this.registerOutgoing(64, ServerEntitySetPassengersPacket.class);
this.registerOutgoing(65, ServerTeamPacket.class);
this.registerOutgoing(66, ServerUpdateScorePacket.class);
this.registerOutgoing(67, ServerSpawnPositionPacket.class);
this.registerOutgoing(68, ServerUpdateTimePacket.class);
this.registerOutgoing(69, ServerTitlePacket.class);
this.registerOutgoing(70, ServerUpdateSignPacket.class);
this.registerOutgoing(71, ServerPlaySoundEventPacket.class);
this.registerOutgoing(72, ServerPlayerListDataPacket.class);
this.registerOutgoing(73, ServerEntityCollectItemPacket.class);
this.registerOutgoing(74, ServerEntityTeleportPacket.class);
this.registerOutgoing(75, ServerEntityPropertiesPacket.class);
this.registerOutgoing(76, ServerEntityEffectPacket.class);
}
private void initClientStatus(Session session) {

View file

@ -0,0 +1,9 @@
package org.spacehq.mc.protocol.data.game;
public enum BossBarDivision {
NONE,
NOTCHES_6,
NOTCHES_10,
NOTCHES_12,
NOTCHES_20;
}

View file

@ -1,27 +1,27 @@
package org.spacehq.mc.protocol.data.game;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.entity.type.PaintingType;
import org.spacehq.mc.protocol.data.game.entity.attribute.AttributeType;
import org.spacehq.mc.protocol.data.game.entity.Effect;
import org.spacehq.mc.protocol.data.game.entity.EntityStatus;
import org.spacehq.mc.protocol.data.game.entity.EquipmentSlot;
import org.spacehq.mc.protocol.data.game.entity.type.GlobalEntityType;
import org.spacehq.mc.protocol.data.game.entity.type.object.HangingDirection;
import org.spacehq.mc.protocol.data.game.entity.metadata.MetadataType;
import org.spacehq.mc.protocol.data.game.entity.type.object.MinecartType;
import org.spacehq.mc.protocol.data.game.entity.type.MobType;
import org.spacehq.mc.protocol.data.game.entity.attribute.AttributeType;
import org.spacehq.mc.protocol.data.game.entity.attribute.ModifierOperation;
import org.spacehq.mc.protocol.data.game.entity.attribute.ModifierType;
import org.spacehq.mc.protocol.data.game.entity.type.object.ObjectType;
import org.spacehq.mc.protocol.data.game.entity.metadata.MetadataType;
import org.spacehq.mc.protocol.data.game.entity.player.Animation;
import org.spacehq.mc.protocol.data.game.entity.player.BlockBreakStage;
import org.spacehq.mc.protocol.data.game.entity.player.CombatState;
import org.spacehq.mc.protocol.data.game.entity.player.GameMode;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.entity.player.InteractAction;
import org.spacehq.mc.protocol.data.game.entity.player.PlayerAction;
import org.spacehq.mc.protocol.data.game.entity.player.PlayerState;
import org.spacehq.mc.protocol.data.game.entity.player.PositionElement;
import org.spacehq.mc.protocol.data.game.entity.type.GlobalEntityType;
import org.spacehq.mc.protocol.data.game.entity.type.MobType;
import org.spacehq.mc.protocol.data.game.entity.type.PaintingType;
import org.spacehq.mc.protocol.data.game.entity.type.object.HangingDirection;
import org.spacehq.mc.protocol.data.game.entity.type.object.MinecartType;
import org.spacehq.mc.protocol.data.game.entity.type.object.ObjectType;
import org.spacehq.mc.protocol.data.game.scoreboard.CollisionRule;
import org.spacehq.mc.protocol.data.game.scoreboard.NameTagVisibility;
import org.spacehq.mc.protocol.data.game.scoreboard.ObjectiveAction;
@ -47,7 +47,6 @@ import org.spacehq.mc.protocol.data.game.window.property.AnvilProperty;
import org.spacehq.mc.protocol.data.game.window.property.BrewingStandProperty;
import org.spacehq.mc.protocol.data.game.window.property.EnchantmentTableProperty;
import org.spacehq.mc.protocol.data.game.window.property.FurnaceProperty;
import org.spacehq.mc.protocol.data.game.world.GenericSound;
import org.spacehq.mc.protocol.data.game.world.Particle;
import org.spacehq.mc.protocol.data.game.world.WorldBorderAction;
import org.spacehq.mc.protocol.data.game.world.WorldType;
@ -64,6 +63,9 @@ import org.spacehq.mc.protocol.data.game.world.effect.SmokeEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.SoundEffect;
import org.spacehq.mc.protocol.data.game.world.notify.ClientNotification;
import org.spacehq.mc.protocol.data.game.world.notify.DemoMessageValue;
import org.spacehq.mc.protocol.data.game.world.sound.GenericSound;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.mc.protocol.data.game.world.sound.SoundEvent;
import java.util.HashMap;
import java.util.Map;
@ -97,6 +99,15 @@ public class MagicValues {
register(ModifierType.SLOW_POTION_MODIFIER, UUID.fromString("7107DE5E-7CE8-4030-940E-514C1F160890"));
register(ModifierType.STRENGTH_POTION_MODIFIER, UUID.fromString("648D7064-6A60-4F59-8ABE-C2C23A6DD7A9"));
register(ModifierType.WEAKNESS_POTION_MODIFIER, UUID.fromString("22653B89-116E-49DC-9B6B-9971489B5BE5"));
register(ModifierType.HASTE_POTION_MODIFIER, UUID.fromString("AF8B6E3F-3328-4C0A-AA36-5BA2BB9DBEF3"));
register(ModifierType.MINING_FATIGUE_POTION_MODIFIER, UUID.fromString("55FCED67-E92A-486E-9800-B47F202C4386"));
register(ModifierType.LUCK_POTION_MODIFIER, UUID.fromString("03C3C89D-7037-4B42-869F-B146BCB64D2E"));
register(ModifierType.UNLUCK_POTION_MODIFIER, UUID.fromString("CC5AF142-2BD2-4215-B636-2605AED11727"));
register(ModifierType.BOOTS_MODIFIER, UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"));
register(ModifierType.LEGGINGS_MODIFIER, UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"));
register(ModifierType.CHESTPLATE_MODIFIER, UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"));
register(ModifierType.HELMET_MODIFIER, UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150"));
register(ModifierType.COVERED_ARMOR_BONUS, UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F"));
register(ModifierOperation.ADD, 0);
register(ModifierOperation.ADD_MULTIPLIED, 1);
@ -926,6 +937,12 @@ public class MagicValues {
register(BossBarColor.PURPLE, 5);
register(BossBarColor.WHITE, 6);
register(BossBarDivision.NONE, 0);
register(BossBarDivision.NOTCHES_6, 1);
register(BossBarDivision.NOTCHES_10, 2);
register(BossBarDivision.NOTCHES_12, 3);
register(BossBarDivision.NOTCHES_20, 4);
register(BlockFace.DOWN, 0);
register(BlockFace.UP, 1);
register(BlockFace.NORTH, 2);
@ -939,6 +956,22 @@ public class MagicValues {
register(EquipmentSlot.LEGGINGS, 3);
register(EquipmentSlot.CHESTPLATE, 4);
register(EquipmentSlot.HELMET, 5);
register(SoundCategory.MASTER, 0);
register(SoundCategory.MUSIC, 1);
register(SoundCategory.RECORD, 2);
register(SoundCategory.WEATHER, 3);
register(SoundCategory.BLOCK, 4);
register(SoundCategory.HOSTILE, 5);
register(SoundCategory.NEUTRAL, 6);
register(SoundCategory.PLAYER, 7);
register(SoundCategory.AMBIENT, 8);
register(SoundCategory.VOICE, 9);
int soundEventId = 0;
for(SoundEvent event : SoundEvent.values()) {
register(event, soundEventId++);
}
}
private static void register(Enum<?> key, Object value) {
@ -962,7 +995,7 @@ public class MagicValues {
}
}
throw new IllegalArgumentException("Value " + value + " has no mapping for key class " + keyType + ".");
throw new IllegalArgumentException("Value " + value + " has no mapping for key class " + keyType.getName() + ".");
}
@SuppressWarnings("unchecked")
@ -988,7 +1021,7 @@ public class MagicValues {
}
}
throw new IllegalArgumentException("Key " + key + " has no mapping for value class " + valueType + ".");
throw new IllegalArgumentException("Key " + key + " has no mapping for value class " + valueType.getName() + ".");
}
}

View file

@ -12,6 +12,10 @@ public class AttributeModifier {
private ModifierOperation operation;
public AttributeModifier(ModifierType type, double amount, ModifierOperation operation) {
if(type == ModifierType.DYNAMIC) {
throw new IllegalArgumentException("Cannot create a dynamic-typed modifier without a UUID.");
}
this.type = type;
this.uuid = MagicValues.value(UUID.class, type);
this.amount = amount;
@ -19,7 +23,12 @@ public class AttributeModifier {
}
public AttributeModifier(UUID uuid, double amount, ModifierOperation operation) {
try {
this.type = MagicValues.key(ModifierType.class, uuid);
} catch(IllegalArgumentException e) {
this.type = ModifierType.DYNAMIC;
}
this.uuid = uuid;
this.amount = amount;
this.operation = operation;
@ -50,7 +59,7 @@ public class AttributeModifier {
if(Double.compare(that.amount, amount) != 0) return false;
if(operation != that.operation) return false;
if(type != that.type) return false;
if(!type.equals(that.type)) return false;
return true;
}

View file

@ -1,6 +1,7 @@
package org.spacehq.mc.protocol.data.game.entity.attribute;
public enum ModifierType {
DYNAMIC,
CREATURE_FLEE_SPEED_BONUS,
ENDERMAN_ATTACK_SPEED_BOOST,
@ -14,6 +15,14 @@ public enum ModifierType {
HEALTH_BOOST_POTION_MODIFIER,
SLOW_POTION_MODIFIER,
STRENGTH_POTION_MODIFIER,
WEAKNESS_POTION_MODIFIER;
WEAKNESS_POTION_MODIFIER,
HASTE_POTION_MODIFIER,
MINING_FATIGUE_POTION_MODIFIER,
LUCK_POTION_MODIFIER,
UNLUCK_POTION_MODIFIER,
BOOTS_MODIFIER,
LEGGINGS_MODIFIER,
CHESTPLATE_MODIFIER,
HELMET_MODIFIER,
COVERED_ARMOR_BONUS;
}

View file

@ -1,4 +0,0 @@
package org.spacehq.mc.protocol.data.game.world;
public interface Sound {
}

View file

@ -1,4 +1,4 @@
package org.spacehq.mc.protocol.data.game.world;
package org.spacehq.mc.protocol.data.game.world.sound;
public class CustomSound implements Sound {

View file

@ -1,4 +1,4 @@
package org.spacehq.mc.protocol.data.game.world;
package org.spacehq.mc.protocol.data.game.world.sound;
public enum GenericSound implements Sound {

View file

@ -0,0 +1,4 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public interface Sound {
}

View file

@ -0,0 +1,14 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public enum SoundCategory {
MASTER,
MUSIC,
RECORD,
WEATHER,
BLOCK,
HOSTILE,
NEUTRAL,
PLAYER,
AMBIENT,
VOICE;
}

View file

@ -0,0 +1,436 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public enum SoundEvent {
AMBIENT_CAVE,
BLOCK_ANVIL_BREAK,
BLOCK_ANVIL_DESTROY,
BLOCK_ANVIL_FALL,
BLOCK_ANVIL_HIT,
BLOCK_ANVIL_LAND,
BLOCK_ANVIL_PLACE,
BLOCK_ANVIL_STEP,
BLOCK_ANVIL_USE,
BLOCK_BREWING_STAND_BREW,
BLOCK_CHEST_CLOSE,
BLOCK_CHEST_LOCKED,
BLOCK_CHEST_OPEN,
BLOCK_CHORUS_FLOWER_DEATH,
BLOCK_CHORUS_FLOWER_GROW,
BLOCK_CLOTH_BREAK,
BLOCK_CLOTH_FALL,
BLOCK_CLOTH_HIT,
BLOCK_CLOTH_PLACE,
BLOCK_CLOTH_STEP,
BLOCK_COMPARATOR_CLICK,
BLOCK_DISPENSER_DISPENSE,
BLOCK_DISPENSER_FAIL,
BLOCK_DISPENSER_LAUNCH,
BLOCK_END_GATEWAY_SPAWN,
BLOCK_ENDERCHEST_CLOSE,
BLOCK_ENDERCHEST_OPEN,
BLOCK_FENCE_GATE_CLOSE,
BLOCK_FENCE_GATE_OPEN,
BLOCK_FIRE_AMBIENT,
BLOCK_FIRE_EXTINGUISH,
BLOCK_FURNACE_FIRE_CRACKLE,
BLOCK_GLASS_BREAK,
BLOCK_GLASS_FALL,
BLOCK_GLASS_HIT,
BLOCK_GLASS_PLACE,
BLOCK_GLASS_STEP,
BLOCK_GRASS_BREAK,
BLOCK_GRASS_FALL,
BLOCK_GRASS_HIT,
BLOCK_GRASS_PLACE,
BLOCK_GRASS_STEP,
BLOCK_GRAVEL_BREAK,
BLOCK_GRAVEL_FALL,
BLOCK_GRAVEL_HIT,
BLOCK_GRAVEL_PLACE,
BLOCK_GRAVEL_STEP,
BLOCK_IRON_DOOR_CLOSE,
BLOCK_IRON_DOOR_OPEN,
BLOCK_IRON_TRAPDOOR_CLOSE,
BLOCK_IRON_TRAPDOOR_OPEN,
BLOCK_LADDER_BREAK,
BLOCK_LADDER_FALL,
BLOCK_LADDER_HIT,
BLOCK_LADDER_PLACE,
BLOCK_LADDER_STEP,
BLOCK_LAVA_AMBIENT,
BLOCK_LAVA_EXTINGUISH,
BLOCK_LAVA_POP,
BLOCK_LEVER_CLICK,
BLOCK_METAL_BREAK,
BLOCK_METAL_FALL,
BLOCK_METAL_HIT,
BLOCK_METAL_PLACE,
BLOCK_METAL_STEP,
BLOCK_METAL_PRESSUREPLATE_CLICK_OFF,
BLOCK_METAL_PRESSUREPLATE_CLICK_ON,
BLOCK_NOTE_BASEDRUM,
BLOCK_NOTE_BASS,
BLOCK_NOTE_HARP,
BLOCK_NOTE_HAT,
BLOCK_NOTE_SNARE,
BLOCK_PISTON_CONTRACT,
BLOCK_PISTON_EXTEND,
BLOCK_PORTAL_AMBIENT,
BLOCK_PORTAL_TRAVEL,
BLOCK_PORTAL_TRIGGER,
BLOCK_REDSTONE_TORCH_BURNOUT,
BLOCK_SAND_BREAK,
BLOCK_SAND_FALL,
BLOCK_SAND_HIT,
BLOCK_SAND_PLACE,
BLOCK_SAND_STEP,
BLOCK_SLIME_BREAK,
BLOCK_SLIME_FALL,
BLOCK_SLIME_HIT,
BLOCK_SLIME_PLACE,
BLOCK_SLIME_STEP,
BLOCK_SNOW_BREAK,
BLOCK_SNOW_FALL,
BLOCK_SNOW_HIT,
BLOCK_SNOW_PLACE,
BLOCK_SNOW_STEP,
BLOCK_STONE_BREAK,
BLOCK_STONE_FALL,
BLOCK_STONE_HIT,
BLOCK_STONE_PLACE,
BLOCK_STONE_STEP,
BLOCK_STONE_BUTTON_CLICK_OFF,
BLOCK_STONE_BUTTON_CLICK_ON,
BLOCK_STONE_PRESSUREPLATE_CLICK_OFF,
BLOCK_STONE_PRESSUREPLATE_CLICK_ON,
BLOCK_TRIPWIRE_ATTACH,
BLOCK_TRIPWIRE_CLICK_OFF,
BLOCK_TRIPWIRE_CLICK_ON,
BLOCK_TRIPWIRE_DETACH,
BLOCK_WATER_AMBIENT,
BLOCK_WATERLILY_PLACE,
BLOCK_WOOD_BREAK,
BLOCK_WOOD_FALL,
BLOCK_WOOD_HIT,
BLOCK_WOOD_PLACE,
BLOCK_WOOD_STEP,
BLOCK_WOOD_BUTTON_CLICK_OFF,
BLOCK_WOOD_BUTTON_CLICK_ON,
BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF,
BLOCK_WOOD_PRESSUREPLATE_CLICK_ON,
BLOCK_WOODEN_DOOR_CLOSE,
BLOCK_WOODEN_DOOR_OPEN,
BLOCK_WOODEN_TRAPDOOR_CLOSE,
BLOCK_WOODEN_TRAPDOOR_OPEN,
ENCHANT_THORNS_HIT,
ENTITY_ARMORSTAND_BREAK,
ENTITY_ARMORSTAND_FALL,
ENTITY_ARMORSTAND_HIT,
ENTITY_ARMORSTAND_PLACE,
ENTITY_ARROW_HIT,
ENTITY_ARROW_HIT_PLAYER,
ENTITY_ARROW_SHOOT,
ENTITY_BAT_AMBIENT,
ENTITY_BAT_DEATH,
ENTITY_BAT_HURT,
ENTITY_BAT_TAKEOFF,
ENTITY_BLAZE_AMBIENT,
ENTITY_BLAZE_BURN,
ENTITY_BLAZE_DEATH,
ENTITY_BLAZE_HURT,
ENTITY_BLAZE_SHOOT,
ENTITY_BOBBER_SPLASH,
ENTITY_BOBBER_THROW,
ENTITY_CAT_AMBIENT,
ENTITY_CAT_DEATH,
ENTITY_CAT_HURT,
ENTITY_CAT_PURR,
ENTITY_CAT_PURREOW,
ENTITY_CHICKEN_AMBIENT,
ENTITY_CHICKEN_DEATH,
ENTITY_CHICKEN_EGG,
ENTITY_CHICKEN_HURT,
ENTITY_CHICKEN_STEP,
ENTITY_COW_AMBIENT,
ENTITY_COW_DEATH,
ENTITY_COW_HURT,
ENTITY_COW_MILK,
ENTITY_COW_STEP,
ENTITY_CREEPER_DEATH,
ENTITY_CREEPER_HURT,
ENTITY_CREEPER_PRIMED,
ENTITY_DONKEY_AMBIENT,
ENTITY_DONKEY_ANGRY,
ENTITY_DONKEY_CHEST,
ENTITY_DONKEY_DEATH,
ENTITY_DONKEY_HURT,
ENTITY_EGG_THROW,
ENTITY_ELDER_GUARDIAN_AMBIENT,
ENTITY_ELDER_GUARDIAN_AMBIENT_LAND,
ENTITY_ELDER_GUARDIAN_CURSE,
ENTITY_ELDER_GUARDIAN_DEATH,
ENTITY_ELDER_GUARDIAN_DEATH_LAND,
ENTITY_ELDER_GUARDIAN_HURT,
ENTITY_ELDER_GUARDIAN_HURT_LAND,
ENTITY_ENDERDRAGON_AMBIENT,
ENTITY_ENDERDRAGON_DEATH,
ENTITY_ENDERDRAGON_FLAP,
ENTITY_ENDERDRAGON_GROWL,
ENTITY_ENDERDRAGON_HURT,
ENTITY_ENDERDRAGON_SHOOT,
ENTITY_ENDERDRAGON_FIREBALL_EXPLODE,
ENTITY_ENDEREYE_LAUNCH,
ENTITY_ENDERMEN_AMBIENT,
ENTITY_ENDERMEN_DEATH,
ENTITY_ENDERMEN_HURT,
ENTITY_ENDERMEN_SCREAM,
ENTITY_ENDERMEN_STARE,
ENTITY_ENDERMEN_TELEPORT,
ENTITY_ENDERMITE_AMBIENT,
ENTITY_ENDERMITE_DEATH,
ENTITY_ENDERMITE_HURT,
ENTITY_ENDERMITE_STEP,
ENTITY_ENDERPEARL_THROW,
ENTITY_EXPERIENCE_BOTTLE_THROW,
ENTITY_EXPERIENCE_ORB_PICKUP,
ENTITY_EXPERIENCE_ORB_TOUCH,
ENTITY_FIREWORK_BLAST,
ENTITY_FIREWORK_BLAST_FAR,
ENTITY_FIREWORK_LARGE_BLAST,
ENTITY_FIREWORK_LARGE_BLAST_FAR,
ENTITY_FIREWORK_LAUNCH,
ENTITY_FIREWORK_SHOOT,
ENTITY_FIREWORK_TWINKLE,
ENTITY_FIREWORK_TWINKLE_FAR,
ENTITY_GENERIC_BIG_FALL,
ENTITY_GENERIC_BURN,
ENTITY_GENERIC_DEATH,
ENTITY_GENERIC_DRINK,
ENTITY_GENERIC_EAT,
ENTITY_GENERIC_EXPLODE,
ENTITY_GENERIC_EXTINGUISH_FIRE,
ENTITY_GENERIC_HURT,
ENTITY_GENERIC_SMALL_FALL,
ENTITY_GENERIC_SPLASH,
ENTITY_GENERIC_SWIM,
ENTITY_GHAST_AMBIENT,
ENTITY_GHAST_DEATH,
ENTITY_GHAST_HURT,
ENTITY_GHAST_SHOOT,
ENTITY_GHAST_WARN,
ENTITY_GUARDIAN_AMBIENT,
ENTITY_GUARDIAN_AMBIENT_LAND,
ENTITY_GUARDIAN_ATTACK,
ENTITY_GUARDIAN_DEATH,
ENTITY_GUARDIAN_DEATH_LAND,
ENTITY_GUARDIAN_FLOP,
ENTITY_GUARDIAN_HURT,
ENTITY_GUARDIAN_HURT_LAND,
ENTITY_HORSE_AMBIENT,
ENTITY_HORSE_ANGRY,
ENTITY_HORSE_ARMOR,
ENTITY_HORSE_BREATHE,
ENTITY_HORSE_DEATH,
ENTITY_HORSE_EAT,
ENTITY_HORSE_GALLOP,
ENTITY_HORSE_HURT,
ENTITY_HORSE_JUMP,
ENTITY_HORSE_LAND,
ENTITY_HORSE_SADDLE,
ENTITY_HORSE_STEP,
ENTITY_HORSE_STEP_WOOD,
ENTITY_HOSTILE_BIG_FALL,
ENTITY_HOSTILE_DEATH,
ENTITY_HOSTILE_HURT,
ENTITY_HOSTILE_SMALL_FALL,
ENTITY_HOSTILE_SPLASH,
ENTITY_HOSTILE_SWIM,
ENTITY_IRONGOLEM_ATTACK,
ENTITY_IRONGOLEM_DEATH,
ENTITY_IRONGOLEM_HURT,
ENTITY_IRONGOLEM_STEP,
ENTITY_ITEM_BREAK,
ENTITY_ITEM_PICKUP,
ENTITY_ITEMFRAME_ADD_ITEM,
ENTITY_ITEMFRAME_BREAK,
ENTITY_ITEMFRAME_PLACE,
ENTITY_ITEMFRAME_REMOVE_ITEM,
ENTITY_ITEMFRAME_ROTATE_ITEM,
ENTITY_LEASHKNOT_BREAK,
ENTITY_LEASHKNOT_PLACE,
ENTITY_LIGHTNING_IMPACT,
ENTITY_LIGHTNING_THUNDER,
ENTITY_LINGERINGPOTION_THROW,
ENTITY_MAGMACUBE_DEATH,
ENTITY_MAGMACUBE_HURT,
ENTITY_MAGMACUBE_JUMP,
ENTITY_MAGMACUBE_SQUISH,
ENTITY_MINECART_INSIDE,
ENTITY_MINECART_RIDING,
ENTITY_MOOSHROOM_SHEAR,
ENTITY_MULE_AMBIENT,
ENTITY_MULE_DEATH,
ENTITY_MULE_HURT,
ENTITY_PAINTING_BREAK,
ENTITY_PAINTING_PLACE,
ENTITY_PIG_AMBIENT,
ENTITY_PIG_DEATH,
ENTITY_PIG_HURT,
ENTITY_PIG_SADDLE,
ENTITY_PIG_STEP,
ENTITY_PLAYER_ATTACK_CRIT,
ENTITY_PLAYER_ATTACK_KNOCKBACK,
ENTITY_PLAYER_ATTACK_NODAMAGE,
ENTITY_PLAYER_ATTACK_STRONG,
ENTITY_PLAYER_ATTACK_SWEEP,
ENTITY_PLAYER_ATTACK_WEAK,
ENTITY_PLAYER_BIG_FALL,
ENTITY_PLAYER_BURP,
ENTITY_PLAYER_DEATH,
ENTITY_PLAYER_HURT,
ENTITY_PLAYER_LEVELUP,
ENTITY_PLAYER_SMALL_FALL,
ENTITY_PLAYER_SPLASH,
ENTITY_PLAYER_SWIM,
ENTITY_RABBIT_AMBIENT,
ENTITY_RABBIT_ATTACK,
ENTITY_RABBIT_DEATH,
ENTITY_RABBIT_HURT,
ENTITY_RABBIT_JUMP,
ENTITY_SHEEP_AMBIENT,
ENTITY_SHEEP_DEATH,
ENTITY_SHEEP_HURT,
ENTITY_SHEEP_SHEAR,
ENTITY_SHEEP_STEP,
ENTITY_SHIELD_BLOCK,
ENTITY_SHIELD_BREAK,
ENTITY_SHULKER_AMBIENT,
ENTITY_SHULKER_CLOSE,
ENTITY_SHULKER_DEATH,
ENTITY_SHULKER_HURT,
ENTITY_SHULKER_HURT_CLOSED,
ENTITY_SHULKER_OPEN,
ENTITY_SHULKER_SHOOT,
ENTITY_SHULKER_TELEPORT,
ENTITY_SHULKER_BULLET_HIT,
ENTITY_SHULKER_BULLET_HURT,
ENTITY_SILVERFISH_AMBIENT,
ENTITY_SILVERFISH_DEATH,
ENTITY_SILVERFISH_HURT,
ENTITY_SILVERFISH_STEP,
ENTITY_SKELETON_AMBIENT,
ENTITY_SKELETON_DEATH,
ENTITY_SKELETON_HURT,
ENTITY_SKELETON_SHOOT,
ENTITY_SKELETON_STEP,
ENTITY_SKELETON_HORSE_AMBIENT,
ENTITY_SKELETON_HORSE_DEATH,
ENTITY_SKELETON_HORSE_HURT,
ENTITY_SLIME_ATTACK,
ENTITY_SLIME_DEATH,
ENTITY_SLIME_HURT,
ENTITY_SLIME_JUMP,
ENTITY_SLIME_SQUISH,
ENTITY_SMALL_MAGMACUBE_DEATH,
ENTITY_SMALL_MAGMACUBE_HURT,
ENTITY_SMALL_MAGMACUBE_SQUISH,
ENTITY_SMALL_SLIME_DEATH,
ENTITY_SMALL_SLIME_HURT,
ENTITY_SMALL_SLIME_SQUISH,
ENTITY_SNOWBALL_THROW,
ENTITY_SNOWMAN_AMBIENT,
ENTITY_SNOWMAN_DEATH,
ENTITY_SNOWMAN_HURT,
ENTITY_SNOWMAN_SHOOT,
ENTITY_SPIDER_AMBIENT,
ENTITY_SPIDER_DEATH,
ENTITY_SPIDER_HURT,
ENTITY_SPIDER_STEP,
ENTITY_SPLASH_POTION_BREAK,
ENTITY_SPLASH_POTION_THROW,
ENTITY_SQUID_AMBIENT,
ENTITY_SQUID_DEATH,
ENTITY_SQUID_HURT,
ENTITY_TNT_PRIMED,
ENTITY_VILLAGER_AMBIENT,
ENTITY_VILLAGER_DEATH,
ENTITY_VILLAGER_HURT,
ENTITY_VILLAGER_NO,
ENTITY_VILLAGER_TRADING,
ENTITY_VILLAGER_YES,
ENTITY_WITCH_AMBIENT,
ENTITY_WITCH_DEATH,
ENTITY_WITCH_DRINK,
ENTITY_WITCH_HURT,
ENTITY_WITCH_THROW,
ENTITY_WITHER_AMBIENT,
ENTITY_WITHER_BREAK_BLOCK,
ENTITY_WITHER_DEATH,
ENTITY_WITHER_HURT,
ENTITY_WITHER_SHOOT,
ENTITY_WITHER_SPAWN,
ENTITY_WOLF_AMBIENT,
ENTITY_WOLF_DEATH,
ENTITY_WOLF_GROWL,
ENTITY_WOLF_HURT,
ENTITY_WOLF_PANT,
ENTITY_WOLF_SHAKE,
ENTITY_WOLF_STEP,
ENTITY_WOLF_WHINE,
ENTITY_ZOMBIE_AMBIENT,
ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
ENTITY_ZOMBIE_ATTACK_IRON_DOOR,
ENTITY_ZOMBIE_BREAK_DOOR_WOOD,
ENTITY_ZOMBIE_CURE,
ENTITY_ZOMBIE_DEATH,
ENTITY_ZOMBIE_HURT,
ENTITY_ZOMBIE_INFECT,
ENTITY_ZOMBIE_STEP,
ENTITY_ZOMBIE_UNFECT,
ENTITY_ZOMBIE_HORSE_AMBIENT,
ENTITY_ZOMBIE_HORSE_DEATH,
ENTITY_ZOMBIE_HORSE_HURT,
ENTITY_ZOMBIE_PIG_AMBIENT,
ENTITY_ZOMBIE_PIG_ANGRY,
ENTITY_ZOMBIE_PIG_DEATH,
ENTITY_ZOMBIE_PIG_HURT,
ITEM_ARMOR_EQUIP_CHAIN,
ITEM_ARMOR_EQUIP_DIAMOND,
ITEM_ARMOR_EQUIP_GENERIC,
ITEM_ARMOR_EQUIP_GOLD,
ITEM_ARMOR_EQUIP_IRON,
ITEM_ARMOR_EQUIP_LEATHER,
ITEM_BOTTLE_FILL,
ITEM_BOTTLE_FILL_DRAGONBREATH,
ITEM_BUCKET_EMPTY,
ITEM_BUCKET_EMPTY_LAVA,
ITEM_BUCKET_FILL,
ITEM_BUCKET_FILL_LAVA,
ITEM_CHORUS_FRUIT_TELEPORT,
ITEM_FIRECHARGE_USE,
ITEM_FLINTANDSTEEL_USE,
ITEM_HOE_TILL,
ITEM_SHOVEL_FLATTEN,
MUSIC_CREATIVE,
MUSIC_CREDITS,
MUSIC_DRAGON,
MUSIC_END,
MUSIC_GAME,
MUSIC_MENU,
MUSIC_NETHER,
RECORD_11,
RECORD_13,
RECORD_BLOCKS,
RECORD_CAT,
RECORD_CHIRP,
RECORD_FAR,
RECORD_MALL,
RECORD_MELLOHI,
RECORD_STAL,
RECORD_STRAD,
RECORD_WAIT,
RECORD_WARD,
UI_BUTTON_CLICK,
WEATHER_RAIN,
WEATHER_RAIN_ABOVE;
}

View file

@ -11,37 +11,49 @@ import java.io.IOException;
public class ClientTabCompletePacket implements Packet {
private String text;
private Position position;
private boolean assumeCommand;
private Position lookingAt;
@SuppressWarnings("unused")
private ClientTabCompletePacket() {
}
public ClientTabCompletePacket(String text) {
this(text, null);
public ClientTabCompletePacket(String text, boolean assumeCommand) {
this(text, assumeCommand, null);
}
public ClientTabCompletePacket(String text, Position position) {
public ClientTabCompletePacket(String text, boolean assumeCommand, Position lookingAt) {
this.text = text;
this.position = position;
this.assumeCommand = assumeCommand;
this.lookingAt = lookingAt;
}
public String getText() {
return this.text;
}
public boolean getAssumeCommand() {
return this.assumeCommand;
}
public Position getLookingAt() {
return this.lookingAt;
}
@Override
public void read(NetInput in) throws IOException {
this.text = in.readString();
this.position = in.readBoolean() ? NetUtil.readPosition(in) : null;
this.assumeCommand = in.readBoolean();
this.lookingAt = in.readBoolean() ? NetUtil.readPosition(in) : null;
}
@Override
public void write(NetOutput out) throws IOException {
out.writeString(this.text);
out.writeBoolean(this.position != null);
if(this.position != null) {
NetUtil.writePosition(out, this.position);
out.writeBoolean(this.assumeCommand);
out.writeBoolean(this.lookingAt != null);
if(this.lookingAt != null) {
NetUtil.writePosition(out, this.lookingAt);
}
}

View file

@ -0,0 +1,48 @@
package org.spacehq.mc.protocol.packet.ingame.client.world;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ClientSteerBoatPacket implements Packet {
private boolean unk1;
private boolean unk2;
@SuppressWarnings("unused")
private ClientSteerBoatPacket() {
}
public ClientSteerBoatPacket(boolean unk1, boolean unk2) {
this.unk1 = unk1;
this.unk2 = unk2;
}
public boolean getUnknown1() {
return this.unk1;
}
public boolean getUnknown2() {
return this.unk2;
}
@Override
public void read(NetInput in) throws IOException {
this.unk1 = in.readBoolean();
this.unk2 = in.readBoolean();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeBoolean(this.unk1);
out.writeBoolean(this.unk2);
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -0,0 +1,38 @@
package org.spacehq.mc.protocol.packet.ingame.client.world;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ClientTeleportConfirmPacket implements Packet {
private int id;
@SuppressWarnings("unused")
private ClientTeleportConfirmPacket() {
}
public ClientTeleportConfirmPacket(int id) {
this.id = id;
}
public int getTeleportId() {
return this.id;
}
@Override
public void read(NetInput in) throws IOException {
this.id = in.readVarInt();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.id);
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -0,0 +1,70 @@
package org.spacehq.mc.protocol.packet.ingame.client.world;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ClientVehicleMovePacket implements Packet {
private double x;
private double y;
private double z;
private float yaw;
private float pitch;
@SuppressWarnings("unused")
private ClientVehicleMovePacket() {
}
public ClientVehicleMovePacket(double x, double y, double z, float yaw, float pitch) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
public float getYaw() {
return this.yaw;
}
public float getPitch() {
return this.pitch;
}
@Override
public void read(NetInput in) throws IOException {
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.yaw = in.readFloat();
this.pitch = in.readFloat();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeFloat(this.yaw);
out.writeFloat(this.pitch);
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -2,6 +2,7 @@ package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.BossBarAction;
import org.spacehq.mc.protocol.data.game.BossBarColor;
import org.spacehq.mc.protocol.data.game.BossBarDivision;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.packetlib.io.NetInput;
@ -18,22 +19,24 @@ public class ServerBossBarPacket implements Packet {
private Message title;
private float health;
private BossBarColor color;
private int dividers;
private int flags;
private BossBarDivision division;
private boolean darkenSky;
private boolean dragonBar;
@SuppressWarnings("unused")
private ServerBossBarPacket() {
}
public ServerBossBarPacket(UUID uuid, BossBarAction action, Message title, float health, BossBarColor color, int dividers, int flags) {
public ServerBossBarPacket(UUID uuid, BossBarAction action, Message title, float health, BossBarColor color, BossBarDivision division, boolean darkenSky, boolean dragonBar) {
this.uuid = uuid;
this.action = BossBarAction.ADD;
this.title = title;
this.health = health;
this.color = color;
this.dividers = dividers;
this.flags = flags;
this.division = division;
this.darkenSky = darkenSky;
this.dragonBar = dragonBar;
}
public ServerBossBarPacket(UUID uuid) {
@ -55,19 +58,20 @@ public class ServerBossBarPacket implements Packet {
this.title = title;
}
public ServerBossBarPacket(UUID uuid, BossBarAction action, BossBarColor color, int dividers) {
public ServerBossBarPacket(UUID uuid, BossBarAction action, BossBarColor color, BossBarDivision division) {
this.uuid = uuid;
this.action = BossBarAction.UPDATE_STYLE;
this.color = color;
this.dividers = dividers;
this.division = division;
}
public ServerBossBarPacket(UUID uuid, BossBarAction action, int flags) {
public ServerBossBarPacket(UUID uuid, BossBarAction action, boolean darkenSky, boolean dragonBar) {
this.uuid = uuid;
this.action = BossBarAction.UPDATE_FLAGS;
this.flags = flags;
this.darkenSky = darkenSky;
this.dragonBar = dragonBar;
}
public UUID getUUID() {
@ -90,12 +94,16 @@ public class ServerBossBarPacket implements Packet {
return this.color;
}
public int getDividers() {
return this.dividers;
public BossBarDivision getDivision() {
return this.division;
}
public int getFlags() {
return this.flags;
public boolean getDarkenSky() {
return this.darkenSky;
}
public boolean isDragonBar() {
return this.dragonBar;
}
@Override
@ -113,11 +121,13 @@ public class ServerBossBarPacket implements Packet {
if(this.action == BossBarAction.ADD || this.action == BossBarAction.UPDATE_STYLE) {
this.color = MagicValues.key(BossBarColor.class, in.readVarInt());
this.dividers = in.readVarInt();
this.division = MagicValues.key(BossBarDivision.class, in.readVarInt());
}
if(this.action == BossBarAction.ADD || this.action == BossBarAction.UPDATE_FLAGS) {
this.flags = in.readUnsignedByte();
int flags = in.readUnsignedByte();
this.darkenSky = (flags & 0x1) == 0x1;
this.dragonBar = (flags & 0x2) == 0x2;
}
}
@ -136,11 +146,20 @@ public class ServerBossBarPacket implements Packet {
if(this.action == BossBarAction.ADD || this.action == BossBarAction.UPDATE_STYLE) {
out.writeVarInt(MagicValues.value(Integer.class, this.color));
out.writeVarInt(this.dividers);
out.writeVarInt(MagicValues.value(Integer.class, this.division));
}
if(this.action == BossBarAction.ADD || this.action == BossBarAction.UPDATE_FLAGS) {
out.writeByte(this.flags);
int flags = 0;
if(this.darkenSky) {
flags |= 0x1;
}
if(this.dragonBar) {
flags |= 0x2;
}
out.writeByte(flags);
}
}

View file

@ -10,16 +10,14 @@ public class ServerEntityAttachPacket implements Packet {
private int entityId;
private int attachedToId;
private boolean leash;
@SuppressWarnings("unused")
private ServerEntityAttachPacket() {
}
public ServerEntityAttachPacket(int entityId, int attachedToId, boolean leash) {
public ServerEntityAttachPacket(int entityId, int attachedToId) {
this.entityId = entityId;
this.attachedToId = attachedToId;
this.leash = leash;
}
public int getEntityId() {
@ -30,22 +28,16 @@ public class ServerEntityAttachPacket implements Packet {
return this.attachedToId;
}
public boolean getLeash() {
return this.leash;
}
@Override
public void read(NetInput in) throws IOException {
this.entityId = in.readInt();
this.attachedToId = in.readInt();
this.leash = in.readBoolean();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeInt(this.entityId);
out.writeInt(this.attachedToId);
out.writeBoolean(this.leash);
}
@Override

View file

@ -14,18 +14,20 @@ public class ServerEntityEffectPacket implements Packet {
private Effect effect;
private int amplifier;
private int duration;
private boolean hideParticles;
private boolean ambient;
private boolean showParticles;
@SuppressWarnings("unused")
private ServerEntityEffectPacket() {
}
public ServerEntityEffectPacket(int entityId, Effect effect, int amplifier, int duration, boolean hideParticles) {
public ServerEntityEffectPacket(int entityId, Effect effect, int amplifier, int duration, boolean ambient, boolean showParticles) {
this.entityId = entityId;
this.effect = effect;
this.amplifier = amplifier;
this.duration = duration;
this.hideParticles = hideParticles;
this.ambient = ambient;
this.showParticles = showParticles;
}
public int getEntityId() {
@ -44,8 +46,12 @@ public class ServerEntityEffectPacket implements Packet {
return this.duration;
}
public boolean getHideParticles() {
return this.hideParticles;
public boolean isAmbient() {
return this.ambient;
}
public boolean getShowParticles() {
return this.showParticles;
}
@Override
@ -54,7 +60,10 @@ public class ServerEntityEffectPacket implements Packet {
this.effect = MagicValues.key(Effect.class, in.readByte());
this.amplifier = in.readByte();
this.duration = in.readVarInt();
this.hideParticles = in.readBoolean();
int flags = in.readByte();
this.ambient = (flags & 0x1) == 0x1;
this.showParticles = (flags & 0x2) == 0x2;
}
@Override
@ -63,7 +72,17 @@ public class ServerEntityEffectPacket implements Packet {
out.writeByte(MagicValues.value(Integer.class, this.effect));
out.writeByte(this.amplifier);
out.writeVarInt(this.duration);
out.writeBoolean(this.hideParticles);
int flags = 0;
if(this.ambient) {
flags |= 0x1;
}
if(this.showParticles) {
flags |= 0x2;
}
out.writeByte(flags);
}
@Override

View file

@ -59,9 +59,9 @@ public class ServerEntityMovementPacket implements Packet {
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
if(this.pos) {
this.moveX = in.readByte() / 32D;
this.moveY = in.readByte() / 32D;
this.moveZ = in.readByte() / 32D;
this.moveX = in.readShort() / 4096D;
this.moveY = in.readShort() / 4096D;
this.moveZ = in.readShort() / 4096D;
}
if(this.rot) {
@ -78,9 +78,9 @@ public class ServerEntityMovementPacket implements Packet {
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
if(this.pos) {
out.writeByte((int) (this.moveX * 32));
out.writeByte((int) (this.moveY * 32));
out.writeByte((int) (this.moveZ * 32));
out.writeShort((int) (this.moveX * 4096));
out.writeShort((int) (this.moveY * 4096));
out.writeShort((int) (this.moveZ * 4096));
}
if(this.rot) {

View file

@ -0,0 +1,46 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ServerEntitySetPassengersPacket implements Packet {
private int entityIds[];
@SuppressWarnings("unused")
private ServerEntitySetPassengersPacket() {
}
public ServerEntitySetPassengersPacket(int... entityIds) {
this.entityIds = entityIds;
}
public int[] getEntityIds() {
return this.entityIds;
}
@Override
public void read(NetInput in) throws IOException {
this.entityIds = new int[in.readVarInt()];
for(int index = 0; index < this.entityIds.length; index++) {
this.entityIds[index] = in.readVarInt();
}
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityIds.length);
for(int entityId : this.entityIds) {
out.writeVarInt(entityId);
}
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -61,9 +61,9 @@ public class ServerEntityTeleportPacket implements Packet {
@Override
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
this.x = in.readInt() / 32D;
this.y = in.readInt() / 32D;
this.z = in.readInt() / 32D;
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.yaw = in.readByte() * 360 / 256f;
this.pitch = in.readByte() * 360 / 256f;
this.onGround = in.readBoolean();
@ -72,9 +72,9 @@ public class ServerEntityTeleportPacket implements Packet {
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
out.writeInt((int) (this.x * 32));
out.writeInt((int) (this.y * 32));
out.writeInt((int) (this.z * 32));
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeByte((byte) (this.yaw * 256 / 360));
out.writeByte((byte) (this.pitch * 256 / 360));
out.writeBoolean(this.onGround);

View file

@ -0,0 +1,70 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ServerVehicleMovePacket implements Packet {
private double x;
private double y;
private double z;
private float yaw;
private float pitch;
@SuppressWarnings("unused")
private ServerVehicleMovePacket() {
}
public ServerVehicleMovePacket(double x, double y, double z, float yaw, float pitch) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
public float getYaw() {
return this.yaw;
}
public float getPitch() {
return this.pitch;
}
@Override
public void read(NetInput in) throws IOException {
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.yaw = in.readFloat();
this.pitch = in.readFloat();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeFloat(this.yaw);
out.writeFloat(this.pitch);
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -19,22 +19,20 @@ public class ServerPlayerPositionRotationPacket implements Packet {
private float yaw;
private float pitch;
private List<PositionElement> relative;
private int teleportId;
@SuppressWarnings("unused")
private ServerPlayerPositionRotationPacket() {
}
public ServerPlayerPositionRotationPacket(double x, double y, double z, float yaw, float pitch) {
this(x, y, z, yaw, pitch, new PositionElement[0]);
}
public ServerPlayerPositionRotationPacket(double x, double y, double z, float yaw, float pitch, PositionElement... relative) {
public ServerPlayerPositionRotationPacket(double x, double y, double z, float yaw, float pitch, int teleportId, PositionElement... relative) {
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
this.relative = Arrays.asList(relative);
this.teleportId = teleportId;
this.relative = Arrays.asList(relative != null ? relative : new PositionElement[0]);
}
public double getX() {
@ -61,6 +59,10 @@ public class ServerPlayerPositionRotationPacket implements Packet {
return this.relative;
}
public int getTeleportId() {
return this.teleportId;
}
@Override
public void read(NetInput in) throws IOException {
this.x = in.readDouble();
@ -76,6 +78,8 @@ public class ServerPlayerPositionRotationPacket implements Packet {
this.relative.add(element);
}
}
this.teleportId = in.readVarInt();
}
@Override
@ -91,6 +95,7 @@ public class ServerPlayerPositionRotationPacket implements Packet {
}
out.writeByte(flags);
out.writeVarInt(this.teleportId);
}
@Override

View file

@ -49,18 +49,18 @@ public class ServerSpawnExpOrbPacket implements Packet {
@Override
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
this.x = in.readInt() / 32D;
this.y = in.readInt() / 32D;
this.z = in.readInt() / 32D;
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.exp = in.readShort();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
out.writeInt((int) (this.x * 32));
out.writeInt((int) (this.y * 32));
out.writeInt((int) (this.z * 32));
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeShort(this.exp);
}

View file

@ -12,15 +12,15 @@ public class ServerSpawnGlobalEntityPacket implements Packet {
private int entityId;
private GlobalEntityType type;
private int x;
private int y;
private int z;
private double x;
private double y;
private double z;
@SuppressWarnings("unused")
private ServerSpawnGlobalEntityPacket() {
}
public ServerSpawnGlobalEntityPacket(int entityId, GlobalEntityType type, int x, int y, int z) {
public ServerSpawnGlobalEntityPacket(int entityId, GlobalEntityType type, double x, double y, double z) {
this.entityId = entityId;
this.type = type;
this.x = x;
@ -36,15 +36,15 @@ public class ServerSpawnGlobalEntityPacket implements Packet {
return this.type;
}
public int getX() {
public double getX() {
return this.x;
}
public int getY() {
public double getY() {
return this.y;
}
public int getZ() {
public double getZ() {
return this.z;
}
@ -52,18 +52,18 @@ public class ServerSpawnGlobalEntityPacket implements Packet {
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
this.type = MagicValues.key(GlobalEntityType.class, in.readByte());
this.x = in.readInt();
this.y = in.readInt();
this.z = in.readInt();
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
out.writeByte(MagicValues.value(Integer.class, this.type));
out.writeInt(this.x);
out.writeInt(this.y);
out.writeInt(this.z);
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
}
@Override

View file

@ -104,9 +104,9 @@ public class ServerSpawnMobPacket implements Packet {
this.entityId = in.readVarInt();
this.uuid = in.readUUID();
this.type = MagicValues.key(MobType.class, in.readUnsignedByte());
this.x = in.readInt() / 32D;
this.y = in.readInt() / 32D;
this.z = in.readInt() / 32D;
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.yaw = in.readByte() * 360 / 256f;
this.pitch = in.readByte() * 360 / 256f;
this.headYaw = in.readByte() * 360 / 256f;
@ -121,9 +121,9 @@ public class ServerSpawnMobPacket implements Packet {
out.writeVarInt(this.entityId);
out.writeUUID(this.uuid);
out.writeByte(MagicValues.value(Integer.class, this.type));
out.writeInt((int) (this.x * 32));
out.writeInt((int) (this.y * 32));
out.writeInt((int) (this.z * 32));
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeByte((byte) (this.yaw * 256 / 360));
out.writeByte((byte) (this.pitch * 256 / 360));
out.writeByte((byte) (this.headYaw * 256 / 360));

View file

@ -114,9 +114,9 @@ public class ServerSpawnObjectPacket implements Packet {
this.entityId = in.readVarInt();
this.uuid = in.readUUID();
this.type = MagicValues.key(ObjectType.class, in.readByte());
this.x = in.readInt() / 32D;
this.y = in.readInt() / 32D;
this.z = in.readInt() / 32D;
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.pitch = in.readByte() * 360 / 256f;
this.yaw = in.readByte() * 360 / 256f;
@ -148,9 +148,9 @@ public class ServerSpawnObjectPacket implements Packet {
out.writeVarInt(this.entityId);
out.writeUUID(this.uuid);
out.writeByte(MagicValues.value(Integer.class, this.type));
out.writeInt((int) (this.x * 32));
out.writeInt((int) (this.y * 32));
out.writeInt((int) (this.z * 32));
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeByte((byte) (this.pitch * 256 / 360));
out.writeByte((byte) (this.yaw * 256 / 360));

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.entity.type.PaintingType;
import org.spacehq.mc.protocol.data.game.entity.type.object.HangingDirection;
import org.spacehq.mc.protocol.util.NetUtil;
@ -10,10 +10,12 @@ import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
import java.util.UUID;
public class ServerSpawnPaintingPacket implements Packet {
private int entityId;
private UUID uuid;
private PaintingType paintingType;
private Position position;
private HangingDirection direction;
@ -22,8 +24,9 @@ public class ServerSpawnPaintingPacket implements Packet {
private ServerSpawnPaintingPacket() {
}
public ServerSpawnPaintingPacket(int entityId, PaintingType paintingType, Position position, HangingDirection direction) {
public ServerSpawnPaintingPacket(int entityId, UUID uuid, PaintingType paintingType, Position position, HangingDirection direction) {
this.entityId = entityId;
this.uuid = uuid;
this.paintingType = paintingType;
this.position = position;
this.direction = direction;
@ -33,6 +36,10 @@ public class ServerSpawnPaintingPacket implements Packet {
return this.entityId;
}
public UUID getUUID() {
return this.uuid;
}
public PaintingType getPaintingType() {
return this.paintingType;
}
@ -48,6 +55,7 @@ public class ServerSpawnPaintingPacket implements Packet {
@Override
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
this.uuid = in.readUUID();
this.paintingType = MagicValues.key(PaintingType.class, in.readString());
this.position = NetUtil.readPosition(in);
this.direction = MagicValues.key(HangingDirection.class, in.readUnsignedByte());
@ -56,6 +64,7 @@ public class ServerSpawnPaintingPacket implements Packet {
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
out.writeUUID(this.uuid);
out.writeString(MagicValues.value(String.class, this.paintingType));
NetUtil.writePosition(out, this.position);
out.writeByte(MagicValues.value(Integer.class, this.direction));

View file

@ -71,9 +71,9 @@ public class ServerSpawnPlayerPacket implements Packet {
public void read(NetInput in) throws IOException {
this.entityId = in.readVarInt();
this.uuid = in.readUUID();
this.x = in.readInt() / 32D;
this.y = in.readInt() / 32D;
this.z = in.readInt() / 32D;
this.x = in.readDouble();
this.y = in.readDouble();
this.z = in.readDouble();
this.yaw = in.readByte() * 360 / 256f;
this.pitch = in.readByte() * 360 / 256f;
this.metadata = NetUtil.readEntityMetadata(in);
@ -83,9 +83,9 @@ public class ServerSpawnPlayerPacket implements Packet {
public void write(NetOutput out) throws IOException {
out.writeVarInt(this.entityId);
out.writeUUID(this.uuid);
out.writeInt((int) (this.x * 32));
out.writeInt((int) (this.y * 32));
out.writeInt((int) (this.z * 32));
out.writeDouble(this.x);
out.writeDouble(this.y);
out.writeDouble(this.z);
out.writeByte((byte) (this.yaw * 256 / 360));
out.writeByte((byte) (this.pitch * 256 / 360));
NetUtil.writeEntityMetadata(out, this.metadata);

View file

@ -0,0 +1,100 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.mc.protocol.data.game.world.sound.SoundEvent;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ServerPlaySoundEventPacket implements Packet {
private SoundEvent sound;
private SoundCategory category;
private double x;
private double y;
private double z;
private float volume;
private float pitch;
@SuppressWarnings("unused")
private ServerPlaySoundEventPacket() {
}
public ServerPlaySoundEventPacket(SoundEvent sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
this.sound = sound;
this.category = category;
this.x = x;
this.y = y;
this.z = z;
this.volume = volume;
this.pitch = pitch;
}
public SoundEvent getSound() {
return this.sound;
}
public SoundCategory getCategory() {
return this.category;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
public float getVolume() {
return this.volume;
}
public float getPitch() {
return this.pitch;
}
@Override
public void read(NetInput in) throws IOException {
this.sound = MagicValues.key(SoundEvent.class, in.readVarInt());
this.category = MagicValues.key(SoundCategory.class, in.readVarInt());
this.x = in.readInt() / 8D;
this.y = in.readInt() / 8D;
this.z = in.readInt() / 8D;
this.volume = in.readFloat();
this.pitch = in.readUnsignedByte() / 63.5f;
}
@Override
public void write(NetOutput out) throws IOException {
out.writeVarInt(MagicValues.value(Integer.class, this.sound));
out.writeVarInt(MagicValues.value(Integer.class, this.category));
out.writeInt((int) (this.x * 8));
out.writeInt((int) (this.y * 8));
out.writeInt((int) (this.z * 8));
out.writeFloat(this.volume);
int pitch = (int) (this.pitch * 63.5f);
if(pitch > 255) {
pitch = 255;
}
if(pitch < 0) {
pitch = 0;
}
out.writeByte(pitch);
}
@Override
public boolean isPriority() {
return false;
}
}

View file

@ -1,9 +1,10 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.game.world.CustomSound;
import org.spacehq.mc.protocol.data.game.world.GenericSound;
import org.spacehq.mc.protocol.data.game.world.Sound;
import org.spacehq.mc.protocol.data.game.world.sound.CustomSound;
import org.spacehq.mc.protocol.data.game.world.sound.GenericSound;
import org.spacehq.mc.protocol.data.game.world.sound.Sound;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
@ -13,6 +14,7 @@ import java.io.IOException;
public class ServerPlaySoundPacket implements Packet {
private Sound sound;
private SoundCategory category;
private double x;
private double y;
private double z;
@ -23,8 +25,9 @@ public class ServerPlaySoundPacket implements Packet {
private ServerPlaySoundPacket() {
}
public ServerPlaySoundPacket(Sound sound, double x, double y, double z, float volume, float pitch) {
public ServerPlaySoundPacket(Sound sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
this.sound = sound;
this.category = category;
this.x = x;
this.y = y;
this.z = z;
@ -36,6 +39,10 @@ public class ServerPlaySoundPacket implements Packet {
return this.sound;
}
public SoundCategory getCategory() {
return this.category;
}
public double getX() {
return this.x;
}
@ -65,6 +72,7 @@ public class ServerPlaySoundPacket implements Packet {
this.sound = new CustomSound(value);
}
this.category = MagicValues.key(SoundCategory.class, in.readVarInt());
this.x = in.readInt() / 8D;
this.y = in.readInt() / 8D;
this.z = in.readInt() / 8D;
@ -82,6 +90,7 @@ public class ServerPlaySoundPacket implements Packet {
}
out.writeString(value);
out.writeVarInt(MagicValues.value(Integer.class, this.category));
out.writeInt((int) (this.x * 8));
out.writeInt((int) (this.y * 8));
out.writeInt((int) (this.z * 8));