add ViewableInventory builder type supplier overload
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.Key;
import org.spongepowered.api.data.Keys;
-import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import org.spongepowered.api.item.inventory.Carrier;
import org.spongepowered.api.item.inventory.ContainerType;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import java.util.function.Supplier;
/**
* Interface for inventories which may be interacted with by Players.
@@ -100,6 +100,17 @@ static Builder builder() {
*/
BuildingStep type(ContainerType type);
+ /**
+ * Specifies the type of inventory you want to build.
+ * <p>You must define all slots of the given type.</p>
+ *
+ * @param supplier The ContainerType supplier
+ * @return The building step.
+ */
+ default BuildingStep type(Supplier<ContainerType> supplier) {
+ return this.type(supplier.get());
+ }
+
/**
* The building step. Define all slots needed for the chosen {@link ContainerType}.
* <p>When done use {@link #completeStructure()} to finalize the inventory.</p>
