Allow custom GuiEditArrayEntries without having to recreate the object in several places (#4329)

This commit is contained in:
BlayTheNinth 2017-09-06 23:03:14 +02:00 committed by LexManos
parent 5db4505fdb
commit da85dcadf5

View file

@ -103,7 +103,7 @@ public class GuiEditArray extends GuiScreen
@Override
public void initGui()
{
this.entryList = new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues);
this.entryList = createEditArrayEntries();
int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2;
int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2;
@ -136,15 +136,20 @@ public class GuiEditArray extends GuiScreen
else if (button.id == 2001)
{
this.currentValues = configElement.getDefaults();
this.entryList = new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues);
this.entryList = createEditArrayEntries();
}
else if (button.id == 2002)
{
this.currentValues = Arrays.copyOf(beforeValues, beforeValues.length);
this.entryList = new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues);
this.entryList = createEditArrayEntries();
}
}
protected GuiEditArrayEntries createEditArrayEntries()
{
return new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues);
}
@Override
public void handleMouseInput() throws IOException
{