fix: updated place ghost recipe packet

This commit is contained in:
mworzala 2024-11-12 03:30:22 -05:00 committed by Matt Worzala
parent f4b32eddcf
commit 1cced68722
2 changed files with 5 additions and 8 deletions

View File

@ -3,15 +3,12 @@ package net.minestom.server.network.packet.server.play;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.network.NetworkBufferTemplate;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.recipe.display.RecipeDisplay;
import org.jetbrains.annotations.NotNull;
import static net.minestom.server.network.NetworkBuffer.STRING;
import static net.minestom.server.network.NetworkBuffer.VAR_INT;
// TODO(1.21.2): Recipe is now a RecipeDisplay object need to look further into it.
public record PlaceGhostRecipePacket(int windowId, @NotNull String recipe) implements ServerPacket.Play {
public record PlaceGhostRecipePacket(int windowId, @NotNull RecipeDisplay recipe) implements ServerPacket.Play {
public static final NetworkBuffer.Type<PlaceGhostRecipePacket> SERIALIZER = NetworkBufferTemplate.template(
VAR_INT, PlaceGhostRecipePacket::windowId,
STRING, PlaceGhostRecipePacket::recipe,
NetworkBuffer.VAR_INT, PlaceGhostRecipePacket::windowId,
RecipeDisplay.NETWORK_TYPE, PlaceGhostRecipePacket::recipe,
PlaceGhostRecipePacket::new);
}

View File

@ -80,7 +80,7 @@ public class PacketWriteReadTest {
SERVER_PACKETS.add(new ClearTitlesPacket(false));
SERVER_PACKETS.add(new CloseWindowPacket((byte) 2));
SERVER_PACKETS.add(new CollectItemPacket(5, 5, 5));
SERVER_PACKETS.add(new PlaceGhostRecipePacket((byte) 2, "recipe"));
// SERVER_PACKETS.add(new PlaceGhostRecipePacket((byte) 2, "recipe")); // TODO(1.21.2)
SERVER_PACKETS.add(new DeathCombatEventPacket(5, COMPONENT));
SERVER_PACKETS.add(new DeclareRecipesPacket(Map.of(
RecipeProperty.SMITHING_BASE, List.of(Material.STONE),