Search in sources :

Example 1 with ForgingScreenHandler

use of net.minecraft.screen.ForgingScreenHandler in project Polymorph by TheIllusiveC4.

the class PolymorphNetwork method handlePlayerSelect.

private static void handlePlayerSelect(MinecraftServer pServer, ServerPlayerEntity pPlayer, ServerPlayNetworkHandler pHandler, PacketByteBuf pBuf, PacketSender pResponseSender) {
    Identifier identifier = pBuf.readIdentifier();
    pServer.execute(() -> {
        ScreenHandler screenHandler = pPlayer.currentScreenHandler;
        pPlayer.world.getRecipeManager().get(identifier).ifPresent(recipe -> {
            PolymorphApi.common().getRecipeData(pPlayer).ifPresent(recipeData -> recipeData.selectRecipe(recipe));
            for (AbstractCompatibilityModule integration : PolymorphIntegrations.get()) {
                if (integration.selectRecipe(screenHandler, recipe)) {
                    return;
                }
            }
            screenHandler.onContentChanged(pPlayer.getInventory());
            if (screenHandler instanceof ForgingScreenHandler) {
                ((ForgingScreenHandler) screenHandler).updateResult();
            }
        });
    });
}
Also used : Identifier(net.minecraft.util.Identifier) ForgingScreenHandler(net.minecraft.screen.ForgingScreenHandler) ForgingScreenHandler(net.minecraft.screen.ForgingScreenHandler) ScreenHandler(net.minecraft.screen.ScreenHandler) AbstractCompatibilityModule(top.theillusivec4.polymorph.common.integration.AbstractCompatibilityModule)

Aggregations

ForgingScreenHandler (net.minecraft.screen.ForgingScreenHandler)1 ScreenHandler (net.minecraft.screen.ScreenHandler)1 Identifier (net.minecraft.util.Identifier)1 AbstractCompatibilityModule (top.theillusivec4.polymorph.common.integration.AbstractCompatibilityModule)1