mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 09:27:58 +01:00
Fix condition, add documentation
This commit is contained in:
parent
d86a733b79
commit
17fcd23c77
@ -8,11 +8,21 @@ import java.util.Map;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface FillOption<T> {
|
public interface FillOption<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place as much as the item as possible.
|
||||||
|
* <p>
|
||||||
|
* The remaining, can be air.
|
||||||
|
*/
|
||||||
FillOption<ItemStack> ALL = (inventory, result, itemChangesMap) -> {
|
FillOption<ItemStack> ALL = (inventory, result, itemChangesMap) -> {
|
||||||
itemChangesMap.forEach(inventory::safeItemInsert);
|
itemChangesMap.forEach(inventory::safeItemInsert);
|
||||||
return result;
|
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) -> {
|
FillOption<Boolean> ALL_OR_NOTHING = (inventory, result, itemChangesMap) -> {
|
||||||
if (result.isAir()) {
|
if (result.isAir()) {
|
||||||
// Item can be fully placed inside the inventory, do so
|
// 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,
|
T fill(@NotNull AbstractInventory inventory,
|
||||||
@NotNull ItemStack result,
|
@NotNull ItemStack result,
|
||||||
|
@ -38,7 +38,7 @@ public abstract class ThreadProvider {
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Default thread count in the pool (cores * 2)
|
// Default thread count in the pool (cores * 2)
|
||||||
setThreadCount(NettyRuntime.availableProcessors() * 2);
|
setThreadCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user