code refactoring
This commit is contained in:
parent
ad919e76d5
commit
f706a7e91a
4 changed files with 16 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
package me.unurled.sacredrealms.sr.gui.entitytype;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import me.unurled.sacredrealms.sr.components.entity.EntityManager;
|
||||
import me.unurled.sacredrealms.sr.components.entity.SREntityType;
|
||||
import me.unurled.sacredrealms.sr.gui.BackItem;
|
||||
|
@ -21,11 +21,11 @@ public class EntityTypeGUI {
|
|||
|
||||
public static @NotNull Gui listGui() {
|
||||
EntityManager em = Manager.getInstance(EntityManager.class);
|
||||
List<Item> items =
|
||||
em.getTypes().stream()
|
||||
.map(type -> new SimpleItem(new ItemBuilder(type.getItem())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Item> list = new ArrayList<>();
|
||||
for (SREntityType type : em.getTypes()) {
|
||||
SimpleItem simpleItem = new SimpleItem(new ItemBuilder(type.getItem()));
|
||||
list.add(simpleItem);
|
||||
}
|
||||
return PagedGui.items()
|
||||
.setStructure(
|
||||
"# # # # # # # # #",
|
||||
|
@ -36,7 +36,7 @@ public class EntityTypeGUI {
|
|||
.addIngredient('X', Markers.CONTENT_LIST_SLOT_HORIZONTAL)
|
||||
.addIngredient('<', new BackItem())
|
||||
.addIngredient('>', new ForwardItem())
|
||||
.setContent(items)
|
||||
.setContent(list)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue