mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 01:04:30 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -17,111 +17,109 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
public class GuiNpcPather extends GuiNPCInterface implements IGuiData {
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private DataAI ai;
|
||||
private final HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private final DataAI ai;
|
||||
|
||||
public GuiNpcPather(EntityNPCInterface npc) {
|
||||
super();
|
||||
drawDefaultBackground = false;
|
||||
public GuiNpcPather(EntityNPCInterface npc) {
|
||||
super();
|
||||
drawDefaultBackground = false;
|
||||
xSize = 176;
|
||||
title = "Npc Pather";
|
||||
setBackground("smallbg.png");
|
||||
ai = npc.ais;
|
||||
PacketClient.sendClient(new MovingPathGetPacket());
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(160, 164);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int[] arr: ai.getMovingPath()){
|
||||
list.add("x:" + arr[0] + " y:" + arr[1] + " z:" + arr[2]);
|
||||
for (int[] arr : ai.getMovingPath()) {
|
||||
list.add("x:" + arr[0] + " y:" + arr[1] + " z:" + arr[2]);
|
||||
}
|
||||
scroll.setUnsortedList(list);
|
||||
scroll.guiLeft = guiLeft + 7;
|
||||
scroll.guiTop = guiTop + 12;
|
||||
|
||||
addScroll(scroll);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 6, guiTop + 178,52,20, "gui.down"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 178,52,20, "gui.up"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 118, guiTop + 178,52,20, "selectWorld.deleteButton"));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 6, guiTop + 178, 52, 20, "gui.down"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 178, 52, 20, "gui.up"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 118, guiTop + 178, 52, 20, "selectWorld.deleteButton"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if(scroll.selected < 0)
|
||||
return;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if (scroll.selected < 0)
|
||||
return;
|
||||
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
if(list.size() <= selected + 1)
|
||||
return;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected + 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected + 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected + 1;
|
||||
}
|
||||
if(id == 1){
|
||||
if(scroll.selected - 1 < 0)
|
||||
return;
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected - 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected - 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected - 1;
|
||||
}
|
||||
if(id == 2){
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
if(list.size() <= 1)
|
||||
return;
|
||||
list.remove(scroll.selected);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
}
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
if (list.size() <= selected + 1)
|
||||
return;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected + 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected + 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected + 1;
|
||||
}
|
||||
if (id == 1) {
|
||||
if (scroll.selected - 1 < 0)
|
||||
return;
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected - 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected - 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected - 1;
|
||||
}
|
||||
if (id == 2) {
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
if (list.size() <= 1)
|
||||
return;
|
||||
list.remove(scroll.selected);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
{
|
||||
public void keyTyped(char c, int i) {
|
||||
if (i == 1 || isInventoryKey(i)) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath()));
|
||||
@Override
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath()));
|
||||
PacketClient.sendClient(new MovingPathSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
ai.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
ai.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user