mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-17 19:05:10 +00:00
customizable registries (#25)
* add a bit javadoc Signed-off-by: Glease <[email protected]> * customizable registries Signed-off-by: Glease <[email protected]> * add gui for customizing registries * add a bit javadoc Signed-off-by: Glease <[email protected]> * spotless Signed-off-by: Glease <[email protected]> * remove debug statements Signed-off-by: Glease <[email protected]> * add notes on localization Signed-off-by: Glease <[email protected]> * update * fix * fix --------- Signed-off-by: Glease <[email protected]> Co-authored-by: Dream Master <[email protected]>
This commit is contained in:
1 parent
03e84e3d37
commit
3d150d95cb
17 files changed
+1387
-11
No files matched your search
@@ -0,0 +1,77 @@
|
||||
package com.gtnewhorizon.structurelib;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public final class RegistryOrderEntry extends GuiConfigEntries.CategoryEntry {
|
||||
|
||||
public RegistryOrderEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList,
|
||||
IConfigElement<?> configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
List<IConfigElement<?>> childElements = this.configElement.getChildElements();
|
||||
IConfigElement<?> disabled = null, order = null;
|
||||
for (IConfigElement<?> e : childElements) {
|
||||
if (e.getName().equals("disabled")) disabled = e;
|
||||
else if (e.getName().equals("ordering")) order = e;
|
||||
}
|
||||
if (disabled == null || order == null) {
|
||||
throw new IllegalArgumentException("Did not find expected config entires");
|
||||
}
|
||||
return new GuiEditRegistryConfig(
|
||||
this.owningScreen,
|
||||
disabled,
|
||||
order,
|
||||
configElement.getName(),
|
||||
this.owningScreen.modID,
|
||||
null,
|
||||
owningScreen.allRequireWorldRestart || this.configElement.requiresWorldRestart(),
|
||||
owningScreen.allRequireMcRestart || this.configElement.requiresMcRestart(),
|
||||
this.owningScreen.title,
|
||||
((this.owningScreen.titleLine2 == null ? "" : this.owningScreen.titleLine2) + " > " + this.name));
|
||||
}
|
||||
|
||||
private GuiEditRegistryConfig getChildScreen() {
|
||||
return (GuiEditRegistryConfig) childScreen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfigElement() {
|
||||
GuiEditRegistryConfig c = getChildScreen();
|
||||
if (c != null && c.isInitialized()) return c.saveConfigElements();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChanged() {
|
||||
GuiEditRegistryConfig c = getChildScreen();
|
||||
return c != null && c.isInitialized() && c.isChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
GuiEditRegistryConfig c = getChildScreen();
|
||||
return c != null && c.isInitialized() && c.isDefault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToDefault() {
|
||||
GuiEditRegistryConfig c = getChildScreen();
|
||||
if (c != null && c.isInitialized()) c.setToDefault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoChanges() {
|
||||
GuiEditRegistryConfig c = getChildScreen();
|
||||
if (c != null && c.isInitialized()) c.undoChanges();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user