use of com.minecolonies.api.util.constant.BuildingConstants.FUEL_LIST in project minecolonies by ldtteam.
the class AbstractEntityAIRequestSmelter method getAllowedFuel.
/**
* Get a copy of the list of allowed fuel.
* @return the list.
*/
private List<ItemStack> getAllowedFuel() {
final List<ItemStack> list = new ArrayList<>();
for (final ItemStorage storage : getOwnBuilding().getModuleMatching(ItemListModule.class, m -> m.getId().equals(FUEL_LIST)).getList()) {
final ItemStack stack = storage.getItemStack().copy();
stack.setCount(stack.getMaxStackSize());
list.add(stack);
}
return list;
}
use of com.minecolonies.api.util.constant.BuildingConstants.FUEL_LIST in project minecolonies by ldtteam.
the class AbstractEntityAIUsesFurnace method fillUpFurnace.
/**
* Smelt the smeltable after the required items are in the inv.
*
* @return the next state to go to.
*/
private IAIState fillUpFurnace() {
if (getOwnBuilding().getFirstModuleOccurance(FurnaceUserModule.class).getFurnaces().isEmpty()) {
if (worker.getCitizenData() != null) {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(BAKER_HAS_NO_FURNACES_MESSAGE), ChatPriority.BLOCKING));
}
return START_WORKING;
}
if (walkTo == null || world.getBlockState(walkTo).getBlock() != Blocks.FURNACE) {
walkTo = null;
return START_WORKING;
}
if (walkToBlock(walkTo)) {
return getState();
}
final TileEntity entity = world.getBlockEntity(walkTo);
if (entity instanceof FurnaceTileEntity) {
final FurnaceTileEntity furnace = (FurnaceTileEntity) entity;
if (InventoryUtils.hasItemInItemHandler((worker.getInventoryCitizen()), this::isSmeltable) && (hasFuelInFurnaceAndNoSmeltable(furnace) || hasNeitherFuelNorSmeltAble(furnace))) {
InventoryUtils.transferXOfFirstSlotInItemHandlerWithIntoInItemHandler((worker.getInventoryCitizen()), this::isSmeltable, STACKSIZE, new InvWrapper(furnace), SMELTABLE_SLOT);
}
final ItemListModule module = getOwnBuilding().getModuleMatching(ItemListModule.class, m -> m.getId().equals(FUEL_LIST));
if (InventoryUtils.hasItemInItemHandler((worker.getInventoryCitizen()), stack -> module.isItemInList(new ItemStorage(stack))) && (hasSmeltableInFurnaceAndNoFuel(furnace) || hasNeitherFuelNorSmeltAble(furnace))) {
InventoryUtils.transferXOfFirstSlotInItemHandlerWithIntoInItemHandler((worker.getInventoryCitizen()), stack -> module.isItemInList(new ItemStorage(stack)), STACKSIZE, new InvWrapper(furnace), FUEL_SLOT);
}
}
walkTo = null;
return START_WORKING;
}
use of com.minecolonies.api.util.constant.BuildingConstants.FUEL_LIST in project minecolonies by ldtteam.
the class AbstractEntityAIUsesFurnace method getAllowedFuel.
/**
* Get a copy of the list of allowed fuel.
* @return the list.
*/
private List<ItemStack> getAllowedFuel() {
final List<ItemStack> list = new ArrayList<>();
for (final ItemStorage storage : getOwnBuilding().getModuleMatching(ItemListModule.class, m -> m.getId().equals(FUEL_LIST)).getList()) {
final ItemStack stack = storage.getItemStack().copy();
stack.setCount(stack.getMaxStackSize());
list.add(stack);
}
return list;
}
Aggregations