Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Frag

Members
  • Joined

  • Last visited

Everything posted by Frag

  1. In my movement class which is executed server side only. All my mobs motion are set server side. I noticed that the motion and yaw are kept in synch with the client. I noticed that I can play with the pitch by using the client side GL11.glRotated method in the render class (which run client side). But I am curious to know why the pitch needs to be handled by GL11.glRotated... So my question is back ... why rotationyaw is rendered correctly ...but not rotationpitch. I am probably missing something.
  2. No one know why RotationPitch does not change my pitch? My rotationyaw works ...go figure
  3. I noticed that even if I hardcode manually: aWaterMob.rotationPitch=90F; or aWaterMob.rotationPitch=0F; ... the pitch of my mobs does not change. Would it be an issue with my model class? Is the rotationpitch is the correct value to set?! Does the pitch value is in synch between the server and the station like the rotationyaw? Here is the model class. [/ package fantastic.renders.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import fantastic.FantasticDebug; import fantastic.entities.EntityBasicFish; import fantastic.entities.EntityFantasticFish; import fantastic.entities.EntityFeeder; import fantastic.entities.EntityMossy; import fantastic.entities.EntitySalmon; import fantastic.entities.EntityTuna; public class ModelBasicFish extends ModelBase { //fields ModelRenderer headtop; ModelRenderer Lwisker; ModelRenderer Rwisker; ModelRenderer unihorn; ModelRenderer headfin; ModelRenderer hornL; ModelRenderer hornR; ModelRenderer suckermouth; ModelRenderer mouth; ModelRenderer bodysection1; ModelRenderer frontfinL; ModelRenderer frontfinR; ModelRenderer bodysection2; ModelRenderer sidefinL; ModelRenderer sidefinR; ModelRenderer bodysection3; ModelRenderer bodysection4; ModelRenderer bodysection5; ModelRenderer backfinL; ModelRenderer backfinR; ModelRenderer bodysection6; ModelRenderer tail; ModelRenderer altsidefinL; ModelRenderer altsidefinR; ModelRenderer topfin; ModelRenderer bottemfin; public ModelBasicFish() { textureWidth = 128; textureHeight = 64; headtop = new ModelRenderer(this, 0, 0); headtop.addBox(-3F, 0F, 0F, 6, 8, 7); headtop.setRotationPoint(0F, 1F, -14F); headtop.setTextureSize(128, 64); headtop.mirror = true; setRotation(headtop, 0.7853982F, 0F, 0F); Lwisker = new ModelRenderer(this, 0, 15); Lwisker.addBox(2F, -1F, -1F, 0, 7, 9); Lwisker.setRotationPoint(0F, 1F, -14F); Lwisker.setTextureSize(128, 64); Lwisker.mirror = true; setRotation(Lwisker, 0F, 0.2617994F, -0.2617994F); Rwisker = new ModelRenderer(this, 0, 15); Rwisker.addBox(-2F, -1F, -1F, 0, 7, 9); Rwisker.setRotationPoint(0F, 1F, -14F); Rwisker.setTextureSize(128, 64); Rwisker.mirror = true; setRotation(Rwisker, 0F, -0.2617994F, 0.2617994F); unihorn = new ModelRenderer(this, 19, 0); unihorn.addBox(-3F, -3F, 2F, 8, 1, 1); unihorn.setRotationPoint(0F, 1F, -14F); unihorn.setTextureSize(128, 64); unihorn.mirror = true; setRotation(unihorn, 0.7853982F, 1.570796F, -0.2617994F); headfin = new ModelRenderer(this, 40, 42); headfin.addBox(0F, -5F, 1F, 0, 9, 13); headfin.setRotationPoint(0F, 1F, -14F); headfin.setTextureSize(128, 64); headfin.mirror = true; setRotation(headfin, 0.8552113F, 0F, 0F); hornL = new ModelRenderer(this, 70, 45); hornL.addBox(0F, 1F, 5F, 1, 1, 10); hornL.setRotationPoint(0F, 1F, -14F); hornL.setTextureSize(128, 64); hornL.mirror = true; setRotation(hornL, 0.9250245F, 0.2617994F, 0.2617994F); hornR = new ModelRenderer(this, 70, 45); hornR.addBox(-1F, 1F, 5F, 1, 1, 10); hornR.setRotationPoint(0F, 1F, -14F); hornR.setTextureSize(128, 64); hornR.mirror = true; setRotation(hornR, 0.9250245F, -0.2617994F, -0.2617994F); suckermouth = new ModelRenderer(this, 106, 34); suckermouth.addBox(-2.5F, 0F, 0F, 5, 5, 5); suckermouth.setRotationPoint(0F, 1F, -14F); suckermouth.setTextureSize(128, 64); suckermouth.mirror = true; setRotation(suckermouth, 0F, 0F, 0F); mouth = new ModelRenderer(this, 0, 15); mouth.addBox(-2.5F, -4F, -2F, 5, 6, 3); mouth.setRotationPoint(0F, 4F, -9F); mouth.setTextureSize(128, 64); mouth.mirror = true; setRotation(mouth, 0.8726646F, 0F, 0F); bodysection1 = new ModelRenderer(this, 26, 4); bodysection1.addBox(-4F, -5F, 0F, 8, 10, 5); bodysection1.setRotationPoint(0F, 1F, -9F); bodysection1.setTextureSize(128, 64); bodysection1.mirror = true; setRotation(bodysection1, 0F, 0F, 0F); frontfinL = new ModelRenderer(this, 82, 36); frontfinL.addBox(2F, 5F, -1F, 0, 10, 9); frontfinL.setRotationPoint(0F, 0F, -4F); frontfinL.setTextureSize(128, 64); frontfinL.mirror = true; setRotation(frontfinL, 0.3316126F, 0.1396263F, -0.2617994F); frontfinR = new ModelRenderer(this, 82, 36); frontfinR.addBox(-2F, 5F, -1F, 0, 10, 9); frontfinR.setRotationPoint(0F, 0F, -4F); frontfinR.setTextureSize(128, 64); frontfinR.mirror = true; setRotation(frontfinR, 0.3316126F, -0.1396263F, 0.2617994F); bodysection2 = new ModelRenderer(this, 52, 0); bodysection2.addBox(-4.466667F, -5.466667F, 0F, 9, 11, ; bodysection2.setRotationPoint(0F, 0F, 4F); bodysection2.setTextureSize(128, 64); bodysection2.mirror = true; setRotation(bodysection2, 0F, 0F, 0F); sidefinL = new ModelRenderer(this, 0, 16); sidefinL.addBox(0F, -6F, 0F, 0, 12, 15); sidefinL.setRotationPoint(4F, 0F, 1F); sidefinL.setTextureSize(128, 64); sidefinL.mirror = true; setRotation(sidefinL, 0F, 0.7853982F, 0F); sidefinR = new ModelRenderer(this, 0, 16); sidefinR.addBox(0F, -6F, 0F, 0, 12, 15); sidefinR.setRotationPoint(-4F, 0F, 1F); sidefinR.setTextureSize(128, 64); sidefinR.mirror = true; setRotation(sidefinR, 0F, -0.7853982F, 0F); bodysection3 = new ModelRenderer(this, 86, 2); bodysection3.addBox(-4F, -4F, 0F, 8, 9, ; bodysection3.setRotationPoint(0F, -1F, 7F); bodysection3.setTextureSize(128, 64); bodysection3.mirror = true; setRotation(bodysection3, 0F, 0F, 0F); bodysection4 = new ModelRenderer(this, 29, 19); bodysection4.addBox(-3.5F, -3F, 0F, 7, 7, 5); bodysection4.setRotationPoint(0F, 0F, 7F); bodysection4.setTextureSize(128, 64); bodysection4.mirror = true; setRotation(bodysection4, 0F, 0F, 0F); bodysection5 = new ModelRenderer(this, 53, 21); bodysection5.addBox(-2.5F, -2F, 0F, 5, 5, 5); bodysection5.setRotationPoint(0F, 0F, 4F); bodysection5.setTextureSize(128, 64); bodysection5.mirror = true; setRotation(bodysection5, 0F, 0F, 0F); backfinL = new ModelRenderer(this, 80, 21); backfinL.addBox(1F, 3F, 2F, 0, 11, 13); backfinL.setRotationPoint(0F, 0F, 4F); backfinL.setTextureSize(128, 64); backfinL.mirror = true; setRotation(backfinL, 0F, 0F, -0.2617994F); backfinR = new ModelRenderer(this, 80, 21); backfinR.addBox(-1F, 3F, 2F, 0, 11, 13); backfinR.setRotationPoint(0F, 0F, 4F); backfinR.setTextureSize(128, 64); backfinR.mirror = true; setRotation(backfinR, 0F, 0F, 0.2617994F); bodysection6 = new ModelRenderer(this, 73, 24); bodysection6.addBox(-1F, -1F, 0F, 2, 3, 4); bodysection6.setRotationPoint(0F, 0F, 4F); bodysection6.setTextureSize(128, 64); bodysection6.mirror = true; setRotation(bodysection6, 0F, 0F, 0F); tail = new ModelRenderer(this, 0, 23); tail.addBox(0F, -2F, -2F, 0, 20, 20); tail.setRotationPoint(0F, 0F, 4F); tail.setTextureSize(128, 64); tail.mirror = true; setRotation(tail, 0.7853982F, 0F, 0F); altsidefinL = new ModelRenderer(this, 72, 19); altsidefinL.addBox(-2F, 0F, 0F, 19, 0, 15); altsidefinL.setRotationPoint(4F, 1F, -6F); altsidefinL.setTextureSize(128, 64); altsidefinL.mirror = true; setRotation(altsidefinL, 0F, 0F, 0.2617994F); altsidefinR = new ModelRenderer(this, 72, 19); altsidefinR.addBox(-2F, 0F, 0F, 19, 0, 15); altsidefinR.setRotationPoint(-4F, 1F, -6F); altsidefinR.setTextureSize(128, 64); altsidefinR.mirror = true; setRotation(altsidefinR, 0F, 0F, 2.879793F); topfin = new ModelRenderer(this, 40, 11); topfin.addBox(0F, -10F, -6F, 0, 12, 20); topfin.setRotationPoint(0F, -5F, 6F); topfin.setTextureSize(128, 64); topfin.mirror = true; setRotation(topfin, -0.2268928F, 0F, 0F); bottemfin = new ModelRenderer(this, 40, 23); bottemfin.addBox(0F, -1F, -6F, 0, 12, 20); bottemfin.setRotationPoint(0F, 4F, 5F); bottemfin.setTextureSize(128, 64); bottemfin.mirror = true; setRotation(bottemfin, 0.2443461F, 0F, 0F); bodysection1.addChild(bodysection2); bodysection2.addChild(bodysection3); bodysection2.addChild(sidefinL); bodysection2.addChild(sidefinR); bodysection2.addChild(frontfinL); bodysection2.addChild(frontfinR); bodysection2.addChild(bottemfin); bodysection3.addChild(altsidefinL); bodysection3.addChild(altsidefinR); bodysection3.addChild(bodysection4); bodysection4.addChild(bodysection5); bodysection4.addChild(backfinL); bodysection4.addChild(backfinR); bodysection5.addChild(bodysection6); bodysection6.addChild(tail); bodysection2.addChild(topfin); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); headtop.render(f5); Lwisker.render(f5); Rwisker.render(f5); unihorn.render(f5); headfin.render(f5); hornL.render(f5); hornR.render(f5); suckermouth.render(f5); mouth.render(f5); bodysection1.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); EntityFantasticFish _fish = (EntityFantasticFish)entity; this.mouth.rotateAngleX = 0.17F*(MathHelper.cos(f2 * 0.06662F) ) + 0.8726646F; this.bodysection1.rotateAngleY = 0.2F *(MathHelper.cos(f2 * _fish.GetTailFlapSpeed() * 0.527F) ); this.bodysection2.rotateAngleY = 0.2F *(MathHelper.cos(f2 *_fish.GetTailFlapSpeed() * 0.527F - (float)(Math.PI/6)) ); this.bodysection3.rotateAngleY = 0.2F *(MathHelper.cos(f2 * _fish.GetTailFlapSpeed() * 0.527F - (float)(Math.PI/3)) ); this.bodysection4.rotateAngleY = 0.2F *(MathHelper.cos(f2 * _fish.GetTailFlapSpeed() * 0.527F - (float)(Math.PI/2)) ); this.bodysection5.rotateAngleY = 0.2F *(MathHelper.cos(f2 * _fish.GetTailFlapSpeed() * 0.527F - (float)(2*Math.PI/3)) ); this.bodysection6.rotateAngleY = 0.2F *(MathHelper.cos(f2 * _fish.GetTailFlapSpeed() * 0.527F - (float)(5*Math.PI/6)) ); } } code]
  4. Hi guys, I have created a fish that swim quite well under water, however, even if I was able to set the rotationyaw mostly correctly ... I am still looking for a rotation pitch formula. The pitch should be quite straightforward, since the fish is mobbing in a 3D environment under water, I woulk like its nose to point in the direction it is swimming. Here is my rotationyaw code ... float f = (float) (Math.atan2(aWaterMob.motionZ, aWaterMob.motionX) * 180.0D / Math.PI) - 90.0F; float f1 = MathHelper.wrapAngleTo180_float(f - aWaterMob.rotationYaw); aWaterMob.rotationYaw += f1; What would be the rotation pitch code? I was not able to figure it out. aWaterMob.rotationPitch +=? Also ...if you have any hint so my mobs would not change the rotationyaw in one frame ... I would be very happy. Thanks guy, this forum was really helpful to me in the last few days.
  5. Someone could confirm the formula for the pitch calculation please? My mobs is a fish moving underwater, so a direct simple pitch following the velocity would be alright.
  6. Hi guys, I have created a fish mod ...which move freely and quite well animated. But there is one last thing that get on my nerve. When I change the rotation yaw ... the fish can switch from 0 degree to 90 degree in one shot. Making it turning abruptly. What is the trick to get it to turn gradually between 0 and 90. Cant figure it out ... Here is my rotation calculation, I think I took it from the ghast code ...but I hate the effect aWaterMob.renderYawOffset = aWaterMob.rotationYaw = -((float)Math.atan2(aWaterMob.motionX, aWaterMob.motionZ)) * 180.0F / (float)Math.PI; Also, if someone could point me how to set the pitch also ...then it would be Christmas for me.
  7. Actually you answered my questions REALLY well. Thanks Abastro. With your answer in mind I started bug hunting and I was victorious. It was an IMessage looping out of control when that method was called. I found my issue. Thanks a lot again
  8. Thanks for all your answers Abastro. Seems like I handled my class correctly then. I am currently working on an issue where accessing the entity class will cause my rendering to skip frame from time to time. So I am really out of ideas here. I am having a fish and I have a tailflapspeed value... If I hardcode it ...its really smooth. this.bodysegment1.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.527F) ); But if I access the entite class ... it skip frame commonly. this.bodysegment1.rotateAngleY = 0.15F *(MathHelper.cos(f2 * entity.GetTailFlapSpeed() * 0.527F) ); I am really desesperate for a solution here! Any ideas?
  9. Hi guys, just a general question here. I am playing around with Model animation (ModelClass) and it really starts to get in. Few questions, I would really appreciate if you could look at them ... 1. In my model class, which inherit from the net.minecraft.client.model.ModelBase class. How do you usually send your own variable values that will dictate to your model some of their properties. Example: Double mouthOpening, which will hold how large the mouth of the model is opened. I am using IMessage that send the value modified server side to the entity class, which is available almost everywhere in the model class. But is it the recommended way to do this? 2. Could I use an IMessage to update the model class directly instead of the entity? If yes, where I can put my hand on the instance of my model class which is linked somewhere with my entity class. 3. Are the basic values for motion, yaw, pitch ... set for the mobs need to be sent client side over imessage when I modify them server side? Example: aWaterMob.motionX = (vec3.xCoord * speed)*speedAdjustment; aWaterMob.motionY = (vec3.yCoord * speed)*speedAdjustment; aWaterMob.motionZ = (vec3.zCoord * speed)*speedAdjustment; aWaterMob.renderYawOffset = aWaterMob.rotationYaw = -((float)Math.atan2(aWaterMob.motionX, aWaterMob.motionZ)) * 180.0F / (float)Math.PI; Should I send the motion values to the client side over IMessage? I noticed that for some reason my model does walk sideways from time to time. I am under the impression that I am missing something. 4. Could you recommend some code that I could look at ... I saw few basic tutorial. But I am more advance now, and would like to read about the standard technique used by some of you guys. My mobs move quite well, but they are kind of glitchy and would like to learn how to rotate them fluently and all. Any good reading?
  10. I know its a tough one ...so maybe I can try something else. Is it possible to link the Model class to the Entity class. So when the entity class is modified server side, I would send a Message that update the model class client side? I know that the entity is available from the model class methods ...but since accessing it causes glitches in the animation, I could try to always keep my Model class updated with IMessage... Any hints?
  11. Hi guys, I am hunting a bug that makes my animation skipping few frames from time to time ... and I am able to fix it. But I do not understand why. Maybe you can help me out. Look at the following short method code sections ... option A and option B. This code is in the SetRotationAngles method of my model class. Option A this.bodysegment1.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F) ); this.bodysegment2.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F - (float)(Math.PI/6)) ); this.bodysegment3.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F - (float)(Math.PI/3)) ); this.bodysegment4.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F - (float)(Math.PI/2)) ); this.bodysegment5.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F - (float)(2*Math.PI/3)) ); this.bodysegment6.rotateAngleY = 0.15F *(MathHelper.cos(f2 * _shark.GetTailFlapSpeed() * 0.327F - (float)(5*Math.PI/6)) ); Option B this.bodysegment1.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.327F) ); this.bodysegment2.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.327F - (float)(Math.PI/6)) ); this.bodysegment3.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.327F - (float)(Math.PI/3)) ); this.bodysegment4.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.327F - (float)(Math.PI/2)) ); this.bodysegment5.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F* 0.327F - (float)(2*Math.PI/3)) ); this.bodysegment6.rotateAngleY = 0.15F *(MathHelper.cos(f2 * 0.7F * 0.327F - (float)(5*Math.PI/6)) ); The Option A and the Option B section are in fact the same code, as the exception of _shark.GetTailFlapSpeed in Option A and 0.7F and Option B. If I execute the code Option A, it access the entity object passed in parameters (named _shark), which will return a simple 0.7F value. If I execute the code Option B, I simply hardcode the 0.7F value. That is really weird, if I execute the Option A code, that access a simple property ... the animation jump some frame commonly. If I execute the Option B code, then the animation is perfect. I even tried putting the value of _shark.GetTailFlapSpeed() in a variable ...therefore calling it only once ... which has the same effect. I am confused. Why accesing a simple method in the entity class makes the animation run not smoothly. Is it a client/server class synchro thing? Here is the content of that little method. @Override public float GetTailFlapSpeed() { return GetBaseTailFlapSpeed() + (currentSpeed*0.2F); } currentSpeed is a simple protected float value in a parent class. And here is the GetBaseTailFlapSpeed method ... both are from a parent class. As you will see, the access is purely direct ... how come it creates a glitch? protected final float GetBaseTailFlapSpeed() { return pBaseTailFlapSpeed; }
  12. HO MY GOD I FIXED MY ISSUE!!! You have no clue how I could be happy right now!!! The model I posted is fine, I wanted a small example ... but mine was not, even with using par3. But after reading your explanation of how the rendering works, it made me understand few things and I was able to pinpoint the issue on the SPOT. Thank you so much diesieben07 ... this forum is a BLESS. Thanks again!!!
  13. My animations are good ... but yes I have missing frames and jumps from time to time. Which looks like EXACLTY like what you are describing. I tried to fix that thing for months ... but for some reason you probably answered my prayer this morning. From what I understood from your explanation is to use SetLivingAnimations instead of SetRotationAngles? Could I ask you help and ask you to take a look at this tiny 8 lines SetRotationAngles method of the blooper and modify it with your technique. From there, I will figure it out really quickly. I am a soft dev, but not much experience with the rendering. With this short example, sun will shine on me. I should be able to go from there and would let you know if it fixed my issue. public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { ModelRenderer[] amodelrenderer = this.squidTentacles; int i = amodelrenderer.length; for (int j = 0; j < i; ++j) { ModelRenderer modelrenderer = amodelrenderer[j]; modelrenderer.rotateAngleX = 0.5F + (0.6F)*(float) Math.sin(0.2*par3); }
  14. Ok so as an example ... lets take the very simple Blooper model... Here is the model package fantastic.renders.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelBlooper extends ModelBase { /** The squid's body */ ModelRenderer squidBody; /** The squid's tentacles */ ModelRenderer[] squidTentacles = new ModelRenderer[8]; public ModelBlooper() { byte b0 = -16; this.squidBody = new ModelRenderer(this, 0, 0); this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12); this.squidBody.rotationPointY += (float)(24 + b0); for (int i = 0; i < this.squidTentacles.length; ++i) { this.squidTentacles[i] = new ModelRenderer(this, 48, 0); double d0 = (double)i * Math.PI * 2.0D / (double)this.squidTentacles.length; float f = (float)Math.cos(d0) * 5.0F; float f1 = (float)Math.sin(d0) * 5.0F; this.squidTentacles[i].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2); this.squidTentacles[i].rotationPointX = f; this.squidTentacles[i].rotationPointZ = f1; this.squidTentacles[i].rotationPointY = (float)(31 + b0); d0 = (double)i * Math.PI * -2.0D / (double)this.squidTentacles.length + (Math.PI / 2D); this.squidTentacles[i].rotateAngleY = (float)d0; } } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { ModelRenderer[] amodelrenderer = this.squidTentacles; int i = amodelrenderer.length; for (int j = 0; j < i; ++j) { ModelRenderer modelrenderer = amodelrenderer[j]; modelrenderer.rotateAngleX = 0.5F + (0.6F)*(float) Math.sin(0.2*par3); } } /** * Sets the models various rotation angles then renders the model. */ public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); this.squidBody.render(par7); for (int i = 0; i < this.squidTentacles.length; ++i) { this.squidTentacles[i].render(par7); } } } And here is the render package fantastic.renders.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; import fantastic.FantasticInfo; import fantastic.entities.EntityBlooper; import fantastic.renders.models.ModelBlooper; public class RenderBlooper extends RenderLiving { private static final ResourceLocation texture1 = new ResourceLocation(FantasticInfo.ID.toLowerCase() + ":textures/models/mobs/blooper.png"); protected ModelBlooper model; public RenderBlooper(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); model = ((ModelBlooper) mainModel); } public void renderBlooper(EntityBlooper par1, double par2, double par3, double par4, float par5, float par6) { super.doRender(par1, par2, par3, par4, par5, par6); } public void doRenderLiving(EntityLiving par1, double par2, double par3, double par4, float par5, float par6) { this.renderBlooper((EntityBlooper) par1, par2, par3, par4, par5, par6); } @Override public void doRender(Entity par1, double par2, double par3, double par4, float par5, float par6) { this.renderBlooper((EntityBlooper) par1, par2, par3, par4, par5, par6); } protected ResourceLocation getEntityTexture(Entity entity) { return texture1; } } I understand the general idea of what you are talking about here ... but its hard for me to really know how to apply it. So looking at those blooper model and classes ... how would you use that technique?
  15. Does make sense ... where I can get that "Tick" value from the ModelBase class to keep an eye on?
  16. Good point you have there. Thanks for the hint.
  17. Hi guys, I saw in my model classes that nothing is modified on a clock. It is rather just executed in loop. So, it is not clear to me. By example, how often the setrotationangle is called? I am asking because I want to control the animation speed. Does it means that if it animate correctly on my beast machine ...it will animate at a slower speed on a slower machine? Or its time based? Anyone can clarify the processing speed of the rendering?
  18. Ok so here is the way I did it .... works perfectly protected EntityItem GetClosestItem(Entity fromEntity, Class anItemClass, int xDistance, int yDistance, int zDistance) { try { if (fromEntity!=null) { List _itemList = fromEntity.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(fromEntity.posX - xDistance, fromEntity.posY - yDistance, fromEntity.posZ - zDistance, fromEntity.posX + xDistance, fromEntity.posY + yDistance, fromEntity.posZ + zDistance)); if ((_itemList!=null) && (_itemList.size()>0)) { EntityItem _entityItem = null; Iterator _iterator = _itemList.iterator(); while (_iterator.hasNext()) { _entityItem = (EntityItem)_iterator.next(); ItemStack _stack = _entityItem.getEntityItem(); Item _item = _stack.getItem(); //Check if the stack is the correct item type if (_item.getClass().equals(anItemClass)) { return _entityItem; } } } return null; } return null; } catch (Exception e) { return null; } }
  19. Holy hell that does make sense. I was not figuring out that an item, when dropped on the ground ... becomes an EntityItem, which contains an ItemStack, which contains an Item. Thanks a thousand time CoolAlias. I will come back here with my final result.
  20. Hi guys, I am looking for something similar to Entity.worldObj.getEntitiesWithinAABB .... but that would return a specific searched item that was dropped on the ground. Any idea what method I could use? Here is what I want to achieve. My mob scan 50 squares around him and can smell a raw steak that was dropped on the ground. I am looking for a method that would return the list of instance of a specific item class within a specific range of a position. I googled the heck out of this ... might be my choice of words, but I was not able to find anything. Where should I start to look at?
  21. Wonder if there is a way to know if the player is swimming. This would fix my issue. I did not find a way. If the player is underwater, IsInWater would return true (which is what I want) ... and at the surface, the "IsSwimming" would also return true. I would cover both cases.
  22. Yeah this is what I concluded while playing around with it. Any idea how I could know when the player is swimming around in an ocean?
  23. Hi guys, I need to know when a player is in water, for some reason I noticed that while swimming around ... that the IsInWater method sometimes return false. I concluded that the player is kind of jumping while swimming around, maybe the false is returned when he is more outside of the water than inside. Any hints? Any ways to know if the player is swimming? What I could do is to check if the player is in water or he is swimming. Also, I noticed that there is a IsWet method for the entity. What is the difference between IsWet and IsInWater? The IsWet method returns the same thing ...a false here and there while swimming around.
  24. Hi guys, I commonly use the method EntityPlayer _closestPlayer =myMob.worldObj.getClosestPlayerToEntity(myMob, (double)20); This method return the closest player. But I would like to have a method that return a list of all players within the same range. I did not find one, any tricks?
  25. Hi guys, as I said earlier, I am working on few fish mobs. I noticed that when I change the rotationyaw of an entity, its animation is reset. For me it does mean that if the fish moves in straightline, he will flap its tail correctly, but if I change the rotationyaw, then the animation is reset and the tail goes back to the original postion, which looks quite bad. Not sure what I should look for. This animation thing is quite new to me.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.