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. You guys are both awesome. I already knew how to handle messages, I am pretty sure you can't live with those. So yes it works ... but I have a new issue now. Maybe you have an idea ... So ok the call works ...but now I have a new issue. When the method is called after the readfromnbt (when the world reload the entities) ...it seems that the entity cannot get the message yet. I guess it is not fully created yet. Any idea where I could make the call after the entity is created on the server and client? I knew it worked by changing the size of my entity by setting it on interact(EntityPlayer player). So I see it works ... just need to find where to call it now. So here was my message, in case someone would have the same issue. package fantastic.network; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import fantastic.FantasticDebug; import fantastic.FantasticMod; import fantastic.entities.EntityFantasticFish; public class FishSetSizeMessage implements IMessage, IMessageHandler<FishSetSizeMessage, IMessage> { private int entityId; private float height; private float width; public FishSetSizeMessage() { } public FishSetSizeMessage(int anEntityId,float aHeight, float aWidth) { entityId=anEntityId; height=aHeight; width=aWidth; } @Override public void fromBytes(ByteBuf buf) { entityId = buf.readInt(); height = buf.readFloat(); width = buf.readFloat(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(entityId); buf.writeFloat(height); buf.writeFloat(width); } @Override public IMessage onMessage(FishSetSizeMessage message, MessageContext ctx) { if (message!=null) { FantasticDebug.Output("MESSAGE RECEIVED. Entity: "+Integer.toString(message.entityId)+" Height:"+Float.toString(message.height)+" Width:"+Float.toString(message.width),true ); EntityPlayer player = FantasticMod.proxy.getPlayerFromMessage(ctx); if (player!=null) { Entity _ent = player.worldObj.getEntityByID(message.entityId); if (_ent!=null) { ((EntityFantasticFish)_ent).SetSizeCollisionBox(message.height, message.width); FantasticDebug.Output("New size set to entity: "+Integer.toString(message.entityId)+" Height:"+Float.toString(message.height)+" Width:"+Float.toString(message.width),true ); return null; } else { FantasticDebug.Output("Entity IS NULL! ",true); } } else { FantasticDebug.Output("PLAYER IS NULL!"); } } else { FantasticDebug.Output("MESSAGE IS NULL!",true); } return null; } } And here is my SetSizeCollisionBoxe in my entity class public void SetSizeCollisionBox(float aHeight, float aWidth) { if ((aHeight!=this.height) || (aWidth!=this.width)) { this.setSize(aHeight, aWidth); if (!this.worldObj.isRemote) { FantasticNetwork.network.sendToAll(new FishSetSizeMessage(this.getEntityId(), aHeight, aWidth)); //FantasticNetwork.network.sendToAllAround(new FishSpeedMessage(this.getEntityId(), currentSpeed),new TargetPoint(this.worldObj.provider.dimensionId,this.posX,this.posY,this.posZ,30)); } } }
  2. Hi guys, I have an issue that haunt me for a while and decided to attack it tonight. I have an entity that can have 5 different sizes. I noticed that if you call SetSize outside the constructor of the entity, it is never set (I checked with F3+B) If I call it within the constructor, then it is set correctly. I tried looking at the setsize code, but I do not really understand the logic in there. Someone would know something I don't? This is a serious issue for me since my entity can have 5 different sizes, so you will understand that I need to be able to change the collision boxes at some point outside the constructor. Thanks guys!
  3. Hi guys, I am still hunting that pitch issue. Actually, reading a tutorial from Jabelar led me to this one. http://greyminecraftcoder.blogspot.ca/2015/07/entity-rotations-and-animation.html?showComment=1444584624236#c7188593033068666922 In this tutorial, the author specifically talk about the DoRender and DoRenderEntity ... which seems that they do not get the pitch by parameters. HEre are the signature of both methods ...so where is the pitch value client side!!?? RenderManager:: doRenderEntity(Entity entity, double x, double y, double z, float rotationYaw, float partialTicks, boolean showOutline); this then calls the Entity Renderer: RendererLivingEntity:: doRender(Entity entity, double x, double y, double z, float rotationYaw, float partialTicks);
  4. LOLL I still can't believe I did not think about this. Thanks diesieben07! I feel like an idiot now LOL I will still let the question opened since it may be interesting to know the creator of a block in some case...
  5. I did that already. I have a diver mask that provide this power. But it is still too dark for my taste...
  6. Yeah I am kind of blocked on this because I wanted to add a hand held underwater light ... its pretty dark down there. With the SEUS shader I can use a torch underwater, adding light. But it vanilla minecraft, I am stucked in the dark. Still looking for a solution ...
  7. Hi guys, how do you know if a block was placed by a player or by the world generator? The reason I need this is simple. I created a block that has a TileEntity linked to it. When this block is placed by the player, the TileEntity will rotate and face the player. But when the block is placed by the World Generator, I would like to rotate it randomly. I notice that the Block method "OnBlockAdded" is called when the block is placed by the generator. So I thought I could use it to set randomly its rotation right in there in the metadata. BUT the same method is also called when the block is added manually by the player ... So how could I know if the block was placed by the player or by the generator?
  8. Hi I get the idea! Which is pretty good! Thanks Jabelar, I will try it out.
  9. Hi guys, I saw few posts on the subject, but they are quite old so I am not sure if the info is still good. I would like to do an item, that when held in hand would emit light. I saw a small mod somewhere that let the player emit light when he is holding a torch. Any ideas how it is done? I know that my shader does that also... Any hint?
  10. I tried putting as much block as I can and it does not seem to interfere with the CPU at all. I guess that drawing the first texture or the second requires the same time. But I have a very powerful machine ... so am I right in my affirmation?
  11. Hi guys, as some of you know, you can put animated .png file (twice the height) in your minecraft block resource folder and put beside it a file with the same name, but with the .mcmeta extension. File would contains something like this ... (2 frames in this example) { "animation": { "frametime": 7, "frames": [0, 1, 2, 1] } } So we have an animated PNG here ...perfect ... but any of you guys found a trick so not all the blocks will be animated at the same time? I guess that the frametime in the mcmeta represent the number of rendering pass before the next slide kicks in. But since all block are rendered one after the next ...we end up having all of them animated at the same time. Any trick to have the blocks not all in synch? So it would look more natural?
  12. Hi guys, I have custom block that extends from Block ... I noticed that the @Override public boolean canBlockStay(World par1World, int par2, int par3, int par4) method is never called. I have tried setting the setTickRandomly to true ... no luck there. When is it called? I could use the the UpdateTick method to do that check myself ...but I was wondering. Is this canBlockStay method could be used?
  13. Hi guys, generated a new tileentity without any issues ... but I am stuck trying to keep the rotation saved. I want the tileentity to face the player when it places it. Then the rotation is saved in the NBT. Next time the world is loaded, the tileentity would keep the same initial rotation that the player set while placing it. I looked at code in forge, but looks overcomplicated, with many blocks inside the same class. Is there any simple example somewhere?
  14. BOOM and BOOM ... you guys rock!!! Both issues are solved! Thanks to you both
  15. Hi Thornack, thanks fir the help. So my fish movement is called server side in this method. //Math converted to use more accurate and readable Vec3's public static void SwimTo(EntityFantasticFish aWaterMob, double xCoor, double yCoor, double zCoor, double speed) { FantasticDebug.Output("Swim to new target"); if ((aWaterMob!=null) && (aWaterMob.isEntityAlive())) { if (!aWaterMob.worldObj.isRemote) { double speedAdjustment = 0.1D; //Create vector Vec3 vec3 = Vec3.createVectorHelper(xCoor - aWaterMob.posX, yCoor - aWaterMob.posY, zCoor - aWaterMob.posZ).normalize(); //Set motion and angles aWaterMob.motionX = (vec3.xCoord * speed)*speedAdjustment; aWaterMob.motionY = (vec3.yCoord * speed)*speedAdjustment; aWaterMob.motionZ = (vec3.zCoord * speed)*speedAdjustment; //*** OPTION 1 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; aWaterMob.rotationPitch = 0.5F; //I can set anything here, the pitch will never change //} } } } Notice the line aWaterMob.rotationPitch ... I can set any values in there ... pitch NEVER change. Do you know where that pitch should be passed as a parameter in SetRotationAngle? This is my RenderClass package fantastic.renders.entity; import org.lwjgl.opengl.GL11; import fantastic.FantasticDebug; import fantastic.FantasticInfo; import fantastic.entities.EntityBasicFish; import fantastic.entities.EntityBasicFish; import fantastic.renders.models.ModelBasicFish; import net.minecraft.block.material.Material; 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.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; public class RenderBasicFish extends RenderLiving { protected ModelBasicFish model; public RenderBasicFish(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); model = ((ModelBasicFish) mainModel); } public void renderBasicFish(EntityBasicFish 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.renderBasicFish((EntityBasicFish) par1, par2, par3, par4, par5, par6); } @Override public void doRender(Entity par1, double par2, double par3, double par4, float par5, float par6) { this.renderBasicFish((EntityBasicFish) par1, par2, par3, par4, par5, par6); } protected ResourceLocation getEntityTexture(Entity entity) { return ((EntityBasicFish)entity).GetTexture(); } /** * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: * entityLiving, partialTickTime */ @Override protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { this.scaleFish((EntityBasicFish)par1EntityLivingBase, par2); } protected void scaleFish(EntityBasicFish par1, float par2) { float scale = (float)par1.GetRenderValueFromSize(); GL11.glScalef(scale, scale, scale); } protected void func_82430_a(EntityBasicFish par1, float par2, float par3, float par4) { GL11.glTranslatef(0.0F, (float)(-par1.GetRenderValueFromSize()), 0.0F); super.rotateCorpse((EntityLivingBase)par1, par2, par3, 0); } protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { this.func_82430_a((EntityBasicFish)par1EntityLivingBase, par2, par3, par4); } } This is my 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) { EntityFantasticFish _fish = (EntityFantasticFish)entity; //FantasticDebug.Output(Float.toString(_fish.GetTailFlapSpeed()),true); if (_fish.GetTailFlapSpeed()>0) { super.setRotationAngles(f, f1, f2, f3, f4, f5, 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)) ); } } }
  16. Hi guys, I am trying to render an object underwater, but it end up always having an air bubble around it, which completely kill the project if I can't find a resolution. Take a look at this skeleton ... which inherit from the blockcontainer at this point (will be changed depending of the answers here.) Two questions. 1. Ay idea how to get rid of that bubble? 2. Does a TileEntity should always inherit from a BlockContainer? As funny as it sounds, all the examples I found were inheriting from that.
  17. Now with the picture ...any ideas of what I am doing wrong? I am starting to think that the pitch is not in synch client/server side ...but that the rotation is.
  18. Override Item#hasCustomEntity to return true and Item#createEntity to return a new instance of FragEntityItem at the same position as the Entity argument. Just looked at the code and your recommendation does seem right! I will try it out and let you know. Thanks Choonster!
  19. Having the entity floating is not really my issue since I already know how to do it ... but I do not know how to get my new FragEntityItem when the item is dropped (instead of the standard EntityItem) ...
  20. Hi guys, from what I understood, when you throw an item on the ground, the item becomes and EntityItem, which contains an ItemStack, which contains the item. Here is what I want to achieve. I want to have a floating item in water, so it wont drop to the bottom of the ocean when you release it with Q. So I thought about inheriting the EntityItem. Here is my question: 1. What method I should override in my item to instantiate my own FragEntityItem ? As funny as it sounds, it was not that obvious... 2. Something I could be missing? Thanks guys...
  21. I know its a tough one ...but I am pretty sure someone could hint me out around here...
  22. 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. Please post the image of the fish. I think you should apply rotation yourself. Also please post code of your Render class. 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)) ); This might make your model like it is applying yaw. Thanks Abastro, you were really helpful to me those days... Just to make sure we are on the same page. The yaw is fine ... I have issue with the pitch. My fish will never point their nose up or down to swim thru their destination. Here is the render package fantastic.renders.entity; import org.lwjgl.opengl.GL11; import fantastic.FantasticDebug; import fantastic.FantasticInfo; import fantastic.entities.EntityBasicFish; import fantastic.entities.EntityBasicFish; import fantastic.renders.models.ModelBasicFish; import net.minecraft.block.material.Material; 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.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; public class RenderBasicFish extends RenderLiving { protected ModelBasicFish model; public RenderBasicFish(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); model = ((ModelBasicFish) mainModel); } public void renderBasicFish(EntityBasicFish 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.renderBasicFish((EntityBasicFish) par1, par2, par3, par4, par5, par6); } @Override public void doRender(Entity par1, double par2, double par3, double par4, float par5, float par6) { this.renderBasicFish((EntityBasicFish) par1, par2, par3, par4, par5, par6); } protected ResourceLocation getEntityTexture(Entity entity) { return ((EntityBasicFish)entity).GetTexture(); } /** * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: * entityLiving, partialTickTime */ @Override protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { this.scaleFish((EntityBasicFish)par1EntityLivingBase, par2); } protected void scaleFish(EntityBasicFish par1, float par2) { float scale = (float)par1.GetRenderValueFromSize(); GL11.glScalef(scale, scale, scale); } protected void func_82430_a(EntityBasicFish par1, float par2, float par3, float par4) { GL11.glTranslatef(0.0F, (float)(-par1.GetRenderValueFromSize()), 0.0F); super.rotateCorpse((EntityLivingBase)par1, par2, par3, 0); } protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { this.func_82430_a((EntityBasicFish)par1EntityLivingBase, par2, par3, par4); } }
  23. Hi guys, I read a lot about Perlin noise to generate mountains and hills. I know that Minecraft used it a lot in its terrain generation. I got the general idea, but I cant figure it out completely. So here is my question... Let's say I would like to generate a hill of 6 blocks high and approximatively 25 blocks in diameter. What methods I could use and how? I know that the classes are available in forge, just not sure how to use those. I am ONLY looking for an arraylist of coordinate (block position). With the list, then I could manually browse it and generate the block of my choice. Would return something like [0,0,0][0,0,1][1,0,1][2,0,2] ... Example: I want to get back the list of coordinate if I want to generate a hill of 6 blocks high with a 25 blocks in diameter. I am looking for something like: public ArrayList GetMountainsBlockCoordinateList(int centerX, int centerY, int centerZ) The parameters passed (centerX,centerY,centerZ) would be the block at the base center of the hill.

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.