Recipes mostly work now

This commit is contained in:
Nassim Jahnke 2024-10-08 17:43:23 +02:00
parent 5646d04ba9
commit c57b238b86
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -37,6 +37,7 @@ import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPacke
import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPackets1_21_2; import com.viaversion.viaversion.protocols.v1_21to1_21_2.packet.ClientboundPackets1_21_2;
import com.viaversion.viaversion.rewriter.BlockRewriter; import com.viaversion.viaversion.rewriter.BlockRewriter;
import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter;
import com.viaversion.viaversion.util.Key;
import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.downgradeItemData; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.downgradeItemData;
import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.updateItemData; import static com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter.BlockItemPacketRewriter1_21_2.updateItemData;
@ -224,15 +225,17 @@ public final class BlockItemPacketRewriter1_21_2 extends BackwardsStructuredItem
}); });
protocol.registerClientbound(ClientboundPackets1_21_2.PLACE_GHOST_RECIPE, wrapper -> { protocol.registerClientbound(ClientboundPackets1_21_2.PLACE_GHOST_RECIPE, wrapper -> {
this.updateContainerId(wrapper); this.updateContainerId(wrapper);
wrapper.cancel(); // TODO wrapper.cancel(); // Full recipe display, this doesn't look mappable
}); });
protocol.registerServerbound(ServerboundPackets1_20_5.PLACE_RECIPE, wrapper -> { protocol.registerServerbound(ServerboundPackets1_20_5.PLACE_RECIPE, wrapper -> {
this.updateContainerIdServerbound(wrapper); this.updateContainerIdServerbound(wrapper);
wrapper.cancel(); // TODO
final String recipe = Key.stripMinecraftNamespace(wrapper.read(Types.STRING));
wrapper.write(Types.VAR_INT, Integer.parseInt(recipe));
}); });
protocol.registerServerbound(ServerboundPackets1_20_5.RECIPE_BOOK_SEEN_RECIPE, wrapper -> { protocol.registerServerbound(ServerboundPackets1_20_5.RECIPE_BOOK_SEEN_RECIPE, wrapper -> {
this.updateContainerIdServerbound(wrapper); final String recipe = Key.stripMinecraftNamespace(wrapper.read(Types.STRING));
wrapper.cancel(); // TODO wrapper.write(Types.VAR_INT, Integer.parseInt(recipe));
}); });
} }