use of net.minecraft.server.v1_15_R1.InventoryCraftResult in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method setItems.
protected void setItems(List<org.bukkit.inventory.ItemStack> items) {
int index = 0;
for (org.bukkit.inventory.ItemStack item : items) {
this.items.set(index++, CraftItemStack.asNMSCopy(item));
}
// Want to update the result without having to use a real player
if (this.resultInventory instanceof InventoryCraftResult) {
CustomContainerWorkbench container = new CustomContainerWorkbench(manager.mockPlayer.getBukkitEntity(), bloc, this, (InventoryCraftResult) resultInventory);
container.a(this);
CraftingInventory crafting = (CraftingInventory) container.getBukkitView().getTopInventory();
Bukkit.getPluginManager().callEvent(new PrepareItemCraftEvent(crafting, container.getBukkitView(), false));
}
display.forceUpdate();
}
use of net.minecraft.server.v1_15_R1.InventoryCraftResult in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerSelector method getWorkbenchContainer.
protected Container getWorkbenchContainer(EntityHuman ent) {
CustomInventoryCrafting crafting = manager.benches.get(bloc);
if (crafting == null) {
crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(), 3, 3);
manager.put(bloc, crafting);
}
IInventory result = crafting.resultInventory;
if (result == null) {
result = new InventoryCraftResult();
crafting.resultInventory = result;
}
Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
crafting.addContainer(container);
return container;
}
use of net.minecraft.server.v1_15_R1.InventoryCraftResult in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerSelector method getAnvilContainer.
protected Container getAnvilContainer(PlayerInventory inventory, EntityHuman human) {
CustomAnvilSubcontainer crafting = manager.anvils.get(bloc);
if (crafting == null) {
crafting = new CustomAnvilSubcontainer("Repair", true, 2);
manager.anvils.put(bloc, crafting);
}
InventoryCraftResult result = crafting.result;
if (result == null) {
result = new InventoryCraftResult();
crafting.result = result;
}
Container anvil = new CustomContainerAnvil(human.getBukkitEntity(), bloc, crafting, result);
return anvil;
}
use of net.minecraft.server.v1_15_R1.InventoryCraftResult in project PublicCrafters by BananaPuncher714.
the class CustomInventoryCrafting method setItems.
protected void setItems(List<org.bukkit.inventory.ItemStack> items) {
int index = 0;
for (org.bukkit.inventory.ItemStack item : items) {
this.items.set(index++, CraftItemStack.asNMSCopy(item));
}
// Want to update the result without having to use a real player
if (this.resultInventory instanceof InventoryCraftResult) {
CustomContainerWorkbench container = new CustomContainerWorkbench(manager.mockPlayer.getBukkitEntity(), bloc, this, (InventoryCraftResult) resultInventory);
container.a(this);
CraftingInventory crafting = (CraftingInventory) container.getBukkitView().getTopInventory();
Bukkit.getPluginManager().callEvent(new PrepareItemCraftEvent(crafting, container.getBukkitView(), false));
}
display.forceUpdate();
}
use of net.minecraft.server.v1_15_R1.InventoryCraftResult in project PublicCrafters by BananaPuncher714.
the class CustomTileEntityContainerWorkbench method createContainer.
/**
* This is an ITileEntityContainer method that returns a new container for whatever tile entity
*/
@Override
public Container createContainer(PlayerInventory paramPlayerInventory, EntityHuman ent) {
CustomInventoryCrafting crafting = manager.benches.get(bloc);
if (crafting == null) {
crafting = new CustomInventoryCrafting(bloc, manager, new SelfContainer(), 3, 3);
manager.put(bloc, crafting);
}
IInventory inventory = crafting.resultInventory;
InventoryCraftResult result;
if (inventory instanceof InventoryCraftResult || inventory == null) {
result = new InventoryCraftResult();
crafting.resultInventory = result;
} else {
result = (InventoryCraftResult) inventory;
}
Container container = new CustomContainerWorkbench(ent.getBukkitEntity(), bloc, crafting, result);
crafting.addContainer(container);
return container;
}
Aggregations