mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 13:53:07 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -19,12 +19,12 @@ import noppes.npcs.roles.RoleFollower;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiData{
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/follower.png");
|
||||
private EntityNPCInterface npc;
|
||||
private RoleFollower role;
|
||||
public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiData {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/follower.png");
|
||||
private EntityNPCInterface npc;
|
||||
private RoleFollower role;
|
||||
|
||||
public GuiNpcFollower(EntityNPCInterface npc,ContainerNPCFollower container){
|
||||
public GuiNpcFollower(EntityNPCInterface npc, ContainerNPCFollower container) {
|
||||
super(npc, container);
|
||||
this.npc = npc;
|
||||
role = (RoleFollower) npc.roleInterface;
|
||||
@@ -32,84 +32,87 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
|
||||
PacketClient.sendClient(new GetNPCRole());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
buttonList.clear();
|
||||
addButton(new GuiNpcButton(4, guiLeft + 100, guiTop+ 110, 50, 20, new String[]{StatCollector.translateToLocal("follower.waiting"),StatCollector.translateToLocal("follower.following")},role.isFollowing?1:0));
|
||||
if(!role.infiniteDays)
|
||||
addButton(new GuiNpcButton(5, guiLeft + 8, guiTop+ 30, 50, 20, StatCollector.translateToLocal("follower.hire")));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 100, guiTop + 110, 50, 20, new String[]{StatCollector.translateToLocal("follower.waiting"), StatCollector.translateToLocal("follower.following")}, role.isFollowing ? 1 : 0));
|
||||
if (!role.infiniteDays)
|
||||
addButton(new GuiNpcButton(5, guiLeft + 8, guiTop + 30, 50, 20, StatCollector.translateToLocal("follower.hire")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guibutton){
|
||||
super.actionPerformed(guibutton);
|
||||
int id = guibutton.id;
|
||||
if(id == 4){
|
||||
public void actionPerformed(GuiButton guibutton) {
|
||||
super.actionPerformed(guibutton);
|
||||
int id = guibutton.id;
|
||||
if (id == 4) {
|
||||
PacketClient.sendClient(new FollowerPacket(FollowerPacket.Action.State));
|
||||
}
|
||||
if(id == 5){
|
||||
if (id == 5) {
|
||||
PacketClient.sendClient(new FollowerPacket(FollowerPacket.Action.Extend));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2){
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.health")+": " + npc.getHealth()+"/"+ npc.getMaxHealth(), 62, 70, CustomNpcResourceListener.DefaultTextColor);
|
||||
if(!role.infiniteDays){
|
||||
if(role.getDaysLeft() <= 1)
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft")+": " + StatCollector.translateToLocal("follower.lastday"), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
else
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + (role.getDaysLeft()-1), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.health") + ": " + npc.getHealth() + "/" + npc.getMaxHealth(), 62, 70, CustomNpcResourceListener.DefaultTextColor);
|
||||
if (!role.infiniteDays) {
|
||||
if (role.getDaysLeft() <= 1)
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + StatCollector.translateToLocal("follower.lastday"), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
else
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + (role.getDaysLeft() - 1), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j){
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
int l = guiLeft;
|
||||
int i1 = guiTop;
|
||||
int l = guiLeft;
|
||||
int i1 = guiTop;
|
||||
drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
|
||||
int index = 0;
|
||||
if(!role.infiniteDays){
|
||||
for(int id : role.inventory.items.keySet()){
|
||||
ItemStack itemstack = role.inventory.items.get(id);
|
||||
if(itemstack == null)
|
||||
continue;
|
||||
int days = 1;
|
||||
if(role.rates.containsKey(id))
|
||||
days = role.rates.get(id);
|
||||
int index = 0;
|
||||
if (!role.infiniteDays) {
|
||||
for (int id : role.inventory.items.keySet()) {
|
||||
ItemStack itemstack = role.inventory.items.get(id);
|
||||
if (itemstack == null)
|
||||
continue;
|
||||
int days = 1;
|
||||
if (role.rates.containsKey(id))
|
||||
days = role.rates.get(id);
|
||||
|
||||
int yOffset = index * 20;
|
||||
int yOffset = index * 20;
|
||||
|
||||
int x = guiLeft + 68;
|
||||
int y = guiTop + yOffset + 4;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11,y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x+11,y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
int x = guiLeft + 68;
|
||||
int y = guiTop + yOffset + 4;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11, y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
|
||||
String daysS = days + " " + ((days == 1)?StatCollector.translateToLocal("follower.day"):StatCollector.translateToLocal("follower.days"));
|
||||
fontRendererObj.drawString(" = "+daysS, x + 27, y + 4, CustomNpcResourceListener.DefaultTextColor);
|
||||
//fontRenderer.drawString(quantity, x + 0 + (12-fontRenderer.getStringWidth(quantity))/2, y + 4, 0x404040);
|
||||
String daysS = days + " " + ((days == 1) ? StatCollector.translateToLocal("follower.day") : StatCollector.translateToLocal("follower.days"));
|
||||
fontRendererObj.drawString(" = " + daysS, x + 27, y + 4, CustomNpcResourceListener.DefaultTextColor);
|
||||
//fontRenderer.drawString(quantity, x + 0 + (12-fontRenderer.getStringWidth(quantity))/2, y + 4, 0x404040);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.drawNpc(33, 131);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.drawNpc(33, 131);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.roleInterface.readFromNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.roleInterface.readFromNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user