mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 13:25:10 +00:00
Tell client NPC is being drawn
This commit is contained in:
1 parent
8c7f31f1e2
commit
ec78673fa2
8 files changed
+45
-35
No files matched your search
@@ -30,6 +30,7 @@ public class GuiNPCTextures extends GuiNpcSelectionInterface
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -61,6 +62,7 @@ public class GuiNPCTextures extends GuiNpcSelectionInterface
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.rotationYawHead = f7;
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -68,7 +70,7 @@ public class GuiNPCTextures extends GuiNpcSelectionInterface
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -60,6 +61,7 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.rotationYawHead = f7;
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -67,7 +69,7 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
@Override
|
||||
@@ -76,7 +78,7 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
npc.display.cloakTexture = assets.getAsset(slot.selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -60,6 +61,7 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.rotationYawHead = f7;
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -67,10 +69,10 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(dataTextures.contains(slot.selected) && slot.selected != null){
|
||||
|
||||
@@ -32,14 +32,14 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
slot = getResource("slot.png");
|
||||
Client.sendData(EnumPacketServer.MainmenuInvGet);
|
||||
}
|
||||
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18));
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
@@ -128,6 +128,7 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
}
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
npc.isDrawn = true;
|
||||
int showname = npc.display.showName;
|
||||
npc.display.showName = 1;
|
||||
int l = guiLeft + 20; //(width/2)-180;
|
||||
@@ -164,15 +165,14 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
npc.display.showName = showname;
|
||||
|
||||
npc.isDrawn = false;
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
npc.inventory.dropchance = chances;
|
||||
@@ -180,7 +180,7 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
npc.inventory.maxExp = getTextField(1).getInteger();
|
||||
Client.sendData(EnumPacketServer.MainmenuInvSave, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.inventory.readEntityFromNBT(compound);
|
||||
|
||||
@@ -111,6 +111,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
if(!dialog.hideNPC){
|
||||
npc.isDrawn = true;
|
||||
float l = (guiLeft - 70);
|
||||
float i1 = (guiTop + ySize);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
@@ -151,6 +152,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
npc.prevRotationYawHead = npc.rotationYawHead = f7;
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -691,7 +693,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
options.add(slot);
|
||||
}
|
||||
calculateRowHeight();
|
||||
|
||||
|
||||
grabMouse(dialog.showWheel);
|
||||
}
|
||||
private void calculateRowHeight(){
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
public boolean closeOnEsc = false;
|
||||
private SubGuiInterface subgui;
|
||||
public int mouseX, mouseY;
|
||||
|
||||
|
||||
public GuiContainerNPCInterface(EntityNPCInterface npc,Container cont)
|
||||
{
|
||||
super(cont);
|
||||
@@ -63,9 +63,9 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
subgui.setWorldAndResolution(mc, width, height);
|
||||
subgui.initGui();
|
||||
}
|
||||
|
||||
|
||||
buttonList.clear();
|
||||
|
||||
|
||||
guiLeft = (width - xSize)/2;
|
||||
guiTop = (height - ySize) / 2;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
}
|
||||
}
|
||||
public void mouseEvent(int i, int j, int k){};
|
||||
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char c, int i)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
else{
|
||||
for(GuiNpcTextField tf : new ArrayList<GuiNpcTextField>(textfields.values()))
|
||||
tf.textboxKeyTyped(c, i);
|
||||
|
||||
|
||||
if (closeOnEsc && (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode() && !GuiNpcTextField.isFieldActive()))
|
||||
close();
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
buttonEvent(guibutton);
|
||||
}
|
||||
public void buttonEvent(GuiButton guibutton){};
|
||||
|
||||
|
||||
public void close(){
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
GuiNpcTextField.unfocus();
|
||||
@@ -171,12 +171,12 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
scrolls.put(scroll.id, scroll);
|
||||
}
|
||||
public GuiCustomScroll getScroll(int id){
|
||||
return scrolls.get(id);
|
||||
return scrolls.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2){
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,7 +190,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
scroll.drawScreen(i, j, f, hasSubGui()?0:Mouse.getDWheel());
|
||||
}
|
||||
public abstract void save();
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f){
|
||||
mouseX = i;
|
||||
@@ -215,7 +215,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
if(drawDefaultBackground && subgui == null)
|
||||
super.drawDefaultBackground();
|
||||
}
|
||||
|
||||
|
||||
public FontRenderer getFontRenderer() {
|
||||
return this.fontRendererObj;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
public void displayGuiScreen(GuiScreen gui) {
|
||||
this.mc.displayGuiScreen(gui);
|
||||
}
|
||||
|
||||
|
||||
public void setSubGui(SubGuiInterface gui){
|
||||
subgui = gui;
|
||||
subgui.setWorldAndResolution(mc, width, height);
|
||||
@@ -243,6 +243,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
}
|
||||
|
||||
public void drawNpc(int x, int y){
|
||||
npc.isDrawn = true;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
@@ -285,6 +286,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
|
||||
npc.ai.orientation = orientation;
|
||||
}
|
||||
}
|
||||
npc.isDrawn = false;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
public int guiLeft,guiTop,xSize,ySize;
|
||||
private SubGuiInterface subgui;
|
||||
public int mouseX, mouseY;
|
||||
|
||||
|
||||
public float bgScale = 1;
|
||||
public float bgScaleX = 1;
|
||||
public float bgScaleY = 1;
|
||||
@@ -233,7 +233,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
if(background != null && mc.renderEngine != null){
|
||||
drawBackground();
|
||||
}
|
||||
|
||||
|
||||
drawCenteredString(fontRendererObj, title, width / 2, guiTop + 4, 0xffffff);
|
||||
for(GuiNpcLabel label : labels.values())
|
||||
label.drawLabel(this,fontRendererObj);
|
||||
@@ -272,7 +272,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
public FontRenderer getFontRenderer() {
|
||||
return this.fontRendererObj;
|
||||
}
|
||||
|
||||
|
||||
public void elementClicked() {
|
||||
if(subgui != null)
|
||||
subgui.elementClicked();
|
||||
@@ -281,10 +281,10 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
public boolean doesGuiPauseGame(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void doubleClicked() {
|
||||
}
|
||||
|
||||
|
||||
public boolean isInventoryKey(int i){
|
||||
return i == mc.gameSettings.keyBindInventory.getKeyCode(); //inventory key
|
||||
}
|
||||
@@ -314,21 +314,20 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
return subgui.getSubGui();
|
||||
return subgui;
|
||||
}
|
||||
|
||||
|
||||
public void drawNpc(int x, int y){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
npc.isDrawn = true;
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(guiLeft + x, guiTop + y, 50F);
|
||||
float scale = 1;
|
||||
if(npc.height > 2.4)
|
||||
scale = 2 / npc.height;
|
||||
|
||||
|
||||
GL11.glScalef(-30 * scale, 30 * scale, 30 * scale);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
|
||||
|
||||
float f2 = npc.renderYawOffset;
|
||||
float f3 = npc.rotationYaw;
|
||||
float f4 = npc.rotationPitch;
|
||||
@@ -353,12 +352,12 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
npc.isDrawn = false;
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
}
|
||||
|
||||
|
||||
public void openLink(String link){
|
||||
try{
|
||||
Class oclass = Class.forName("java.awt.Desktop");
|
||||
|
||||
@@ -100,6 +100,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
private int taskCount = 1;
|
||||
public int lastInteract = 0;
|
||||
public int itemGiverId = 0;
|
||||
public boolean isDrawn = false;
|
||||
|
||||
public Faction faction; //should only be used server side
|
||||
|
||||
|
||||
Reference in new issue
Block a user