Everything posted by hydroflame
-
Rendering an Image into the world[Solved]
....... originally was meaning its the constructor this constructor was suppose to set the timer to somethign so that shit renders well please copy the WHOLE class and register it
-
Rendering an Image into the world[Solved]
have you copied the entire class ? this is what it looks like for me: http://imagebin.org/267029
-
[1.5.2] GUI coding - Cannot find Symbol mc.renderEngine
can we see your GUI class ? is it extending "GuiScreen" or "Gui"
-
Rendering an Image into the world[Solved]
i know, change it to float interp = 1; instead
-
Rendering an Image into the world[Solved]
right, i made special change to the Minecraft class change it to float interp = 1; for now, ill make the proper code later
-
Rendering an Image into the world[Solved]
import java.lang.reflect.Field; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Timer; import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.event.ForgeSubscribe; import org.lwjgl.opengl.GL11; import com.hydroflame.mod.ForgeRevCommonProxy; public class HealthBarRenderer { private Timer timer; public HealthBarRenderer(){ Field[] fields = Minecraft.getMinecraft().getClass().getDeclaredFields(); for(Field field: fields){ if(field.getType().isAssignableFrom(Timer.class)){ field.setAccessible(true); try { timer = (Timer)field.get(Minecraft.getMinecraft()); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } @ForgeSubscribe public void renderHealthBar(RenderLivingEvent.Specials.Post event){ float interp = timer.renderPartialTicks; EntityLivingBase e = event.entity; float healthLength = 1;//you can change the length of the health if you want float healthHeight = 0.25f;//and its height EntityPlayer p = Minecraft.getMinecraft().thePlayer; double diffX = e.prevPosX+interp*(e.posX-e.prevPosX) - (p.prevPosX+interp*(p.posX-p.prevPosX)); double diffY = e.prevPosY+interp*(e.posY-e.prevPosY) - (p.prevPosY+interp*(p.posY-p.prevPosY)); double diffZ = e.prevPosZ+interp*(e.posZ-e.prevPosZ) - (p.prevPosZ+interp*(p.posZ-p.prevPosZ)); GL11.glPushMatrix(); double height = event.entity.boundingBox.maxY-event.entity.boundingBox.minY+0.5; GL11.glTranslated(diffX, diffY+height, diffZ); GL11.glRotated(-p.rotationYaw, 0, 1, 0); GL11.glScaled(-1, 1, 1); Tessellator t = Tessellator.instance; Minecraft.getMinecraft().renderEngine.func_110577_a(ForgeRevCommonProxy.blankTexture);//make sure to change thsi to your blank texture float currentHealth = e.getDataWatcher().func_111145_d(6); float maxHealth = e.func_110138_aP(); float sizeOfActiveHealth = healthLength*(currentHealth/maxHealth); GL11.glTranslated(-healthLength/2f, 0, 0); t.startDrawingQuads(); t.setColorOpaque(0, 255, 0); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(sizeOfActiveHealth, 0, 0, 1, 0); t.addVertexWithUV(sizeOfActiveHealth, healthHeight, 0, 1, 1); t.addVertexWithUV(0, healthHeight, 0, 0, 1); t.draw(); float rest = healthLength-sizeOfActiveHealth; GL11.glTranslated(sizeOfActiveHealth, 0, 0); t.startDrawingQuads(); t.setColorOpaque(255, 0, 0); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(rest, 0, 0, 1, 0); t.addVertexWithUV(rest, healthHeight, 0, 1, 1); t.addVertexWithUV(0, healthHeight, 0, 0, 1); t.draw(); GL11.glPopMatrix(); } } heres a health bar rendere i hacked in ~10 minute, artefact free just register it and you're good to go
-
Rendering an Image into the world[Solved]
give me another maybe 10 minute ive hacked one togheter ill give it to you
-
Rendering an Image into the world[Solved]
then revert to whatever was working and add small value, see how its affected
-
Rendering an Image into the world[Solved]
well then change the rotate line to teh old rotate with the System.nanoTime, itll render while turning
-
Rendering an Image into the world[Solved]
depending on the orientation its possible the quad you render is facing away from you , opengl only render 1 side of each quad you ask him to try thsi
-
Rendering an Image into the world[Solved]
ok well first, the method i gave you, youll need to change it, remove every setColorxxx 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(); } because this will force the quad to be white by some of the green you mean something like [g][g][g][g][g][r][r][r] *lose life* [g][g][g][g][r][r][r][r] if thats the case you will need to render a lot of quad, openGL can draw as many quad as you want but it wont subseparate them but basicly to set a color for the quad use Tessellator.instance.setColorOpaque(R, B, G); //example setColorOpaque(255, 0, 0); for red and then if you want to render multiple quad (one for each bar of health), somethign like: pseudo code for(int i =0; i < caveman.getMaxHealth(); i++){ if caveman.getHealth() > i render a green quad else render a red quad move one unit to the left/right (so that all quads are not one over the other) }
-
send partialTick in RenderLivingEvent and RenderPlayerEvent
the handlers for the events RenderLivingEvent and RenderPlayerEvent dont have any access to the partialTick time making it impossible to render fluid models/plane/etc without either using reflection to access the Timer object in Minecraft (to get the partialTick from the timer itself) or using ASM to change the visibility of Timer example: public void func_130009_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) { if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this))) return; float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0; if (itemstack != null && par1AbstractClientPlayer.getItemInUseCount() > 0) { EnumAction enumaction = itemstack.getItemUseAction(); if (enumaction == EnumAction.block) { this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = true; } } this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = par1AbstractClientPlayer.isSneaking(); double d3 = par4 - (double)par1AbstractClientPlayer.yOffset; if (par1AbstractClientPlayer.isSneaking() && !(par1AbstractClientPlayer instanceof EntityPlayerSP)) { d3 -= 0.125D; } super.func_130000_a(par1AbstractClientPlayer, par2, d3, par6, par8, par9); this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; //MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this)); //MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this, par9)); } par9 is the partialTick btw.
-
Rendering an Image into the world[Solved]
ah, then all you have to do now is increase the height and use the proper orientation (so that the image always faces the player)
-
Rendering an Image into the world[Solved]
ok but letting you know that it is a bad programming habit... well you said that the quad was only rendering above your head (or inside you, wtv:P) not above the caveman (or inside him) what we need to do now is try to figure out a way to configure the openGL matrix at the location of the entity when you begin the method renderCavemanHealthBar 0, 0, 0 is considered the position of steve eyes 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 these lines are suppose to translate the 0, 0, 0 to the location of the caveman. but basicly it should be translated by "the difference in position between the player and the entity" try getting very close to the caveman to see if the panel doesnt emerge from somewhere. is the caveman really big meaning it could be tottally inside it ? (and you wouldnt be able to see it)
-
Rendering an Image into the world[Solved]
jsut look at my guide later, no big deal but still... most likely becasue since you removed the caveman check the player you are is also taken into account now so you are renderered with the thing the main one, or maybe maker a smaller that the main render method would call to keep thing clean example of a generic entity renderer @Override public void doRender(Entity entity, double x, double y, double z, float rot, float partialTick) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); //maybe more transformation Minecraft.getMinecraft().renderEngine.func_110577_a(ForgeRevCommonProxy.blankTexture); model.render(); renderTag(entity); GL11.glPopMatrix(); } public void renderTag(Entity entity){ //some move/rotate before //bind the texture this.drawTexturedQuadFit(-1, -1, 2, 2, 0); }
-
Rendering an Image into the world[Solved]
this is just an idea, but do you have a special renderer for your caveman? because if yes you should probably do that there since you have control over it. RenderLivingEvent is for very general things or stuff you cannot normally do because you dont want to touch the source code (in your first thread you refer to another thread, in that one he wanted to render stuff over Villagers which is a vanilla class and that is why he needed a event for it, in my profile picture i use a RenderLivingEvent too because i dont want to modify vanilla code)
-
Rendering an Image into the world[Solved]
is it only off in Y or is it off in XZ too ? in any case lets re-add the translation to the caveman entity public void renderCavemanHealthBar(RenderLivingEvent.Specials.Pre event) { mc = mc.getMinecraft(); GL11.glPushMatrix(); 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)); // 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(); } also later i suggest you take a look at my texture guide (go on the wiki and search "hydroflame guide to texture") because the way you are creating your ResourceLocation is bad anyway, with this code the image should generally be near the caveman and should be rotating
-
[solver] More beacon pyramid blocks
really, are you sure public boolean isBeaconBase; { return (blockID == PureBlock.blockID || blockID == RubyBlock.blockID || blockID == SapphireBlock.blockID); } thats not overriding a method generic method accessibility [static] [final] returnType methodname(arguments){ method body } public boolean isBeaconBase; { return (blockID == PureBlock.blockID || blockID == RubyBlock.blockID || blockID == SapphireBlock.blockID); } *input the "method" in my magic code claner/fixer/transformer* public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return (blockID == PureBlock.blockID || blockID == RubyBlock.blockID || blockID == SapphireBlock.blockID); } *relive ancient times* *second pass of magic transformation* @Override public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return true; }
-
Rendering an Image into the world[Solved]
ok, it might take a couple of post, but its going to be fixed in the end original code 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(); } } well simplify thsi a little and grow from there first thing were gonna do is make SURE we are drawing something, so screw the location of it, lets just make sure its rendering public void renderCavemanHealthBar(RenderLivingEvent.Specials.Pre event) { mc = mc.getMinecraft(); GL11.glPushMatrix(); GL11.glRotatef(System.nanoTime()/10000000f, 0.0F, 1.0F, 0.0F);//this will make the image rotate, might be too fast or too slow, just add /remove zeros if that the case mc.func_110434_K().func_110577_a(new ResourceLocation(Strings.MOD_ID, "/textures/gui/temperature_bar.png")); this.drawTexturedQuadFit(-1, -1, 2, 2, 0);//this was a bit big and kinof far away from the entity (the 2 first variable are x, y so technicly you were rendering the image 20 block away in x and 20 block away in y GL11.glPopMatrix(); } go in 3rd person, you should see something turning above your head
-
Rendering an Image into the world[Solved]
System.out.println("Drawing Rect"); can you see this in your logs ? if not that mean its a event register problem if yes it mean your problem is related to your matrix configuration, ill help you figure out the correct matrix if that's the case
-
Rendering an Image into the world[Solved]
without an image, no BUT you can make a 1 pixel by 1 pixel image in *insert your favorite image editor here* (mine is paint.net, different from microsoft paint btw) and make that a texture in minecraft next you can load that texture and use tessellator.setColorOpaque(R, G, B) (or any other color altering function) bind your texture: Minecraft.getMinecraft().renderEngine.func_xxxx_x(BlankTexture); set your color and call this utility method 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(); } final code: //in drawing method mc.renderEngine.func_110577_a(blankTexture);//blankTexture is a ResourceLocation btw RenderHelper.drawTexturedQuadFit(xPosition, yPosition, height, height, 0); remember, drawing a width, height of 1, 1 in the minecraft world represent the size of a block, 1x1 in a gui represent 1 pixel so 100x100 in the world is HUGE but in your gui is like the length of the health bar
-
Rendering an Image into the world[Solved]
heard someone saying my name yes you can, but drawTextureModelRectangle does a weird reshape of the texture, so it "works" in gui but in world it would probably look like shit
-
Inventory Reversing [1.6.2]
pretty much, just make sure to create a new NBTTagCompound if its null at this point
-
[1.6.2] [Solved] Every block of a type updates based on one
as long as the total amount of combinaison is smaller then 16 then you're ok in your case if you have 3 level of water and 2 potion status (on/off) then the total is 3*2 = 6 which is under 16 now suppose you also has 2 other type of potion (secondary and tertiary, both on and off) the total would become 3*2*2*2 = 24 which is bigger then 16 so youd need a TE
-
Inventory Reversing [1.6.2]
not in the item but in the itemStack ItemStack.java(line ~51): /** * A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items */ public NBTTagCompound stackTagCompound; conviniently, the itemStack used in "onItemUseFirst" and similar method is provided by the caller
IPS spam blocked by CleanTalk.