Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Inventory API #26

Open
PizzaCrust opened this issue Jun 21, 2016 · 3 comments
Open

Inventory API #26

PizzaCrust opened this issue Jun 21, 2016 · 3 comments
Assignees

Comments

@PizzaCrust
Copy link
Contributor

PizzaCrust commented Jun 21, 2016

Possibly:

Fountain.getServer().newInventory("Microwave")
                                 .size(9)
                                 .item(Item.builder(server, Materials.TACO)
                                 .tasty(true)
                                 .addEnchantment(EnchantmentTypes.SUPER_YUMMY,  1)
                                 .build(),                            
                                 ,0)
                                 .itemRange(Materials.MICROWAVE_STUFF, 1, 8)
                                 .build();
@phase
Copy link
Member

phase commented Jun 21, 2016

I don't know if I like going through the server to create them. An InventoryManager or another proxy class would make things cleaner.

I also think making a builder for everything is overkill. What if I want to create the inventory while iterating through a loop? I'd have to cache my items in an array and then add it to the builder.

@PizzaCrust
Copy link
Contributor Author

PizzaCrust commented Jun 21, 2016

Fountain.getInventoryBuilder("Microwave").build();

You don't have to cache, you could do this:

InventoryBuilder builder = Fountain.getInventoryBuilder("Microwave");
for (SomeItem item : itemList) {
     builder.item(item);
}
builder.build();

@Techcable
Copy link
Member

Techcable commented Jun 22, 2016

Inventories shouldn't be immutable.
Thats going to involve massive amounts of overhead and copying, and is pretty confusing.

@Techcable Techcable self-assigned this Jun 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants