
Thornack
Members-
Posts
629 -
Joined
-
Last visited
Everything posted by Thornack
-
I have recently upgraded my dev environment for Mincecraft 1.7.2 and I was wondering how to access Minecraft source code packages as you could in previous versions of Forge.
-
could you provide me with an example
-
I have been playing around with items and have figured out how to render 3D items when thrown and held and dropped. I wish to now give the item some animations and I was wondering how to call animations in minecraft. I tried looking at it and it doesn't seem simple. I have figured out how to give a mob basic animations that I guess get called when the AI decides to call them but I want to understand how they work better. I understand that there are several parameters you can change to make techne models look good: scaling (how large your model will be), rotation (might be required if the Techne model you made was backwards), and height (your model might be partially underground or floating, which needs to be fixed). I understand that all transformations in Minecraft are done using the OpenGL functions: glRotatef, glScalef, and glTranslatef. These functions operate on an internal transformation matrix which combines all previously applied transformations into a single 4x4 matrix, which is then used during rendering. One quirk of OpenGL is that all operations applied will appear in REVERSE order! Usually this will not affect your transformations, but in some special cases it might. For mobs when doing the transformations, your code should go in the mobs model.java file, in the render function before everything else. Also, in order to use OpenGL, you must add the import to the top of the file : import org.lwjgl.opengl.GL11; 1) Scaling Scaling is done using the glScalef function. GL11.glScalef(x, y, z); The x, y, and z parameters determine how much in each direction the model should be scaled, with 1.0 meaning no change. If you only want to scale the model, x, y, and z should all be the same. 2) Rotation Rotation is done using the glRotatef function. GL11.glRotatef (angle, x, y, z); The angle determines how much to rotate the model, in degrees. The x, y, and z parameters make up a 3D vector which determines the axis to rotate around (not sure if it needs to be a unit vector). Typically to keep it simple, you will only want to rotate around either the x, y or z axes at once, and simply make multiple calls to glRotate if you want to rotate around multiple axes. For example, the following code will rotate the model by 180 degrees around the y-axis, so it will face backwards: GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); In this case, the rotation axis is the y-axis, which is (0,1,0). 3) Height Vertical and horizontal translation is done using the glTranslatef function. GL11.glTranslatef ( x, y, z); The x, y, and z parameters simply determine how far to move the model. Note: The translate function actually moves the ‘world’, NOT the model. This means that you will need to apply the opposite for it to go where you want. For example, GL11.glTranslatef(0.0f, -0.5f, 0.0f); Will move the model up by 0.5 units. Example render function: public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { //OpenGL transformation code. Remember that all transformations are applied in the //opposite order that they are called in GL11.glTranslatef(0.0f, -0.5f, 0.0f); //move model up a little bit GL11.glRotatef(10.0f, 1.0f, 0.0f, 0.0f); //pitch 10 degrees downwards GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); //rotate so the model is no longer backwards GL11.glScalef(5.5f, 5.5f, 5.5f); //scale the model 5.5x setRotationAngles(f, f1, f2, f3, f4, f5); Face.render(f5); Bottom_Chin.render(f5); head_L.render(f5); head_R.render(f5); head.render(f5); } What i do not understand is how to call animations so that they can be implemented by being called in methods such as the on right click or on impact methods that are available for items. Any help would be appreciated.
-
I posted a working renderer in my rendering a 3D item thread
-
See my Rendering a 3D item after thrown thread. We figured this out for 1.5. You can probably adapt the code i posted to 1.6.4
-
Part 1 SOLVED here is the code for the renderer that worked in rendering the ball midflight. package soccer.render; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import soccer.model.ItemModelBall; @SideOnly(Side.CLIENT) public class RenderBall extends Render { /** * instance of ModelBoat for rendering */ protected ModelBase modelBall; public RenderBall() { this.shadowSize = 0.5F; this.modelBall = new ItemModelBall(); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1EntityBoat, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); Minecraft.getMinecraft().renderEngine .bindTexture("/mods/soccer/textures/items/Ball3D.png"); GL11.glScalef(-1.0F, -1.0F, 1.0F); this.modelBall.render(par1EntityBoat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } }
-
Awesome! That doesnt crash Minecraft now but it throws my 2D inventory icon for the ball and this ball doesnt show up on the ground as an entity it just spawns snowball particles and does damage
-
Some of my other methods dont work in other versions yet so I havent upgraded. I fixed the error in the change but minecraft still crashes with the following errors.
-
Ok I found the problem it says that ball cannot be resolved in field or type (I missed the error)
-
Im not sure what else to try at this point. Ive been looking for whats making the ball not render and remain invisible and havent had any luck yet.
-
Ok so it took me some time to revert the code as I was trying out a few things. The Hyperlinked code you requested Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
-
My Minecraft version is 1.5.2 and Forge version and the forge version properties file says: forge.major.number=7 forge.minor.number=8 forge.revision.number=1 forge.build.number=737
-
This fixed the Stack overflow problem and that error doesn't show up anymore but its still invisible.
-
I have changed my render class to this. Upon right click it doesn't crash minecraft now and spawns snowball particles when the entity hits something but does not actually render the ball (it is invisible). Also, I get this error upon right click displayed in the console.
-
After I apply your suggested changes Minecraft crashes again upon right click of the Ball and generates this report.
-
Im not really sure how to define the field field_94151_a in renderball. My item class Ball.java is the item but when I insert it into your function it asks to register it as a variable. Im not really sure how to insert the item there. Also, Is there something wrong with having the register in the common proxy? That is where I register my mob entities and now the items also.
-
I added your suggestion and upon right click Minecraft crashes and generates the following error report.
-
For some reason the renderer I try to use after the ball is thrown isnt being called, I just checked. The ball is invisible when you right click nothing shows up and you cannot go pick it up, but when I change par2World.spawnEntityInWorld(new EntityBall(par2World, par3EntityPlayer)); to par2World.spawnEntityInWorld(new EntitySnowball(par2World, par3EntityPlayer)); in the Ball class the snowball is thrown and that works perfectly. I dont think the ball is being thrown when the par2World.spawnEntityInWorld(new EntityBall(par2World, par3EntityPlayer)); line is in the class file and Im not sure what the problem is. - All files minus the imports have been posted above in the previous posts.
-
Im unsure what to do next I have been trying to get it to render and have had no success. Does anyone see anything wrong with my code. I have posted all of it that concerns the item I wish to render after it is thrown.
-
Client Proxy
-
Ok so im trying to Render the Ball after it is thrown with the following class and it isnt working. Would you know what the problem is.
-
Hi, I have been working on my mod and have figured out how to render a 3D item when held as well as when dropped. I am having trouble getting it to render on right click after it is thrown. Id like the public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, method to throw my 3D item (Ball) and for that item to land some distance away.
-
To clarify my question, I wish to render the item during flight so that as it flies through the air it looks like my 3D item and then lands as a 3D item/model on the ground. I have tried using the snowball code and currently my item is rendered in 3D in the players hand. Upon right click it throws a snowball when instead it should render itself and then upon 'landing' nothing happens and the item doesnt appear at all.
-
Hi, I have been developing a mod where I wish to throw a 3D item. I have it rendered in 3D when it is held and at the moment when I right click it throws snowballs. I wish to add functionality to the item which would allow it to be thrown when the player right clicks while holding the item and land some distance away from the player. Does anyone know how to do this code wise? I have been looking for a way to accomplish this with no luck so far.
-
How would you get your Blender model in game as a Mob?
Thornack replied to Thornack's topic in Modder Support
If anyone knows how to get a .obj file into the game as a mob please let me know I will post anything I find on this subject