use of net.minecraft.server.v1_9_R2.PacketPlayOutSetSlot in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method setCraftResult.
public void setCraftResult() {
CraftingManager.getInstance().lastCraftView = getBukkitView();
ItemStack craftResult = CraftingManager.getInstance().craft(craftInventory, world);
resultInventory.setItem(0, craftResult);
if (listeners.isEmpty()) {
return;
}
if ((craftResult != null) && (craftResult.getItem() == Items.FILLED_MAP)) {
return;
}
for (Object listener : listeners) {
EntityPlayer player = (EntityPlayer) listener;
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
}
}
use of net.minecraft.server.v1_9_R2.PacketPlayOutSetSlot 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_9_R2.PacketPlayOutSetSlot 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_9_R2.PacketPlayOutSetSlot in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method setCraftResult.
public void setCraftResult() {
CraftingManager.getInstance().lastCraftView = getBukkitView();
ItemStack craftResult = CraftingManager.getInstance().craft(craftInventory, world);
resultInventory.setItem(0, craftResult);
if (listeners.isEmpty()) {
return;
}
if ((craftResult != null) && (craftResult.getItem() == Items.FILLED_MAP)) {
return;
}
for (Object listener : listeners) {
EntityPlayer player = (EntityPlayer) listener;
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
}
}
use of net.minecraft.server.v1_9_R2.PacketPlayOutSetSlot 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