Fix condition, add documentation

This commit is contained in:
TheMode 2021-04-11 23:52:12 +02:00
parent d86a733b79
commit 17fcd23c77
2 changed files with 17 additions and 2 deletions

View File

@ -8,11 +8,21 @@ import java.util.Map;
@FunctionalInterface
public interface FillOption<T> {
/**
* Place as much as the item as possible.
* <p>
* The remaining, can be air.
*/
FillOption<ItemStack> ALL = (inventory, result, itemChangesMap) -> {
itemChangesMap.forEach(inventory::safeItemInsert);
return result;
};
/**
* Only place the item if can be fully added.
* <p>
* Returns true if the item has been added, false if nothing changed.
*/
FillOption<Boolean> ALL_OR_NOTHING = (inventory, result, itemChangesMap) -> {
if (result.isAir()) {
// Item can be fully placed inside the inventory, do so
@ -24,7 +34,12 @@ public interface FillOption<T> {
}
};
FillOption<Boolean> DRY_RUN = (inventory, result, itemChangesMap) -> !result.isAir();
/**
* Loop through the inventory items without changing anything.
* <p>
* Returns true if the item can be fully added, false otherwise.
*/
FillOption<Boolean> DRY_RUN = (inventory, result, itemChangesMap) -> result.isAir();
T fill(@NotNull AbstractInventory inventory,
@NotNull ItemStack result,

View File

@ -38,7 +38,7 @@ public abstract class ThreadProvider {
{
// Default thread count in the pool (cores * 2)
setThreadCount(NettyRuntime.availableProcessors() * 2);
setThreadCount(1);
}
/**