use of net.minecraft.world.inventory.ItemCombinerMenu in project Polymorph by TheIllusiveC4.
the class CPacketPlayerRecipeSelection method handle.
public static void handle(CPacketPlayerRecipeSelection pPacket, Supplier<NetworkEvent.Context> pContext) {
pContext.get().enqueueWork(() -> {
ServerPlayer sender = pContext.get().getSender();
if (sender != null) {
AbstractContainerMenu container = sender.containerMenu;
sender.level.getRecipeManager().byKey(pPacket.recipe).ifPresent(recipe -> {
PolymorphApi.common().getRecipeData(sender).ifPresent(recipeData -> recipeData.selectRecipe(recipe));
for (AbstractCompatibilityModule integration : PolymorphIntegrations.get()) {
if (integration.selectRecipe(container, recipe)) {
return;
}
}
container.slotsChanged(sender.getInventory());
if (container instanceof ItemCombinerMenu) {
((ItemCombinerMenu) container).createResult();
}
});
}
});
pContext.get().setPacketHandled(true);
}
Aggregations