code refactoring

This commit is contained in:
unurled 2024-03-18 22:26:42 +01:00
parent ad919e76d5
commit f706a7e91a
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F
4 changed files with 16 additions and 11 deletions

View file

@ -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();
}