use of net.dries007.tfc.common.container.Container in project TerraFirmaCraft by TerraFirmaCraft.
the class PotBlockEntity method handleCooking.
@Override
protected void handleCooking() {
if (isBoiling()) {
assert cachedRecipe != null;
if (boilingTicks < cachedRecipe.getDuration()) {
boilingTicks++;
if (boilingTicks == 1)
markForSync();
} else {
// Create output
// Save the recipe here, as setting inventory will call setAndUpdateSlots, which will clear the cached recipe before output is created
final PotRecipe recipe = cachedRecipe;
final PotRecipe.Output output = recipe.getOutput(inventory);
// Clear inputs
inventory.tank.setFluid(FluidStack.EMPTY);
for (int slot = SLOT_EXTRA_INPUT_START; slot <= SLOT_EXTRA_INPUT_END; slot++) {
// Consume items, but set container items if they exist
inventory.setStackInSlot(slot, inventory.getStackInSlot(slot).getContainerItem());
}
// Let the output handle filling into the empty pot
output.onFinish(inventory);
if (// Then, if we still have contents, save the output
!output.isEmpty()) {
this.output = output;
}
// Reset recipe progress
cachedRecipe = null;
boilingTicks = 0;
updateCachedRecipe();
markForSync();
}
} else {
boilingTicks = 0;
}
}
use of net.dries007.tfc.common.container.Container in project firmalife by eerussianguy.
the class FLGuiHandler method getClientGuiElement.
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
Container container = getServerGuiElement(ID, player, world, x, y, z);
Type type = Type.valueOf(ID);
switch(type) {
case KNAPPING_PUMPKIN:
return new GuiKnapping(container, player, KnappingType.LEATHER, PUMPKIN_TEXTURE);
default:
return null;
}
}
use of net.dries007.tfc.common.container.Container in project firmalife by eerussianguy.
the class FLGuiHandler method getServerGuiElement.
@Override
public Container getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
ItemStack stack = player.getHeldItemMainhand();
Type type = Type.valueOf(ID);
switch(type) {
case KNAPPING_PUMPKIN:
return new ContainerKnapping(KnappingFL.PUMPKIN, player.inventory, stack.getItem() == Item.getItemFromBlock(BlocksFL.PUMPKIN_FRUIT) ? stack : player.getHeldItemOffhand());
default:
return null;
}
}
Aggregations