mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-12 08:41:00 -05:00
commit
c4c23eb00f
71 changed files with 2232 additions and 697 deletions
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
<artifactId>mcprotocollib</artifactId>
|
||||
<version>1.12.2-3-SNAPSHOT</version>
|
||||
<version>1.13-1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MCProtocolLib</name>
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.github.steveice10.mc.protocol;
|
|||
|
||||
public class MinecraftConstants {
|
||||
// General Constants
|
||||
public static final String GAME_VERSION = "1.12.2";
|
||||
public static final int PROTOCOL_VERSION = 340;
|
||||
public static final String GAME_VERSION = "1.13";
|
||||
public static final int PROTOCOL_VERSION = 393;
|
||||
|
||||
// General Key Constants
|
||||
public static final String PROFILE_KEY = "profile";
|
||||
|
|
|
@ -26,16 +26,26 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientAdvancementTabPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCraftingBookDataPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEditBookPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEnchantItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientMoveItemToHotbarPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientPrepareCraftingGridPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSetBeaconEffectPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateStructureBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientBlockNBTRequestPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientEntityNBTRequestPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientSpectatePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientSteerBoatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientSteerVehiclePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockMinecartPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerAdvancementTabPacket;
|
||||
|
@ -43,6 +53,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerAdvancements
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerBossBarPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerCombatPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareRecipesPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDifficultyPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDisconnectPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||
|
@ -54,6 +67,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerResourcePack
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerSetCooldownPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStatisticsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStopSoundPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerSwitchCameraPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTabCompletePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerTitlePacket;
|
||||
|
@ -79,6 +93,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntit
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerVehicleMovePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerFacingPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerSetExperiencePacket;
|
||||
|
@ -107,6 +122,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkD
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMapDataPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNBTResponsePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket;
|
||||
|
@ -119,9 +135,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdate
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerWorldBorderPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.client.EncryptionResponsePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.client.LoginStartPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.server.EncryptionRequestPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.server.LoginDisconnectPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.server.LoginSetCompressionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.status.client.StatusPingPacket;
|
||||
|
@ -320,19 +338,23 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerIncoming(0x01, EncryptionRequestPacket.class);
|
||||
this.registerIncoming(0x02, LoginSuccessPacket.class);
|
||||
this.registerIncoming(0x03, LoginSetCompressionPacket.class);
|
||||
this.registerIncoming(0x04, LoginPluginRequestPacket.class);
|
||||
|
||||
this.registerOutgoing(0x00, LoginStartPacket.class);
|
||||
this.registerOutgoing(0x01, EncryptionResponsePacket.class);
|
||||
this.registerOutgoing(0x02, LoginPluginResponsePacket.class);
|
||||
}
|
||||
|
||||
private void initServerLogin(Session session) {
|
||||
this.registerIncoming(0x00, LoginStartPacket.class);
|
||||
this.registerIncoming(0x01, EncryptionResponsePacket.class);
|
||||
this.registerIncoming(0x02, LoginPluginResponsePacket.class);
|
||||
|
||||
this.registerOutgoing(0x00, LoginDisconnectPacket.class);
|
||||
this.registerOutgoing(0x01, EncryptionRequestPacket.class);
|
||||
this.registerOutgoing(0x02, LoginSuccessPacket.class);
|
||||
this.registerOutgoing(0x03, LoginSetCompressionPacket.class);
|
||||
this.registerOutgoing(0x04, LoginPluginRequestPacket.class);
|
||||
}
|
||||
|
||||
private void initClientGame(Session session) {
|
||||
|
@ -350,142 +372,168 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerIncoming(0x0B, ServerBlockChangePacket.class);
|
||||
this.registerIncoming(0x0C, ServerBossBarPacket.class);
|
||||
this.registerIncoming(0x0D, ServerDifficultyPacket.class);
|
||||
this.registerIncoming(0x0E, ServerTabCompletePacket.class);
|
||||
this.registerIncoming(0x0F, ServerChatPacket.class);
|
||||
this.registerIncoming(0x10, ServerMultiBlockChangePacket.class);
|
||||
this.registerIncoming(0x11, ServerConfirmTransactionPacket.class);
|
||||
this.registerIncoming(0x12, ServerCloseWindowPacket.class);
|
||||
this.registerIncoming(0x13, ServerOpenWindowPacket.class);
|
||||
this.registerIncoming(0x14, ServerWindowItemsPacket.class);
|
||||
this.registerIncoming(0x15, ServerWindowPropertyPacket.class);
|
||||
this.registerIncoming(0x16, ServerSetSlotPacket.class);
|
||||
this.registerIncoming(0x17, ServerSetCooldownPacket.class);
|
||||
this.registerIncoming(0x18, ServerPluginMessagePacket.class);
|
||||
this.registerIncoming(0x19, ServerPlaySoundPacket.class);
|
||||
this.registerIncoming(0x1A, ServerDisconnectPacket.class);
|
||||
this.registerIncoming(0x1B, ServerEntityStatusPacket.class);
|
||||
this.registerIncoming(0x1C, ServerExplosionPacket.class);
|
||||
this.registerIncoming(0x1D, ServerUnloadChunkPacket.class);
|
||||
this.registerIncoming(0x1E, ServerNotifyClientPacket.class);
|
||||
this.registerIncoming(0x1F, ServerKeepAlivePacket.class);
|
||||
this.registerIncoming(0x20, ServerChunkDataPacket.class);
|
||||
this.registerIncoming(0x21, ServerPlayEffectPacket.class);
|
||||
this.registerIncoming(0x22, ServerSpawnParticlePacket.class);
|
||||
this.registerIncoming(0x23, ServerJoinGamePacket.class);
|
||||
this.registerIncoming(0x24, ServerMapDataPacket.class);
|
||||
this.registerIncoming(0x25, ServerEntityMovementPacket.class);
|
||||
this.registerIncoming(0x26, ServerEntityPositionPacket.class);
|
||||
this.registerIncoming(0x27, ServerEntityPositionRotationPacket.class);
|
||||
this.registerIncoming(0x28, ServerEntityRotationPacket.class);
|
||||
this.registerIncoming(0x29, ServerVehicleMovePacket.class);
|
||||
this.registerIncoming(0x2A, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerIncoming(0x2B, ServerPreparedCraftingGridPacket.class);
|
||||
this.registerIncoming(0x2C, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerIncoming(0x2D, ServerCombatPacket.class);
|
||||
this.registerIncoming(0x2E, ServerPlayerListEntryPacket.class);
|
||||
this.registerIncoming(0x2F, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x30, ServerPlayerUseBedPacket.class);
|
||||
this.registerIncoming(0x31, ServerUnlockRecipesPacket.class);
|
||||
this.registerIncoming(0x32, ServerEntityDestroyPacket.class);
|
||||
this.registerIncoming(0x33, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerIncoming(0x34, ServerResourcePackSendPacket.class);
|
||||
this.registerIncoming(0x35, ServerRespawnPacket.class);
|
||||
this.registerIncoming(0x36, ServerEntityHeadLookPacket.class);
|
||||
this.registerIncoming(0x37, ServerAdvancementTabPacket.class);
|
||||
this.registerIncoming(0x38, ServerWorldBorderPacket.class);
|
||||
this.registerIncoming(0x39, ServerSwitchCameraPacket.class);
|
||||
this.registerIncoming(0x3A, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerIncoming(0x3B, ServerDisplayScoreboardPacket.class);
|
||||
this.registerIncoming(0x3C, ServerEntityMetadataPacket.class);
|
||||
this.registerIncoming(0x3D, ServerEntityAttachPacket.class);
|
||||
this.registerIncoming(0x3E, ServerEntityVelocityPacket.class);
|
||||
this.registerIncoming(0x3F, ServerEntityEquipmentPacket.class);
|
||||
this.registerIncoming(0x40, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerIncoming(0x41, ServerPlayerHealthPacket.class);
|
||||
this.registerIncoming(0x42, ServerScoreboardObjectivePacket.class);
|
||||
this.registerIncoming(0x43, ServerEntitySetPassengersPacket.class);
|
||||
this.registerIncoming(0x44, ServerTeamPacket.class);
|
||||
this.registerIncoming(0x45, ServerUpdateScorePacket.class);
|
||||
this.registerIncoming(0x46, ServerSpawnPositionPacket.class);
|
||||
this.registerIncoming(0x47, ServerUpdateTimePacket.class);
|
||||
this.registerIncoming(0x48, ServerTitlePacket.class);
|
||||
this.registerIncoming(0x49, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerIncoming(0x4A, ServerPlayerListDataPacket.class);
|
||||
this.registerIncoming(0x4B, ServerEntityCollectItemPacket.class);
|
||||
this.registerIncoming(0x4C, ServerEntityTeleportPacket.class);
|
||||
this.registerIncoming(0x4D, ServerAdvancementsPacket.class);
|
||||
this.registerIncoming(0x4E, ServerEntityPropertiesPacket.class);
|
||||
this.registerIncoming(0x4F, ServerEntityEffectPacket.class);
|
||||
this.registerIncoming(0x0E, ServerChatPacket.class);
|
||||
this.registerIncoming(0x0F, ServerMultiBlockChangePacket.class);
|
||||
this.registerIncoming(0x10, ServerTabCompletePacket.class);
|
||||
this.registerIncoming(0x11, ServerDeclareCommandsPacket.class);
|
||||
this.registerIncoming(0x12, ServerConfirmTransactionPacket.class);
|
||||
this.registerIncoming(0x13, ServerCloseWindowPacket.class);
|
||||
this.registerIncoming(0x14, ServerOpenWindowPacket.class);
|
||||
this.registerIncoming(0x15, ServerWindowItemsPacket.class);
|
||||
this.registerIncoming(0x16, ServerWindowPropertyPacket.class);
|
||||
this.registerIncoming(0x17, ServerSetSlotPacket.class);
|
||||
this.registerIncoming(0x18, ServerSetCooldownPacket.class);
|
||||
this.registerIncoming(0x19, ServerPluginMessagePacket.class);
|
||||
this.registerIncoming(0x1A, ServerPlaySoundPacket.class);
|
||||
this.registerIncoming(0x1B, ServerDisconnectPacket.class);
|
||||
this.registerIncoming(0x1C, ServerEntityStatusPacket.class);
|
||||
this.registerIncoming(0x1D, ServerNBTResponsePacket.class);
|
||||
this.registerIncoming(0x1E, ServerExplosionPacket.class);
|
||||
this.registerIncoming(0x1F, ServerUnloadChunkPacket.class);
|
||||
this.registerIncoming(0x20, ServerNotifyClientPacket.class);
|
||||
this.registerIncoming(0x21, ServerKeepAlivePacket.class);
|
||||
this.registerIncoming(0x22, ServerChunkDataPacket.class);
|
||||
this.registerIncoming(0x23, ServerPlayEffectPacket.class);
|
||||
this.registerIncoming(0x24, ServerSpawnParticlePacket.class);
|
||||
this.registerIncoming(0x25, ServerJoinGamePacket.class);
|
||||
this.registerIncoming(0x26, ServerMapDataPacket.class);
|
||||
this.registerIncoming(0x27, ServerEntityMovementPacket.class);
|
||||
this.registerIncoming(0x28, ServerEntityPositionPacket.class);
|
||||
this.registerIncoming(0x29, ServerEntityPositionRotationPacket.class);
|
||||
this.registerIncoming(0x2A, ServerEntityRotationPacket.class);
|
||||
this.registerIncoming(0x2B, ServerVehicleMovePacket.class);
|
||||
this.registerIncoming(0x2C, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerIncoming(0x2D, ServerPreparedCraftingGridPacket.class);
|
||||
this.registerIncoming(0x2E, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerIncoming(0x2F, ServerCombatPacket.class);
|
||||
this.registerIncoming(0x30, ServerPlayerListEntryPacket.class);
|
||||
this.registerIncoming(0x31, ServerPlayerFacingPacket.class);
|
||||
this.registerIncoming(0x32, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x33, ServerPlayerUseBedPacket.class);
|
||||
this.registerIncoming(0x34, ServerUnlockRecipesPacket.class);
|
||||
this.registerIncoming(0x35, ServerEntityDestroyPacket.class);
|
||||
this.registerIncoming(0x36, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerIncoming(0x37, ServerResourcePackSendPacket.class);
|
||||
this.registerIncoming(0x38, ServerRespawnPacket.class);
|
||||
this.registerIncoming(0x39, ServerEntityHeadLookPacket.class);
|
||||
this.registerIncoming(0x3A, ServerAdvancementTabPacket.class);
|
||||
this.registerIncoming(0x3B, ServerWorldBorderPacket.class);
|
||||
this.registerIncoming(0x3C, ServerSwitchCameraPacket.class);
|
||||
this.registerIncoming(0x3D, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerIncoming(0x3E, ServerDisplayScoreboardPacket.class);
|
||||
this.registerIncoming(0x3F, ServerEntityMetadataPacket.class);
|
||||
this.registerIncoming(0x40, ServerEntityAttachPacket.class);
|
||||
this.registerIncoming(0x41, ServerEntityVelocityPacket.class);
|
||||
this.registerIncoming(0x42, ServerEntityEquipmentPacket.class);
|
||||
this.registerIncoming(0x43, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerIncoming(0x44, ServerPlayerHealthPacket.class);
|
||||
this.registerIncoming(0x45, ServerScoreboardObjectivePacket.class);
|
||||
this.registerIncoming(0x46, ServerEntitySetPassengersPacket.class);
|
||||
this.registerIncoming(0x47, ServerTeamPacket.class);
|
||||
this.registerIncoming(0x48, ServerUpdateScorePacket.class);
|
||||
this.registerIncoming(0x49, ServerSpawnPositionPacket.class);
|
||||
this.registerIncoming(0x4A, ServerUpdateTimePacket.class);
|
||||
this.registerIncoming(0x4B, ServerTitlePacket.class);
|
||||
this.registerIncoming(0x4C, ServerStopSoundPacket.class);
|
||||
this.registerIncoming(0x4D, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerIncoming(0x4E, ServerPlayerListDataPacket.class);
|
||||
this.registerIncoming(0x4F, ServerEntityCollectItemPacket.class);
|
||||
this.registerIncoming(0x50, ServerEntityTeleportPacket.class);
|
||||
this.registerIncoming(0x51, ServerAdvancementsPacket.class);
|
||||
this.registerIncoming(0x52, ServerEntityPropertiesPacket.class);
|
||||
this.registerIncoming(0x53, ServerEntityEffectPacket.class);
|
||||
this.registerIncoming(0x54, ServerDeclareRecipesPacket.class);
|
||||
this.registerIncoming(0x55, ServerDeclareTagsPacket.class);
|
||||
|
||||
this.registerOutgoing(0x00, ClientTeleportConfirmPacket.class);
|
||||
this.registerOutgoing(0x01, ClientTabCompletePacket.class);
|
||||
this.registerOutgoing(0x01, ClientBlockNBTRequestPacket.class);
|
||||
this.registerOutgoing(0x02, ClientChatPacket.class);
|
||||
this.registerOutgoing(0x03, ClientRequestPacket.class);
|
||||
this.registerOutgoing(0x04, ClientSettingsPacket.class);
|
||||
this.registerOutgoing(0x05, ClientConfirmTransactionPacket.class);
|
||||
this.registerOutgoing(0x06, ClientEnchantItemPacket.class);
|
||||
this.registerOutgoing(0x07, ClientWindowActionPacket.class);
|
||||
this.registerOutgoing(0x08, ClientCloseWindowPacket.class);
|
||||
this.registerOutgoing(0x09, ClientPluginMessagePacket.class);
|
||||
this.registerOutgoing(0x0A, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerOutgoing(0x0B, ClientKeepAlivePacket.class);
|
||||
this.registerOutgoing(0x0C, ClientPlayerMovementPacket.class);
|
||||
this.registerOutgoing(0x0D, ClientPlayerPositionPacket.class);
|
||||
this.registerOutgoing(0x0E, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x0F, ClientPlayerRotationPacket.class);
|
||||
this.registerOutgoing(0x10, ClientVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x11, ClientSteerBoatPacket.class);
|
||||
this.registerOutgoing(0x12, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerOutgoing(0x13, ClientPlayerAbilitiesPacket.class);
|
||||
this.registerOutgoing(0x14, ClientPlayerActionPacket.class);
|
||||
this.registerOutgoing(0x15, ClientPlayerStatePacket.class);
|
||||
this.registerOutgoing(0x16, ClientSteerVehiclePacket.class);
|
||||
this.registerOutgoing(0x17, ClientCraftingBookDataPacket.class);
|
||||
this.registerOutgoing(0x18, ClientResourcePackStatusPacket.class);
|
||||
this.registerOutgoing(0x19, ClientAdvancementTabPacket.class);
|
||||
this.registerOutgoing(0x1A, ClientPlayerChangeHeldItemPacket.class);
|
||||
this.registerOutgoing(0x1B, ClientCreativeInventoryActionPacket.class);
|
||||
this.registerOutgoing(0x1C, ClientUpdateSignPacket.class);
|
||||
this.registerOutgoing(0x1D, ClientPlayerSwingArmPacket.class);
|
||||
this.registerOutgoing(0x1E, ClientSpectatePacket.class);
|
||||
this.registerOutgoing(0x1F, ClientPlayerPlaceBlockPacket.class);
|
||||
this.registerOutgoing(0x20, ClientPlayerUseItemPacket.class);
|
||||
this.registerOutgoing(0x05, ClientTabCompletePacket.class);
|
||||
this.registerOutgoing(0x06, ClientConfirmTransactionPacket.class);
|
||||
this.registerOutgoing(0x07, ClientEnchantItemPacket.class);
|
||||
this.registerOutgoing(0x08, ClientWindowActionPacket.class);
|
||||
this.registerOutgoing(0x09, ClientCloseWindowPacket.class);
|
||||
this.registerOutgoing(0x0A, ClientPluginMessagePacket.class);
|
||||
this.registerOutgoing(0x0B, ClientEditBookPacket.class);
|
||||
this.registerOutgoing(0x0C, ClientEntityNBTRequestPacket.class);
|
||||
this.registerOutgoing(0x0D, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerOutgoing(0x0E, ClientKeepAlivePacket.class);
|
||||
this.registerOutgoing(0x0F, ClientPlayerMovementPacket.class);
|
||||
this.registerOutgoing(0x10, ClientPlayerPositionPacket.class);
|
||||
this.registerOutgoing(0x11, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x12, ClientPlayerRotationPacket.class);
|
||||
this.registerOutgoing(0x13, ClientVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x14, ClientSteerBoatPacket.class);
|
||||
this.registerOutgoing(0x15, ClientMoveItemToHotbarPacket.class);
|
||||
this.registerOutgoing(0x16, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerOutgoing(0x17, ClientPlayerAbilitiesPacket.class);
|
||||
this.registerOutgoing(0x18, ClientPlayerActionPacket.class);
|
||||
this.registerOutgoing(0x19, ClientPlayerStatePacket.class);
|
||||
this.registerOutgoing(0x1A, ClientSteerVehiclePacket.class);
|
||||
this.registerOutgoing(0x1B, ClientCraftingBookDataPacket.class);
|
||||
this.registerOutgoing(0x1C, ClientRenameItemPacket.class);
|
||||
this.registerOutgoing(0x1D, ClientResourcePackStatusPacket.class);
|
||||
this.registerOutgoing(0x1E, ClientAdvancementTabPacket.class);
|
||||
this.registerOutgoing(0x1F, ClientSelectTradePacket.class);
|
||||
this.registerOutgoing(0x20, ClientSetBeaconEffectPacket.class);
|
||||
this.registerOutgoing(0x21, ClientPlayerChangeHeldItemPacket.class);
|
||||
this.registerOutgoing(0x22, ClientUpdateCommandBlockPacket.class);
|
||||
this.registerOutgoing(0x23, ClientUpdateCommandBlockMinecartPacket.class);
|
||||
this.registerOutgoing(0x24, ClientCreativeInventoryActionPacket.class);
|
||||
this.registerOutgoing(0x25, ClientUpdateStructureBlockPacket.class);
|
||||
this.registerOutgoing(0x26, ClientUpdateSignPacket.class);
|
||||
this.registerOutgoing(0x27, ClientPlayerSwingArmPacket.class);
|
||||
this.registerOutgoing(0x28, ClientSpectatePacket.class);
|
||||
this.registerOutgoing(0x29, ClientPlayerPlaceBlockPacket.class);
|
||||
this.registerOutgoing(0x2A, ClientPlayerUseItemPacket.class);
|
||||
}
|
||||
|
||||
private void initServerGame(Session session) {
|
||||
this.registerIncoming(0x00, ClientTeleportConfirmPacket.class);
|
||||
this.registerIncoming(0x01, ClientTabCompletePacket.class);
|
||||
this.registerIncoming(0x01, ClientBlockNBTRequestPacket.class);
|
||||
this.registerIncoming(0x02, ClientChatPacket.class);
|
||||
this.registerIncoming(0x03, ClientRequestPacket.class);
|
||||
this.registerIncoming(0x04, ClientSettingsPacket.class);
|
||||
this.registerIncoming(0x05, ClientConfirmTransactionPacket.class);
|
||||
this.registerIncoming(0x06, ClientEnchantItemPacket.class);
|
||||
this.registerIncoming(0x07, ClientWindowActionPacket.class);
|
||||
this.registerIncoming(0x08, ClientCloseWindowPacket.class);
|
||||
this.registerIncoming(0x09, ClientPluginMessagePacket.class);
|
||||
this.registerIncoming(0x0A, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerIncoming(0x0B, ClientKeepAlivePacket.class);
|
||||
this.registerIncoming(0x0C, ClientPlayerMovementPacket.class);
|
||||
this.registerIncoming(0x0D, ClientPlayerPositionPacket.class);
|
||||
this.registerIncoming(0x0E, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x0F, ClientPlayerRotationPacket.class);
|
||||
this.registerIncoming(0x10, ClientVehicleMovePacket.class);
|
||||
this.registerIncoming(0x11, ClientSteerBoatPacket.class);
|
||||
this.registerIncoming(0x12, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerIncoming(0x13, ClientPlayerAbilitiesPacket.class);
|
||||
this.registerIncoming(0x14, ClientPlayerActionPacket.class);
|
||||
this.registerIncoming(0x15, ClientPlayerStatePacket.class);
|
||||
this.registerIncoming(0x16, ClientSteerVehiclePacket.class);
|
||||
this.registerIncoming(0x17, ClientCraftingBookDataPacket.class);
|
||||
this.registerIncoming(0x18, ClientResourcePackStatusPacket.class);
|
||||
this.registerIncoming(0x19, ClientAdvancementTabPacket.class);
|
||||
this.registerIncoming(0x1A, ClientPlayerChangeHeldItemPacket.class);
|
||||
this.registerIncoming(0x1B, ClientCreativeInventoryActionPacket.class);
|
||||
this.registerIncoming(0x1C, ClientUpdateSignPacket.class);
|
||||
this.registerIncoming(0x1D, ClientPlayerSwingArmPacket.class);
|
||||
this.registerIncoming(0x1E, ClientSpectatePacket.class);
|
||||
this.registerIncoming(0x1F, ClientPlayerPlaceBlockPacket.class);
|
||||
this.registerIncoming(0x20, ClientPlayerUseItemPacket.class);
|
||||
this.registerIncoming(0x05, ClientTabCompletePacket.class);
|
||||
this.registerIncoming(0x06, ClientConfirmTransactionPacket.class);
|
||||
this.registerIncoming(0x07, ClientEnchantItemPacket.class);
|
||||
this.registerIncoming(0x08, ClientWindowActionPacket.class);
|
||||
this.registerIncoming(0x09, ClientCloseWindowPacket.class);
|
||||
this.registerIncoming(0x0A, ClientPluginMessagePacket.class);
|
||||
this.registerIncoming(0x0B, ClientEditBookPacket.class);
|
||||
this.registerIncoming(0x0C, ClientEntityNBTRequestPacket.class);
|
||||
this.registerIncoming(0x0D, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerIncoming(0x0E, ClientKeepAlivePacket.class);
|
||||
this.registerIncoming(0x0F, ClientPlayerMovementPacket.class);
|
||||
this.registerIncoming(0x10, ClientPlayerPositionPacket.class);
|
||||
this.registerIncoming(0x11, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x12, ClientPlayerRotationPacket.class);
|
||||
this.registerIncoming(0x13, ClientVehicleMovePacket.class);
|
||||
this.registerIncoming(0x14, ClientSteerBoatPacket.class);
|
||||
this.registerIncoming(0x15, ClientMoveItemToHotbarPacket.class);
|
||||
this.registerIncoming(0x16, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerIncoming(0x17, ClientPlayerAbilitiesPacket.class);
|
||||
this.registerIncoming(0x18, ClientPlayerActionPacket.class);
|
||||
this.registerIncoming(0x19, ClientPlayerStatePacket.class);
|
||||
this.registerIncoming(0x1A, ClientSteerVehiclePacket.class);
|
||||
this.registerIncoming(0x1B, ClientCraftingBookDataPacket.class);
|
||||
this.registerIncoming(0x1C, ClientRenameItemPacket.class);
|
||||
this.registerIncoming(0x1D, ClientResourcePackStatusPacket.class);
|
||||
this.registerIncoming(0x1E, ClientAdvancementTabPacket.class);
|
||||
this.registerIncoming(0x1F, ClientSelectTradePacket.class);
|
||||
this.registerIncoming(0x20, ClientSetBeaconEffectPacket.class);
|
||||
this.registerIncoming(0x21, ClientPlayerChangeHeldItemPacket.class);
|
||||
this.registerIncoming(0x22, ClientUpdateCommandBlockPacket.class);
|
||||
this.registerIncoming(0x23, ClientUpdateCommandBlockMinecartPacket.class);
|
||||
this.registerIncoming(0x24, ClientCreativeInventoryActionPacket.class);
|
||||
this.registerIncoming(0x25, ClientUpdateStructureBlockPacket.class);
|
||||
this.registerIncoming(0x26, ClientUpdateSignPacket.class);
|
||||
this.registerIncoming(0x27, ClientPlayerSwingArmPacket.class);
|
||||
this.registerIncoming(0x28, ClientSpectatePacket.class);
|
||||
this.registerIncoming(0x29, ClientPlayerPlaceBlockPacket.class);
|
||||
this.registerIncoming(0x2A, ClientPlayerUseItemPacket.class);
|
||||
|
||||
this.registerOutgoing(0x00, ServerSpawnObjectPacket.class);
|
||||
this.registerOutgoing(0x01, ServerSpawnExpOrbPacket.class);
|
||||
|
@ -501,72 +549,78 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerOutgoing(0x0B, ServerBlockChangePacket.class);
|
||||
this.registerOutgoing(0x0C, ServerBossBarPacket.class);
|
||||
this.registerOutgoing(0x0D, ServerDifficultyPacket.class);
|
||||
this.registerOutgoing(0x0E, ServerTabCompletePacket.class);
|
||||
this.registerOutgoing(0x0F, ServerChatPacket.class);
|
||||
this.registerOutgoing(0x10, ServerMultiBlockChangePacket.class);
|
||||
this.registerOutgoing(0x11, ServerConfirmTransactionPacket.class);
|
||||
this.registerOutgoing(0x12, ServerCloseWindowPacket.class);
|
||||
this.registerOutgoing(0x13, ServerOpenWindowPacket.class);
|
||||
this.registerOutgoing(0x14, ServerWindowItemsPacket.class);
|
||||
this.registerOutgoing(0x15, ServerWindowPropertyPacket.class);
|
||||
this.registerOutgoing(0x16, ServerSetSlotPacket.class);
|
||||
this.registerOutgoing(0x17, ServerSetCooldownPacket.class);
|
||||
this.registerOutgoing(0x18, ServerPluginMessagePacket.class);
|
||||
this.registerOutgoing(0x19, ServerPlaySoundPacket.class);
|
||||
this.registerOutgoing(0x1A, ServerDisconnectPacket.class);
|
||||
this.registerOutgoing(0x1B, ServerEntityStatusPacket.class);
|
||||
this.registerOutgoing(0x1C, ServerExplosionPacket.class);
|
||||
this.registerOutgoing(0x1D, ServerUnloadChunkPacket.class);
|
||||
this.registerOutgoing(0x1E, ServerNotifyClientPacket.class);
|
||||
this.registerOutgoing(0x1F, ServerKeepAlivePacket.class);
|
||||
this.registerOutgoing(0x20, ServerChunkDataPacket.class);
|
||||
this.registerOutgoing(0x21, ServerPlayEffectPacket.class);
|
||||
this.registerOutgoing(0x22, ServerSpawnParticlePacket.class);
|
||||
this.registerOutgoing(0x23, ServerJoinGamePacket.class);
|
||||
this.registerOutgoing(0x24, ServerMapDataPacket.class);
|
||||
this.registerOutgoing(0x25, ServerEntityMovementPacket.class);
|
||||
this.registerOutgoing(0x26, ServerEntityPositionPacket.class);
|
||||
this.registerOutgoing(0x27, ServerEntityPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x28, ServerEntityRotationPacket.class);
|
||||
this.registerOutgoing(0x29, ServerVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x2A, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerOutgoing(0x2B, ServerPreparedCraftingGridPacket.class);
|
||||
this.registerOutgoing(0x2C, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerOutgoing(0x2D, ServerCombatPacket.class);
|
||||
this.registerOutgoing(0x2E, ServerPlayerListEntryPacket.class);
|
||||
this.registerOutgoing(0x2F, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x30, ServerPlayerUseBedPacket.class);
|
||||
this.registerOutgoing(0x31, ServerUnlockRecipesPacket.class);
|
||||
this.registerOutgoing(0x32, ServerEntityDestroyPacket.class);
|
||||
this.registerOutgoing(0x33, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerOutgoing(0x34, ServerResourcePackSendPacket.class);
|
||||
this.registerOutgoing(0x35, ServerRespawnPacket.class);
|
||||
this.registerOutgoing(0x36, ServerEntityHeadLookPacket.class);
|
||||
this.registerOutgoing(0x37, ServerAdvancementTabPacket.class);
|
||||
this.registerOutgoing(0x38, ServerWorldBorderPacket.class);
|
||||
this.registerOutgoing(0x39, ServerSwitchCameraPacket.class);
|
||||
this.registerOutgoing(0x3A, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerOutgoing(0x3B, ServerDisplayScoreboardPacket.class);
|
||||
this.registerOutgoing(0x3C, ServerEntityMetadataPacket.class);
|
||||
this.registerOutgoing(0x3D, ServerEntityAttachPacket.class);
|
||||
this.registerOutgoing(0x3E, ServerEntityVelocityPacket.class);
|
||||
this.registerOutgoing(0x3F, ServerEntityEquipmentPacket.class);
|
||||
this.registerOutgoing(0x40, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerOutgoing(0x41, ServerPlayerHealthPacket.class);
|
||||
this.registerOutgoing(0x42, ServerScoreboardObjectivePacket.class);
|
||||
this.registerOutgoing(0x43, ServerEntitySetPassengersPacket.class);
|
||||
this.registerOutgoing(0x44, ServerTeamPacket.class);
|
||||
this.registerOutgoing(0x45, ServerUpdateScorePacket.class);
|
||||
this.registerOutgoing(0x46, ServerSpawnPositionPacket.class);
|
||||
this.registerOutgoing(0x47, ServerUpdateTimePacket.class);
|
||||
this.registerOutgoing(0x48, ServerTitlePacket.class);
|
||||
this.registerOutgoing(0x49, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerOutgoing(0x4A, ServerPlayerListDataPacket.class);
|
||||
this.registerOutgoing(0x4B, ServerEntityCollectItemPacket.class);
|
||||
this.registerOutgoing(0x4C, ServerEntityTeleportPacket.class);
|
||||
this.registerOutgoing(0x4D, ServerAdvancementsPacket.class);
|
||||
this.registerOutgoing(0x4E, ServerEntityPropertiesPacket.class);
|
||||
this.registerOutgoing(0x4F, ServerEntityEffectPacket.class);
|
||||
this.registerOutgoing(0x0E, ServerChatPacket.class);
|
||||
this.registerOutgoing(0x0F, ServerMultiBlockChangePacket.class);
|
||||
this.registerOutgoing(0x10, ServerTabCompletePacket.class);
|
||||
this.registerOutgoing(0x11, ServerDeclareCommandsPacket.class);
|
||||
this.registerOutgoing(0x12, ServerConfirmTransactionPacket.class);
|
||||
this.registerOutgoing(0x13, ServerCloseWindowPacket.class);
|
||||
this.registerOutgoing(0x14, ServerOpenWindowPacket.class);
|
||||
this.registerOutgoing(0x15, ServerWindowItemsPacket.class);
|
||||
this.registerOutgoing(0x16, ServerWindowPropertyPacket.class);
|
||||
this.registerOutgoing(0x17, ServerSetSlotPacket.class);
|
||||
this.registerOutgoing(0x18, ServerSetCooldownPacket.class);
|
||||
this.registerOutgoing(0x19, ServerPluginMessagePacket.class);
|
||||
this.registerOutgoing(0x1A, ServerPlaySoundPacket.class);
|
||||
this.registerOutgoing(0x1B, ServerDisconnectPacket.class);
|
||||
this.registerOutgoing(0x1C, ServerEntityStatusPacket.class);
|
||||
this.registerOutgoing(0x1D, ServerNBTResponsePacket.class);
|
||||
this.registerOutgoing(0x1E, ServerExplosionPacket.class);
|
||||
this.registerOutgoing(0x1F, ServerUnloadChunkPacket.class);
|
||||
this.registerOutgoing(0x20, ServerNotifyClientPacket.class);
|
||||
this.registerOutgoing(0x21, ServerKeepAlivePacket.class);
|
||||
this.registerOutgoing(0x22, ServerChunkDataPacket.class);
|
||||
this.registerOutgoing(0x23, ServerPlayEffectPacket.class);
|
||||
this.registerOutgoing(0x24, ServerSpawnParticlePacket.class);
|
||||
this.registerOutgoing(0x25, ServerJoinGamePacket.class);
|
||||
this.registerOutgoing(0x26, ServerMapDataPacket.class);
|
||||
this.registerOutgoing(0x27, ServerEntityMovementPacket.class);
|
||||
this.registerOutgoing(0x28, ServerEntityPositionPacket.class);
|
||||
this.registerOutgoing(0x29, ServerEntityPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x2A, ServerEntityRotationPacket.class);
|
||||
this.registerOutgoing(0x2B, ServerVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x2C, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerOutgoing(0x2D, ServerPreparedCraftingGridPacket.class);
|
||||
this.registerOutgoing(0x2E, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerOutgoing(0x2F, ServerCombatPacket.class);
|
||||
this.registerOutgoing(0x30, ServerPlayerListEntryPacket.class);
|
||||
this.registerOutgoing(0x31, ServerPlayerFacingPacket.class);
|
||||
this.registerOutgoing(0x32, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x33, ServerPlayerUseBedPacket.class);
|
||||
this.registerOutgoing(0x34, ServerUnlockRecipesPacket.class);
|
||||
this.registerOutgoing(0x35, ServerEntityDestroyPacket.class);
|
||||
this.registerOutgoing(0x36, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerOutgoing(0x37, ServerResourcePackSendPacket.class);
|
||||
this.registerOutgoing(0x38, ServerRespawnPacket.class);
|
||||
this.registerOutgoing(0x39, ServerEntityHeadLookPacket.class);
|
||||
this.registerOutgoing(0x3A, ServerAdvancementTabPacket.class);
|
||||
this.registerOutgoing(0x3B, ServerWorldBorderPacket.class);
|
||||
this.registerOutgoing(0x3C, ServerSwitchCameraPacket.class);
|
||||
this.registerOutgoing(0x3D, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerOutgoing(0x3E, ServerDisplayScoreboardPacket.class);
|
||||
this.registerOutgoing(0x3F, ServerEntityMetadataPacket.class);
|
||||
this.registerOutgoing(0x40, ServerEntityAttachPacket.class);
|
||||
this.registerOutgoing(0x41, ServerEntityVelocityPacket.class);
|
||||
this.registerOutgoing(0x42, ServerEntityEquipmentPacket.class);
|
||||
this.registerOutgoing(0x43, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerOutgoing(0x44, ServerPlayerHealthPacket.class);
|
||||
this.registerOutgoing(0x45, ServerScoreboardObjectivePacket.class);
|
||||
this.registerOutgoing(0x46, ServerEntitySetPassengersPacket.class);
|
||||
this.registerOutgoing(0x47, ServerTeamPacket.class);
|
||||
this.registerOutgoing(0x48, ServerUpdateScorePacket.class);
|
||||
this.registerOutgoing(0x49, ServerSpawnPositionPacket.class);
|
||||
this.registerOutgoing(0x4A, ServerUpdateTimePacket.class);
|
||||
this.registerOutgoing(0x4B, ServerTitlePacket.class);
|
||||
this.registerOutgoing(0x4C, ServerStopSoundPacket.class);
|
||||
this.registerOutgoing(0x4D, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerOutgoing(0x4E, ServerPlayerListDataPacket.class);
|
||||
this.registerOutgoing(0x4F, ServerEntityCollectItemPacket.class);
|
||||
this.registerOutgoing(0x50, ServerEntityTeleportPacket.class);
|
||||
this.registerOutgoing(0x51, ServerAdvancementsPacket.class);
|
||||
this.registerOutgoing(0x52, ServerEntityPropertiesPacket.class);
|
||||
this.registerOutgoing(0x53, ServerEntityEffectPacket.class);
|
||||
this.registerOutgoing(0x54, ServerDeclareRecipesPacket.class);
|
||||
this.registerOutgoing(0x55, ServerDeclareTagsPacket.class);
|
||||
}
|
||||
|
||||
private void initClientStatus(Session session) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.github.steveice10.mc.protocol.data.game.advancement.Advancement;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.Effect;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.EntityStatus;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.EquipmentSlot;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.FeetOrEyes;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeType;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.attribute.ModifierOperation;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.attribute.ModifierType;
|
||||
|
@ -43,6 +44,7 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor;
|
|||
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.GenericStatistic;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.StatisticCategory;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.AdvancementTabAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.ClickItemParam;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.CraftingBookDataType;
|
||||
|
@ -52,13 +54,18 @@ import com.github.steveice10.mc.protocol.data.game.window.FillStackParam;
|
|||
import com.github.steveice10.mc.protocol.data.game.window.MoveToHotbarParam;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.ShiftClickItemParam;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.SpreadItemParam;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.UpdateStructureBlockAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.UpdateStructureBlockMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.property.AnvilProperty;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.property.BrewingStandProperty;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.property.EnchantmentTableProperty;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.property.FurnaceProperty;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.Particle;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.StructureMirror;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.StructureRotation;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.CommandBlockMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.WorldBorderAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.WorldType;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
|
||||
|
@ -136,15 +143,17 @@ public class MagicValues {
|
|||
register(MetadataType.FLOAT, 2);
|
||||
register(MetadataType.STRING, 3);
|
||||
register(MetadataType.CHAT, 4);
|
||||
register(MetadataType.ITEM, 5);
|
||||
register(MetadataType.BOOLEAN, 6);
|
||||
register(MetadataType.ROTATION, 7);
|
||||
register(MetadataType.POSITION, 8);
|
||||
register(MetadataType.OPTIONAL_POSITION, 9);
|
||||
register(MetadataType.BLOCK_FACE, 10);
|
||||
register(MetadataType.OPTIONAL_UUID, 11);
|
||||
register(MetadataType.BLOCK_STATE, 12);
|
||||
register(MetadataType.NBT_TAG, 13);
|
||||
register(MetadataType.OPTIONAL_CHAT, 5);
|
||||
register(MetadataType.ITEM, 6);
|
||||
register(MetadataType.BOOLEAN, 7);
|
||||
register(MetadataType.ROTATION, 8);
|
||||
register(MetadataType.POSITION, 9);
|
||||
register(MetadataType.OPTIONAL_POSITION, 10);
|
||||
register(MetadataType.BLOCK_FACE, 11);
|
||||
register(MetadataType.OPTIONAL_UUID, 12);
|
||||
register(MetadataType.BLOCK_STATE, 13);
|
||||
register(MetadataType.NBT_TAG, 14);
|
||||
register(MetadataType.PARTICLE, 15);
|
||||
|
||||
register(HandshakeIntent.STATUS, 1);
|
||||
register(HandshakeIntent.LOGIN, 2);
|
||||
|
@ -417,32 +426,32 @@ public class MagicValues {
|
|||
register(HangingDirection.NORTH, 2);
|
||||
register(HangingDirection.EAST, 3);
|
||||
|
||||
register(PaintingType.KEBAB, "Kebab");
|
||||
register(PaintingType.AZTEC, "Aztec");
|
||||
register(PaintingType.ALBAN, "Alban");
|
||||
register(PaintingType.AZTEC2, "Aztec2");
|
||||
register(PaintingType.BOMB, "Bomb");
|
||||
register(PaintingType.PLANT, "Plant");
|
||||
register(PaintingType.WASTELAND, "Wasteland");
|
||||
register(PaintingType.POOL, "Pool");
|
||||
register(PaintingType.COURBET, "Courbet");
|
||||
register(PaintingType.SEA, "Sea");
|
||||
register(PaintingType.SUNSET, "Sunset");
|
||||
register(PaintingType.CREEBET, "Creebet");
|
||||
register(PaintingType.WANDERER, "Wanderer");
|
||||
register(PaintingType.GRAHAM, "Graham");
|
||||
register(PaintingType.MATCH, "Match");
|
||||
register(PaintingType.BUST, "Bust");
|
||||
register(PaintingType.STAGE, "Stage");
|
||||
register(PaintingType.VOID, "Void");
|
||||
register(PaintingType.SKULL_AND_ROSES, "SkullAndRoses");
|
||||
register(PaintingType.WITHER, "Wither");
|
||||
register(PaintingType.FIGHTERS, "Fighters");
|
||||
register(PaintingType.POINTER, "Pointer");
|
||||
register(PaintingType.PIG_SCENE, "Pigscene");
|
||||
register(PaintingType.BURNING_SKULL, "BurningSkull");
|
||||
register(PaintingType.SKELETON, "Skeleton");
|
||||
register(PaintingType.DONKEY_KONG, "DonkeyKong");
|
||||
register(PaintingType.KEBAB, 0);
|
||||
register(PaintingType.AZTEC, 1);
|
||||
register(PaintingType.ALBAN, 2);
|
||||
register(PaintingType.AZTEC2, 3);
|
||||
register(PaintingType.BOMB, 4);
|
||||
register(PaintingType.PLANT, 5);
|
||||
register(PaintingType.WASTELAND, 6);
|
||||
register(PaintingType.POOL, 7);
|
||||
register(PaintingType.COURBET, 8);
|
||||
register(PaintingType.SEA, 9);
|
||||
register(PaintingType.SUNSET, 10);
|
||||
register(PaintingType.CREEBET, 11);
|
||||
register(PaintingType.WANDERER, 12);
|
||||
register(PaintingType.GRAHAM, 13);
|
||||
register(PaintingType.MATCH, 14);
|
||||
register(PaintingType.BUST, 15);
|
||||
register(PaintingType.STAGE, 16);
|
||||
register(PaintingType.VOID, 17);
|
||||
register(PaintingType.SKULL_AND_ROSES, 18);
|
||||
register(PaintingType.WITHER, 19);
|
||||
register(PaintingType.FIGHTERS, 20);
|
||||
register(PaintingType.POINTER, 21);
|
||||
register(PaintingType.PIG_SCENE, 22);
|
||||
register(PaintingType.BURNING_SKULL, 23);
|
||||
register(PaintingType.SKELETON, 24);
|
||||
register(PaintingType.DONKEY_KONG, 25);
|
||||
|
||||
register(ScoreboardPosition.PLAYER_LIST, 0);
|
||||
register(ScoreboardPosition.SIDEBAR, 1);
|
||||
|
@ -487,12 +496,23 @@ public class MagicValues {
|
|||
register(MapIconType.SMALL_WHITE_CIRCLE, 7);
|
||||
register(MapIconType.MANSION, 8);
|
||||
register(MapIconType.TEMPLE, 9);
|
||||
register(MapIconType.UNUSED_10, 10);
|
||||
register(MapIconType.UNUSED_11, 11);
|
||||
register(MapIconType.UNUSED_12, 12);
|
||||
register(MapIconType.UNUSED_13, 13);
|
||||
register(MapIconType.UNUSED_14, 14);
|
||||
register(MapIconType.UNUSED_15, 15);
|
||||
register(MapIconType.WHITE_BANNER, 10);
|
||||
register(MapIconType.ORANGE_BANNER, 11);
|
||||
register(MapIconType.MAGENTA_BANNER, 12);
|
||||
register(MapIconType.LIGHT_BLUE_BANNER, 13);
|
||||
register(MapIconType.YELLOW_BANNER, 14);
|
||||
register(MapIconType.LIME_BANNER, 15);
|
||||
register(MapIconType.PINK_BANNER, 16);
|
||||
register(MapIconType.GRAY_BANNER, 17);
|
||||
register(MapIconType.LIGHT_GRAY_BANNER, 18);
|
||||
register(MapIconType.CYAN_BANNER, 19);
|
||||
register(MapIconType.PURPLE_BANNER, 20);
|
||||
register(MapIconType.BLUE_BANNER, 21);
|
||||
register(MapIconType.BROWN_BANNER, 22);
|
||||
register(MapIconType.GREEN_BANNER, 23);
|
||||
register(MapIconType.RED_BANNER, 24);
|
||||
register(MapIconType.BLACK_BANNER, 25);
|
||||
register(MapIconType.TREASURE_MARKER, 26);
|
||||
|
||||
register(WindowType.GENERIC_INVENTORY, "minecraft:container");
|
||||
register(WindowType.ANVIL, "minecraft:anvil");
|
||||
|
@ -543,7 +563,7 @@ public class MagicValues {
|
|||
register(UpdatedTileType.COMMAND_BLOCK, 2);
|
||||
register(UpdatedTileType.BEACON, 3);
|
||||
register(UpdatedTileType.SKULL, 4);
|
||||
register(UpdatedTileType.FLOWER_POT, 5);
|
||||
register(UpdatedTileType.CONDUIT, 5);
|
||||
register(UpdatedTileType.BANNER, 6);
|
||||
register(UpdatedTileType.STRUCTURE_BLOCK, 7);
|
||||
register(UpdatedTileType.END_GATEWAY, 8);
|
||||
|
@ -562,6 +582,29 @@ public class MagicValues {
|
|||
register(ClientNotification.THUNDER_STRENGTH, 8);
|
||||
register(ClientNotification.AFFECTED_BY_ELDER_GUARDIAN, 10);
|
||||
|
||||
register(CommandBlockMode.SEQUENCE, 0);
|
||||
register(CommandBlockMode.AUTO, 1);
|
||||
register(CommandBlockMode.REDSTONE, 2);
|
||||
|
||||
register(UpdateStructureBlockAction.UPDATE_DATA, 0);
|
||||
register(UpdateStructureBlockAction.SAVE_STRUCTURE, 1);
|
||||
register(UpdateStructureBlockAction.LOAD_STRUCTURE, 2);
|
||||
register(UpdateStructureBlockAction.DETECT_SIZE, 3);
|
||||
|
||||
register(UpdateStructureBlockMode.SAVE, 0);
|
||||
register(UpdateStructureBlockMode.LOAD, 1);
|
||||
register(UpdateStructureBlockMode.CORNER, 2);
|
||||
register(UpdateStructureBlockMode.DATA, 3);
|
||||
|
||||
register(StructureRotation.NONE, 0);
|
||||
register(StructureRotation.CLOCKWISE_90, 1);
|
||||
register(StructureRotation.CLOCKWISE_180, 2);
|
||||
register(StructureRotation.COUNTERCLOCKWISE_90, 3);
|
||||
|
||||
register(StructureMirror.NONE, 0);
|
||||
register(StructureMirror.LEFT_RIGHT, 1);
|
||||
register(StructureMirror.FRONT_BACK, 2);
|
||||
|
||||
register(DemoMessageValue.WELCOME, 0);
|
||||
register(DemoMessageValue.MOVEMENT_CONTROLS, 101);
|
||||
register(DemoMessageValue.JUMP_CONTROL, 102);
|
||||
|
@ -570,106 +613,117 @@ public class MagicValues {
|
|||
register(EnterCreditsValue.SEEN_BEFORE, 0);
|
||||
register(EnterCreditsValue.FIRST_TIME, 1);
|
||||
|
||||
register(GenericStatistic.CAKE_SLICES_EATEN, "stat.cakeSlicesEaten");
|
||||
register(GenericStatistic.TIMES_CAULDRON_FILLED, "stat.cauldronFilled");
|
||||
register(GenericStatistic.TIMES_CAULDRON_USED, "stat.cauldronUsed");
|
||||
register(GenericStatistic.TIMES_ARMOR_CLEANED, "stat.armorCleaned");
|
||||
register(GenericStatistic.TIMES_BANNER_CLEANED, "stat.bannerCleaned");
|
||||
register(GenericStatistic.TIMES_BREWING_STAND_GUI_OPENED, "stat.brewingstandInteraction");
|
||||
register(GenericStatistic.TIMES_BEACON_GUI_OPENED, "stat.beaconInteraction");
|
||||
register(GenericStatistic.TIMES_CRAFTING_TABLE_GUI_OPENED, "stat.craftingTableInteraction");
|
||||
register(GenericStatistic.TIMES_FURNACE_GUI_OPENED, "stat.furnaceInteraction");
|
||||
register(GenericStatistic.TIMES_DISPENSER_GUI_OPENED, "stat.dispenserInteraction");
|
||||
register(GenericStatistic.TIMES_DROPPER_GUI_OPENED, "stat.dropperInteraction");
|
||||
register(GenericStatistic.TIMES_HOPPER_GUI_OPENED, "stat.hopperInteraction");
|
||||
register(GenericStatistic.TIMES_CHEST_GUI_OPENED, "stat.chestInteraction");
|
||||
register(GenericStatistic.TIMES_SHULKER_BOX_GUI_OPENED, "stat.shulkerBoxOpened");
|
||||
register(GenericStatistic.TIMES_TRAPPED_CHEST_GUI_OPENED, "stat.trappedChestInteraction");
|
||||
register(GenericStatistic.TIMES_ENDER_CHEST_GUI_OPENED, "stat.enderchestInteraction");
|
||||
register(GenericStatistic.TIMES_NOTEBLOCK_PLAYED, "stat.noteblockPlayed");
|
||||
register(GenericStatistic.TIMES_NOTEBLOCK_TUNED, "stat.noteblockTuned");
|
||||
register(GenericStatistic.TIMES_PLANT_POTTED, "stat.flowerPotted");
|
||||
register(GenericStatistic.TIMES_RECORD_PLAYED, "stat.recordPlayed");
|
||||
register(GenericStatistic.TIMES_BED_ENTERED, "stat.sleepInBed");
|
||||
register(GenericStatistic.TIMES_LEFT_GAME, "stat.leaveGame");
|
||||
register(GenericStatistic.TICKS_PLAYED, "stat.playOneMinute");
|
||||
register(GenericStatistic.TICKS_SINCE_DEATH, "stat.timeSinceDeath");
|
||||
register(GenericStatistic.TICKS_SNEAKED, "stat.sneakTime");
|
||||
register(GenericStatistic.CENTIMETERS_WALKED, "stat.walkOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_CROUCHED, "stat.crouchOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_SPRINTED, "stat.sprintOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_SWAM, "stat.swimOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_FALLEN, "stat.fallOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_CLIMBED, "stat.climbOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_FLOWN, "stat.flyOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_FLOWN_WITH_ELYTRA, "stat.aviateOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_DOVE, "stat.diveOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_TRAVELLED_IN_MINECART, "stat.minecartOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_TRAVELLED_IN_BOAT, "stat.boatOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_RODE_ON_PIG, "stat.pigOneCm");
|
||||
register(GenericStatistic.CENTIMETERS_RODE_ON_HORSE, "stat.horseOneCm");
|
||||
register(GenericStatistic.TIMES_JUMPED, "stat.jump");
|
||||
register(GenericStatistic.TIMES_DROPPED_ITEMS, "stat.drop");
|
||||
register(GenericStatistic.TIMES_ENCHANTED_ITEMS, "stat.itemEnchanted");
|
||||
register(GenericStatistic.TIMES_TALKED_TO_VILLAGERS, "stat.talkedToVillager");
|
||||
register(GenericStatistic.TIMES_TRADED_WITH_VILLAGERS, "stat.tradedWithVillager");
|
||||
register(GenericStatistic.DAMAGE_DEALT, "stat.damageDealt");
|
||||
register(GenericStatistic.DAMAGE_TAKEN, "stat.damageTaken");
|
||||
register(GenericStatistic.DEATHS, "stat.deaths");
|
||||
register(GenericStatistic.MOB_KILLS, "stat.mobKills");
|
||||
register(GenericStatistic.ANIMALS_BRED, "stat.animalsBred");
|
||||
register(GenericStatistic.PLAYERS_KILLED, "stat.playerKills");
|
||||
register(GenericStatistic.FISH_CAUGHT, "stat.fishCaught");
|
||||
register(GenericStatistic.TIMES_LEFT_GAME, 0);
|
||||
register(GenericStatistic.TICKS_PLAYED, 1);
|
||||
register(GenericStatistic.TICKS_SINCE_DEATH, 2);
|
||||
register(GenericStatistic.TICKS_SNEAKED, 3);
|
||||
register(GenericStatistic.CENTIMETERS_WALKED, 4);
|
||||
register(GenericStatistic.CENTIMETERS_CROUCHED, 5);
|
||||
register(GenericStatistic.CENTIMETERS_SPRINTED, 6);
|
||||
register(GenericStatistic.CENTIMETERS_SWAM, 7);
|
||||
register(GenericStatistic.CENTIMETERS_FALLEN, 8);
|
||||
register(GenericStatistic.CENTIMETERS_CLIMBED, 9);
|
||||
register(GenericStatistic.CENTIMETERS_FLOWN, 10);
|
||||
register(GenericStatistic.CENTIMETERS_DOVE, 11);
|
||||
register(GenericStatistic.CENTIMETERS_TRAVELLED_IN_MINECART, 12);
|
||||
register(GenericStatistic.CENTIMETERS_TRAVELLED_IN_BOAT, 13);
|
||||
register(GenericStatistic.CENTIMETERS_RODE_ON_PIG, 14);
|
||||
register(GenericStatistic.CENTIMETERS_RODE_ON_HORSE, 15);
|
||||
register(GenericStatistic.CENTIMETERS_FLOWN_WITH_ELYTRA, 16);
|
||||
register(GenericStatistic.TIMES_JUMPED, 17);
|
||||
register(GenericStatistic.TIMES_DROPPED_ITEMS, 18);
|
||||
register(GenericStatistic.DAMAGE_DEALT, 19);
|
||||
register(GenericStatistic.DAMAGE_TAKEN, 20);
|
||||
register(GenericStatistic.DEATHS, 21);
|
||||
register(GenericStatistic.MOB_KILLS, 22);
|
||||
register(GenericStatistic.ANIMALS_BRED, 23);
|
||||
register(GenericStatistic.PLAYERS_KILLED, 24);
|
||||
register(GenericStatistic.FISH_CAUGHT, 25);
|
||||
register(GenericStatistic.TIMES_TALKED_TO_VILLAGERS, 26);
|
||||
register(GenericStatistic.TIMES_TRADED_WITH_VILLAGERS, 27);
|
||||
register(GenericStatistic.CAKE_SLICES_EATEN, 28);
|
||||
register(GenericStatistic.TIMES_CAULDRON_FILLED, 29);
|
||||
register(GenericStatistic.TIMES_CAULDRON_USED, 30);
|
||||
register(GenericStatistic.TIMES_ARMOR_CLEANED, 31);
|
||||
register(GenericStatistic.TIMES_BANNER_CLEANED, 32);
|
||||
register(GenericStatistic.TIMES_BREWING_STAND_GUI_OPENED, 33);
|
||||
register(GenericStatistic.TIMES_BEACON_GUI_OPENED, 34);
|
||||
register(GenericStatistic.TIMES_DROPPER_GUI_OPENED, 35);
|
||||
register(GenericStatistic.TIMES_HOPPER_GUI_OPENED, 36);
|
||||
register(GenericStatistic.TIMES_DISPENSER_GUI_OPENED, 37);
|
||||
register(GenericStatistic.TIMES_NOTEBLOCK_PLAYED, 38);
|
||||
register(GenericStatistic.TIMES_NOTEBLOCK_TUNED, 39);
|
||||
register(GenericStatistic.TIMES_PLANT_POTTED, 40);
|
||||
register(GenericStatistic.TIMES_TRAPPED_CHEST_GUI_OPENED, 41);
|
||||
register(GenericStatistic.TIMES_ENDER_CHEST_GUI_OPENED, 42);
|
||||
register(GenericStatistic.TIMES_ENCHANTED_ITEMS, 43);
|
||||
register(GenericStatistic.TIMES_RECORD_PLAYED, 44);
|
||||
register(GenericStatistic.TIMES_FURNACE_GUI_OPENED, 45);
|
||||
register(GenericStatistic.TIMES_CRAFTING_TABLE_GUI_OPENED, 46);
|
||||
register(GenericStatistic.TIMES_CHEST_GUI_OPENED, 47);
|
||||
register(GenericStatistic.TIMES_BED_ENTERED, 48);
|
||||
register(GenericStatistic.TIMES_SHULKER_BOX_GUI_OPENED, 49);
|
||||
|
||||
register(Particle.EXPLOSION_NORMAL, 0);
|
||||
register(Particle.EXPLOSION_LARGE, 1);
|
||||
register(Particle.EXPLOSION_HUGE, 2);
|
||||
register(Particle.FIREWORKS_SPARK, 3);
|
||||
register(Particle.WATER_BUBBLE, 4);
|
||||
register(Particle.WATER_SPLASH, 5);
|
||||
register(Particle.WATER_WAKE, 6);
|
||||
register(Particle.SUSPENDED, 7);
|
||||
register(Particle.SUSPENDED_DEPTH, 8);
|
||||
register(Particle.CRIT, 9);
|
||||
register(Particle.CRIT_MAGIC, 10);
|
||||
register(Particle.SMOKE_NORMAL, 11);
|
||||
register(Particle.SMOKE_LARGE, 12);
|
||||
register(Particle.SPELL, 13);
|
||||
register(Particle.SPELL_INSTANT, 14);
|
||||
register(Particle.SPELL_MOB, 15);
|
||||
register(Particle.SPELL_MOB_AMBIENT, 16);
|
||||
register(Particle.SPELL_WITCH, 17);
|
||||
register(Particle.DRIP_WATER, 18);
|
||||
register(Particle.DRIP_LAVA, 19);
|
||||
register(Particle.VILLAGER_ANGRY, 20);
|
||||
register(Particle.VILLAGER_HAPPY, 21);
|
||||
register(Particle.TOWN_AURA, 22);
|
||||
register(Particle.NOTE, 23);
|
||||
register(Particle.PORTAL, 24);
|
||||
register(Particle.ENCHANTMENT_TABLE, 25);
|
||||
register(Particle.FLAME, 26);
|
||||
register(Particle.LAVA, 27);
|
||||
register(Particle.FOOTSTEP, 28);
|
||||
register(Particle.CLOUD, 29);
|
||||
register(Particle.REDSTONE, 30);
|
||||
register(Particle.SNOWBALL, 31);
|
||||
register(Particle.SNOW_SHOVEL, 32);
|
||||
register(Particle.SLIME, 33);
|
||||
register(Particle.HEART, 34);
|
||||
register(Particle.BARRIER, 35);
|
||||
register(Particle.ITEM_CRACK, 36);
|
||||
register(Particle.BLOCK_CRACK, 37);
|
||||
register(Particle.BLOCK_DUST, 38);
|
||||
register(Particle.WATER_DROP, 39);
|
||||
register(Particle.ITEM_TAKE, 40);
|
||||
register(Particle.MOB_APPEARANCE, 41);
|
||||
register(Particle.DRAGON_BREATH, 42);
|
||||
register(Particle.END_ROD, 43);
|
||||
register(Particle.DAMAGE_INDICATOR, 44);
|
||||
register(Particle.SWEEP_ATTACK, 45);
|
||||
register(Particle.FALLING_DUST, 46);
|
||||
register(Particle.TOTEM, 47);
|
||||
register(Particle.SPIT, 48);
|
||||
register(StatisticCategory.BREAK_BLOCK, 0);
|
||||
register(StatisticCategory.CRAFT_ITEM, 1);
|
||||
register(StatisticCategory.USE_ITEM, 2);
|
||||
register(StatisticCategory.BREAK_ITEM, 3);
|
||||
register(StatisticCategory.PICKED_UP_ITEM, 4);
|
||||
register(StatisticCategory.DROP_ITEM, 5);
|
||||
register(StatisticCategory.KILL_ENTITY, 6);
|
||||
register(StatisticCategory.KILLED_BY_ENTITY, 7);
|
||||
register(StatisticCategory.GENERIC, 8);
|
||||
|
||||
register(ParticleType.AMBIENT_ENTITY_EFFECT, 0);
|
||||
register(ParticleType.ANGRY_VILLAGER, 1);
|
||||
register(ParticleType.BARRIER, 2);
|
||||
register(ParticleType.BLOCK, 3);
|
||||
register(ParticleType.BUBBLE, 4);
|
||||
register(ParticleType.CLOUD, 5);
|
||||
register(ParticleType.CRIT, 6);
|
||||
register(ParticleType.DAMAGE_INDICATOR, 7);
|
||||
register(ParticleType.DRAGON_BREATH, 8);
|
||||
register(ParticleType.DRIPPING_LAVA, 9);
|
||||
register(ParticleType.DRIPPING_WATER, 10);
|
||||
register(ParticleType.DUST, 11);
|
||||
register(ParticleType.EFFECT, 12);
|
||||
register(ParticleType.ELDER_GUARDIAN, 13);
|
||||
register(ParticleType.ENCHANTED_HIT, 14);
|
||||
register(ParticleType.ENCHANT, 15);
|
||||
register(ParticleType.END_ROD, 16);
|
||||
register(ParticleType.ENTITY_EFFECT, 17);
|
||||
register(ParticleType.EXPLOSION_EMITTER, 18);
|
||||
register(ParticleType.EXPLOSION, 19);
|
||||
register(ParticleType.FALLING_DUST, 20);
|
||||
register(ParticleType.FIREWORK, 21);
|
||||
register(ParticleType.FISHING, 22);
|
||||
register(ParticleType.FLAME, 23);
|
||||
register(ParticleType.HAPPY_VILLAGER, 24);
|
||||
register(ParticleType.HEART, 25);
|
||||
register(ParticleType.INSTANT_EFFECT, 26);
|
||||
register(ParticleType.ITEM, 27);
|
||||
register(ParticleType.ITEM_SLIME, 28);
|
||||
register(ParticleType.ITEM_SNOWBALL, 29);
|
||||
register(ParticleType.LARGE_SMOKE, 30);
|
||||
register(ParticleType.LAVA, 31);
|
||||
register(ParticleType.MYCELIUM, 32);
|
||||
register(ParticleType.NOTE, 33);
|
||||
register(ParticleType.POOF, 34);
|
||||
register(ParticleType.PORTAL, 35);
|
||||
register(ParticleType.RAIN, 36);
|
||||
register(ParticleType.SMOKE, 37);
|
||||
register(ParticleType.SPIT, 38);
|
||||
register(ParticleType.SQUID_INK, 39);
|
||||
register(ParticleType.SWEEP_ATTACK, 40);
|
||||
register(ParticleType.TOTEM_OF_UNDYING, 41);
|
||||
register(ParticleType.UNDERWATER, 42);
|
||||
register(ParticleType.SPLASH, 43);
|
||||
register(ParticleType.WITCH, 44);
|
||||
register(ParticleType.BUBBLE_POP, 45);
|
||||
register(ParticleType.CURRENT_DOWN, 46);
|
||||
register(ParticleType.BUBBLE_COLUMN_UP, 47);
|
||||
register(ParticleType.NAUTILUS, 48);
|
||||
register(ParticleType.DOLPHIN, 49);
|
||||
|
||||
register(NoteBlockValueType.HARP, 0);
|
||||
register(NoteBlockValueType.DOUBLE_BASS, 1);
|
||||
|
@ -770,7 +824,6 @@ public class MagicValues {
|
|||
register(CollisionRule.PUSH_OTHER_TEAMS, "pushOtherTeams");
|
||||
register(CollisionRule.PUSH_OWN_TEAM, "pushOwnTeam");
|
||||
|
||||
register(TeamColor.NONE, -1);
|
||||
register(TeamColor.BLACK, 0);
|
||||
register(TeamColor.DARK_BLUE, 1);
|
||||
register(TeamColor.DARK_GREEN, 2);
|
||||
|
@ -787,9 +840,15 @@ public class MagicValues {
|
|||
register(TeamColor.LIGHT_PURPLE, 13);
|
||||
register(TeamColor.YELLOW, 14);
|
||||
register(TeamColor.WHITE, 15);
|
||||
register(TeamColor.OBFUSCATED, 16);
|
||||
register(TeamColor.BOLD, 17);
|
||||
register(TeamColor.STRIKETHROUGH, 18);
|
||||
register(TeamColor.UNDERLINED, 19);
|
||||
register(TeamColor.ITALIC, 20);
|
||||
register(TeamColor.NONE, 21);
|
||||
|
||||
register(ScoreType.INTEGER, "integer");
|
||||
register(ScoreType.HEARTS, "hearts");
|
||||
register(ScoreType.INTEGER, 0);
|
||||
register(ScoreType.HEARTS, 1);
|
||||
|
||||
register(Advancement.DisplayData.FrameType.TASK, 0);
|
||||
register(Advancement.DisplayData.FrameType.CHALLENGE, 1);
|
||||
|
@ -869,6 +928,9 @@ public class MagicValues {
|
|||
register(EquipmentSlot.CHESTPLATE, 4);
|
||||
register(EquipmentSlot.HELMET, 5);
|
||||
|
||||
register(FeetOrEyes.FEET, 0);
|
||||
register(FeetOrEyes.EYES, 1);
|
||||
|
||||
register(SoundCategory.MASTER, 0);
|
||||
register(SoundCategory.MUSIC, 1);
|
||||
register(SoundCategory.RECORD, 2);
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
public class BlockStorage {
|
||||
private static final BlockState AIR = new BlockState(0, 0);
|
||||
private static final BlockState AIR = new BlockState(0);
|
||||
|
||||
private int bitsPerEntry;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class BlockStorage {
|
|||
this.bitsPerEntry = in.readUnsignedByte();
|
||||
|
||||
this.states = new ArrayList<BlockState>();
|
||||
int stateCount = in.readVarInt();
|
||||
int stateCount = this.bitsPerEntry > 8 ? 0 : in.readVarInt();
|
||||
for(int i = 0; i < stateCount; i++) {
|
||||
this.states.add(NetUtil.readBlockState(in));
|
||||
}
|
||||
|
@ -46,19 +46,21 @@ public class BlockStorage {
|
|||
}
|
||||
|
||||
private static BlockState rawToState(int raw) {
|
||||
return new BlockState(raw >> 4, raw & 0xF);
|
||||
return new BlockState(raw);
|
||||
}
|
||||
|
||||
private static int stateToRaw(BlockState state) {
|
||||
return (state.getId() << 4) | (state.getData() & 0xF);
|
||||
return state.getId();
|
||||
}
|
||||
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte(this.bitsPerEntry);
|
||||
|
||||
out.writeVarInt(this.states.size());
|
||||
for(BlockState state : this.states) {
|
||||
NetUtil.writeBlockState(out, state);
|
||||
if (this.bitsPerEntry <= 8) {
|
||||
out.writeVarInt(this.states.size());
|
||||
for (BlockState state : this.states) {
|
||||
NetUtil.writeBlockState(out, state);
|
||||
}
|
||||
}
|
||||
|
||||
long[] data = this.storage.getData();
|
||||
|
|
|
@ -9,7 +9,7 @@ public class Column {
|
|||
private int x;
|
||||
private int z;
|
||||
private Chunk chunks[];
|
||||
private byte biomeData[];
|
||||
private int biomeData[];
|
||||
private CompoundTag tileEntities[];
|
||||
|
||||
private boolean skylight;
|
||||
|
@ -18,7 +18,7 @@ public class Column {
|
|||
this(x, z, chunks, null, tileEntities);
|
||||
}
|
||||
|
||||
public Column(int x, int z, Chunk chunks[], byte biomeData[], CompoundTag[] tileEntities) {
|
||||
public Column(int x, int z, Chunk chunks[], int biomeData[], CompoundTag[] tileEntities) {
|
||||
if(chunks.length != 16) {
|
||||
throw new IllegalArgumentException("Chunk array length must be 16.");
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class Column {
|
|||
return this.biomeData != null;
|
||||
}
|
||||
|
||||
public byte[] getBiomeData() {
|
||||
public int[] getBiomeData() {
|
||||
return this.biomeData;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.entity;
|
||||
|
||||
public enum FeetOrEyes {
|
||||
FEET,
|
||||
EYES;
|
||||
}
|
|
@ -8,7 +8,6 @@ import java.util.Objects;
|
|||
public class ItemStack {
|
||||
private int id;
|
||||
private int amount;
|
||||
private int data;
|
||||
private CompoundTag nbt;
|
||||
|
||||
public ItemStack(int id) {
|
||||
|
@ -16,17 +15,12 @@ public class ItemStack {
|
|||
}
|
||||
|
||||
public ItemStack(int id, int amount) {
|
||||
this(id, amount, 0);
|
||||
this(id, amount, null);
|
||||
}
|
||||
|
||||
public ItemStack(int id, int amount, int data) {
|
||||
this(id, amount, data, null);
|
||||
}
|
||||
|
||||
public ItemStack(int id, int amount, int data, CompoundTag nbt) {
|
||||
public ItemStack(int id, int amount, CompoundTag nbt) {
|
||||
this.id = id;
|
||||
this.amount = amount;
|
||||
this.data = data;
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
|
@ -38,10 +32,6 @@ public class ItemStack {
|
|||
return this.amount;
|
||||
}
|
||||
|
||||
public int getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public CompoundTag getNBT() {
|
||||
return this.nbt;
|
||||
}
|
||||
|
@ -54,13 +44,12 @@ public class ItemStack {
|
|||
ItemStack that = (ItemStack) o;
|
||||
return this.id == that.id &&
|
||||
this.amount == that.amount &&
|
||||
this.data == that.data &&
|
||||
Objects.equals(this.nbt, that.nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.id, this.amount, this.data, this.nbt);
|
||||
return ObjectUtil.hashCode(this.id, this.amount, this.nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ public enum MetadataType {
|
|||
FLOAT,
|
||||
STRING,
|
||||
CHAT,
|
||||
OPTIONAL_CHAT,
|
||||
ITEM,
|
||||
BOOLEAN,
|
||||
ROTATION,
|
||||
|
@ -14,5 +15,6 @@ public enum MetadataType {
|
|||
BLOCK_FACE,
|
||||
OPTIONAL_UUID,
|
||||
BLOCK_STATE,
|
||||
NBT_TAG;
|
||||
NBT_TAG,
|
||||
PARTICLE;
|
||||
}
|
||||
|
|
|
@ -17,5 +17,10 @@ public enum TeamColor {
|
|||
RED,
|
||||
LIGHT_PURPLE,
|
||||
YELLOW,
|
||||
WHITE;
|
||||
WHITE,
|
||||
OBFUSCATED,
|
||||
BOLD,
|
||||
STRIKETHROUGH,
|
||||
UNDERLINED,
|
||||
ITALIC;
|
||||
}
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BreakBlockStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public BreakBlockStatistic(String id) {
|
||||
public BreakBlockStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class BreakBlockStatistic implements Statistic {
|
|||
if(!(o instanceof BreakBlockStatistic)) return false;
|
||||
|
||||
BreakBlockStatistic that = (BreakBlockStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BreakItemStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public BreakItemStatistic(String id) {
|
||||
public BreakItemStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class BreakItemStatistic implements Statistic {
|
|||
if(!(o instanceof BreakItemStatistic)) return false;
|
||||
|
||||
BreakItemStatistic that = (BreakItemStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CraftItemStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public CraftItemStatistic(String id) {
|
||||
public CraftItemStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class CraftItemStatistic implements Statistic {
|
|||
if(!(o instanceof CraftItemStatistic)) return false;
|
||||
|
||||
CraftItemStatistic that = (CraftItemStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.statistic;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CustomStatistic implements Statistic {
|
||||
private String name;
|
||||
private int category;
|
||||
private int id;
|
||||
|
||||
public CustomStatistic(String name) {
|
||||
this.name = name;
|
||||
public CustomStatistic(int id) {
|
||||
this(MagicValues.value(Integer.class, StatisticCategory.GENERIC), id);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
public CustomStatistic(int category, int id) {
|
||||
this.category = category;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getCategory() {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,12 +30,13 @@ public class CustomStatistic implements Statistic {
|
|||
if(!(o instanceof CustomStatistic)) return false;
|
||||
|
||||
CustomStatistic that = (CustomStatistic) o;
|
||||
return Objects.equals(this.name, that.name);
|
||||
return this.category == that.category
|
||||
&& this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.name);
|
||||
return ObjectUtil.hashCode(this.id, this.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class DropItemStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public DropItemStatistic(String id) {
|
||||
public DropItemStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class DropItemStatistic implements Statistic {
|
|||
if(!(o instanceof DropItemStatistic)) return false;
|
||||
|
||||
DropItemStatistic that = (DropItemStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class KillEntityStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public KillEntityStatistic(String id) {
|
||||
public KillEntityStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class KillEntityStatistic implements Statistic {
|
|||
if(!(o instanceof KillEntityStatistic)) return false;
|
||||
|
||||
KillEntityStatistic that = (KillEntityStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class KilledByEntityStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public KilledByEntityStatistic(String id) {
|
||||
public KilledByEntityStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class KilledByEntityStatistic implements Statistic {
|
|||
if(!(o instanceof KilledByEntityStatistic)) return false;
|
||||
|
||||
KilledByEntityStatistic that = (KilledByEntityStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PickupItemStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public PickupItemStatistic(String id) {
|
||||
public PickupItemStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class PickupItemStatistic implements Statistic {
|
|||
if(!(o instanceof PickupItemStatistic)) return false;
|
||||
|
||||
PickupItemStatistic that = (PickupItemStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.statistic;
|
||||
|
||||
public enum StatisticCategory {
|
||||
BREAK_BLOCK,
|
||||
CRAFT_ITEM,
|
||||
USE_ITEM,
|
||||
BREAK_ITEM,
|
||||
PICKED_UP_ITEM,
|
||||
DROP_ITEM,
|
||||
KILL_ENTITY,
|
||||
KILLED_BY_ENTITY,
|
||||
GENERIC;
|
||||
}
|
|
@ -2,16 +2,14 @@ package com.github.steveice10.mc.protocol.data.game.statistic;
|
|||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class UseItemStatistic implements Statistic {
|
||||
private String id;
|
||||
private int id;
|
||||
|
||||
public UseItemStatistic(String id) {
|
||||
public UseItemStatistic(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ public class UseItemStatistic implements Statistic {
|
|||
if(!(o instanceof UseItemStatistic)) return false;
|
||||
|
||||
UseItemStatistic that = (UseItemStatistic) o;
|
||||
return Objects.equals(this.id, that.id);
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.window;
|
||||
|
||||
public enum UpdateStructureBlockAction {
|
||||
UPDATE_DATA,
|
||||
SAVE_STRUCTURE,
|
||||
LOAD_STRUCTURE,
|
||||
DETECT_SIZE;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.window;
|
||||
|
||||
public enum UpdateStructureBlockMode {
|
||||
SAVE,
|
||||
LOAD,
|
||||
CORNER,
|
||||
DATA;
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world;
|
||||
|
||||
public enum Particle {
|
||||
EXPLOSION_NORMAL,
|
||||
EXPLOSION_LARGE,
|
||||
EXPLOSION_HUGE,
|
||||
FIREWORKS_SPARK,
|
||||
WATER_BUBBLE,
|
||||
WATER_SPLASH,
|
||||
WATER_WAKE,
|
||||
SUSPENDED,
|
||||
SUSPENDED_DEPTH,
|
||||
CRIT,
|
||||
CRIT_MAGIC,
|
||||
SMOKE_NORMAL,
|
||||
SMOKE_LARGE,
|
||||
SPELL,
|
||||
SPELL_INSTANT,
|
||||
SPELL_MOB,
|
||||
SPELL_MOB_AMBIENT,
|
||||
SPELL_WITCH,
|
||||
DRIP_WATER,
|
||||
DRIP_LAVA,
|
||||
VILLAGER_ANGRY,
|
||||
VILLAGER_HAPPY,
|
||||
TOWN_AURA,
|
||||
NOTE,
|
||||
PORTAL,
|
||||
ENCHANTMENT_TABLE,
|
||||
FLAME,
|
||||
LAVA,
|
||||
FOOTSTEP,
|
||||
CLOUD,
|
||||
REDSTONE,
|
||||
SNOWBALL,
|
||||
SNOW_SHOVEL,
|
||||
SLIME,
|
||||
HEART,
|
||||
BARRIER,
|
||||
ITEM_CRACK(2),
|
||||
BLOCK_CRACK(1),
|
||||
BLOCK_DUST(1),
|
||||
WATER_DROP,
|
||||
ITEM_TAKE,
|
||||
MOB_APPEARANCE,
|
||||
DRAGON_BREATH,
|
||||
END_ROD,
|
||||
DAMAGE_INDICATOR,
|
||||
SWEEP_ATTACK,
|
||||
FALLING_DUST,
|
||||
SPIT,
|
||||
TOTEM;
|
||||
|
||||
private int dataLength;
|
||||
|
||||
private Particle() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
private Particle(int dataLength) {
|
||||
this.dataLength = dataLength;
|
||||
}
|
||||
|
||||
public int getDataLength() {
|
||||
return this.dataLength;
|
||||
}
|
||||
}
|
|
@ -4,34 +4,27 @@ import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
|||
|
||||
public class BlockState {
|
||||
private int id;
|
||||
private int data;
|
||||
|
||||
public BlockState(int id, int data) {
|
||||
public BlockState(int id) {
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(this == o) return true;
|
||||
if(!(o instanceof BlockState)) return false;
|
||||
|
||||
BlockState that = (BlockState) o;
|
||||
return this.id == that.id &&
|
||||
this.data == that.data;
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.id, this.data);
|
||||
return ObjectUtil.hashCode(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.block;
|
||||
|
||||
public enum CommandBlockMode {
|
||||
SEQUENCE,
|
||||
AUTO,
|
||||
REDSTONE;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.block;
|
||||
|
||||
public enum StructureMirror {
|
||||
NONE,
|
||||
LEFT_RIGHT,
|
||||
FRONT_BACK;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.block;
|
||||
|
||||
public enum StructureRotation {
|
||||
NONE,
|
||||
CLOCKWISE_90,
|
||||
CLOCKWISE_180,
|
||||
COUNTERCLOCKWISE_90;
|
||||
}
|
|
@ -5,7 +5,7 @@ public enum UpdatedTileType {
|
|||
COMMAND_BLOCK,
|
||||
BEACON,
|
||||
SKULL,
|
||||
FLOWER_POT,
|
||||
CONDUIT,
|
||||
BANNER,
|
||||
STRUCTURE_BLOCK,
|
||||
END_GATEWAY,
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.map;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MapIcon {
|
||||
private int centerX;
|
||||
private int centerZ;
|
||||
private MapIconType iconType;
|
||||
private int iconRotation;
|
||||
private Message displayName;
|
||||
|
||||
public MapIcon(int centerX, int centerZ, MapIconType iconType, int iconRotation) {
|
||||
public MapIcon(int centerX, int centerZ, MapIconType iconType, int iconRotation, Message displayName) {
|
||||
this.centerX = centerX;
|
||||
this.centerZ = centerZ;
|
||||
this.iconType = iconType;
|
||||
this.iconRotation = iconRotation;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public int getCenterX() {
|
||||
|
@ -31,6 +36,10 @@ public class MapIcon {
|
|||
return this.iconRotation;
|
||||
}
|
||||
|
||||
public Message getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(this == o) return true;
|
||||
|
@ -40,12 +49,13 @@ public class MapIcon {
|
|||
return this.centerX == that.centerX &&
|
||||
this.centerZ == that.centerZ &&
|
||||
this.iconType == that.iconType &&
|
||||
this.iconRotation == that.iconRotation;
|
||||
this.iconRotation == that.iconRotation &&
|
||||
Objects.equals(this.displayName, that.displayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.centerX, this.centerZ, this.iconType, this.iconRotation);
|
||||
return ObjectUtil.hashCode(this.centerX, this.centerZ, this.iconType, this.iconRotation, this.displayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,10 +11,21 @@ public enum MapIconType {
|
|||
SMALL_WHITE_CIRCLE,
|
||||
MANSION,
|
||||
TEMPLE,
|
||||
UNUSED_10,
|
||||
UNUSED_11,
|
||||
UNUSED_12,
|
||||
UNUSED_13,
|
||||
UNUSED_14,
|
||||
UNUSED_15;
|
||||
WHITE_BANNER,
|
||||
ORANGE_BANNER,
|
||||
MAGENTA_BANNER,
|
||||
LIGHT_BLUE_BANNER,
|
||||
YELLOW_BANNER,
|
||||
LIME_BANNER,
|
||||
PINK_BANNER,
|
||||
GRAY_BANNER,
|
||||
LIGHT_GRAY_BANNER,
|
||||
CYAN_BANNER,
|
||||
PURPLE_BANNER,
|
||||
BLUE_BANNER,
|
||||
BROWN_BANNER,
|
||||
GREEN_BANNER,
|
||||
RED_BANNER,
|
||||
BLACK_BANNER,
|
||||
TREASURE_MARKER;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BlockParticleData implements ParticleData {
|
||||
private final BlockState blockState;
|
||||
|
||||
public BlockParticleData(BlockState blockState) {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
public BlockState getBlockState() {
|
||||
return this.blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if(!(o instanceof BlockParticleData)) return false;
|
||||
|
||||
BlockParticleData that = (BlockParticleData) o;
|
||||
return Objects.equals(this.blockState, that.blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ObjectUtil.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
public class DustParticleData implements ParticleData {
|
||||
private final float red; // 0 - 1
|
||||
private final float green; // 0 - 1
|
||||
private final float blue; // 0 - 1
|
||||
private final float scale; // clamped between 0.01 and 4
|
||||
|
||||
public DustParticleData(float red, float green, float blue, float scale) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public float getRed() {
|
||||
return this.red;
|
||||
}
|
||||
|
||||
public float getGreen() {
|
||||
return this.green;
|
||||
}
|
||||
|
||||
public float getBlue() {
|
||||
return this.blue;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof DustParticleData)) return false;
|
||||
|
||||
DustParticleData that = (DustParticleData) o;
|
||||
return Float.compare(that.red, this.red) == 0 &&
|
||||
Float.compare(that.green, this.green) == 0 &&
|
||||
Float.compare(that.blue, this.blue) == 0 &&
|
||||
Float.compare(that.scale, this.scale) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.red, this.green, this.blue, this.scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ObjectUtil.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class FallingDustParticleData implements ParticleData {
|
||||
private final BlockState blockState;
|
||||
|
||||
public FallingDustParticleData(BlockState blockState) {
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
public BlockState getBlockState() {
|
||||
return this.blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if(!(o instanceof FallingDustParticleData)) return false;
|
||||
|
||||
FallingDustParticleData that = (FallingDustParticleData) o;
|
||||
return Objects.equals(this.blockState, that.blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ObjectUtil.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ItemParticleData implements ParticleData {
|
||||
private final ItemStack itemStack;
|
||||
|
||||
public ItemParticleData(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return this.itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if(!(o instanceof ItemParticleData)) return false;
|
||||
|
||||
ItemParticleData that = (ItemParticleData) o;
|
||||
return Objects.equals(this.itemStack, that.itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ObjectUtil.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
import com.github.steveice10.mc.protocol.util.ObjectUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Particle {
|
||||
private final ParticleType type;
|
||||
private final ParticleData data;
|
||||
|
||||
public Particle(ParticleType type, ParticleData data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ParticleType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public ParticleData getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if(!(o instanceof Particle)) return false;
|
||||
|
||||
Particle that = (Particle) o;
|
||||
return Objects.equals(this.type, that.type)
|
||||
&& Objects.equals(this.data, that.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtil.hashCode(this.type, this.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ObjectUtil.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
public interface ParticleData {
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.world.particle;
|
||||
|
||||
public enum ParticleType {
|
||||
AMBIENT_ENTITY_EFFECT,
|
||||
ANGRY_VILLAGER,
|
||||
BARRIER,
|
||||
BLOCK,
|
||||
BUBBLE,
|
||||
CLOUD,
|
||||
CRIT,
|
||||
DAMAGE_INDICATOR,
|
||||
DRAGON_BREATH,
|
||||
DRIPPING_LAVA,
|
||||
DRIPPING_WATER,
|
||||
DUST,
|
||||
EFFECT,
|
||||
ELDER_GUARDIAN,
|
||||
ENCHANTED_HIT,
|
||||
ENCHANT,
|
||||
END_ROD,
|
||||
ENTITY_EFFECT,
|
||||
EXPLOSION_EMITTER,
|
||||
EXPLOSION,
|
||||
FALLING_DUST,
|
||||
FIREWORK,
|
||||
FISHING,
|
||||
FLAME,
|
||||
HAPPY_VILLAGER,
|
||||
HEART,
|
||||
INSTANT_EFFECT,
|
||||
ITEM,
|
||||
ITEM_SLIME,
|
||||
ITEM_SNOWBALL,
|
||||
LARGE_SMOKE,
|
||||
LAVA,
|
||||
MYCELIUM,
|
||||
NOTE,
|
||||
POOF,
|
||||
PORTAL,
|
||||
RAIN,
|
||||
SMOKE,
|
||||
SPIT,
|
||||
SQUID_INK,
|
||||
SWEEP_ATTACK,
|
||||
TOTEM_OF_UNDYING,
|
||||
UNDERWATER,
|
||||
SPLASH,
|
||||
WITCH,
|
||||
BUBBLE_POP,
|
||||
CURRENT_DOWN,
|
||||
BUBBLE_COLUMN_UP,
|
||||
NAUTILUS,
|
||||
DOLPHIN;
|
||||
}
|
|
@ -1,58 +1,41 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientTabCompletePacket extends MinecraftPacket {
|
||||
private int transactionId;
|
||||
private String text;
|
||||
private boolean assumeCommand;
|
||||
private Position lookingAt;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientTabCompletePacket() {
|
||||
}
|
||||
|
||||
public ClientTabCompletePacket(String text, boolean assumeCommand) {
|
||||
this(text, assumeCommand, null);
|
||||
public ClientTabCompletePacket(int transactionId, String text) {
|
||||
this.transactionId = transactionId;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public ClientTabCompletePacket(String text, boolean assumeCommand, Position lookingAt) {
|
||||
this.text = text;
|
||||
this.assumeCommand = assumeCommand;
|
||||
this.lookingAt = lookingAt;
|
||||
public int getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
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.transactionId = in.readVarInt();
|
||||
this.text = in.readString();
|
||||
this.assumeCommand = in.readBoolean();
|
||||
this.lookingAt = in.readBoolean() ? NetUtil.readPosition(in) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.transactionId);
|
||||
out.writeString(this.text);
|
||||
out.writeBoolean(this.assumeCommand);
|
||||
out.writeBoolean(this.lookingAt != null);
|
||||
if(this.lookingAt != null) {
|
||||
NetUtil.writePosition(out, this.lookingAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,23 +10,26 @@ import java.io.IOException;
|
|||
|
||||
public class ClientCraftingBookDataPacket extends MinecraftPacket {
|
||||
private CraftingBookDataType type;
|
||||
private int recipeId;
|
||||
private String recipeId;
|
||||
private boolean craftingBookOpen;
|
||||
private boolean filterActive;
|
||||
private boolean filterCraftingActive;
|
||||
private boolean smeltingBookOpen;
|
||||
private boolean filterSmeltingActive;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientCraftingBookDataPacket() {
|
||||
}
|
||||
|
||||
public ClientCraftingBookDataPacket(int recipeId) {
|
||||
public ClientCraftingBookDataPacket(String recipeId) {
|
||||
this.type = CraftingBookDataType.DISPLAYED_RECIPE;
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public ClientCraftingBookDataPacket(boolean craftingBookOpen, boolean filterActive) {
|
||||
public ClientCraftingBookDataPacket(boolean craftingBookOpen, boolean filterCraftingActive,
|
||||
boolean smeltingBookOpen, boolean filterSmeltingActive) {
|
||||
this.type = CraftingBookDataType.CRAFTING_BOOK_STATUS;
|
||||
this.craftingBookOpen = craftingBookOpen;
|
||||
this.filterActive = filterActive;
|
||||
this.filterCraftingActive = filterCraftingActive;
|
||||
}
|
||||
|
||||
public CraftingBookDataType getType() {
|
||||
|
@ -39,7 +42,7 @@ public class ClientCraftingBookDataPacket extends MinecraftPacket {
|
|||
}
|
||||
}
|
||||
|
||||
public int getRecipeId() {
|
||||
public String getRecipeId() {
|
||||
ensureType(CraftingBookDataType.DISPLAYED_RECIPE, "recipeId");
|
||||
return recipeId;
|
||||
}
|
||||
|
@ -49,20 +52,32 @@ public class ClientCraftingBookDataPacket extends MinecraftPacket {
|
|||
return craftingBookOpen;
|
||||
}
|
||||
|
||||
public boolean isFilterActive() {
|
||||
ensureType(CraftingBookDataType.CRAFTING_BOOK_STATUS, "filterActive");
|
||||
return filterActive;
|
||||
public boolean isFilterCraftingActive() {
|
||||
ensureType(CraftingBookDataType.CRAFTING_BOOK_STATUS, "filterCraftingActive");
|
||||
return filterCraftingActive;
|
||||
}
|
||||
|
||||
public boolean isSmeltingBookOpen() {
|
||||
ensureType(CraftingBookDataType.CRAFTING_BOOK_STATUS, "smeltingBookOpen");
|
||||
return smeltingBookOpen;
|
||||
}
|
||||
|
||||
public boolean isFilterSmeltingActive() {
|
||||
ensureType(CraftingBookDataType.CRAFTING_BOOK_STATUS, "filterSmeltingActive");
|
||||
return filterSmeltingActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
switch(this.type = MagicValues.key(CraftingBookDataType.class, in.readVarInt())) {
|
||||
case DISPLAYED_RECIPE:
|
||||
this.recipeId = in.readInt();
|
||||
this.recipeId = in.readString();
|
||||
break;
|
||||
case CRAFTING_BOOK_STATUS:
|
||||
this.craftingBookOpen = in.readBoolean();
|
||||
this.filterActive = in.readBoolean();
|
||||
this.filterCraftingActive = in.readBoolean();
|
||||
this.smeltingBookOpen = in.readBoolean();
|
||||
this.filterSmeltingActive = in.readBoolean();
|
||||
break;
|
||||
default:
|
||||
throw new IOException("Unknown crafting book data type: " + this.type);
|
||||
|
@ -74,11 +89,13 @@ public class ClientCraftingBookDataPacket extends MinecraftPacket {
|
|||
out.writeVarInt(MagicValues.value(Integer.class, this.type));
|
||||
switch(this.type) {
|
||||
case DISPLAYED_RECIPE:
|
||||
out.writeInt(this.recipeId);
|
||||
out.writeString(this.recipeId);
|
||||
break;
|
||||
case CRAFTING_BOOK_STATUS:
|
||||
out.writeBoolean(this.craftingBookOpen);
|
||||
out.writeBoolean(this.filterActive);
|
||||
out.writeBoolean(this.filterCraftingActive);
|
||||
out.writeBoolean(this.smeltingBookOpen);
|
||||
out.writeBoolean(this.filterSmeltingActive);
|
||||
break;
|
||||
default:
|
||||
throw new IOException("Unknown crafting book data type: " + this.type);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientEditBookPacket extends MinecraftPacket {
|
||||
private ItemStack book;
|
||||
private boolean isSigning;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientEditBookPacket() {
|
||||
}
|
||||
|
||||
public ClientEditBookPacket(ItemStack book, boolean isSigning) {
|
||||
this.book = book;
|
||||
this.isSigning = isSigning;
|
||||
}
|
||||
|
||||
public ItemStack getBook() {
|
||||
return this.book;
|
||||
}
|
||||
|
||||
public boolean getIsSigning() {
|
||||
return this.isSigning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.book = NetUtil.readItem(in);
|
||||
this.isSigning = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
NetUtil.writeItem(out, this.book);
|
||||
out.writeBoolean(this.isSigning);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientMoveItemToHotbarPacket extends MinecraftPacket {
|
||||
private int slot;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientMoveItemToHotbarPacket() {
|
||||
}
|
||||
|
||||
public ClientMoveItemToHotbarPacket(int slot) {
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return this.slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.slot = in.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.slot);
|
||||
}
|
||||
}
|
|
@ -8,14 +8,14 @@ import java.io.IOException;
|
|||
|
||||
public class ClientPrepareCraftingGridPacket extends MinecraftPacket {
|
||||
private int windowId;
|
||||
private int recipeId;
|
||||
private String recipeId;
|
||||
private boolean makeAll;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientPrepareCraftingGridPacket() {
|
||||
}
|
||||
|
||||
public ClientPrepareCraftingGridPacket(int windowId, int recipeId, boolean makeAll) {
|
||||
public ClientPrepareCraftingGridPacket(int windowId, String recipeId, boolean makeAll) {
|
||||
this.windowId = windowId;
|
||||
this.recipeId = recipeId;
|
||||
this.makeAll = makeAll;
|
||||
|
@ -25,7 +25,7 @@ public class ClientPrepareCraftingGridPacket extends MinecraftPacket {
|
|||
return this.windowId;
|
||||
}
|
||||
|
||||
public int getRecipeId() {
|
||||
public String getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
|
@ -36,14 +36,14 @@ public class ClientPrepareCraftingGridPacket extends MinecraftPacket {
|
|||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.windowId = in.readByte();
|
||||
this.recipeId = in.readVarInt();
|
||||
this.recipeId = in.readString();
|
||||
this.makeAll = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte(this.windowId);
|
||||
out.writeVarInt(this.recipeId);
|
||||
out.writeString(this.recipeId);
|
||||
out.writeBoolean(this.makeAll);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientRenameItemPacket extends MinecraftPacket {
|
||||
private String name;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientRenameItemPacket() {
|
||||
}
|
||||
|
||||
public ClientRenameItemPacket(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.name = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeString(this.name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientSelectTradePacket extends MinecraftPacket {
|
||||
private int slot;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientSelectTradePacket() {
|
||||
}
|
||||
|
||||
public ClientSelectTradePacket(int slot) {
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return this.slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.slot = in.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.slot);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientSetBeaconEffectPacket extends MinecraftPacket {
|
||||
private int primaryEffect;
|
||||
private int secondaryEffect;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientSetBeaconEffectPacket() {
|
||||
}
|
||||
|
||||
public ClientSetBeaconEffectPacket(int primaryEffect, int secondaryEffect) {
|
||||
this.primaryEffect = primaryEffect;
|
||||
this.secondaryEffect = secondaryEffect;
|
||||
}
|
||||
|
||||
public int getPrimaryEffect() {
|
||||
return this.primaryEffect;
|
||||
}
|
||||
|
||||
public int getSecondaryEffect() {
|
||||
return this.secondaryEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.primaryEffect = in.readVarInt();
|
||||
this.secondaryEffect = in.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.primaryEffect);
|
||||
out.writeVarInt(this.secondaryEffect);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientUpdateCommandBlockMinecartPacket extends MinecraftPacket {
|
||||
private int entityId;
|
||||
private String command;
|
||||
private boolean doesTrackOutput;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientUpdateCommandBlockMinecartPacket() {
|
||||
}
|
||||
|
||||
public ClientUpdateCommandBlockMinecartPacket(int entityId, String command, boolean doesTrackOutput) {
|
||||
this.entityId = entityId;
|
||||
this.command = command;
|
||||
this.doesTrackOutput = doesTrackOutput;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return this.entityId;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public boolean isDoesTrackOutput() {
|
||||
return this.doesTrackOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.entityId = in.readVarInt();
|
||||
this.command = in.readString();
|
||||
this.doesTrackOutput = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.entityId);
|
||||
out.writeString(this.command);
|
||||
out.writeBoolean(this.doesTrackOutput);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
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.world.block.CommandBlockMode;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientUpdateCommandBlockPacket extends MinecraftPacket {
|
||||
private Position position;
|
||||
private String command;
|
||||
private CommandBlockMode mode;
|
||||
private boolean doesTrackOutput;
|
||||
private boolean isConditional;
|
||||
private boolean isAutomatic;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientUpdateCommandBlockPacket() {
|
||||
}
|
||||
|
||||
public ClientUpdateCommandBlockPacket(Position position, String command, CommandBlockMode mode,
|
||||
boolean doesTrackOutput, boolean isConditional, boolean isAutomatic) {
|
||||
this.position = position;
|
||||
this.command = command;
|
||||
this.mode = mode;
|
||||
this.doesTrackOutput = doesTrackOutput;
|
||||
this.isConditional = isConditional;
|
||||
this.isAutomatic = isAutomatic;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public CommandBlockMode getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public boolean isDoesTrackOutput() {
|
||||
return this.doesTrackOutput;
|
||||
}
|
||||
|
||||
public boolean isConditional() {
|
||||
return this.isConditional;
|
||||
}
|
||||
|
||||
public boolean isAutomatic() {
|
||||
return this.isAutomatic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.position = NetUtil.readPosition(in);
|
||||
this.command = in.readString();
|
||||
this.mode = MagicValues.key(CommandBlockMode.class, in.readVarInt());
|
||||
int flags = in.readUnsignedByte();
|
||||
this.doesTrackOutput = (flags & 0x01) != 0;
|
||||
this.isConditional = (flags & 0x02) != 0;
|
||||
this.isAutomatic = (flags & 0x04) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
NetUtil.writePosition(out, this.position);
|
||||
out.writeString(this.command);
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.mode));
|
||||
int flags = 0;
|
||||
if (this.doesTrackOutput) flags |= 0x01;
|
||||
if (this.isConditional) flags |= 0x02;
|
||||
if (this.isAutomatic) flags |= 0x04;
|
||||
out.writeByte(flags);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.window;
|
||||
|
||||
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.window.UpdateStructureBlockAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.UpdateStructureBlockMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.StructureMirror;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.StructureRotation;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientUpdateStructureBlockPacket extends MinecraftPacket {
|
||||
private Position position;
|
||||
private UpdateStructureBlockAction action;
|
||||
private UpdateStructureBlockMode mode;
|
||||
private String name;
|
||||
private Position offset;
|
||||
private Position size;
|
||||
private StructureMirror mirror;
|
||||
private StructureRotation rotation;
|
||||
private String metadata;
|
||||
private float integrity;
|
||||
private long seed;
|
||||
private boolean ignoreEntities;
|
||||
private boolean showAir;
|
||||
private boolean showBoundingBox;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientUpdateStructureBlockPacket() {
|
||||
}
|
||||
|
||||
public ClientUpdateStructureBlockPacket(Position position,
|
||||
UpdateStructureBlockAction action, UpdateStructureBlockMode mode,
|
||||
String name, Position offset, Position size,
|
||||
StructureMirror mirror, StructureRotation rotation,
|
||||
String metadata, float integrity, long seed,
|
||||
boolean ignoreEntities, boolean showAir, boolean showBoundingBox) {
|
||||
this.position = position;
|
||||
this.action = action;
|
||||
this.mode = mode;
|
||||
this.name = name;
|
||||
this.offset = offset;
|
||||
this.size = size;
|
||||
this.mirror = mirror;
|
||||
this.rotation = rotation;
|
||||
this.metadata = metadata;
|
||||
this.integrity = integrity;
|
||||
this.seed = seed;
|
||||
this.ignoreEntities = ignoreEntities;
|
||||
this.showAir = showAir;
|
||||
this.showBoundingBox = showBoundingBox;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public UpdateStructureBlockAction getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public UpdateStructureBlockMode getMode() {
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Position getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
public Position getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public StructureMirror getMirror() {
|
||||
return this.mirror;
|
||||
}
|
||||
|
||||
public StructureRotation getRotation() {
|
||||
return this.rotation;
|
||||
}
|
||||
|
||||
public String getMetadata() {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
public float getIntegrity() {
|
||||
return this.integrity;
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return this.seed;
|
||||
}
|
||||
|
||||
public boolean isIgnoreEntities() {
|
||||
return this.ignoreEntities;
|
||||
}
|
||||
|
||||
public boolean isShowAir() {
|
||||
return this.showAir;
|
||||
}
|
||||
|
||||
public boolean isShowBoundingBox() {
|
||||
return this.showBoundingBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.position = NetUtil.readPosition(in);
|
||||
this.action = MagicValues.key(UpdateStructureBlockAction.class, in.readVarInt());
|
||||
this.mode = MagicValues.key(UpdateStructureBlockMode.class, in.readVarInt());
|
||||
this.name = in.readString();
|
||||
this.offset = new Position(in.readByte(), in.readByte(), in.readByte());
|
||||
this.size = new Position(in.readUnsignedByte(), in.readUnsignedByte(), in.readUnsignedByte());
|
||||
this.mirror = MagicValues.key(StructureMirror.class, in.readVarInt());
|
||||
this.rotation = MagicValues.key(StructureRotation.class, in.readVarInt());
|
||||
this.metadata = in.readString();
|
||||
this.integrity = in.readFloat();
|
||||
this.seed = in.readVarLong();
|
||||
int flags = in.readUnsignedByte();
|
||||
this.ignoreEntities = (flags & 0x01) != 0;
|
||||
this.showAir = (flags & 0x02) != 0;
|
||||
this.showBoundingBox = (flags & 0x04) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
NetUtil.writePosition(out, this.position);
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.action));
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.mode));
|
||||
out.writeString(this.name);
|
||||
out.writeByte(this.offset.getX());
|
||||
out.writeByte(this.offset.getY());
|
||||
out.writeByte(this.offset.getZ());
|
||||
out.writeByte(this.size.getX());
|
||||
out.writeByte(this.size.getY());
|
||||
out.writeByte(this.size.getZ());
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.mirror));
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.rotation));
|
||||
out.writeString(this.metadata);
|
||||
out.writeFloat(this.integrity);
|
||||
out.writeVarLong(this.seed);
|
||||
int flags = 0;
|
||||
if (this.ignoreEntities) flags |= 0x01;
|
||||
if (this.showAir) flags |= 0x02;
|
||||
if (this.showBoundingBox) flags |= 0x04;
|
||||
out.writeByte(flags);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientBlockNBTRequestPacket extends MinecraftPacket {
|
||||
private int transactionId;
|
||||
private Position position;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientBlockNBTRequestPacket() {
|
||||
}
|
||||
|
||||
public ClientBlockNBTRequestPacket(int transactionId, Position position) {
|
||||
this.transactionId = transactionId;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public int getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.transactionId = in.readVarInt();
|
||||
this.position = NetUtil.readPosition(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.transactionId);
|
||||
NetUtil.writePosition(out, this.position);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.client.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientEntityNBTRequestPacket extends MinecraftPacket {
|
||||
private int transactionId;
|
||||
private int entityId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientEntityNBTRequestPacket() {
|
||||
}
|
||||
|
||||
public ClientEntityNBTRequestPacket(int transactionId, int entityId) {
|
||||
this.transactionId = transactionId;
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public int getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return this.entityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.transactionId = in.readVarInt();
|
||||
this.entityId = in.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.transactionId);
|
||||
out.writeVarInt(this.entityId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerDeclareCommandsPacket extends MinecraftPacket {
|
||||
private byte[] data;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerDeclareCommandsPacket() {
|
||||
}
|
||||
|
||||
@Deprecated // This packet isn't fully implemented, please send a PR if you need to use it
|
||||
public ServerDeclareCommandsPacket(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Deprecated // This packet isn't fully implemented, please send a PR if you need to use it
|
||||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.data = in.readBytes(in.available());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeBytes(this.data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerDeclareRecipesPacket extends MinecraftPacket {
|
||||
private byte[] data;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerDeclareRecipesPacket() {
|
||||
}
|
||||
|
||||
@Deprecated // This packet isn't fully implemented, please send a PR if you need to use it
|
||||
public ServerDeclareRecipesPacket(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Deprecated // This packet isn't fully implemented, please send a PR if you need to use it
|
||||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.data = in.readBytes(in.available());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeBytes(this.data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ServerDeclareTagsPacket extends MinecraftPacket {
|
||||
private Map<String, int[]> blockTags;
|
||||
private Map<String, int[]> itemTags;
|
||||
private Map<String, int[]> fluidTags;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerDeclareTagsPacket() {
|
||||
}
|
||||
|
||||
public ServerDeclareTagsPacket(Map<String, int[]> blockTags, Map<String, int[]> itemTags, Map<String, int[]> fluidTags) {
|
||||
this.blockTags = blockTags;
|
||||
this.itemTags = itemTags;
|
||||
this.fluidTags = fluidTags;
|
||||
}
|
||||
|
||||
public Map<String, int[]> getBlockTags() {
|
||||
return this.blockTags;
|
||||
}
|
||||
|
||||
public Map<String, int[]> getItemTags() {
|
||||
return this.itemTags;
|
||||
}
|
||||
|
||||
public Map<String, int[]> getFluidTags() {
|
||||
return this.fluidTags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
blockTags = new HashMap<>();
|
||||
itemTags = new HashMap<>();
|
||||
fluidTags = new HashMap<>();
|
||||
for(Map<String, int[]> tags : Arrays.asList(blockTags, itemTags, fluidTags)) {
|
||||
int tagsCount = in.readVarInt();
|
||||
for(int i = 0; i < tagsCount; i++) {
|
||||
String name = in.readString();
|
||||
int entriesCount = in.readVarInt();
|
||||
int[] entries = new int[entriesCount];
|
||||
for(int index = 0; index < entriesCount; index++) {
|
||||
entries[index] = in.readVarInt();
|
||||
}
|
||||
tags.put(name, entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
for(Map<String, int[]> tags : Arrays.asList(blockTags, itemTags, fluidTags)) {
|
||||
out.writeVarInt(tags.size());
|
||||
for (Map.Entry<String, int[]> tag : tags.entrySet()) {
|
||||
out.writeString(tag.getKey());
|
||||
out.writeVarInt(tag.getValue().length);
|
||||
for (int id : tag.getValue()) {
|
||||
out.writeVarInt(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.github.steveice10.mc.protocol.data.game.statistic.KillEntityStatistic
|
|||
import com.github.steveice10.mc.protocol.data.game.statistic.KilledByEntityStatistic;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.PickupItemStatistic;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.Statistic;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.StatisticCategory;
|
||||
import com.github.steveice10.mc.protocol.data.game.statistic.UseItemStatistic;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
|
@ -21,15 +22,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
public class ServerStatisticsPacket extends MinecraftPacket {
|
||||
private static final String CRAFT_ITEM_PREFIX = "stat.craftItem.";
|
||||
private static final String BREAK_BLOCK_PREFIX = "stat.mineBlock.";
|
||||
private static final String USE_ITEM_PREFIX = "stat.useItem.";
|
||||
private static final String BREAK_ITEM_PREFIX = "stat.breakItem.";
|
||||
private static final String KILL_ENTITY_PREFIX = "stat.killEntity.";
|
||||
private static final String KILLED_BY_ENTITY_PREFIX = "stat.entityKilledBy.";
|
||||
private static final String DROP_ITEM_PREFIX = "stat.drop.";
|
||||
private static final String PICKUP_ITEM_PREFIX = "stat.pickup.";
|
||||
|
||||
private Map<Statistic, Integer> statistics = new HashMap<Statistic, Integer>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -48,32 +40,44 @@ public class ServerStatisticsPacket extends MinecraftPacket {
|
|||
public void read(NetInput in) throws IOException {
|
||||
int length = in.readVarInt();
|
||||
for(int index = 0; index < length; index++) {
|
||||
String value = in.readString();
|
||||
Statistic statistic = null;
|
||||
if(value.startsWith(CRAFT_ITEM_PREFIX)) {
|
||||
statistic = new CraftItemStatistic(value.substring(CRAFT_ITEM_PREFIX.length()));
|
||||
} else if(value.startsWith(BREAK_BLOCK_PREFIX)) {
|
||||
statistic = new BreakBlockStatistic(value.substring(BREAK_BLOCK_PREFIX.length()));
|
||||
} else if(value.startsWith(USE_ITEM_PREFIX)) {
|
||||
statistic = new UseItemStatistic(value.substring(USE_ITEM_PREFIX.length()));
|
||||
} else if(value.startsWith(BREAK_ITEM_PREFIX)) {
|
||||
statistic = new BreakItemStatistic(value.substring(BREAK_ITEM_PREFIX.length()));
|
||||
} else if(value.startsWith(KILL_ENTITY_PREFIX)) {
|
||||
statistic = new KillEntityStatistic(value.substring(KILL_ENTITY_PREFIX.length()));
|
||||
} else if(value.startsWith(KILLED_BY_ENTITY_PREFIX)) {
|
||||
statistic = new KilledByEntityStatistic(value.substring(KILLED_BY_ENTITY_PREFIX.length()));
|
||||
} else if(value.startsWith(DROP_ITEM_PREFIX)) {
|
||||
statistic = new DropItemStatistic(value.substring(DROP_ITEM_PREFIX.length()));
|
||||
} else if(value.startsWith(PICKUP_ITEM_PREFIX)) {
|
||||
statistic = new PickupItemStatistic(value.substring(PICKUP_ITEM_PREFIX.length()));
|
||||
} else {
|
||||
try {
|
||||
statistic = MagicValues.key(GenericStatistic.class, value);
|
||||
} catch(IllegalArgumentException e) {
|
||||
statistic = new CustomStatistic(value);
|
||||
int categoryId = in.readVarInt();
|
||||
int statisticId = in.readVarInt();
|
||||
Statistic statistic;
|
||||
try {
|
||||
switch (MagicValues.key(StatisticCategory.class, categoryId)) {
|
||||
case BREAK_BLOCK:
|
||||
statistic = new BreakBlockStatistic(statisticId);
|
||||
break;
|
||||
case CRAFT_ITEM:
|
||||
statistic = new CraftItemStatistic(statisticId);
|
||||
break;
|
||||
case USE_ITEM:
|
||||
statistic = new UseItemStatistic(statisticId);
|
||||
break;
|
||||
case BREAK_ITEM:
|
||||
statistic = new BreakItemStatistic(statisticId);
|
||||
break;
|
||||
case PICKED_UP_ITEM:
|
||||
statistic = new PickupItemStatistic(statisticId);
|
||||
break;
|
||||
case DROP_ITEM:
|
||||
statistic = new DropItemStatistic(statisticId);
|
||||
break;
|
||||
case KILL_ENTITY:
|
||||
statistic = new KillEntityStatistic(statisticId);
|
||||
break;
|
||||
case KILLED_BY_ENTITY:
|
||||
statistic = new KilledByEntityStatistic(statisticId);
|
||||
break;
|
||||
case GENERIC:
|
||||
statistic = MagicValues.key(GenericStatistic.class, statisticId);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
statistic = new CustomStatistic(categoryId, statisticId);
|
||||
}
|
||||
|
||||
this.statistics.put(statistic, in.readVarInt());
|
||||
}
|
||||
}
|
||||
|
@ -82,28 +86,47 @@ public class ServerStatisticsPacket extends MinecraftPacket {
|
|||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.statistics.size());
|
||||
for(Statistic statistic : this.statistics.keySet()) {
|
||||
String value = "";
|
||||
if(statistic instanceof CraftItemStatistic) {
|
||||
value = CRAFT_ITEM_PREFIX + ((CraftItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof BreakBlockStatistic) {
|
||||
value = BREAK_BLOCK_PREFIX + ((BreakBlockStatistic) statistic).getId();
|
||||
} else if(statistic instanceof UseItemStatistic) {
|
||||
value = USE_ITEM_PREFIX + ((UseItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof BreakItemStatistic) {
|
||||
value = BREAK_ITEM_PREFIX + ((BreakItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof KillEntityStatistic) {
|
||||
value = KILL_ENTITY_PREFIX + ((KillEntityStatistic) statistic).getId();
|
||||
} else if(statistic instanceof KilledByEntityStatistic) {
|
||||
value = KILLED_BY_ENTITY_PREFIX + ((KilledByEntityStatistic) statistic).getId();
|
||||
} else if(statistic instanceof DropItemStatistic) {
|
||||
value = DROP_ITEM_PREFIX + ((DropItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof PickupItemStatistic) {
|
||||
value = PICKUP_ITEM_PREFIX + ((PickupItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof GenericStatistic) {
|
||||
value = MagicValues.value(String.class, (GenericStatistic) statistic);
|
||||
int categoryId;
|
||||
int statisticId;
|
||||
if(statistic instanceof CustomStatistic) {
|
||||
categoryId = ((CustomStatistic) statistic).getCategory();
|
||||
statisticId = ((CustomStatistic) statistic).getId();
|
||||
} else {
|
||||
StatisticCategory category;
|
||||
if(statistic instanceof CraftItemStatistic) {
|
||||
category = StatisticCategory.CRAFT_ITEM;
|
||||
statisticId = ((CraftItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof BreakBlockStatistic) {
|
||||
category = StatisticCategory.BREAK_BLOCK;
|
||||
statisticId = ((BreakBlockStatistic) statistic).getId();
|
||||
} else if(statistic instanceof UseItemStatistic) {
|
||||
category = StatisticCategory.USE_ITEM;
|
||||
statisticId = ((UseItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof BreakItemStatistic) {
|
||||
category = StatisticCategory.BREAK_ITEM;
|
||||
statisticId = ((BreakItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof KillEntityStatistic) {
|
||||
category = StatisticCategory.KILL_ENTITY;
|
||||
statisticId = ((KillEntityStatistic) statistic).getId();
|
||||
} else if(statistic instanceof KilledByEntityStatistic) {
|
||||
category = StatisticCategory.KILLED_BY_ENTITY;
|
||||
statisticId = ((KilledByEntityStatistic) statistic).getId();
|
||||
} else if(statistic instanceof DropItemStatistic) {
|
||||
category = StatisticCategory.DROP_ITEM;
|
||||
statisticId = ((DropItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof PickupItemStatistic) {
|
||||
category = StatisticCategory.PICKED_UP_ITEM;
|
||||
statisticId = ((PickupItemStatistic) statistic).getId();
|
||||
} else if(statistic instanceof GenericStatistic) {
|
||||
category = StatisticCategory.GENERIC;
|
||||
statisticId = MagicValues.value(Integer.class, statistic);
|
||||
} else {
|
||||
throw new IllegalArgumentException(statistic.getClass().getName());
|
||||
}
|
||||
categoryId = MagicValues.value(Integer.class, category);
|
||||
}
|
||||
|
||||
out.writeString(value);
|
||||
out.writeVarInt(categoryId);
|
||||
out.writeVarInt(statisticId);
|
||||
out.writeVarInt(this.statistics.get(statistic));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.sound.CustomSound;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.sound.Sound;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.sound.SoundCategory;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerStopSoundPacket extends MinecraftPacket {
|
||||
private SoundCategory category;
|
||||
private Sound sound;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerStopSoundPacket() {
|
||||
}
|
||||
|
||||
public ServerStopSoundPacket(SoundCategory category, Sound sound) {
|
||||
this.category = category;
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
public SoundCategory getCategory() {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
public Sound getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
int flags = in.readByte();
|
||||
if((flags & 0x1) != 0) {
|
||||
this.category = MagicValues.key(SoundCategory.class, in.readVarInt());
|
||||
} else {
|
||||
this.category = null;
|
||||
}
|
||||
if((flags & 0x2) != 0) {
|
||||
String value = in.readString();
|
||||
try {
|
||||
this.sound = MagicValues.key(BuiltinSound.class, value);
|
||||
} catch(IllegalArgumentException e) {
|
||||
this.sound = new CustomSound(value);
|
||||
}
|
||||
} else {
|
||||
this.sound = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte((this.category != null ? 0x1 : 0) | (this.sound != null ? 0x2 : 0));
|
||||
if (this.category != null) {
|
||||
out.writeByte(MagicValues.value(Integer.class, this.category));
|
||||
}
|
||||
if (this.sound != null) {
|
||||
String value = "";
|
||||
if (this.sound instanceof CustomSound) {
|
||||
value = ((CustomSound) this.sound).getName();
|
||||
} else if (this.sound instanceof BuiltinSound) {
|
||||
value = MagicValues.value(String.class, this.sound);
|
||||
}
|
||||
out.writeString(value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
@ -7,33 +9,71 @@ import com.github.steveice10.packetlib.io.NetOutput;
|
|||
import java.io.IOException;
|
||||
|
||||
public class ServerTabCompletePacket extends MinecraftPacket {
|
||||
private int transactionId;
|
||||
private int start;
|
||||
private int length;
|
||||
private String matches[];
|
||||
private Message tooltips[];
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerTabCompletePacket() {
|
||||
}
|
||||
|
||||
public ServerTabCompletePacket(String matches[]) {
|
||||
public ServerTabCompletePacket(int transactionId, int start, int length, String matches[], Message tooltips[]) {
|
||||
if (tooltips.length != matches.length) {
|
||||
throw new IllegalArgumentException("Length of matches and tooltips must be equal.");
|
||||
}
|
||||
this.transactionId = transactionId;
|
||||
this.start = start;
|
||||
this.length = length;
|
||||
this.matches = matches;
|
||||
this.tooltips = tooltips;
|
||||
}
|
||||
|
||||
public int getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return this.start;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
public String[] getMatches() {
|
||||
return this.matches;
|
||||
}
|
||||
|
||||
public Message[] getTooltips() {
|
||||
return this.tooltips;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.matches = new String[in.readVarInt()];
|
||||
this.tooltips = new TextMessage[this.matches.length];
|
||||
for(int index = 0; index < this.matches.length; index++) {
|
||||
this.matches[index] = in.readString();
|
||||
if (in.readBoolean()) {
|
||||
this.tooltips[index] = Message.fromString(in.readString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.matches.length);
|
||||
for(String match : this.matches) {
|
||||
out.writeString(match);
|
||||
for(int index = 0; index < this.matches.length; index++) {
|
||||
out.writeString(this.matches[index]);
|
||||
Message tooltip = this.tooltips[index];
|
||||
if (tooltip != null) {
|
||||
out.writeBoolean(true);
|
||||
out.writeString(tooltip.toJsonString());
|
||||
} else {
|
||||
out.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,30 +13,40 @@ import java.util.List;
|
|||
public class ServerUnlockRecipesPacket extends MinecraftPacket {
|
||||
private UnlockRecipesAction action;
|
||||
|
||||
private List<Integer> recipes;
|
||||
private List<Integer> alreadyKnownRecipes;
|
||||
private List<String> recipes;
|
||||
private List<String> alreadyKnownRecipes;
|
||||
|
||||
private boolean openCraftingBook;
|
||||
private boolean activateFiltering;
|
||||
private boolean activateCraftingFiltering;
|
||||
private boolean openSmeltingBook;
|
||||
private boolean activateSmeltingFiltering;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerUnlockRecipesPacket() {
|
||||
}
|
||||
|
||||
private ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateFiltering, List<Integer> recipes) {
|
||||
private ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateCraftingFiltering,
|
||||
boolean openSmeltingBook, boolean activateSmeltingFiltering,
|
||||
List<String> recipes) {
|
||||
this.openCraftingBook = openCraftingBook;
|
||||
this.activateFiltering = activateFiltering;
|
||||
this.activateCraftingFiltering = activateCraftingFiltering;
|
||||
this.openSmeltingBook = openSmeltingBook;
|
||||
this.activateSmeltingFiltering = activateSmeltingFiltering;
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateFiltering, List<Integer> recipes, List<Integer> alreadyKnownRecipes) {
|
||||
this(openCraftingBook, activateFiltering, recipes);
|
||||
public ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateCraftingFiltering,
|
||||
boolean openSmeltingBook, boolean activateSmeltingFiltering,
|
||||
List<String> recipes, List<String> alreadyKnownRecipes) {
|
||||
this(openCraftingBook, activateCraftingFiltering, openSmeltingBook, activateSmeltingFiltering, recipes);
|
||||
this.action = UnlockRecipesAction.INIT;
|
||||
this.alreadyKnownRecipes = alreadyKnownRecipes;
|
||||
}
|
||||
|
||||
public ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateFiltering, List<Integer> recipes, UnlockRecipesAction action) {
|
||||
this(openCraftingBook, activateFiltering, recipes);
|
||||
public ServerUnlockRecipesPacket(boolean openCraftingBook, boolean activateCraftingFiltering,
|
||||
boolean openSmeltingBook, boolean activateSmeltingFiltering,
|
||||
List<String> recipes, UnlockRecipesAction action) {
|
||||
this(openCraftingBook, activateCraftingFiltering, openSmeltingBook, activateSmeltingFiltering, recipes);
|
||||
if(action != UnlockRecipesAction.ADD && action != UnlockRecipesAction.REMOVE) {
|
||||
throw new IllegalArgumentException("action must be ADD or REMOVE");
|
||||
}
|
||||
|
@ -47,11 +57,11 @@ public class ServerUnlockRecipesPacket extends MinecraftPacket {
|
|||
return this.action;
|
||||
}
|
||||
|
||||
public List<Integer> getRecipes() {
|
||||
public List<String> getRecipes() {
|
||||
return this.recipes;
|
||||
}
|
||||
|
||||
public List<Integer> getAlreadyKnownRecipes() {
|
||||
public List<String> getAlreadyKnownRecipes() {
|
||||
if(this.action != UnlockRecipesAction.INIT) {
|
||||
throw new IllegalStateException("alreadyKnownRecipes is only set if action is " + UnlockRecipesAction.INIT
|
||||
+ " but it was " + this.action);
|
||||
|
@ -63,8 +73,16 @@ public class ServerUnlockRecipesPacket extends MinecraftPacket {
|
|||
return this.openCraftingBook;
|
||||
}
|
||||
|
||||
public boolean getActivateFiltering() {
|
||||
return this.activateFiltering;
|
||||
public boolean getActivateCraftingFiltering() {
|
||||
return this.activateCraftingFiltering;
|
||||
}
|
||||
|
||||
public boolean getOpenSmeltingBook() {
|
||||
return this.openSmeltingBook;
|
||||
}
|
||||
|
||||
public boolean getActivateSmeltingFiltering() {
|
||||
return this.activateSmeltingFiltering;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,20 +90,22 @@ public class ServerUnlockRecipesPacket extends MinecraftPacket {
|
|||
this.action = MagicValues.key(UnlockRecipesAction.class, in.readVarInt());
|
||||
|
||||
this.openCraftingBook = in.readBoolean();
|
||||
this.activateFiltering = in.readBoolean();
|
||||
this.activateCraftingFiltering = in.readBoolean();
|
||||
this.openSmeltingBook = in.readBoolean();
|
||||
this.activateSmeltingFiltering = in.readBoolean();
|
||||
|
||||
if(this.action == UnlockRecipesAction.INIT) {
|
||||
int size = in.readVarInt();
|
||||
this.alreadyKnownRecipes = new ArrayList<>(size);
|
||||
for(int i = 0; i < size; i++) {
|
||||
this.alreadyKnownRecipes.add(in.readVarInt());
|
||||
this.alreadyKnownRecipes.add(in.readString());
|
||||
}
|
||||
}
|
||||
|
||||
int size = in.readVarInt();
|
||||
this.recipes = new ArrayList<>(size);
|
||||
for(int i = 0; i < size; i++) {
|
||||
this.recipes.add(in.readVarInt());
|
||||
this.recipes.add(in.readString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,18 +114,20 @@ public class ServerUnlockRecipesPacket extends MinecraftPacket {
|
|||
out.writeVarInt(MagicValues.value(Integer.class, this.action));
|
||||
|
||||
out.writeBoolean(this.openCraftingBook);
|
||||
out.writeBoolean(this.activateFiltering);
|
||||
out.writeBoolean(this.activateCraftingFiltering);
|
||||
out.writeBoolean(this.openSmeltingBook);
|
||||
out.writeBoolean(this.activateSmeltingFiltering);
|
||||
|
||||
if(this.action == UnlockRecipesAction.INIT) {
|
||||
out.writeVarInt(this.alreadyKnownRecipes.size());
|
||||
for(Integer recipeId : this.alreadyKnownRecipes) {
|
||||
out.writeVarInt(recipeId);
|
||||
for(String recipeId : this.alreadyKnownRecipes) {
|
||||
out.writeString(recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
out.writeVarInt(this.recipes.size());
|
||||
for(Integer recipeId : this.recipes) {
|
||||
out.writeVarInt(recipeId);
|
||||
for(String recipeId : this.recipes) {
|
||||
out.writeString(recipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server.entity.player;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.FeetOrEyes;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerPlayerFacingPacket extends MinecraftPacket {
|
||||
private FeetOrEyes origin; // presumably the origin from which pitch is calculated at
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private Integer targetEntityId;
|
||||
private FeetOrEyes targetEntityFeetOrEyes;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerPlayerFacingPacket() {
|
||||
}
|
||||
|
||||
public ServerPlayerFacingPacket(FeetOrEyes origin, double x, double y, double z) {
|
||||
this.origin = origin;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public ServerPlayerFacingPacket(FeetOrEyes origin, int targetEntityId, FeetOrEyes lookAt) {
|
||||
this.origin = origin;
|
||||
this.targetEntityId = targetEntityId;
|
||||
this.targetEntityFeetOrEyes = lookAt;
|
||||
}
|
||||
|
||||
public FeetOrEyes getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public Integer getTargetEntityId() {
|
||||
return targetEntityId;
|
||||
}
|
||||
|
||||
public FeetOrEyes getTargetEntityFeetOrEyes() {
|
||||
return targetEntityFeetOrEyes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.origin = MagicValues.key(FeetOrEyes.class, in.readVarInt());
|
||||
this.x = in.readDouble();
|
||||
this.y = in.readDouble();
|
||||
this.z = in.readDouble();
|
||||
if (in.readBoolean()) {
|
||||
this.targetEntityId = in.readVarInt();
|
||||
this.targetEntityFeetOrEyes = MagicValues.key(FeetOrEyes.class, in.readVarInt());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.origin));
|
||||
out.writeDouble(this.x);
|
||||
out.writeDouble(this.y);
|
||||
out.writeDouble(this.z);
|
||||
if (this.targetEntityId != null) {
|
||||
out.writeBoolean(true);
|
||||
out.writeVarInt(this.targetEntityId);
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.targetEntityFeetOrEyes));
|
||||
} else {
|
||||
out.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,7 +55,7 @@ public class ServerSpawnPaintingPacket extends MinecraftPacket {
|
|||
public void read(NetInput in) throws IOException {
|
||||
this.entityId = in.readVarInt();
|
||||
this.uuid = in.readUUID();
|
||||
this.paintingType = MagicValues.key(PaintingType.class, in.readString());
|
||||
this.paintingType = MagicValues.key(PaintingType.class, in.readVarInt());
|
||||
this.position = NetUtil.readPosition(in);
|
||||
this.direction = MagicValues.key(HangingDirection.class, in.readUnsignedByte());
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class ServerSpawnPaintingPacket extends MinecraftPacket {
|
|||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.entityId);
|
||||
out.writeUUID(this.uuid);
|
||||
out.writeString(MagicValues.value(String.class, this.paintingType));
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.paintingType));
|
||||
NetUtil.writePosition(out, this.position);
|
||||
out.writeByte(MagicValues.value(Integer.class, this.direction));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard;
|
|||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreType;
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
@ -12,7 +13,7 @@ import java.io.IOException;
|
|||
public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
||||
private String name;
|
||||
private ObjectiveAction action;
|
||||
private String displayName;
|
||||
private Message displayName;
|
||||
private ScoreType type;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -24,7 +25,7 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
this.action = ObjectiveAction.REMOVE;
|
||||
}
|
||||
|
||||
public ServerScoreboardObjectivePacket(String name, ObjectiveAction action, String displayName, ScoreType type) {
|
||||
public ServerScoreboardObjectivePacket(String name, ObjectiveAction action, Message displayName, ScoreType type) {
|
||||
if(action != ObjectiveAction.ADD && action != ObjectiveAction.UPDATE) {
|
||||
throw new IllegalArgumentException("(name, action, displayName) constructor only valid for adding and updating objectives.");
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
return this.action;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
public Message getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
|
@ -56,8 +57,8 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
this.name = in.readString();
|
||||
this.action = MagicValues.key(ObjectiveAction.class, in.readByte());
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
this.displayName = in.readString();
|
||||
this.type = MagicValues.key(ScoreType.class, in.readString());
|
||||
this.displayName = Message.fromString(in.readString());
|
||||
this.type = MagicValues.key(ScoreType.class, in.readVarInt());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,8 +67,8 @@ public class ServerScoreboardObjectivePacket extends MinecraftPacket {
|
|||
out.writeString(this.name);
|
||||
out.writeByte(MagicValues.value(Integer.class, this.action));
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
out.writeString(this.displayName);
|
||||
out.writeString(MagicValues.value(String.class, this.type));
|
||||
out.writeString(this.displayName.toJsonString());
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ 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.TeamAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor;
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
@ -14,9 +15,9 @@ import java.io.IOException;
|
|||
public class ServerTeamPacket extends MinecraftPacket {
|
||||
private String name;
|
||||
private TeamAction action;
|
||||
private String displayName;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private Message displayName;
|
||||
private Message prefix;
|
||||
private Message suffix;
|
||||
private boolean friendlyFire;
|
||||
private boolean seeFriendlyInvisibles;
|
||||
private NameTagVisibility nameTagVisibility;
|
||||
|
@ -43,7 +44,7 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
this.players = players;
|
||||
}
|
||||
|
||||
public ServerTeamPacket(String name, String displayName, String prefix, String suffix, boolean friendlyFire, boolean seeFriendlyInvisibles, NameTagVisibility nameTagVisibility, CollisionRule collisionRule, TeamColor color) {
|
||||
public ServerTeamPacket(String name, Message displayName, Message prefix, Message suffix, boolean friendlyFire, boolean seeFriendlyInvisibles, NameTagVisibility nameTagVisibility, CollisionRule collisionRule, TeamColor color) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.prefix = prefix;
|
||||
|
@ -56,7 +57,7 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
this.action = TeamAction.UPDATE;
|
||||
}
|
||||
|
||||
public ServerTeamPacket(String name, String displayName, String prefix, String suffix, boolean friendlyFire, boolean seeFriendlyInvisibles, NameTagVisibility nameTagVisibility, CollisionRule collisionRule, TeamColor color, String players[]) {
|
||||
public ServerTeamPacket(String name, Message displayName, Message prefix, Message suffix, boolean friendlyFire, boolean seeFriendlyInvisibles, NameTagVisibility nameTagVisibility, CollisionRule collisionRule, TeamColor color, String players[]) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.prefix = prefix;
|
||||
|
@ -78,15 +79,15 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
return this.action;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
public Message getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
public Message getPrefix() {
|
||||
return this.prefix;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
public Message getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
|
@ -119,9 +120,7 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
this.name = in.readString();
|
||||
this.action = MagicValues.key(TeamAction.class, in.readByte());
|
||||
if(this.action == TeamAction.CREATE || this.action == TeamAction.UPDATE) {
|
||||
this.displayName = in.readString();
|
||||
this.prefix = in.readString();
|
||||
this.suffix = in.readString();
|
||||
this.displayName = Message.fromString(in.readString());
|
||||
byte flags = in.readByte();
|
||||
this.friendlyFire = (flags & 0x1) != 0;
|
||||
this.seeFriendlyInvisibles = (flags & 0x2) != 0;
|
||||
|
@ -129,10 +128,13 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
this.collisionRule = MagicValues.key(CollisionRule.class, in.readString());
|
||||
|
||||
try {
|
||||
this.color = MagicValues.key(TeamColor.class, in.readByte());
|
||||
this.color = MagicValues.key(TeamColor.class, in.readVarInt());
|
||||
} catch(IllegalArgumentException e) {
|
||||
this.color = TeamColor.NONE;
|
||||
}
|
||||
|
||||
this.prefix = Message.fromString(in.readString());
|
||||
this.suffix = Message.fromString(in.readString());
|
||||
}
|
||||
|
||||
if(this.action == TeamAction.CREATE || this.action == TeamAction.ADD_PLAYER || this.action == TeamAction.REMOVE_PLAYER) {
|
||||
|
@ -148,13 +150,13 @@ public class ServerTeamPacket extends MinecraftPacket {
|
|||
out.writeString(this.name);
|
||||
out.writeByte(MagicValues.value(Integer.class, this.action));
|
||||
if(this.action == TeamAction.CREATE || this.action == TeamAction.UPDATE) {
|
||||
out.writeString(this.displayName);
|
||||
out.writeString(this.prefix);
|
||||
out.writeString(this.suffix);
|
||||
out.writeString(this.displayName.toJsonString());
|
||||
out.writeByte((this.friendlyFire ? 0x1 : 0x0) | (this.seeFriendlyInvisibles ? 0x2 : 0x0));
|
||||
out.writeString(MagicValues.value(String.class, this.nameTagVisibility));
|
||||
out.writeString(MagicValues.value(String.class, this.collisionRule));
|
||||
out.writeByte(MagicValues.value(Integer.class, this.color));
|
||||
out.writeVarInt(MagicValues.value(Integer.class, this.color));
|
||||
out.writeString(this.prefix.toJsonString());
|
||||
out.writeString(this.suffix.toJsonString());
|
||||
}
|
||||
|
||||
if(this.action == TeamAction.CREATE || this.action == TeamAction.ADD_PLAYER || this.action == TeamAction.REMOVE_PLAYER) {
|
||||
|
|
|
@ -8,13 +8,13 @@ import java.io.IOException;
|
|||
|
||||
public class ServerPreparedCraftingGridPacket extends MinecraftPacket {
|
||||
private int windowId;
|
||||
private int recipeId;
|
||||
private String recipeId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerPreparedCraftingGridPacket() {
|
||||
}
|
||||
|
||||
public ServerPreparedCraftingGridPacket(int windowId, int recipeId) {
|
||||
public ServerPreparedCraftingGridPacket(int windowId, String recipeId) {
|
||||
this.windowId = windowId;
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
@ -23,19 +23,19 @@ public class ServerPreparedCraftingGridPacket extends MinecraftPacket {
|
|||
return this.windowId;
|
||||
}
|
||||
|
||||
public int getRecipeId() {
|
||||
public String getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.windowId = in.readByte();
|
||||
this.recipeId = in.readVarInt();
|
||||
this.recipeId = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte(this.windowId);
|
||||
out.writeVarInt(this.recipeId);
|
||||
out.writeString(this.recipeId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.github.steveice10.mc.protocol.data.MagicValues;
|
|||
import com.github.steveice10.mc.protocol.data.game.world.map.MapData;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.map.MapIcon;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.map.MapIconType;
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
@ -61,12 +62,15 @@ public class ServerMapDataPacket extends MinecraftPacket {
|
|||
this.trackingPosition = in.readBoolean();
|
||||
this.icons = new MapIcon[in.readVarInt()];
|
||||
for(int index = 0; index < this.icons.length; index++) {
|
||||
int data = in.readUnsignedByte();
|
||||
int type = (data >> 4) & 15;
|
||||
int rotation = data & 15;
|
||||
int type = in.readVarInt();
|
||||
int x = in.readUnsignedByte();
|
||||
int z = in.readUnsignedByte();
|
||||
this.icons[index] = new MapIcon(x, z, MagicValues.key(MapIconType.class, type), rotation);
|
||||
int rotation = in.readUnsignedByte();
|
||||
Message displayName = null;
|
||||
if (in.readBoolean()) {
|
||||
displayName = Message.fromString(in.readString());
|
||||
}
|
||||
this.icons[index] = new MapIcon(x, z, MagicValues.key(MapIconType.class, type), rotation, displayName);
|
||||
}
|
||||
|
||||
int columns = in.readUnsignedByte();
|
||||
|
@ -88,9 +92,16 @@ public class ServerMapDataPacket extends MinecraftPacket {
|
|||
for(int index = 0; index < this.icons.length; index++) {
|
||||
MapIcon icon = this.icons[index];
|
||||
int type = MagicValues.value(Integer.class, icon.getIconType());
|
||||
out.writeByte((type & 15) << 4 | icon.getIconRotation() & 15);
|
||||
out.writeVarInt(type);
|
||||
out.writeByte(icon.getCenterX());
|
||||
out.writeByte(icon.getCenterZ());
|
||||
out.writeByte(icon.getIconRotation());
|
||||
if (icon.getDisplayName() != null) {
|
||||
out.writeBoolean(false);
|
||||
out.writeString(icon.getDisplayName().toJsonString());
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.data != null && this.data.getColumns() != 0) {
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerNBTResponsePacket extends MinecraftPacket {
|
||||
private int transactionId;
|
||||
private CompoundTag nbt;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerNBTResponsePacket() {
|
||||
}
|
||||
|
||||
public ServerNBTResponsePacket(int transactionId, CompoundTag nbt) {
|
||||
this.transactionId = transactionId;
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
public int getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public CompoundTag getNBT() {
|
||||
return this.nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.transactionId = in.readVarInt();
|
||||
this.nbt = NetUtil.readNBT(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.transactionId);
|
||||
NetUtil.writeNBT(out, this.nbt);
|
||||
}
|
||||
}
|
|
@ -66,7 +66,7 @@ public class ServerPlayEffectPacket extends MinecraftPacket {
|
|||
} else if(this.effect == ParticleEffect.SMOKE) {
|
||||
this.data = MagicValues.key(SmokeEffectData.class, value % 9);
|
||||
} else if(this.effect == ParticleEffect.BREAK_BLOCK) {
|
||||
this.data = new BreakBlockEffectData(new BlockState(value & 4095, (value >> 12) & 255));
|
||||
this.data = new BreakBlockEffectData(new BlockState(value));
|
||||
} else if(this.effect == ParticleEffect.BREAK_SPLASH_POTION) {
|
||||
this.data = new BreakPotionEffectData(value);
|
||||
} else if(this.effect == ParticleEffect.BONEMEAL_GROW) {
|
||||
|
@ -86,7 +86,7 @@ public class ServerPlayEffectPacket extends MinecraftPacket {
|
|||
} else if(this.data instanceof SmokeEffectData) {
|
||||
value = MagicValues.value(Integer.class, (SmokeEffectData) this.data);
|
||||
} else if(this.data instanceof BreakBlockEffectData) {
|
||||
value = (((BreakBlockEffectData) this.data).getBlockState().getId() & 4095) | ((((BreakBlockEffectData) this.data).getBlockState().getData() & 255) << 12);
|
||||
value = ((BreakBlockEffectData) this.data).getBlockState().getId();
|
||||
} else if(this.data instanceof BreakPotionEffectData) {
|
||||
value = ((BreakPotionEffectData) this.data).getPotionId();
|
||||
} else if(this.data instanceof BonemealGrowEffectData) {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.MagicValues;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.Particle;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.Particle;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType;
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
|
@ -19,13 +21,12 @@ public class ServerSpawnParticlePacket extends MinecraftPacket {
|
|||
private float offsetZ;
|
||||
private float velocityOffset;
|
||||
private int amount;
|
||||
private int data[];
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerSpawnParticlePacket() {
|
||||
}
|
||||
|
||||
public ServerSpawnParticlePacket(Particle particle, boolean longDistance, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float velocityOffset, int amount, int... data) {
|
||||
public ServerSpawnParticlePacket(Particle particle, boolean longDistance, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float velocityOffset, int amount) {
|
||||
this.particle = particle;
|
||||
this.longDistance = longDistance;
|
||||
this.x = x;
|
||||
|
@ -36,10 +37,6 @@ public class ServerSpawnParticlePacket extends MinecraftPacket {
|
|||
this.offsetZ = offsetZ;
|
||||
this.velocityOffset = velocityOffset;
|
||||
this.amount = amount;
|
||||
this.data = data;
|
||||
if(this.data.length != particle.getDataLength()) {
|
||||
throw new IllegalArgumentException("Data array length must be equal to particle's data length.");
|
||||
}
|
||||
}
|
||||
|
||||
public Particle getParticle() {
|
||||
|
@ -82,13 +79,9 @@ public class ServerSpawnParticlePacket extends MinecraftPacket {
|
|||
return this.amount;
|
||||
}
|
||||
|
||||
public int[] getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.particle = MagicValues.key(Particle.class, in.readInt());
|
||||
ParticleType type = MagicValues.key(ParticleType.class, in.readInt());
|
||||
this.longDistance = in.readBoolean();
|
||||
this.x = in.readFloat();
|
||||
this.y = in.readFloat();
|
||||
|
@ -98,10 +91,7 @@ public class ServerSpawnParticlePacket extends MinecraftPacket {
|
|||
this.offsetZ = in.readFloat();
|
||||
this.velocityOffset = in.readFloat();
|
||||
this.amount = in.readInt();
|
||||
this.data = new int[this.particle.getDataLength()];
|
||||
for(int index = 0; index < this.data.length; index++) {
|
||||
this.data[index] = in.readVarInt();
|
||||
}
|
||||
this.particle = new Particle(type, NetUtil.readParticleData(in, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,8 +106,6 @@ public class ServerSpawnParticlePacket extends MinecraftPacket {
|
|||
out.writeFloat(this.offsetZ);
|
||||
out.writeFloat(this.velocityOffset);
|
||||
out.writeInt(this.amount);
|
||||
for(int index = 0; index < this.particle.getDataLength(); index++) {
|
||||
out.writeVarInt(this.data[index]);
|
||||
}
|
||||
NetUtil.writeParticleData(out, this.particle.getData(), this.particle.getType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.github.steveice10.mc.protocol.packet.login.client;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LoginPluginResponsePacket extends MinecraftPacket {
|
||||
private int messageId;
|
||||
private byte[] data;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private LoginPluginResponsePacket() {
|
||||
}
|
||||
|
||||
public LoginPluginResponsePacket(int messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public LoginPluginResponsePacket(int messageId, byte[] data) {
|
||||
this.messageId = messageId;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getMessageId() {
|
||||
return this.messageId;
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.messageId = in.readVarInt();
|
||||
if (in.readBoolean()) {
|
||||
this.data = in.readBytes(in.available());
|
||||
} else {
|
||||
this.data = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.messageId);
|
||||
if (data != null) {
|
||||
out.writeBoolean(true);
|
||||
out.writeBytes(this.data);
|
||||
} else {
|
||||
out.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.github.steveice10.mc.protocol.packet.login.server;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LoginPluginRequestPacket extends MinecraftPacket {
|
||||
private int messageId;
|
||||
private String channel;
|
||||
private byte[] data;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private LoginPluginRequestPacket() {
|
||||
}
|
||||
|
||||
public LoginPluginRequestPacket(int messageId, String channel, byte[] data) {
|
||||
this.messageId = messageId;
|
||||
this.channel = channel;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getMessageId() {
|
||||
return this.messageId;
|
||||
}
|
||||
|
||||
public String getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.messageId = in.readVarInt();
|
||||
this.channel = in.readString();
|
||||
this.data = in.readBytes(in.available());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeVarInt(this.messageId);
|
||||
out.writeString(this.channel);
|
||||
out.writeBytes(this.data);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Rotation;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.BlockParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.DustParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.FallingDustParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ItemParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.Particle;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType;
|
||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleData;
|
||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||
import com.github.steveice10.opennbt.NBTIO;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
|
@ -54,12 +61,11 @@ public class NetUtil {
|
|||
}
|
||||
|
||||
public static BlockState readBlockState(NetInput in) throws IOException {
|
||||
int rawId = in.readVarInt();
|
||||
return new BlockState(rawId >> 4, rawId & 0xF);
|
||||
return new BlockState(in.readVarInt());
|
||||
}
|
||||
|
||||
public static void writeBlockState(NetOutput out, BlockState blockState) throws IOException {
|
||||
out.writeVarInt((blockState.getId() << 4) | (blockState.getData() & 0xF));
|
||||
out.writeVarInt(blockState.getId());
|
||||
}
|
||||
|
||||
public static ItemStack readItem(NetInput in) throws IOException {
|
||||
|
@ -67,7 +73,7 @@ public class NetUtil {
|
|||
if(item < 0) {
|
||||
return null;
|
||||
} else {
|
||||
return new ItemStack(item, in.readByte(), in.readShort(), readNBT(in));
|
||||
return new ItemStack(item, in.readByte(), readNBT(in));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +83,6 @@ public class NetUtil {
|
|||
} else {
|
||||
out.writeShort(item.getId());
|
||||
out.writeByte(item.getAmount());
|
||||
out.writeShort(item.getData());
|
||||
writeNBT(out, item.getNBT());
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +115,56 @@ public class NetUtil {
|
|||
out.writeFloat(rot.getRoll());
|
||||
}
|
||||
|
||||
public static Particle readParticle(NetInput in) throws IOException {
|
||||
ParticleType type = MagicValues.key(ParticleType.class, in.readVarInt());
|
||||
ParticleData data = readParticleData(in, type);
|
||||
return new Particle(type, data);
|
||||
}
|
||||
|
||||
public static ParticleData readParticleData(NetInput in, ParticleType type) throws IOException {
|
||||
switch (type) {
|
||||
case BLOCK:
|
||||
return new BlockParticleData(readBlockState(in));
|
||||
case DUST:
|
||||
float red = in.readFloat();
|
||||
float green = in.readFloat();
|
||||
float blue = in.readFloat();
|
||||
float scale = in.readFloat();
|
||||
return new DustParticleData(red, green, blue, scale);
|
||||
case FALLING_DUST:
|
||||
return new FallingDustParticleData(readBlockState(in));
|
||||
case ITEM:
|
||||
return new ItemParticleData(readItem(in));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeParticle(NetOutput out, Particle particle) throws IOException {
|
||||
out.writeVarInt(MagicValues.value(Integer.class, particle.getType()));
|
||||
writeParticleData(out, particle.getData(), particle.getType());
|
||||
}
|
||||
|
||||
public static void writeParticleData(NetOutput out, ParticleData data, ParticleType type) throws IOException {
|
||||
switch (type) {
|
||||
case BLOCK:
|
||||
writeBlockState(out, ((BlockParticleData) data).getBlockState());
|
||||
break;
|
||||
case DUST:
|
||||
out.writeFloat(((DustParticleData) data).getRed());
|
||||
out.writeFloat(((DustParticleData) data).getGreen());
|
||||
out.writeFloat(((DustParticleData) data).getBlue());
|
||||
out.writeFloat(((DustParticleData) data).getScale());
|
||||
break;
|
||||
case FALLING_DUST:
|
||||
writeBlockState(out, ((FallingDustParticleData) data).getBlockState());
|
||||
break;
|
||||
case ITEM:
|
||||
writeItem(out, ((ItemParticleData) data).getItemStack());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static EntityMetadata[] readEntityMetadata(NetInput in) throws IOException {
|
||||
List<EntityMetadata> ret = new ArrayList<EntityMetadata>();
|
||||
int id;
|
||||
|
@ -130,6 +185,12 @@ public class NetUtil {
|
|||
case STRING:
|
||||
value = in.readString();
|
||||
break;
|
||||
case OPTIONAL_CHAT:
|
||||
boolean chatPresent = in.readBoolean();
|
||||
if (!chatPresent) {
|
||||
break;
|
||||
}
|
||||
// Intentional fall-through
|
||||
case CHAT:
|
||||
value = Message.fromString(in.readString());
|
||||
break;
|
||||
|
@ -168,6 +229,9 @@ public class NetUtil {
|
|||
case NBT_TAG:
|
||||
value = readNBT(in);
|
||||
break;
|
||||
case PARTICLE:
|
||||
value = readParticle(in);
|
||||
break;
|
||||
default:
|
||||
throw new IOException("Unknown metadata type id: " + typeId);
|
||||
}
|
||||
|
@ -195,6 +259,12 @@ public class NetUtil {
|
|||
case STRING:
|
||||
out.writeString((String) meta.getValue());
|
||||
break;
|
||||
case OPTIONAL_CHAT:
|
||||
out.writeBoolean(meta.getValue() != null);
|
||||
if (meta.getValue() == null) {
|
||||
break;
|
||||
}
|
||||
// Intentional fall-through
|
||||
case CHAT:
|
||||
out.writeString(((Message) meta.getValue()).toJsonString());
|
||||
break;
|
||||
|
@ -233,6 +303,9 @@ public class NetUtil {
|
|||
case NBT_TAG:
|
||||
writeNBT(out, (CompoundTag) meta.getValue());
|
||||
break;
|
||||
case PARTICLE:
|
||||
writeParticle(out, (Particle) meta.getValue());
|
||||
break;
|
||||
default:
|
||||
throw new IOException("Unknown metadata type: " + meta.getType());
|
||||
}
|
||||
|
@ -256,9 +329,9 @@ public class NetUtil {
|
|||
}
|
||||
}
|
||||
|
||||
byte biomeData[] = null;
|
||||
int biomeData[] = null;
|
||||
if(fullChunk) {
|
||||
biomeData = in.readBytes(256);
|
||||
biomeData = in.readInts(256);
|
||||
}
|
||||
|
||||
column = new Column(x, z, chunks, biomeData, tileEntities);
|
||||
|
@ -292,7 +365,7 @@ public class NetUtil {
|
|||
}
|
||||
|
||||
if(fullChunk) {
|
||||
out.writeBytes(column.getBiomeData());
|
||||
out.writeInts(column.getBiomeData());
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
|
|
@ -47,8 +47,7 @@ public class ByteBufHelper {
|
|||
assertEquals("Received incorrect Z position", z, position.getZ());
|
||||
}
|
||||
|
||||
public static void assertBlock(BlockChangeRecord record, int block, int data) {
|
||||
public static void assertBlock(BlockChangeRecord record, int block) {
|
||||
assertEquals("Received incorrect block id", block, record.getBlock().getId());
|
||||
assertEquals("Received incorrect block data", data, record.getBlock().getData());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,11 +135,11 @@ public class MinecraftProtocolTest {
|
|||
|
||||
@Test
|
||||
public void testBlockBreak() throws IOException {
|
||||
BlockChangeRecord record = new BlockChangeRecord(new Position(1, 61, -1), new BlockState(3, 2));
|
||||
BlockChangeRecord record = new BlockChangeRecord(new Position(1, 61, -1), new BlockState(3));
|
||||
ServerBlockChangePacket packet = writeAndRead(new ServerBlockChangePacket(record));
|
||||
|
||||
assertPosition(packet.getRecord().getPosition(), 1, 61, -1);
|
||||
assertBlock(packet.getRecord(), 3, 2);
|
||||
assertBlock(packet.getRecord(), 3);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in a new issue