use of top.theillusivec4.polymorph.api.common.base.PolymorphPacketDistributor in project Polymorph by TheIllusiveC4.
the class CommonEventsListener method openScreenHandler.
public static void openScreenHandler(ServerPlayerEntity player) {
ScreenHandler screenHandler = player.currentScreenHandler;
PolymorphCommon commonApi = PolymorphApi.common();
commonApi.getRecipeDataFromBlockEntity(screenHandler).ifPresent(recipeData -> {
PolymorphPacketDistributor packetDistributor = commonApi.getPacketDistributor();
if (recipeData.isFailing() || recipeData.isEmpty(null)) {
packetDistributor.sendRecipesListS2C(player);
} else {
Pair<SortedSet<RecipePair>, Identifier> data = recipeData.getPacketData();
packetDistributor.sendRecipesListS2C(player, data.getLeft(), data.getRight());
}
});
for (AbstractCompatibilityModule integration : PolymorphIntegrations.get()) {
if (integration.openScreenHandler(screenHandler, player)) {
return;
}
}
}
Aggregations