use of net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket in project MCDoom by AzureDoom.
the class GunTableScreenHandler method updateResult.
protected static void updateResult(int syncId, World world, PlayerEntity player, GunTableInventory craftingInventory) {
if (!world.isClient) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) player;
ItemStack itemStack = ItemStack.EMPTY;
Optional<GunTableRecipe> optional = world.getServer().getRecipeManager().getFirstMatch(Type.INSTANCE, craftingInventory, world);
if (optional.isPresent()) {
GunTableRecipe craftingRecipe = optional.get();
itemStack = craftingRecipe.craft(craftingInventory);
}
craftingInventory.setStack(5, itemStack);
serverPlayerEntity.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(syncId, 0, 5, itemStack));
}
}
Aggregations