Some work, need to fix somethings at a later date

This commit is contained in:
modmuss50 2015-06-18 21:10:26 +01:00
parent 45d0f36286
commit a38899184d
6 changed files with 52 additions and 23 deletions

View file

@ -6,10 +6,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import techreborn.client.container.ContainerIDSU;
import techreborn.client.gui.componets.TabIDConfig;
import techreborn.cofhLib.gui.GuiBase;
import techreborn.cofhLib.gui.element.ElementListBox;
import techreborn.cofhLib.gui.element.ElementTextField;
import techreborn.cofhLib.gui.element.ElementTextFieldLimited;
import techreborn.cofhLib.gui.element.listbox.IListBoxElement;
import techreborn.cofhLib.gui.element.listbox.ListBoxElementText;
import techreborn.packets.PacketHandler;
import techreborn.packets.PacketIdsu;
@ -18,6 +20,9 @@ import techreborn.tiles.idsu.IDSUManager;
import techreborn.tiles.idsu.TileIDSU;
import techreborn.util.LogHelper;
import java.util.LinkedList;
import java.util.List;
public class GuiIDSU extends GuiBase {
@ -25,12 +30,13 @@ public class GuiIDSU extends GuiBase {
ContainerIDSU containerIDSU;
ElementListBox listBox;
public static ElementListBox listBox = new ElementListBox(null, 10, 28, 80, 60);
ElementTextFieldLimited idFeild;
ElementTextField nameFeild;
public GuiIDSU(EntityPlayer player,
TileIDSU tileIDSU)
{
@ -58,25 +64,8 @@ public class GuiIDSU extends GuiBase {
this.buttonList.add(new GuiButton(3, k + 96, l + 8 + (22*3), 18, 20, "--"));
this.buttonList.add(new GuiButton(4, k + 40, l + 10, 10, 10, "+"));
listBox = new ElementListBox(this, 10, 28, 80, 60);
listBox.gui = this;
if(idsu.getWorldObj() != null){
for(World world : ClientSideIDSUManager.CLIENT.worldData.keySet()){
// System.out.println(world.n + ":" + idsu.getWorldObj().getProviderName());
//if(world.getProviderName().equals(idsu.getWorldObj().getProviderName())){
IDSUManager.IDSUWorldSaveData saveData = ClientSideIDSUManager.CLIENT.getWorldDataFormWorld(world);
for(Integer id : saveData.idsuValues.keySet()){
IDSUManager.IDSUValueSaveData valueSaveData = saveData.idsuValues.get(id);
if(valueSaveData.name != ""){
listBox.add(new ListBoxElementText(valueSaveData.name + " - " + id));
} else {
listBox.add(new ListBoxElementText(id.toString()));
}
}
// }
}
}
// listBox.borderColor = new GuiColor(120, 120, 120, 0).getColor();
// listBox.backgroundColor = new GuiColor(0, 0, 0, 32).getColor();
addElement(listBox);
@ -90,6 +79,8 @@ public class GuiIDSU extends GuiBase {
addElement(nameFeild);
// tabs.add(new TabIDConfig(this));
}

View file

@ -0,0 +1,13 @@
package techreborn.client.gui.componets;
import techreborn.cofhLib.gui.GuiBase;
import techreborn.cofhLib.gui.element.TabBase;
/**
* Created by mark on 18/06/15.
*/
public class TabIDConfig extends TabBase {
public TabIDConfig(GuiBase gui) {
super(gui);
}
}

View file

@ -1,12 +1,15 @@
package techreborn.cofhLib.gui;
import com.pahimar.ee3.reference.Textures;
import techreborn.lib.ModInfo;
public class GuiProps
{
public static final String RESOURCE_PREFIX = ModInfo.MOD_ID + ":";
/* GUI */
public static final String PATH_GFX = Textures.RESOURCE_PREFIX + "textures/";
public static final String PATH_GFX = RESOURCE_PREFIX + "textures/";
public static final String PATH_ARMOR = PATH_GFX + "armor/";
public static final String PATH_GUI = PATH_GFX + "gui/";
public static final String PATH_RENDER = PATH_GFX + "blocks/";

View file

@ -16,7 +16,7 @@ import java.util.List;
public abstract class ElementBase
{
protected GuiBase gui;
public GuiBase gui;
protected ResourceLocation texture;
protected int posX;

View file

@ -23,7 +23,7 @@ public class ElementListBox extends ElementBase {
private final int _marginRight = 2;
private final int _marginBottom = 2;
private final List<IListBoxElement> _elements = new LinkedList<IListBoxElement>();
public List<IListBoxElement> _elements = new LinkedList<IListBoxElement>();
private int _firstIndexDisplayed;
private int _selectedIndex;

View file

@ -3,7 +3,11 @@ package techreborn.packets;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.World;
import techreborn.client.gui.GuiIDSU;
import techreborn.cofhLib.gui.element.listbox.ListBoxElementText;
import techreborn.tiles.idsu.ClientSideIDSUManager;
import techreborn.tiles.idsu.IDSUManager;
import java.io.IOException;
@ -36,5 +40,23 @@ public class PacketSendIDSUManager extends SimplePacket {
@Override
public void execute() {
ClientSideIDSUManager.CLIENT.loadFromString(json, player.worldObj);
if(player.worldObj != null){
GuiIDSU.listBox._elements.clear();
for(World world : ClientSideIDSUManager.CLIENT.worldData.keySet()){
// System.out.println(world.n + ":" + idsu.getWorldObj().getProviderName());
//if(world.getProviderName().equals(idsu.getWorldObj().getProviderName())){
IDSUManager.IDSUWorldSaveData saveData = ClientSideIDSUManager.CLIENT.getWorldDataFormWorld(world);
for(Integer id : saveData.idsuValues.keySet()){
IDSUManager.IDSUValueSaveData valueSaveData = saveData.idsuValues.get(id);
if(!valueSaveData.name.isEmpty()){
GuiIDSU.listBox._elements.add(new ListBoxElementText(valueSaveData.name + " - " + id));
} else {
GuiIDSU.listBox._elements.add(new ListBoxElementText(id.toString()));
}
}
// }
}
}
}
}