Renamed 'Element' to 'Menu'

This commit is contained in:
Marcel Konrad
2019-11-12 18:23:57 +01:00
parent dc4e3722c2
commit 12cc7f7079
26 changed files with 120 additions and 120 deletions

View File

@@ -28,7 +28,7 @@ import exopandora.worldhandler.gui.button.EnumIcon;
import exopandora.worldhandler.usercontent.model.Action;
import exopandora.worldhandler.usercontent.model.BooleanExpression;
import exopandora.worldhandler.usercontent.model.JsonButton;
import exopandora.worldhandler.usercontent.model.JsonElement;
import exopandora.worldhandler.usercontent.model.JsonMenu;
import exopandora.worldhandler.usercontent.model.JsonUsercontent;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import net.minecraft.util.ResourceLocation;
@@ -65,7 +65,7 @@ public class UsercontentLoader
.registerTypeAdapter(BooleanExpression.Type.class, new EnumTypeAdapter<BooleanExpression.Type>(BooleanExpression.Type.class))
.registerTypeAdapter(JsonButton.Type.class, new EnumTypeAdapter<JsonButton.Type>(JsonButton.Type.class))
.registerTypeAdapter(Action.Type.class, new EnumTypeAdapter<Action.Type>(Action.Type.class))
.registerTypeAdapter(JsonElement.Type.class, new EnumTypeAdapter<JsonElement.Type>(JsonElement.Type.class))
.registerTypeAdapter(JsonMenu.Type.class, new EnumTypeAdapter<JsonMenu.Type>(JsonMenu.Type.class))
.create();
final List<Path> folders = Files.list(path)
.filter(Files::isDirectory)

View File

@@ -6,11 +6,11 @@ import exopandora.worldhandler.gui.button.GuiButtonBase;
import exopandora.worldhandler.gui.button.GuiButtonTooltip;
import exopandora.worldhandler.gui.container.Container;
import exopandora.worldhandler.gui.content.Content;
import exopandora.worldhandler.gui.element.Element;
import exopandora.worldhandler.gui.element.impl.ElementPageList;
import exopandora.worldhandler.gui.logic.ILogicPageList;
import exopandora.worldhandler.gui.menu.Menu;
import exopandora.worldhandler.gui.menu.impl.MenuPageList;
import exopandora.worldhandler.usercontent.UsercontentAPI;
import exopandora.worldhandler.usercontent.model.JsonElement;
import exopandora.worldhandler.usercontent.model.JsonMenu;
import exopandora.worldhandler.usercontent.model.JsonItem;
import exopandora.worldhandler.usercontent.model.JsonWidget;
import exopandora.worldhandler.util.ActionHandler;
@@ -18,28 +18,28 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class ElementFactory extends WidgetFactory
public class MenuFactory extends WidgetFactory
{
public ElementFactory(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory)
public MenuFactory(UsercontentAPI api, ActionHandlerFactory actionHandlerFactory)
{
super(api, actionHandlerFactory);
}
@Nullable
public Element createElement(JsonElement element, Content content, Container container, int x, int y)
public Menu createMenu(JsonMenu menu, Content content, Container container, int x, int y)
{
if(JsonElement.Type.PAGE_LIST.equals(element.getType()))
if(JsonMenu.Type.PAGE_LIST.equals(menu.getType()))
{
return new ElementPageList<JsonItem>
return new MenuPageList<JsonItem>
(
element.getDimensions().getX() + x,
element.getDimensions().getY() + y,
element.getAttributes().getItems(),
element.getDimensions().getWidth(),
element.getDimensions().getHeight(),
element.getAttributes().getLength(),
menu.getDimensions().getX() + x,
menu.getDimensions().getY() + y,
menu.getAttributes().getItems(),
menu.getDimensions().getWidth(),
menu.getDimensions().getHeight(),
menu.getAttributes().getLength(),
container,
new UsercontentLogicPageList<JsonElement.Type>(this.getApi(), this.getActionHandlerFactory(), content, container, element)
new UsercontentLogicPageList<JsonMenu.Type>(this.getApi(), this.getActionHandlerFactory(), content, container, menu)
);
}

View File

@@ -19,18 +19,18 @@ public class JsonGui
@SerializedName("buttons")
private List<JsonButton> buttons = null;
@SerializedName("elements")
private List<JsonElement> elements = null;
@SerializedName("menus")
private List<JsonMenu> menus = null;
@SerializedName("texts")
private List<JsonText> texts = null;
public JsonGui(String title, JsonTab tab, List<JsonButton> buttons, List<JsonElement> elements, List<JsonText> texts)
public JsonGui(String title, JsonTab tab, List<JsonButton> buttons, List<JsonMenu> menus, List<JsonText> texts)
{
this.title = title;
this.tab = tab;
this.buttons = buttons;
this.elements = elements;
this.menus = menus;
this.texts = texts;
}
@@ -64,14 +64,14 @@ public class JsonGui
this.buttons = buttons;
}
public List<JsonElement> getElements()
public List<JsonMenu> getMenus()
{
return this.elements;
return this.menus;
}
public void setElements(List<JsonElement> elements)
public void setMenus(List<JsonMenu> menus)
{
this.elements = elements;
this.menus = menus;
}
public List<JsonText> getTexts()

View File

@@ -2,17 +2,17 @@ package exopandora.worldhandler.usercontent.model;
import com.google.gson.annotations.SerializedName;
import exopandora.worldhandler.usercontent.model.JsonElement.Type;
import exopandora.worldhandler.usercontent.model.JsonMenu.Type;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class JsonElement extends JsonWidget<Type>
public class JsonMenu extends JsonWidget<Type>
{
@SerializedName("type")
private Type type;
public JsonElement(Type type, Action action, JsonDimensions dimensions, Attributes attributes)
public JsonMenu(Type type, Action action, JsonDimensions dimensions, Attributes attributes)
{
super(action, dimensions, attributes);
this.type = type;
@@ -39,30 +39,30 @@ public class JsonElement extends JsonWidget<Type>
{
if(this.type == null)
{
throw new IllegalStateException("element.type is null");
throw new IllegalStateException("menu.type is null");
}
if(this.type == Type.PAGE_LIST)
{
if(this.getAttributes() == null)
{
throw new IllegalStateException("element.attributes is null");
throw new IllegalStateException("menu.attributes is null");
}
else if(this.getAttributes().getId() == null)
{
throw new IllegalStateException("element.attributes.id is null");
throw new IllegalStateException("menu.attributes.id is null");
}
else if(this.getAttributes().getId().isEmpty())
{
throw new IllegalStateException("element.attributes.id is empty");
throw new IllegalStateException("menu.attributes.id is empty");
}
else if(this.getAttributes().getItems() == null)
{
throw new IllegalStateException("element.attributes.items is null");
throw new IllegalStateException("menu.attributes.items is null");
}
else if(this.getAttributes().getItems().isEmpty())
{
throw new IllegalStateException("element.attributes.items is empty");
throw new IllegalStateException("menu.attributes.items is empty");
}
this.validateAction(Action.Type.SET, Action.Type.JS);