
Lua
Members-
Posts
191 -
Joined
-
Last visited
Everything posted by Lua
-
nope still cant see it
-
nope:c
-
I tried it but nothing renders, heres my code @ForgeSubscribe public void renderCavemanHealthBar(RenderLivingEvent.Specials.Pre event) { mc = mc.getMinecraft(); if(event.entity instanceof AC_EntityCaveman) { GL11.glPushMatrix(); double diffX = (event.entity.prevPosX + (event.entity.posX - event.entity.prevPosX)) - (mc.thePlayer.prevPosX + (mc.thePlayer.posX - mc.thePlayer.prevPosX)); double diffY = (event.entity.prevPosY + (event.entity.posY - event.entity.prevPosY)) - (mc.thePlayer.prevPosY + (mc.thePlayer.posY - mc.thePlayer.prevPosY)); double diffZ = (event.entity.prevPosZ + (event.entity.posZ - event.entity.prevPosZ)) - (mc.thePlayer.prevPosZ + (mc.thePlayer.posZ - mc.thePlayer.prevPosZ)); GL11.glTranslated(diffX, diffY, diffZ);//translate to the position of the caveman //GL11.glRotatef(System.nanoTime() / 10000000f, 0.0F, 1.0F, 0.0F); no more of use GL11.glTranslated(0.45, 3.5, 0);//could be 6, 7, 10, 2000, youll have to find the god value yourself //i highly doubt 2000 is even a good value btw //its approximatelly the same height as your entity, and a little more GL11.glRotatef(200.0F - event.entity.renderYawOffset, 0.0F, 1.0F, 0.0F);//this line should make it always face the player, or always away from the player depending on which direction your plane is facing, experiment with it mc.func_110434_K().func_110577_a(new ResourceLocation(Strings.MOD_ID, "/textures/gui/health_bar.png")); this.drawTexturedQuadFit(- 1, - 1, 2, 2, 0); GL11.glPopMatrix(); } } public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel) { caveman = caveman.getCaveman(); Tessellator tessellator = Tessellator.instance; if(caveman != null) { for(int i = 0; i < caveman.func_110138_aP(); i++) { if(caveman.func_110138_aP() > i) { tessellator.startDrawingQuads(); tessellator.setColorOpaque(0, 255, 0); tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0, 1); tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1); tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1, 0); tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0); tessellator.setColorOpaque(0, 255, 0); tessellator.draw(); } else { tessellator.startDrawingQuads(); tessellator.setColorOpaque(255, 0, 0); tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0, 1); tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1); tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1, 0); tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0); tessellator.setColorOpaque(255, 0, 0); tessellator.draw(); } } } }
-
Ok ive got it how i want it. Now you said I could colour it ? What id like is it to be coloured in green which would be its total health then when the health goes down some of the green should be replaced with red depending on how much damage was taken.
-
Ah! It turns out its rendering slightly underneath him http://gyazo.com/f628be978d88d82f80ccc4002a2ed9bc
-
Hm well ive started to do it in here now, lets just continue in there and I can move it later if need be. So what next?
-
"is it only off in Y or is it off in XZ too ?" Y "you are creating your ResourceLocation is bad" Why is it bad? I copied your code but added a check to see if it was the caveman and it didnt render. So I removed that check and the bar was still rotating at the same y Heres the code @ForgeSubscribe public void renderCavemanHealthBar(RenderLivingEvent.Specials.Pre event) { mc = mc.getMinecraft(); if(event.entity instanceof AC_EntityCaveman) { GL11.glPushMatrix(); double diffX = (event.entity.prevPosX + (event.entity.posX - event.entity.prevPosX)) - (mc.thePlayer.prevPosX + (mc.thePlayer.posX - mc.thePlayer.prevPosX)); double diffY = (event.entity.prevPosY + (event.entity.posY - event.entity.prevPosY)) - (mc.thePlayer.prevPosY + (mc.thePlayer.posY - mc.thePlayer.prevPosY)); double diffZ = (event.entity.prevPosZ + (event.entity.posZ - event.entity.prevPosZ)) - (mc.thePlayer.prevPosZ + (mc.thePlayer.posZ - mc.thePlayer.prevPosZ)); //btw if you look mathematicly at that its //int a = 5; //int b = 2; // diffX = a+(b-a) = a+b-a = b //since you're not using the partialTick yet you could simply use the event.entity.posX-player.posX and the effect would be the same GL11.glTranslated(diffX, diffY, diffZ);//translate to the position of the caveman GL11.glRotatef(System.nanoTime() / 10000000f, 0.0F, 1.0F, 0.0F); mc.func_110434_K().func_110577_a(new ResourceLocation(Strings.MOD_ID, "/textures/gui/temperature_bar.png")); this.drawTexturedQuadFit(- 1, - 1, 2, 2, 0); GL11.glPopMatrix(); } } @ Your latest reply, I do have a rendercavemen, but what method would I put it in?
-
Yep I see it, its not above my head though, but we can just gl translate it in
-
Yup it prints, so its a 'matrix' problem
-
Hm, didnt seem to render. Heres the code: @ForgeSubscribe public void renderCavemanHealthBar(RenderLivingEvent.Specials.Pre event) { mc = mc.getMinecraft(); GuiIngame gui = mc.ingameGUI; if(event.entity instanceof AC_EntityCaveman) { System.out.println("Drawing Rect"); Tessellator tessellator = Tessellator.instance; EntityClientPlayerMP player = mc.thePlayer; double diffX = (event.entity.prevPosX + (event.entity.posX - event.entity.prevPosX)) - (player.prevPosX + (player.posX - player.prevPosX)); double diffY = (event.entity.prevPosY + (event.entity.posY - event.entity.prevPosY)) - (player.prevPosY + (player.posY - player.prevPosY)); double diffZ = (event.entity.prevPosZ + (event.entity.posZ - event.entity.prevPosZ)) - (player.prevPosZ + (player.posZ - player.prevPosZ)); GL11.glPushMatrix(); GL11.glTranslated(diffX, diffY + 3, diffZ); GL11.glRotatef(- player.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glPushMatrix(); GL11.glRotatef(- 90, 1, 0, 0);//noted 1 GL11.glTranslated(0, - 1, 0);//noted 2 mc.func_110434_K().func_110577_a(new ResourceLocation(Strings.MOD_ID, "/textures/gui/temperature_bar.png")); this.drawTexturedQuadFit(20, 20, 20, 20, 0); GL11.glPopMatrix(); GL11.glPopMatrix(); } } public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel) { Tessellator tessellator = Tessellator.instance; tessellator.setColorOpaque(255, 255, 255); tessellator.startDrawingQuads(); tessellator.setColorOpaque(255, 255, 255); tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0, 1); tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1); tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1, 0); tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0); tessellator.setColorOpaque(255, 255, 255); tessellator.draw(); }
-
Is there a way to draw a simple rectangle without an image. Im looking to do a health bar
-
Hey, I saw the post the other day asking how to draw images into the world and HyrdoFlame(I think his name is) explained how to do it (Heres the post: http://tinyurl.com/kwygvoc) but I thought why cant you just use drawTexturedModalRect so I tried and it didnt work. So I want to know why, since that method uses tessellator too
-
What has replaced the hitentity method in 1.6?
-
I have but I still get an icon error and the game crashes
-
Okay thank you. Do you what the pack.mcmeta do? its used for animations for fire and water I think, I have my own fire and water so I need to create them but dont know how?
-
did anyone find a fix to this because it seems animation are no longers txts but a .png.mcmeta however that works
-
Ive been hearing that in 1.6.2 your modID has to be a lower case is this true? Also since you can use func_111206_d to give items there textures is setUnlocalizedName needed now and what do pack.mcmeta do?
-
Its because you're applying the potion to a client version of the player
-
Thankyou so much!!!!!
-
Yep, like click on one button and it will cause others to disappears giving the effect that a new gui has came up.
-
Okay, Ive tried to make a 'paged' gui. And it works kinda. I cant really explain what happens, so im going to explain through code and images. But basically when the second 'page' should show up on the gui the old page is still there, even though ive re-initGui() And heres what happens in picture form gyazo.com/1a3aab6fe967fa10c4c259cfd931154e First page looking fine. http://gyazo.com/8c70583b9b93ee65f9bc34ae38b4f54e second page, where the buttons should of been re-inited but havent fully.
-
How would you give it a custom icon?
-
Add me on skpye Ben.donnelly54 Ill help
-
Im trying to render an overlay when the player is in a block. The block is a new liquid and what im trying to do works to a point, however when the liquid is visible on the screen, the overlay renders which obviously I do not want, I just want it to render the overlay if the player is in the block. Here is the code BlockACStill BlockACWaterFlowing TickHandler