mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 02:59:42 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -12,108 +12,106 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
public abstract class GuiNpcSelectionInterface extends GuiNPCInterface{
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">..";
|
||||
public abstract class GuiNpcSelectionInterface extends GuiNPCInterface {
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
private String root = "";
|
||||
public AssetsBrowser assets;
|
||||
private HashSet<String> dataFolder = new HashSet<String>();
|
||||
protected HashSet<String> dataTextures = new HashSet<String>();
|
||||
|
||||
public GuiNpcSelectionInterface(EntityNPCInterface npc, GuiScreen parent, String sound){
|
||||
super(npc);
|
||||
root = AssetsBrowser.getRoot(sound);
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">..";
|
||||
|
||||
private String root = "";
|
||||
public AssetsBrowser assets;
|
||||
private HashSet<String> dataFolder = new HashSet<String>();
|
||||
protected HashSet<String> dataTextures = new HashSet<String>();
|
||||
|
||||
public GuiNpcSelectionInterface(EntityNPCInterface npc, GuiScreen parent, String sound) {
|
||||
super(npc);
|
||||
root = AssetsBrowser.getRoot(sound);
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
dataFolder.clear();
|
||||
String ss = "Current Folder: /assets" + root;
|
||||
addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0, ss, width / 2 - (this.fontRendererObj.getStringWidth(ss) / 2), 20, 0xffffff));
|
||||
Vector<String> list = new Vector<String>();
|
||||
if(!assets.isRoot)
|
||||
list.add(up);
|
||||
for(String folder : assets.folders){
|
||||
list.add("/" + folder);
|
||||
dataFolder.add("/" + folder);
|
||||
if (!assets.isRoot)
|
||||
list.add(up);
|
||||
for (String folder : assets.folders) {
|
||||
list.add("/" + folder);
|
||||
dataFolder.add("/" + folder);
|
||||
}
|
||||
for(String texture : assets.files){
|
||||
list.add(texture);
|
||||
dataTextures.add(texture);
|
||||
for (String texture : assets.files) {
|
||||
list.add(texture);
|
||||
dataTextures.add(texture);
|
||||
}
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list, this, false, 18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(3, width / 2 + 2, height - 44,98, 20, "gui.up"));
|
||||
getButton(3).enabled = !assets.isRoot;
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(3, width / 2 + 2, height - 44, 98, 20, "gui.up"));
|
||||
getButton(3).enabled = !assets.isRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(slot.selected != null && this.dataTextures.contains(slot.selected)){
|
||||
if(parent instanceof GuiNPCInterface){
|
||||
((GuiNPCInterface)parent).elementClicked();
|
||||
}
|
||||
else if(parent instanceof GuiNPCInterface2){
|
||||
((GuiNPCInterface2)parent).elementClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void doubleClicked(){
|
||||
if(slot.selected.equals(up)){
|
||||
root = root.substring(0,root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
else if(dataFolder.contains(slot.selected)){
|
||||
root += slot.selected;
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
else {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if(id == 3){
|
||||
root = root.substring(0,root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
public void elementClicked() {
|
||||
if (slot.selected != null && this.dataTextures.contains(slot.selected)) {
|
||||
if (parent instanceof GuiNPCInterface) {
|
||||
((GuiNPCInterface) parent).elementClicked();
|
||||
} else if (parent instanceof GuiNPCInterface2) {
|
||||
((GuiNPCInterface2) parent).elementClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
public String getSelected(){
|
||||
return assets.getAsset(slot.selected);
|
||||
public void doubleClicked() {
|
||||
if (slot.selected.equals(up)) {
|
||||
root = root.substring(0, root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
} else if (dataFolder.contains(slot.selected)) {
|
||||
root += slot.selected;
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
} else {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 2) {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if (id == 3) {
|
||||
root = root.substring(0, root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
public String getSelected() {
|
||||
return assets.getAsset(slot.selected);
|
||||
}
|
||||
|
||||
public abstract String[] getExtension();
|
||||
}
|
||||
Reference in new issue
Block a user