use of forestry.core.inventory.IInventoryAdapter in project ForestryMC by ForestryMC.
the class TileMoistener method hasFuelMin.
public boolean hasFuelMin(float percentage) {
int max = 0;
int avail = 0;
IInventoryAdapter inventory = getInternalInventory();
for (int i = InventoryMoistener.SLOT_STASH_1; i < InventoryMoistener.SLOT_RESERVOIR_1; i++) {
if (inventory.getStackInSlot(i).isEmpty()) {
max += 64;
continue;
}
if (FuelManager.moistenerResource.containsKey(inventory.getStackInSlot(i))) {
MoistenerFuel res = FuelManager.moistenerResource.get(inventory.getStackInSlot(i));
if (res.getItem().isItemEqual(inventory.getStackInSlot(i))) {
max += 64;
avail += inventory.getStackInSlot(i).getCount();
}
}
}
return (float) avail / (float) max > percentage;
}
use of forestry.core.inventory.IInventoryAdapter in project ForestryMC by ForestryMC.
the class TileBottler method hasResourcesMin.
@Override
public boolean hasResourcesMin(float percentage) {
IInventoryAdapter inventory = getInternalInventory();
ItemStack emptyCan = inventory.getStackInSlot(InventoryBottler.SLOT_FILLING_PROCESSING);
if (emptyCan.isEmpty()) {
return false;
}
return (float) emptyCan.getCount() / (float) emptyCan.getMaxStackSize() > percentage;
}
use of forestry.core.inventory.IInventoryAdapter in project ForestryMC by ForestryMC.
the class TileStampCollector method updateServerSide.
@Override
public void updateServerSide() {
if (!updateOnInterval(20)) {
return;
}
ItemStack stamp = null;
IInventoryAdapter inventory = getInternalInventory();
if (inventory.getStackInSlot(InventoryStampCollector.SLOT_FILTER).isEmpty()) {
stamp = PostManager.postRegistry.getPostOffice(world).getAnyStamp(1);
} else {
ItemStack filter = inventory.getStackInSlot(InventoryStampCollector.SLOT_FILTER);
if (filter.getItem() instanceof IStamps) {
stamp = PostManager.postRegistry.getPostOffice(world).getAnyStamp(((IStamps) filter.getItem()).getPostage(filter), 1);
}
}
if (stamp == null) {
return;
}
// Store it.
InventoryUtil.stowInInventory(stamp, inventory, true, InventoryStampCollector.SLOT_BUFFER_1, InventoryStampCollector.SLOT_BUFFER_COUNT);
}
Aggregations