Merge branch 'master' into dev

# Conflicts:
#	src/main/java/noppes/npcs/scripted/ScriptFaction.java
#	src/main/java/noppes/npcs/scripted/ScriptWorld.java
#	src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java
#	src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java
#	src/main/java/noppes/npcs/scripted/interfaces/IEntity.java
#	src/main/java/noppes/npcs/scripted/interfaces/IWorld.java
#	src/main/java/noppes/npcs/scripted/interfaces/entity/ICustomNpc.java
#	src/main/java/noppes/npcs/scripted/interfaces/entity/IPlayer.java
This commit is contained in:
Luis C.M committed 2022-05-27 15:31:02 -05:00
commit ec5fc71413
300 files changed
+9920 -2959

No files matched your search

@@ -11,8 +11,8 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Line;
import noppes.npcs.controllers.Lines;
import noppes.npcs.controllers.data.Line;
import noppes.npcs.controllers.data.Lines;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData
@@ -4,23 +4,26 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
public GuiNpcTextureOverlays(EntityNPCInterface npc,GuiScreen parent){
super(npc, parent, npc.display.glowTexture.isEmpty()?"customnpcs:textures/overlays/":npc.display.glowTexture);
title = "Select Overlay";
//super(npc, parent, npc.display.glowTexture.isEmpty()?"customnpcs:textures/overlays/":npc.display.glowTexture);
super(npc, parent, npc.display.skinOverlayData.overlayList.containsKey(0) ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : "");
title = "Select Overlay";
this.parent = parent;
}
public void initGui(){
super.initGui();
int index = npc.display.glowTexture.lastIndexOf("/");
String str = npc.display.skinOverlayData.overlayList.containsKey(0) ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : "";
int index = str.lastIndexOf("/");
if(index > 0){
String asset = npc.display.glowTexture.substring(index + 1);
if(npc.display.glowTexture.equals(assets.getAsset(asset)))
String asset = str.substring(index + 1);
if(str.equals(assets.getAsset(asset)))
slot.selected = asset;
}
}
@@ -73,8 +76,13 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
@Override
public void elementClicked(){
if(dataTextures.contains(slot.selected) && slot.selected != null){
npc.display.glowTexture = assets.getAsset(slot.selected);
//npc.display.glowTexture = assets.getAsset(slot.selected);
npc.textureGlowLocation = null;
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
assets.getAsset(slot.selected), true, 1.0F, 1.0F, 0.0F, 0.0F,
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
));
}
}
@@ -0,0 +1,590 @@
package noppes.npcs.client.gui;
import com.ibm.icu.text.ArabicShaping;
import com.ibm.icu.text.ArabicShapingException;
import com.ibm.icu.text.Bidi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomNpcs;
import noppes.npcs.controllers.data.Quest;
import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
public class OverlayQuestTracking extends Gui {
public Minecraft mc;
private ScaledResolution res = null;
public static int scaledWidth = 0;
public static int scaledHeight = 0;
int color = 0xFFFFFF;
float alpha = 1.0F;
private boolean randomStyle = false;
private boolean boldStyle = false;
private boolean italicStyle = false;
private boolean underlineStyle = false;
private boolean strikethroughStyle = false;
private boolean bidiFlag = false;
private boolean unicodeFlag = false;
private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256];
private final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
protected final ResourceLocation locationFontTexture = new ResourceLocation("textures/font/ascii.png");;
protected int[] charWidth = new int[256];
protected byte[] glyphWidth = new byte[65536];
private final int[] colorCode = new int[32];
private float red;
private float green;
private float blue;
private float posX;
private float posY;
private float renderOffsetY;
public static Quest trackedQuest = new Quest();
public static String categoryName = "";
public OverlayQuestTracking(Minecraft mc) {
this.mc = mc;
readFontTexture();
readGlyphSizes();
for (int i = 0; i < 32; ++i)
{
int j = (i >> 3 & 1) * 85;
int k = (i >> 2 & 1) * 170 + j;
int l = (i >> 1 & 1) * 170 + j;
int i1 = (i >> 0 & 1) * 170 + j;
if (i == 6)
{
k += 85;
}
if (Minecraft.getMinecraft().gameSettings.anaglyph)
{
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
int k1 = (k * 30 + l * 70) / 100;
int l1 = (k * 30 + i1 * 70) / 100;
k = j1;
l = k1;
i1 = l1;
}
if (i >= 16)
{
k /= 4;
l /= 4;
i1 /= 4;
}
this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
}
}
public void initOverlay() {
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
scaledWidth = res.getScaledWidth();
scaledHeight = res.getScaledHeight();
}
public void setOverlayData(NBTTagCompound compound) {
trackedQuest.readNBT(compound.getCompoundTag("Quest"));
categoryName = compound.getString("CategoryName");
this.initOverlay();
}
public void renderGameOverlay(float partialTicks){
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
scaledWidth = res.getScaledWidth();
scaledHeight = res.getScaledHeight();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
GL11.glTranslatef(CustomNpcs.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(CustomNpcs.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F);
GL11.glTranslatef(CustomNpcs.TrackingInfoX - 10, CustomNpcs.TrackingInfoY, 0.0F);
red = (color >> 16 & 255) / 255f;
green = (color >> 8 & 255) / 255f;
blue = (color & 255) / 255f;
float centerX = -60;
float questTitleTop;
this.renderOffsetY = -40;
GL11.glPushMatrix();
GL11.glTranslatef(centerX, 0.0F, 0.0F);
this.renderStringLines(trackedQuest.getName(),1.2F, false, true);
GL11.glPopMatrix();
questTitleTop = this.renderOffsetY;
this.renderOffsetY -= 5;
GL11.glPushMatrix();
GL11.glTranslatef(centerX, 0.0F, 0.0F);
this.renderStringLines(categoryName,0.85F, false, false);
GL11.glPopMatrix();
//TODO: Add objectives list, with green strikethrough text for completed objectives. Then, add who the player should turn the quest in to.
this.renderOffsetY = -25;
GL11.glPushMatrix();
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY+2), 0xFF777777);
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY+1), 0xFFA8A8A8);
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
GL11.glPopMatrix();
this.renderOffsetY = questTitleTop + 5;
GL11.glPushMatrix();
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY-1), 0xFFA8A8A8);
this.drawHorizontalLine((int)(-60 + centerX), (int)(60 + centerX), (int) (this.renderOffsetY-2), 0xFF777777);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
public void renderStringLines(String string, float scale, boolean upwards, boolean bold) {
String[] split = string.split(" ");
ArrayList<String> lines = new ArrayList<>();
lines.add(split[0]);
for (int i = 1; i < split.length; i++) {
String s = split[i];
if (this.fontRenderer.getStringWidth(lines.get(lines.size() - 1) + " " + s) > 100) {
lines.add(s);
} else {
lines.set(lines.size() - 1, lines.get(lines.size() - 1) + " " + s);
}
}
for (int i = 0; i < lines.size(); i++) {
String s = lines.get(i);
if (!upwards) {
s = lines.get(lines.size()-1 - i);
}
GL11.glPushMatrix();
GL11.glTranslatef(scale*(-this.fontRenderer.getStringWidth(s)/2.0F), this.renderOffsetY, 0.0F);
GL11.glScalef(scale, scale, scale);
this.drawString(s, 0, 0, this.color, true);
if (bold) {
GL11.glTranslatef(0.2F, 0.2F, 0.0F);
this.drawString(s, 0, 0, this.color, false);
}
this.renderOffsetY += upwards ? 10 : -10;
GL11.glPopMatrix();
}
}
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)
{
this.resetStyles();
int l;
if (p_85187_5_)
{
l = this.renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true);
l = Math.max(l, this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false));
}
else
{
l = this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false);
}
return l;
}
private void resetStyles()
{
this.randomStyle = false;
this.boldStyle = false;
this.italicStyle = false;
this.underlineStyle = false;
this.strikethroughStyle = false;
}
private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_)
{
if (p_78258_1_ == null)
{
return 0;
}
else
{
if (this.bidiFlag)
{
p_78258_1_ = this.bidiReorder(p_78258_1_);
}
setColor(this.red, this.green, this.blue, this.alpha);
if (p_78258_5_) {
setColor(0,0,0,1.0F);
}
this.posX = (float)p_78258_2_;
this.posY = (float)p_78258_3_;
this.renderStringAtPos(p_78258_1_, p_78258_5_);
return (int)this.posX;
}
}
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_)
{
for (int i = 0; i < p_78255_1_.length(); ++i)
{
char c0 = p_78255_1_.charAt(i);
int j;
int k;
if (c0 == 38 && i + 1 < p_78255_1_.length())
{
j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1));
if(j < 16){
this.randomStyle = false;
this.boldStyle = false;
this.strikethroughStyle = false;
this.underlineStyle = false;
this.italicStyle = false;
if (j < 0 || j > 15)
{
j = 15;
}
if (p_78255_2_)
{
j += 16;
}
k = this.colorCode[j];
setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
}
else if (j == 16)
{
this.randomStyle = true;
}
else if (j == 17)
{
this.boldStyle = true;
}
else if (j == 18)
{
this.strikethroughStyle = true;
}
else if (j == 19)
{
this.underlineStyle = true;
}
else if (j == 20)
{
this.italicStyle = true;
}
else if (j == 21)
{
this.randomStyle = false;
this.boldStyle = false;
this.strikethroughStyle = false;
this.underlineStyle = false;
this.italicStyle = false;
}
++i;
}
else
{
j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(c0);
if (this.randomStyle && j != -1)
{
do
{
k = Minecraft.getMinecraft().fontRenderer.fontRandom.nextInt(this.charWidth.length);
}
while (this.charWidth[j] != this.charWidth[k]);
j = k;
}
float f1 = this.unicodeFlag ? 0.5F : 1.0F;
boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
if (flag1)
{
this.posX -= f1;
this.posY -= f1;
}
float f = this.renderCharAtPos(j, c0, this.italicStyle);
if (flag1)
{
this.posX += f1;
this.posY += f1;
}
if (this.boldStyle)
{
this.posX += f1;
if (flag1)
{
this.posX -= f1;
this.posY -= f1;
}
this.renderCharAtPos(j, c0, this.italicStyle);
this.posX -= f1;
if (flag1)
{
this.posX += f1;
this.posY += f1;
}
++f;
}
doDraw(f);
}
}
}
protected void doDraw(float f)
{
{
{
Tessellator tessellator;
if (this.strikethroughStyle)
{
tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
if (this.underlineStyle)
{
tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int l = this.underlineStyle ? -1 : 0;
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
this.posX += (float)((int)f);
}
}
}
private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_)
{
return p_78278_2_ == 32 ? 4.0F : ("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_));
}
protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
{
float f = (float)(p_78266_1_ % 16 * 8);
float f1 = (float)(p_78266_1_ / 16 * 8);
float f2 = p_78266_2_ ? 1.0F : 0.0F;
bindTexture(this.locationFontTexture);
float f3 = (float)this.charWidth[p_78266_1_] - 0.01F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
GL11.glVertex3f(this.posX + f2, this.posY, 0.0F);
GL11.glTexCoord2f(f / 128.0F, (f1 + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX - f2, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, f1 / 128.0F);
GL11.glVertex3f(this.posX + f3 - 1.0F + f2, this.posY, 0.0F);
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return (float)this.charWidth[p_78266_1_];
}
private ResourceLocation getUnicodePageLocation(int p_111271_1_)
{
if (unicodePageLocations[p_111271_1_] == null)
{
unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(p_111271_1_)}));
}
return unicodePageLocations[p_111271_1_];
}
private void loadGlyphTexture(int p_78257_1_)
{
bindTexture(this.getUnicodePageLocation(p_78257_1_));
}
/**
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
*/
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
{
if (this.glyphWidth[p_78277_1_] == 0)
{
return 0.0F;
}
else
{
int i = p_78277_1_ / 256;
this.loadGlyphTexture(i);
int j = this.glyphWidth[p_78277_1_] >>> 4;
int k = this.glyphWidth[p_78277_1_] & 15;
float f = (float)j;
float f1 = (float)(k + 1);
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
float f4 = f1 - f - 0.02F;
float f5 = p_78277_2_ ? 1.0F : 0.0F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f5, this.posY, 0.0F);
GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return (f1 - f) / 2.0F + 1.0F;
}
}
protected void setColor(float r, float g, float b, float a)
{
GL11.glColor4f(r, g, b, a);
}
protected void bindTexture(ResourceLocation location)
{
Minecraft.getMinecraft().renderEngine.bindTexture(location);
}
private void readFontTexture()
{
BufferedImage bufferedimage;
try
{
bufferedimage = ImageIO.read(getResourceInputStream(this.locationFontTexture));
}
catch (IOException ioexception)
{
throw new RuntimeException(ioexception);
}
int i = bufferedimage.getWidth();
int j = bufferedimage.getHeight();
int[] aint = new int[i * j];
bufferedimage.getRGB(0, 0, i, j, aint, 0, i);
int k = j / 16;
int l = i / 16;
byte b0 = 1;
float f = 8.0F / (float)l;
int i1 = 0;
while (i1 < 256)
{
int j1 = i1 % 16;
int k1 = i1 / 16;
if (i1 == 32)
{
this.charWidth[i1] = 3 + b0;
}
int l1 = l - 1;
while (true)
{
if (l1 >= 0)
{
int i2 = j1 * l + l1;
boolean flag = true;
for (int j2 = 0; j2 < k && flag; ++j2)
{
int k2 = (k1 * l + j2) * i;
if ((aint[i2 + k2] >> 24 & 255) != 0)
{
flag = false;
}
}
if (flag)
{
--l1;
continue;
}
}
++l1;
this.charWidth[i1] = (int)(0.5D + (double)((float)l1 * f)) + b0;
++i1;
break;
}
}
}
private void readGlyphSizes()
{
try
{
InputStream inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
inputstream.read(this.glyphWidth);
}
catch (IOException ioexception)
{
throw new RuntimeException(ioexception);
}
}
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
{
return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
}
private String bidiReorder(String p_147647_1_)
{
try
{
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
bidi.setReorderingMode(0);
return bidi.writeReordered(2);
}
catch (ArabicShapingException arabicshapingexception)
{
return p_147647_1_;
}
}
}
@@ -15,7 +15,7 @@ import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.containers.ContainerMail;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.data.PlayerMail;
public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener{
@@ -14,8 +14,8 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAvailabilityFactionType;
import noppes.npcs.constants.EnumDayTime;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Availability;
import noppes.npcs.controllers.Faction;
import noppes.npcs.controllers.data.Availability;
import noppes.npcs.controllers.data.Faction;
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
{
@@ -1,7 +1,6 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
@@ -12,8 +11,8 @@ import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAvailabilityDialog;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Availability;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.data.Availability;
import noppes.npcs.controllers.data.Dialog;
public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiSelectionListener, IGuiData{
private Availability availabitily;
@@ -1,7 +1,6 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
@@ -13,8 +12,8 @@ import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAvailabilityQuest;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Availability;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Availability;
import noppes.npcs.controllers.data.Quest;
public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSelectionListener, IGuiData {
private Availability availabitily;
@@ -5,19 +5,11 @@ import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenMutated;
import net.minecraftforge.common.BiomeManager;
import noppes.npcs.DataAI;
import noppes.npcs.client.gui.util.GuiCustomScroll;
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.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAnimation;
import noppes.npcs.constants.EnumMovingType;
import noppes.npcs.constants.EnumStandingType;
import noppes.npcs.controllers.SpawnData;
import noppes.npcs.controllers.data.SpawnData;
public class SubGuiNpcBiomes extends SubGuiInterface
{
@@ -2,21 +2,14 @@ package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcButtonYesNo;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiSelectionListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAvailabilityDialog;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Availability;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.PlayerMail;
public class SubGuiNpcDialogExtra extends SubGuiInterface implements ISubGuiListener
{
@@ -14,8 +14,8 @@ import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumOptionType;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.DialogOption;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogOption;
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener{
private DialogOption option;
@@ -5,8 +5,8 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumOptionType;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.DialogOption;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogOption;
public class SubGuiNpcDialogOptions extends SubGuiInterface
{
@@ -14,7 +14,7 @@ import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.FactionOptions;
import noppes.npcs.controllers.data.FactionOptions;
public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollData,ICustomScrollListener
{
@@ -7,7 +7,7 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.controllers.Faction;
import noppes.npcs.controllers.data.Faction;
public class SubGuiNpcFactionPoints extends SubGuiInterface implements ITextfieldListener
{
@@ -5,32 +5,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import org.apache.logging.log4j.status.StatusConsoleListener;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.SubGuiEditText;
import noppes.npcs.client.gui.SubGuiMailmanSendSetup;
import noppes.npcs.client.gui.SubGuiNpcCommand;
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
import noppes.npcs.client.gui.SubGuiNpcTextArea;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.GuiSelectionListener;
import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.QuestCategory;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener{
@@ -14,7 +14,7 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiSelectionListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.DialogOption;
import noppes.npcs.controllers.data.DialogOption;
import noppes.npcs.entity.EntityNPCInterface;
@@ -8,12 +8,12 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.TransformData;
import noppes.npcs.controllers.data.DataTransform;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
{
private TransformData data;
private DataTransform data;
public GuiNPCNightSetup(EntityNPCInterface npc)
{
@@ -5,7 +5,6 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -31,7 +30,7 @@ import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.containers.ContainerCustomGui;
import noppes.npcs.scripted.gui.*;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -10,14 +10,13 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ImageDownloadAlt;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
import noppes.npcs.scripted.gui.ScriptGuiButton;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
public class CustomGuiButton extends GuiButton implements IClickListener {
@@ -53,7 +52,7 @@ public class CustomGuiButton extends GuiButton implements IClickListener {
if(texture.startsWith("https://")){
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
ITextureObject object = new ImageDownloadAlt(null, texture, new ResourceLocation("customnpcs:textures/gui/invisible.png"), new ImageBufferDownloadAlt(true,false));
texturemanager.loadTexture(this.texture, object);
}
}
@@ -9,23 +9,19 @@ import com.ibm.icu.text.ArabicShaping;
import com.ibm.icu.text.ArabicShapingException;
import com.ibm.icu.text.Bidi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiLabel;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
import noppes.npcs.scripted.gui.ScriptGuiLabel;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
public class CustomGuiLabel extends Gui implements IGuiComponent {
int x, y, width, height;
@@ -135,14 +131,14 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
}
public static CustomGuiLabel fromComponent(ScriptGuiLabel component) {
CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.hasShadow());
CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.getShadow());
lbl.scale = 1.0F;
lbl.color = component.getColor();
lbl.setScale(component.getScale());
if (component.hasHoverText()) {
lbl.hoverText = component.getHoverText();
}
lbl.labelShadowEnabled = component.hasShadow();
lbl.labelShadowEnabled = component.getShadow();
lbl.color = component.getColor();
lbl.alpha = component.getAlpha();
lbl.rotation = component.getRotation();
@@ -155,7 +151,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
public ICustomGuiComponent toComponent() {
ScriptGuiLabel component = new ScriptGuiLabel(this.id, this.fullLabel, this.field_146162_g, this.field_146174_h, this.field_146167_a, this.field_146161_f, this.color);
component.setHoverText(this.hoverText);
component.enableShadow(this.labelShadowEnabled);
component.setShadow(this.labelShadowEnabled);
component.setColor(this.color);
component.setAlpha(this.alpha);
component.setRotation(this.rotation);
@@ -6,12 +6,9 @@ import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
import noppes.npcs.scripted.gui.ScriptGuiLine;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
public class CustomGuiLine extends Gui implements IGuiComponent {
int id;
GuiCustom parent;
@@ -17,7 +17,7 @@ import noppes.npcs.client.gui.custom.interfaces.IClickListener;
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.scripted.gui.ScriptGuiScroll;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHolder, IClickListener {
@@ -8,14 +8,12 @@ package noppes.npcs.client.gui.custom.components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
import noppes.npcs.client.gui.custom.interfaces.IKeyListener;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.scripted.gui.ScriptGuiTextField;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
public class CustomGuiTextField extends GuiTextField implements IKeyListener, IDataHolder, IClickListener {
@@ -10,19 +10,15 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ImageDownloadAlt;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
import noppes.npcs.scripted.gui.ScriptGuiTexturedRect;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
import org.lwjgl.opengl.GL11;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
GuiCustom parent;
ResourceLocation texture;
@@ -57,7 +53,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
if(texture.startsWith("https://")){
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
ITextureObject object = new ImageDownloadAlt(null, texture, new ResourceLocation("customnpcs:textures/gui/invisible.png"), new ImageBufferDownloadAlt(true,false));
texturemanager.loadTexture(this.texture, object);
}
}
@@ -6,7 +6,7 @@
package noppes.npcs.client.gui.custom.interfaces;
import net.minecraft.client.Minecraft;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
public interface IGuiComponent {
int getID();
@@ -5,12 +5,11 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayLabel;
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayLine;
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayTexturedRect;
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlayComponent;
import noppes.npcs.scripted.overlay.*;
import org.lwjgl.opengl.GL11;
@@ -9,7 +9,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlayComponent;
import noppes.npcs.scripted.overlay.ScriptOverlayLabel;
import org.lwjgl.opengl.GL11;
@@ -2,18 +2,14 @@ package noppes.npcs.client.gui.customoverlay.components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlayComponent;
import noppes.npcs.scripted.overlay.ScriptOverlayLine;
import org.lwjgl.opengl.GL11;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
public class CustomOverlayLine extends Gui implements IOverlayComponent {
OverlayCustom parent;
int alignment;
@@ -2,23 +2,18 @@ package noppes.npcs.client.gui.customoverlay.components;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.SkinManager;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ImageDownloadAlt;
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlayComponent;
import noppes.npcs.scripted.overlay.ScriptOverlayTexturedRect;
import org.lwjgl.opengl.GL11;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL14.glBlendFuncSeparate;
public class CustomOverlayTexturedRect extends Gui implements IOverlayComponent {
OverlayCustom parent;
int alignment;
@@ -55,7 +50,7 @@ public class CustomOverlayTexturedRect extends Gui implements IOverlayComponent
if(texture.startsWith("https://")){
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
ITextureObject object = new ImageDownloadAlt(null, texture, new ResourceLocation("customnpcs:textures/gui/invisible.png"), new ImageBufferDownloadAlt(true,false));
texturemanager.loadTexture(this.texture, object);
}
}
@@ -17,7 +17,7 @@ import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.containers.ContainerManageBanks;
import noppes.npcs.controllers.Bank;
import noppes.npcs.controllers.data.Bank;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData
@@ -8,11 +8,8 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.GuiNpcSoundSelection;
import noppes.npcs.client.gui.SubGuiMailmanSendSetup;
import noppes.npcs.client.gui.SubGuiNpcAvailability;
import noppes.npcs.client.gui.SubGuiNpcCommand;
import noppes.npcs.client.gui.SubGuiNpcDialogExtra;
import noppes.npcs.client.gui.SubGuiNpcDialogOption;
import noppes.npcs.client.gui.SubGuiNpcDialogOptions;
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
import noppes.npcs.client.gui.SubGuiNpcTextArea;
@@ -29,9 +26,8 @@ import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.DialogCategory;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogCategory;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData, ISubGuiListener, GuiSelectionListener,ICustomScrollListener,ITextfieldListener, IGuiData
@@ -22,7 +22,7 @@ import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Faction;
import noppes.npcs.controllers.data.Faction;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData, ISubGuiListener
@@ -5,32 +5,17 @@ import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import org.apache.logging.log4j.status.StatusConsoleListener;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.SubGuiEditText;
import noppes.npcs.client.gui.SubGuiMailmanSendSetup;
import noppes.npcs.client.gui.SubGuiNpcCommand;
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
import noppes.npcs.client.gui.SubGuiNpcTextArea;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.GuiSelectionListener;
import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.QuestCategory;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{
@@ -7,7 +7,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.SubGuiMailmanSendSetup;
import noppes.npcs.client.gui.SubGuiNpcCommand;
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
@@ -32,9 +31,8 @@ import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.constants.EnumQuestCompletion;
import noppes.npcs.constants.EnumQuestRepeat;
import noppes.npcs.constants.EnumQuestType;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.QuestCategory;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.controllers.data.QuestCategory;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollData, ISubGuiListener, GuiSelectionListener,ICustomScrollListener,ITextfieldListener, IGuiData
@@ -21,7 +21,7 @@ import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.containers.ContainerManageRecipes;
import noppes.npcs.controllers.RecipeCarpentry;
import noppes.npcs.controllers.data.RecipeCarpentry;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
@@ -22,7 +22,7 @@ import noppes.npcs.client.gui.util.ISliderListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.SpawnData;
import noppes.npcs.controllers.data.SpawnData;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, IScrollData, ITextfieldListener, ICustomScrollListener, ISliderListener{
@@ -9,7 +9,7 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.containers.ContainerNpcQuestReward;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
@@ -10,11 +10,8 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumAnimation;
import noppes.npcs.constants.EnumMovingType;
import noppes.npcs.constants.EnumStandingType;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.PlayerMail;
import noppes.npcs.controllers.data.Quest;
public class SubGuiNpcQuestAdvanced extends SubGuiInterface implements ITextfieldListener
{
@@ -15,6 +15,7 @@ import noppes.npcs.client.gui.SubGuiNpcName;
import noppes.npcs.client.gui.model.GuiCreationScreen;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
@@ -76,7 +77,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
y+=23;
addLabel(new GuiNpcLabel(9,"display.overlay", guiLeft + 5, y + 5));
addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.glowTexture));
addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 80, y, 200, 20, npc.display.skinOverlayData.overlayList.containsKey(0) ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : ""));
this.addButton(new GuiNpcButton(9, guiLeft + 283, y, 80, 20, "display.selectTexture"));
y+=23;
@@ -128,7 +130,11 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
}
else if(textfield.id == 9){
npc.textureGlowLocation = null;
display.glowTexture = textfield.getText();
//display.glowTexture = textfield.getText();
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F,
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
));
}
else if(textfield.id == 11){
display.title = textfield.getText();
@@ -33,7 +33,6 @@ import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityFakeLiving;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.Sys;
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
@@ -229,7 +228,8 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
npc.display.texture = NPCRendererHelper.getTexture(render,entity);
}
}
npc.display.glowTexture = "";
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
@@ -336,7 +336,8 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
else{
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
}
npc.display.glowTexture = "";
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
@@ -3,7 +3,6 @@ package noppes.npcs.client.gui.model;
import java.util.Collections;
import java.util.Vector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
@@ -127,7 +126,8 @@ public class GuiEntitySelection extends GuiNPCInterface
else{
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
}
npc.display.glowTexture = "";
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
@@ -21,8 +21,8 @@ import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.IGuiClose;
import noppes.npcs.constants.EnumOptionType;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.DialogOption;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogOption;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.input.Keyboard;
@@ -13,8 +13,8 @@ import noppes.npcs.client.gui.util.GuiButtonNextPage;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.controllers.Faction;
import noppes.npcs.controllers.PlayerFactionData;
import noppes.npcs.controllers.data.Faction;
import noppes.npcs.controllers.data.PlayerFactionData;
import org.lwjgl.opengl.GL11;
@@ -19,8 +19,8 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.PlayerMailData;
import noppes.npcs.controllers.data.PlayerMail;
import noppes.npcs.controllers.data.PlayerMailData;
public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScrollListener, GuiYesNoCallback{
@@ -26,7 +26,7 @@ import noppes.npcs.client.gui.util.IGuiError;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.containers.ContainerMail;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.data.PlayerMail;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@@ -3,7 +3,6 @@ package noppes.npcs.client.gui.player;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import noppes.npcs.NoppesStringUtils;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.client.CustomNpcResourceListener;
import noppes.npcs.client.TextBlockClient;
@@ -12,7 +11,7 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.ITopButtonListener;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import org.lwjgl.opengl.GL11;
@@ -13,16 +13,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.QuestLogData;
import noppes.npcs.client.Client;
import noppes.npcs.client.CustomNpcResourceListener;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.TextBlockClient;
import noppes.npcs.client.gui.util.GuiButtonNextPage;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiMenuSideButton;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.ITopButtonListener;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.constants.EnumPlayerPacket;
import org.lwjgl.opengl.GL11;
@@ -33,16 +29,16 @@ import tconstruct.client.tabs.TabRegistry;
public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,ICustomScrollListener, IGuiData{
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
private EntityPlayer player;
private GuiCustomScroll scroll;
private HashMap<Integer,GuiMenuSideButton> sideButtons = new HashMap<Integer,GuiMenuSideButton>();
private QuestLogData data = new QuestLogData();
private boolean noQuests = false;
private boolean questDetails = true;
private Minecraft mc = Minecraft.getMinecraft();
public GuiQuestLog(EntityPlayer player) {
super();
this.player = player;
@@ -58,7 +54,7 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
TabRegistry.addTabsToList(buttonList);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabQuests.class);
noQuests = false;
if(data.categories.isEmpty()){
@@ -76,10 +72,10 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
i++;
}
sideButtons.get(categories.indexOf(data.selectedCategory)).active = true;
if(scroll == null)
scroll = new GuiCustomScroll(this,0);
scroll.setList(data.categories.get(data.selectedCategory));
scroll.setSize(134, 174);
scroll.guiLeft = guiLeft + 5;
@@ -89,21 +85,32 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
addButton(new GuiButtonNextPage(1, guiLeft + 286, guiTop + 176, true));
addButton(new GuiButtonNextPage(2, guiLeft + 144, guiTop + 176, false));
GuiNpcButton trackingButton = new GuiNpcButton(3, guiLeft + 260, guiTop + 151, 50, 20, new String[]{"Track", "Tracking"}, data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest) ? 1 : 0);
if (trackingButton.displayString.equals("Tracking")) {
trackingButton.packedFGColour = 0x32CD32;
}
addButton(trackingButton);
getButton(1).visible = questDetails && data.hasSelectedQuest();
getButton(2).visible = !questDetails && data.hasSelectedQuest();
getButton(3).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
}
@Override
protected void actionPerformed(GuiButton guibutton){
if(!(guibutton instanceof GuiButtonNextPage))
return;
if(guibutton.id == 1){
questDetails = false;
initGui();
}
if(guibutton.id == 2){
questDetails = true;
initGui();
}
if(guibutton.id == 3){
if (!data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest)) {
data.trackedQuestKey = data.selectedCategory + ":" + data.selectedQuest;
} else {
data.trackedQuestKey = "";
}
}
initGui();
}
@Override
public void drawScreen(int i, int j, float f){
@@ -115,7 +122,7 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
super.drawScreen(i, j, f);
if(noQuests){
mc.fontRenderer.drawString(StatCollector.translateToLocal("quest.noquests"),guiLeft + 84,guiTop + 80, CustomNpcResourceListener.DefaultTextColor);
return;
@@ -127,18 +134,17 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
if(!data.hasSelectedQuest())
return;
if(questDetails){
if (questDetails) {
drawProgress();
String title = StatCollector.translateToLocal("gui.text");
mc.fontRenderer.drawString(title, guiLeft + 284 - mc.fontRenderer.getStringWidth(title), guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
}
else{
} else {
drawQuestText();
String title = StatCollector.translateToLocal("quest.objectives");
mc.fontRenderer.drawString(title, guiLeft + 168, guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
}
GL11.glPushMatrix();
GL11.glTranslatef(guiLeft + 148, guiTop, 0);
GL11.glScalef(1.24f, 1.24f, 1.24f);
@@ -146,21 +152,21 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
GL11.glPopMatrix();
drawHorizontalLine(guiLeft + 142, guiLeft + 312, guiTop + 17, + 0xFF000000 + CustomNpcResourceListener.DefaultTextColor);
}
private void drawQuestText(){
TextBlockClient block = new TextBlockClient(data.getQuestText(), 174, true, player);
int yoffset = guiTop + 5;
int yoffset = guiTop + 5;
for(int i = 0; i < block.lines.size(); i++){
String text = block.lines.get(i).getFormattedText();
fontRendererObj.drawString(text, guiLeft + 142, guiTop + 20 + (i * fontRendererObj.FONT_HEIGHT), CustomNpcResourceListener.DefaultTextColor);
}
}
private void drawProgress() {
String complete = data.getComplete();
if(complete != null && !complete.isEmpty())
mc.fontRenderer.drawString(StatCollector.translateToLocalFormatted("quest.completewith", complete), guiLeft + 144, guiTop + 105, CustomNpcResourceListener.DefaultTextColor);
int yoffset = guiTop + 22;
for(String process : data.getQuestStatus()){
int index = process.lastIndexOf(":");
@@ -179,7 +185,7 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
yoffset += 10;
}
}
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
}
@@ -235,10 +241,16 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
this.data = data;
initGui();
}
@Override
@Override
public void onGuiClosed() {
super.onGuiClosed();
this.save();
}
@Override
public void save() {
// TODO Auto-generated method stub
Client.sendData(EnumPacketServer.UpdateTrackedQuest, this.data.trackedQuestKey);
}
}
@@ -1,7 +1,6 @@
package noppes.npcs.client.gui.player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.lwjgl.opengl.GL11;
@@ -18,7 +17,7 @@ import noppes.npcs.client.gui.util.GuiButtonNextPage;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.controllers.RecipeCarpentry;
import noppes.npcs.controllers.data.RecipeCarpentry;
import noppes.npcs.controllers.RecipeController;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -8,13 +8,12 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.GuiNPCDialogSelection;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiSelectionListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.quests.QuestDialog;
@@ -11,7 +11,7 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.containers.ContainerNpcQuestTypeItem;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.quests.QuestItem;
@@ -17,7 +17,7 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.quests.QuestKill;
@@ -2,13 +2,12 @@ package noppes.npcs.client.gui.questtypes;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import noppes.npcs.client.NoppesUtil;
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.ITextfieldListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.quests.QuestLocation;
@@ -11,7 +11,7 @@ import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.IScrollData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.Bank;
import noppes.npcs.controllers.data.Bank;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleBank;
@@ -6,19 +6,15 @@ import java.util.Vector;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.mainmenu.GuiNpcAdvanced;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNPCStringSlot;
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.client.gui.util.IScrollData;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.TransportLocation;
import noppes.npcs.controllers.data.TransportLocation;
import noppes.npcs.entity.EntityNPCInterface;
public class GuiNpcTransporter extends GuiNPCInterface2 implements IScrollData, IGuiData{
@@ -6,13 +6,16 @@
package noppes.npcs.client.gui.script;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomNpcs;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPacketServer;
import org.lwjgl.opengl.GL11;
public class GuiScriptGlobal extends GuiNPCInterface {
public class GuiScriptGlobal extends GuiNPCInterface implements IGuiData {
private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/smallbg.png");
public GuiScriptGlobal() {
@@ -24,16 +27,20 @@ public class GuiScriptGlobal extends GuiNPCInterface {
public void initGui() {
super.initGui();
Client.sendData(EnumPacketServer.ScriptGlobalGuiDataGet, new Object[0]);
}
public void setGuiData(NBTTagCompound compound) {
GuiNpcButton playerButton = new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players");
playerButton.setEnabled(CustomNpcs.GlobalPlayerScripts && CustomNpcs.ScriptingEnabled);
playerButton.setEnabled(compound.getBoolean("PlayerScriptsEnabled") && compound.getBoolean("ScriptsEnabled"));
this.addButton(playerButton);
GuiNpcButton forgeButton = new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge");
forgeButton.setEnabled(CustomNpcs.GlobalForgeScripts && CustomNpcs.ScriptingEnabled);
forgeButton.setEnabled(compound.getBoolean("ForgeScriptsEnabled") && compound.getBoolean("ScriptsEnabled"));
this.addButton(forgeButton);
GuiNpcButton npcButton = new GuiNpcButton(2, this.guiLeft + 38, this.guiTop + 80, 100, 20, "All NPCs");
npcButton.setEnabled(CustomNpcs.GlobalNPCScripts && CustomNpcs.ScriptingEnabled);
npcButton.setEnabled(compound.getBoolean("GlobalNPCScriptsEnabled") && compound.getBoolean("ScriptsEnabled"));
this.addButton(npcButton);
}
@@ -20,7 +20,6 @@ import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.ChunkDataEvent;
@@ -37,6 +36,7 @@ import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.scripted.item.ScriptCustomItem;
import org.apache.commons.lang3.StringUtils;
public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallback, IGuiData, ITextChangeListener, ICustomScrollListener, IJTextAreaListener, ITextfieldListener {
@@ -165,6 +165,21 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
hookList.add("dialogClose");
hookList.add("timer");
}
else if(handler instanceof ScriptCustomItem) {
hookList.add("init");
hookList.add("tick");
hookList.add("tossed");
hookList.add("pickedUp");
hookList.add("spawn");
hookList.add("interact");
hookList.add("attack");
hookList.add("startItem");
hookList.add("usingItem");
hookList.add("stopItem");
hookList.add("finishItem");
//hookList.add("");
//hookList.add("");
}
else if(handler instanceof ForgeDataScript) {
hooks.setSize(238, 198);
hooks.guiLeft = guiLeft - 240;
@@ -0,0 +1,28 @@
package noppes.npcs.client.gui.script;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.CustomItems;
import noppes.npcs.client.Client;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.scripted.item.ScriptCustomItem;
public class GuiScriptItem extends GuiScriptInterface {
private ScriptCustomItem item;
public GuiScriptItem(EntityPlayer player) {
this.handler = this.item = new ScriptCustomItem(new ItemStack(CustomItems.scripted_item));
Client.sendData(EnumPacketServer.ScriptItemDataGet, new Object[0]);
}
public void setGuiData(NBTTagCompound compound) {
this.item.setMCNbt(compound);
super.setGuiData(compound);
}
public void save() {
super.save();
Client.sendData(EnumPacketServer.ScriptItemDataSave, new Object[]{this.item.getMCNbt()});
}
}
@@ -125,6 +125,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
public void buttonEvent(GuiButton guibutton){};
public void close(){
Keyboard.enableRepeatEvents(false);
GuiNpcTextField.unfocus();
save();
player.closeScreen();
@@ -155,6 +155,7 @@ public abstract class GuiNPCInterface extends GuiScreen
GuiNpcTextField.unfocus();
}
public void close(){
Keyboard.enableRepeatEvents(false);
displayGuiScreen(null);
mc.setIngameFocus();
save();
@@ -99,6 +99,8 @@ public class GuiNpcMenu implements GuiYesNoCallback{
}
private void close() {
Keyboard.enableRepeatEvents(false);
if(parent instanceof GuiContainerNPCInterface2)
((GuiContainerNPCInterface2)parent).close();