mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -05:00
Update to MC 1.12.1
This commit is contained in:
parent
821e13ed2c
commit
e7ee69fb3e
6 changed files with 180 additions and 208 deletions
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
<artifactId>mcprotocollib</artifactId>
|
||||
<version>1.12-1</version>
|
||||
<version>1.12.1-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";
|
||||
public static final int PROTOCOL_VERSION = 335;
|
||||
public static final String GAME_VERSION = "1.12.1";
|
||||
public static final int PROTOCOL_VERSION = 338;
|
||||
|
||||
// General Key Constants
|
||||
public static final String PROFILE_KEY = "profile";
|
||||
|
|
|
@ -87,6 +87,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.Serve
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerConfirmTransactionPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerPreparedCraftingGridPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket;
|
||||
|
@ -363,62 +364,63 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerIncoming(0x28, ServerEntityRotationPacket.class);
|
||||
this.registerIncoming(0x29, ServerVehicleMovePacket.class);
|
||||
this.registerIncoming(0x2A, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerIncoming(0x2B, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerIncoming(0x2C, ServerCombatPacket.class);
|
||||
this.registerIncoming(0x2D, ServerPlayerListEntryPacket.class);
|
||||
this.registerIncoming(0x2E, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x2F, ServerPlayerUseBedPacket.class);
|
||||
this.registerIncoming(0x30, ServerUnlockRecipesPacket.class);
|
||||
this.registerIncoming(0x31, ServerEntityDestroyPacket.class);
|
||||
this.registerIncoming(0x32, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerIncoming(0x33, ServerResourcePackSendPacket.class);
|
||||
this.registerIncoming(0x34, ServerRespawnPacket.class);
|
||||
this.registerIncoming(0x35, ServerEntityHeadLookPacket.class);
|
||||
this.registerIncoming(0x36, ServerAdvancementTabPacket.class);
|
||||
this.registerIncoming(0x37, ServerWorldBorderPacket.class);
|
||||
this.registerIncoming(0x38, ServerSwitchCameraPacket.class);
|
||||
this.registerIncoming(0x39, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerIncoming(0x3A, ServerDisplayScoreboardPacket.class);
|
||||
this.registerIncoming(0x3B, ServerEntityMetadataPacket.class);
|
||||
this.registerIncoming(0x3C, ServerEntityAttachPacket.class);
|
||||
this.registerIncoming(0x3D, ServerEntityVelocityPacket.class);
|
||||
this.registerIncoming(0x3E, ServerEntityEquipmentPacket.class);
|
||||
this.registerIncoming(0x3F, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerIncoming(0x40, ServerPlayerHealthPacket.class);
|
||||
this.registerIncoming(0x41, ServerScoreboardObjectivePacket.class);
|
||||
this.registerIncoming(0x42, ServerEntitySetPassengersPacket.class);
|
||||
this.registerIncoming(0x43, ServerTeamPacket.class);
|
||||
this.registerIncoming(0x44, ServerUpdateScorePacket.class);
|
||||
this.registerIncoming(0x45, ServerSpawnPositionPacket.class);
|
||||
this.registerIncoming(0x46, ServerUpdateTimePacket.class);
|
||||
this.registerIncoming(0x47, ServerTitlePacket.class);
|
||||
this.registerIncoming(0x48, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerIncoming(0x49, ServerPlayerListDataPacket.class);
|
||||
this.registerIncoming(0x4A, ServerEntityCollectItemPacket.class);
|
||||
this.registerIncoming(0x4B, ServerEntityTeleportPacket.class);
|
||||
this.registerIncoming(0x4C, ServerAdvancementsPacket.class);
|
||||
this.registerIncoming(0x4D, ServerEntityPropertiesPacket.class);
|
||||
this.registerIncoming(0x4E, ServerEntityEffectPacket.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.registerOutgoing(0x00, ClientTeleportConfirmPacket.class);
|
||||
this.registerOutgoing(0x01, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerOutgoing(0x02, ClientTabCompletePacket.class);
|
||||
this.registerOutgoing(0x03, ClientChatPacket.class);
|
||||
this.registerOutgoing(0x04, ClientRequestPacket.class);
|
||||
this.registerOutgoing(0x05, ClientSettingsPacket.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, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerOutgoing(0x0C, ClientKeepAlivePacket.class);
|
||||
this.registerOutgoing(0x0D, ClientPlayerMovementPacket.class);
|
||||
this.registerOutgoing(0x0E, ClientPlayerPositionPacket.class);
|
||||
this.registerOutgoing(0x0F, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x10, ClientPlayerRotationPacket.class);
|
||||
this.registerOutgoing(0x11, ClientVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x12, ClientSteerBoatPacket.class);
|
||||
this.registerOutgoing(0x01, ClientTabCompletePacket.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);
|
||||
|
@ -437,24 +439,24 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
|
||||
private void initServerGame(Session session) {
|
||||
this.registerIncoming(0x00, ClientTeleportConfirmPacket.class);
|
||||
this.registerIncoming(0x01, ClientPrepareCraftingGridPacket.class);
|
||||
this.registerIncoming(0x02, ClientTabCompletePacket.class);
|
||||
this.registerIncoming(0x03, ClientChatPacket.class);
|
||||
this.registerIncoming(0x04, ClientRequestPacket.class);
|
||||
this.registerIncoming(0x05, ClientSettingsPacket.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, ClientPlayerInteractEntityPacket.class);
|
||||
this.registerIncoming(0x0C, ClientKeepAlivePacket.class);
|
||||
this.registerIncoming(0x0D, ClientPlayerMovementPacket.class);
|
||||
this.registerIncoming(0x0E, ClientPlayerPositionPacket.class);
|
||||
this.registerIncoming(0x0F, ClientPlayerPositionRotationPacket.class);
|
||||
this.registerIncoming(0x10, ClientPlayerRotationPacket.class);
|
||||
this.registerIncoming(0x11, ClientVehicleMovePacket.class);
|
||||
this.registerIncoming(0x12, ClientSteerBoatPacket.class);
|
||||
this.registerIncoming(0x01, ClientTabCompletePacket.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);
|
||||
|
@ -513,42 +515,43 @@ public class MinecraftProtocol extends PacketProtocol {
|
|||
this.registerOutgoing(0x28, ServerEntityRotationPacket.class);
|
||||
this.registerOutgoing(0x29, ServerVehicleMovePacket.class);
|
||||
this.registerOutgoing(0x2A, ServerOpenTileEntityEditorPacket.class);
|
||||
this.registerOutgoing(0x2B, ServerPlayerAbilitiesPacket.class);
|
||||
this.registerOutgoing(0x2C, ServerCombatPacket.class);
|
||||
this.registerOutgoing(0x2D, ServerPlayerListEntryPacket.class);
|
||||
this.registerOutgoing(0x2E, ServerPlayerPositionRotationPacket.class);
|
||||
this.registerOutgoing(0x2F, ServerPlayerUseBedPacket.class);
|
||||
this.registerOutgoing(0x30, ServerUnlockRecipesPacket.class);
|
||||
this.registerOutgoing(0x31, ServerEntityDestroyPacket.class);
|
||||
this.registerOutgoing(0x32, ServerEntityRemoveEffectPacket.class);
|
||||
this.registerOutgoing(0x33, ServerResourcePackSendPacket.class);
|
||||
this.registerOutgoing(0x34, ServerRespawnPacket.class);
|
||||
this.registerOutgoing(0x35, ServerEntityHeadLookPacket.class);
|
||||
this.registerOutgoing(0x36, ServerAdvancementTabPacket.class);
|
||||
this.registerOutgoing(0x37, ServerWorldBorderPacket.class);
|
||||
this.registerOutgoing(0x38, ServerSwitchCameraPacket.class);
|
||||
this.registerOutgoing(0x39, ServerPlayerChangeHeldItemPacket.class);
|
||||
this.registerOutgoing(0x3A, ServerDisplayScoreboardPacket.class);
|
||||
this.registerOutgoing(0x3B, ServerEntityMetadataPacket.class);
|
||||
this.registerOutgoing(0x3C, ServerEntityAttachPacket.class);
|
||||
this.registerOutgoing(0x3D, ServerEntityVelocityPacket.class);
|
||||
this.registerOutgoing(0x3E, ServerEntityEquipmentPacket.class);
|
||||
this.registerOutgoing(0x3F, ServerPlayerSetExperiencePacket.class);
|
||||
this.registerOutgoing(0x40, ServerPlayerHealthPacket.class);
|
||||
this.registerOutgoing(0x41, ServerScoreboardObjectivePacket.class);
|
||||
this.registerOutgoing(0x42, ServerEntitySetPassengersPacket.class);
|
||||
this.registerOutgoing(0x43, ServerTeamPacket.class);
|
||||
this.registerOutgoing(0x44, ServerUpdateScorePacket.class);
|
||||
this.registerOutgoing(0x45, ServerSpawnPositionPacket.class);
|
||||
this.registerOutgoing(0x46, ServerUpdateTimePacket.class);
|
||||
this.registerOutgoing(0x47, ServerTitlePacket.class);
|
||||
this.registerOutgoing(0x48, ServerPlayBuiltinSoundPacket.class);
|
||||
this.registerOutgoing(0x49, ServerPlayerListDataPacket.class);
|
||||
this.registerOutgoing(0x4A, ServerEntityCollectItemPacket.class);
|
||||
this.registerOutgoing(0x4B, ServerEntityTeleportPacket.class);
|
||||
this.registerOutgoing(0x4C, ServerAdvancementsPacket.class);
|
||||
this.registerOutgoing(0x4D, ServerEntityPropertiesPacket.class);
|
||||
this.registerOutgoing(0x4E, ServerEntityEffectPacket.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);
|
||||
}
|
||||
|
||||
private void initClientStatus(Session session) {
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
package com.github.steveice10.mc.protocol.data.game.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.util.ReflectionToString;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PrepareCraftingGridEntry {
|
||||
private ItemStack item;
|
||||
private byte craftingGridSlot;
|
||||
private byte playerInventorySlot;
|
||||
|
||||
public PrepareCraftingGridEntry(ItemStack item, byte craftingGridSlot, byte playerInventorySlot) {
|
||||
this.item = item;
|
||||
this.craftingGridSlot = craftingGridSlot;
|
||||
this.playerInventorySlot = playerInventorySlot;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public byte getCraftingGridSlot() {
|
||||
return this.craftingGridSlot;
|
||||
}
|
||||
|
||||
public byte getPlayerInventorySlot() {
|
||||
return this.playerInventorySlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PrepareCraftingGridEntry)) return false;
|
||||
PrepareCraftingGridEntry that = (PrepareCraftingGridEntry) o;
|
||||
return this.craftingGridSlot == that.craftingGridSlot &&
|
||||
this.playerInventorySlot == that.playerInventorySlot &&
|
||||
Objects.equals(this.item, that.item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(item, craftingGridSlot, playerInventorySlot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ReflectionToString.toString(this);
|
||||
}
|
||||
}
|
|
@ -1,86 +1,52 @@
|
|||
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.data.game.window.PrepareCraftingGridEntry;
|
||||
import com.github.steveice10.mc.protocol.util.NetUtil;
|
||||
import com.github.steveice10.mc.protocol.util.ReflectionToString;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ClientPrepareCraftingGridPacket implements Packet {
|
||||
|
||||
private int windowId;
|
||||
private int actionId;
|
||||
private List<PrepareCraftingGridEntry> returnEntries;
|
||||
private List<PrepareCraftingGridEntry> prepareEntries;
|
||||
private int recipeId;
|
||||
private boolean makeAll;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ClientPrepareCraftingGridPacket() {
|
||||
}
|
||||
|
||||
public ClientPrepareCraftingGridPacket(int windowId, int actionId, List<PrepareCraftingGridEntry> returnEntries,
|
||||
List<PrepareCraftingGridEntry> prepareEntries) {
|
||||
public ClientPrepareCraftingGridPacket(int windowId, int recipeId, boolean makeAll) {
|
||||
this.windowId = windowId;
|
||||
this.actionId = actionId;
|
||||
this.returnEntries = returnEntries;
|
||||
this.prepareEntries = prepareEntries;
|
||||
this.recipeId = recipeId;
|
||||
this.makeAll = makeAll;
|
||||
}
|
||||
|
||||
public int getWindowId() {
|
||||
return this.windowId;
|
||||
}
|
||||
|
||||
public int getActionId() {
|
||||
return this.actionId;
|
||||
public int getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public List<PrepareCraftingGridEntry> getReturnEntries() {
|
||||
return this.returnEntries;
|
||||
}
|
||||
|
||||
public List<PrepareCraftingGridEntry> getPrepareEntries() {
|
||||
return this.prepareEntries;
|
||||
public boolean doesMakeAll() {
|
||||
return makeAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.windowId = in.readByte();
|
||||
this.actionId = in.readShort();
|
||||
this.returnEntries = readEntries(in);
|
||||
this.prepareEntries = readEntries(in);
|
||||
}
|
||||
|
||||
private static List<PrepareCraftingGridEntry> readEntries(NetInput in) throws IOException {
|
||||
List<PrepareCraftingGridEntry> entries = new ArrayList<>();
|
||||
for (int i = in.readShort(); i > 0; i--) {
|
||||
ItemStack item = NetUtil.readItem(in);
|
||||
byte craftingGridSlot = in.readByte();
|
||||
byte playerInventorySlot = in.readByte();
|
||||
entries.add(new PrepareCraftingGridEntry(item, craftingGridSlot, playerInventorySlot));
|
||||
}
|
||||
return entries;
|
||||
this.recipeId = in.readVarInt();
|
||||
this.makeAll = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte(this.windowId);
|
||||
out.writeShort(actionId);
|
||||
writeEntries(out, this.returnEntries);
|
||||
writeEntries(out, this.prepareEntries);
|
||||
}
|
||||
|
||||
private static void writeEntries(NetOutput out, List<PrepareCraftingGridEntry> entries) throws IOException {
|
||||
out.writeShort(entries.size());
|
||||
for (PrepareCraftingGridEntry entry : entries) {
|
||||
NetUtil.writeItem(out, entry.getItem());
|
||||
out.writeByte(entry.getCraftingGridSlot());
|
||||
out.writeByte(entry.getPlayerInventorySlot());
|
||||
}
|
||||
out.writeVarInt(this.recipeId);
|
||||
out.writeBoolean(this.makeAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.github.steveice10.mc.protocol.packet.ingame.server.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.util.ReflectionToString;
|
||||
import com.github.steveice10.packetlib.io.NetInput;
|
||||
import com.github.steveice10.packetlib.io.NetOutput;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServerPreparedCraftingGridPacket implements Packet {
|
||||
|
||||
private int windowId;
|
||||
private int recipeId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerPreparedCraftingGridPacket() {
|
||||
}
|
||||
|
||||
public ServerPreparedCraftingGridPacket(int windowId, int recipeId) {
|
||||
this.windowId = windowId;
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public int getWindowId() {
|
||||
return this.windowId;
|
||||
}
|
||||
|
||||
public int getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.windowId = in.readByte();
|
||||
this.recipeId = in.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeByte(this.windowId);
|
||||
out.writeVarInt(this.recipeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPriority() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ReflectionToString.toString(this);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue