Jump to content

MCRaichu

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by MCRaichu

  1. I have done that multiple times. Also used the context menu option. Still doesn't show up. If i put a file inside the other subfolders of textures, they show up immediately. EDIT: seems to be a problem with the name. I called it "entity". if i create folders with other names it works.
  2. Hi, it is propably a stupid problem but for some reason, if I create a folder inside the textures folder it is not showing up under the assets. If i create a folder parallel to textures it shows. I'm using eclipse and if anyone has encountered this before, some advice would be nice. McRaichu
  3. With "sometimes positive sometimes negative" i meant the return of bolt.rotationYaw. it returns values from 0 to 360 and from 0 to -360 depending if the entity is turning right or left. this screws with my head and therefore my coding. So yeah using only positive values is easier but that doesn't help me understand the functionality behind it.
  4. @ Draco18s: haven't seen a lmgtfy link in a while... @ jabelar: basically that's what I have done for the last 4 days...here is some code that work if the weapon is on the right-hand side...but i don't know how to adapt it for a general case. My main problem is that the rotation is sometime positive sometimes negative and just using the absolute value doesn't work. i tried.(w2X and w2Z) are the offsets) EntityBlasterBolt bolt = new EntityBlasterBolt(world, player); bolt.setLocationAndAngles(bolt.posX, bolt.posY, bolt.posZ, player.rotationYaw, player.rotationPitch); //generate offset based on angle double rotation = bolt.rotationYaw; double hypothe = Math.sqrt((w2X*w2X)+(w2Z*w2Z)); double weaponAngle = Math.acos(w2Z/hypothe) * (180.0/Math.PI); double tempAngle = rotation + (90.0 - weaponAngle); if(tempAngle > 360.0) tempAngle -= 360.0; bolt.posX -= (double)(MathHelper.cos((float)tempAngle / 180.0F * (float)Math.PI) * (hypothe)); bolt.posY -= w2Y; bolt.posZ -= (double)(MathHelper.sin((float)tempAngle / 180.0F * (float)Math.PI) * (hypothe)); bolt.setPosition(bolt.posX, bolt.posY, bolt.posZ); float f = 0.4F; bolt.rotationPitch -= 3; bolt.motionX = (double)(-MathHelper.sin(bolt.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(bolt.rotationPitch / 180.0F * (float)Math.PI) * f); bolt.motionZ = (double)(MathHelper.cos(bolt.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(bolt.rotationPitch / 180.0F * (float)Math.PI) * f); bolt.motionY = (double)(-MathHelper.sin((bolt.rotationPitch) / 180.0F * (float)Math.PI) * f); bolt.setThrowableHeading(bolt.motionX, bolt.motionY, bolt.motionZ, bolt.speed, 1.0F);
  5. Hi, I want to spawn an entity (throwable) at a certain position on another entity. To be precise, the model of my mech has a weapon and I want to spawn the projectile at the weapon (makes sense right). I have the offset of the weapon in the mechs/model coordinates system, but to spawn it I need global coordinates and my trigonometry skills are not the best. Does anyone have an idea where I could find an example for something similar? Any help is appreciated. McRaichu
  6. here you go: package net.McRaichu.LittleWalker.weapons; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityRocket extends EntityThrowable { float explosionRadius; public float speed; private byte damage; int ticksAlive = 0; private void initRocket() { explosionRadius = 1.5F; speed = 1.0F; damage = 10; setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed, 1.0F); } public EntityRocket(World par1World) { super(par1World); initRocket(); } public EntityRocket(World par1World, EntityLivingBase entity) { super(par1World, entity); initRocket(); } public EntityRocket(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); initRocket(); } public EntityRocket(World par1World, EntityLivingBase entity, double par7, double par8, double par9) { super(par1World, entity); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * par7); this.posY -= par8; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * par9); this.setPosition(this.posX, this.posY, this.posZ); initRocket(); } @Override protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if(par1MovingObjectPosition.entityHit != null){ if (this.getThrower().ridingEntity == par1MovingObjectPosition.entityHit) { return; } par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), damage); } this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, true); this.setDead(); } @Override protected float getGravityVelocity() { return 0.0005F; } @Override public void onUpdate() { super.onUpdate(); ticksAlive++; if(ticksAlive > 200) { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, true); setDead(); } if(worldObj.isRemote) { for(int i = 0; i < 4; i++) { worldObj.spawnParticle("smoke", posX, posY, posZ + motionZ, -motionX, -motionY , -motionZ); } } } }
  7. Hi, i created a weapon firing multiple rockets in a row. But, since they explode, the later rockets are misdirected by the explosion. I assume it has something to do with knockback but I couldn't find where I set the resistance to it. Or maybe it can be done with something else. Any help is appreciated. EDIT: It seems to be a problem with getGravityVelocity() returning 0. With a very small value (0.005) the rockets are no longer affected by the explosion (or I cant see it). Still, if someone ones why this happens would be great. McRaichu
  8. Thanks for the tip, but now I have problem. I use the PlayerInteractEvent for enougher weapon (same mechanics) but that event is client-side. How do i create the projectile on the server?
  9. Hi, i got a small problem. currently I use the AttackEntityEvent to intercept the left click of a player while he is riding a mecha,since the player is inside the mecha is attack by the left click. I use this to call a method of the entity to shot (spawn a projectile) but since client and server execute the same code two projectiles are spawned. How can I prevent this from happening? Any help and other solutions are welcome.
  10. I have a small problem. Since the mecha model has weapons on it (e.g. rocktelauncher on the shoulder) how do i achieve the displacement from the players position when a for example a bow is used?
  11. Basically I have two ideas: 1.: Create a Gui which allows the player to insert range-weapons (bow or custom one) and use them 2.: just use the spawnEntityInWorld (like from the snowball) and fire something the second idea would be the easiest i guess but the first one would allow more possibilities for the player. What do you think is the best decision?
  12. I get the first part: register an eventhandler in the eventbus and there check if the player is riding and check for left/right click. what should/could I do about the weapon part?
  13. Hi, I'm new to this forum as well as minecraft modding and made my way through several tutorials. I create a custom rideable entity (a mech) and now I want to override the behaviour of the left and right mouse-button while a player is "riding" it. Basicly I want it to fire two different weapons. My questions are: - What is the "easiest/fastest" way of doing that? (I know it wont be easy) - How should I implement the weapons? - Are there any tutorials covering something related to that? My first idea was to create an item like a "controller" which the player needs to hold in the hand an just use its onRightClick but thats not what i want... Any ideas/suggestions are welcome. Thanks in advance, McRaichu
×
×
  • Create New...

Important Information

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