mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 11:09:42 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,66 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
|
||||
private TileBorder tile;
|
||||
|
||||
public GuiBorderBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileBorder) player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
Client.sendData(EnumPacketServer.GetTileEntity, x, y, z);
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 40, 120, 20, "Availability Options"));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"Height", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,40,20, tile.height + ""));
|
||||
getTextField(0).numbersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"Message", guiLeft+ 1, guiTop + 100, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 95,200,20, tile.message));
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0)
|
||||
close();
|
||||
if (id == 4) {
|
||||
save();
|
||||
setSubGui(new SubGuiNpcAvailability(tile.availability));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
if(tile == null)
|
||||
return;
|
||||
tile.height = getTextField(0).getInteger();
|
||||
tile.message = getTextField(1).getText();
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
tile.readFromNBT(compound);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user