use of net.minecraft.server.v1_12_R1.IRecipe in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method setCraftResult.
public void setCraftResult() {
if (!world.isClientSide) {
EntityPlayer entityplayer = (EntityPlayer) ((CraftHumanEntity) viewer).getHandle();
ItemStack itemstack = ItemStack.a;
IRecipe irecipe = CraftingManager.b(craftInventory, world);
if ((irecipe != null) && ((irecipe.c()) || (!world.getGameRules().getBoolean("doLimitedCrafting")) || (entityplayer.F().b(irecipe)))) {
resultInventory.a(irecipe);
itemstack = irecipe.craftItem(craftInventory);
}
itemstack = CraftEventFactory.callPreCraftEvent(craftInventory, itemstack, getBukkitView(), false);
resultInventory.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, itemstack));
for (Object listener : listeners) {
EntityPlayer player = (EntityPlayer) listener;
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, itemstack));
}
}
}
use of net.minecraft.server.v1_12_R1.IRecipe in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method setCraftResult.
public void setCraftResult() {
if (!world.isClientSide) {
EntityPlayer entityplayer = (EntityPlayer) ((CraftHumanEntity) viewer).getHandle();
ItemStack itemstack = ItemStack.a;
IRecipe irecipe = world.getMinecraftServer().getCraftingManager().b(craftInventory, world);
if ((resultInventory.a(world, entityplayer, irecipe)) && (irecipe != null)) {
resultInventory.a(irecipe);
itemstack = irecipe.craftItem(craftInventory);
}
itemstack = CraftEventFactory.callPreCraftEvent(craftInventory, resultInventory, itemstack, getBukkitView(), false);
resultInventory.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, itemstack));
for (Object listener : listeners) {
EntityPlayer player = (EntityPlayer) listener;
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, itemstack));
}
}
}
use of net.minecraft.server.v1_12_R1.IRecipe in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method setCraftResult.
public void setCraftResult() {
if (!world.isClientSide) {
EntityPlayer entityplayer = (EntityPlayer) ((CraftHumanEntity) viewer).getHandle();
ItemStack itemstack = ItemStack.a;
IRecipe irecipe = world.getMinecraftServer().getCraftingManager().b(craftInventory, world);
if ((resultInventory.a(world, entityplayer, irecipe)) && (irecipe != null)) {
resultInventory.a(irecipe);
itemstack = irecipe.craftItem(craftInventory);
}
itemstack = CraftEventFactory.callPreCraftEvent(craftInventory, resultInventory, itemstack, getBukkitView(), false);
resultInventory.setItem(0, itemstack);
entityplayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, itemstack));
for (Object listener : listeners) {
EntityPlayer player = (EntityPlayer) listener;
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, itemstack));
}
}
}
Aggregations