Jump to content

maestro1184

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by maestro1184

  1. I know java. I just hit this weird instance with an EntityThrowable not causing damage. Not sure if it is a forge bug or if something changed along the way and I missed it.
  2. The "F" isn't a variable, it is an explicit cast to a float. If I had used 20.0D, the java compiler would have recognized that value as a double. Also, this particular line of code worked fine in 1.8.9
  3. But I don't care about the kind of entity. I always want the damage to be 20.0F and that is what my code shows.
  4. But you are still just casting an int of 20 to a float. I'm just explicitly saying 20.0F.
  5. Except in that code snippet, the cast of (float)i is either 0 or 4. In my code, it is this: result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 20.0F); Notice my code explicitly says 20.0F
  6. I don't care about sounds or particles. It's the damage the the EntityThrowable should inflict that isn't working right.
  7. I have a class that I'm trying to upgrade from 1.8.9 to 1.10.2. It's basically just a custom EntityThrowable that is a bullet for a gun. Everything is working except that the bullet causes no damage when it hits another entity. I can't figure out why since I believe this line in the onImpact method: result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 20.0F); is correct. Does 1.10.2 handle damage differently? public class EntityBullet extends EntityThrowable { public EntityBullet(World worldIn, EntityLivingBase throwerIn) { super(worldIn, throwerIn); setHeadingFromThrower(throwerIn, throwerIn.rotationPitch, throwerIn.rotationYaw, 0.0F, 5.0F, 1.0F); } @Override protected void onImpact(RayTraceResult result) { if (this.worldObj.isRemote) { if (result.entityHit != null) { result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 20.0F); } this.setDead(); } } @Override protected float getGravityVelocity() { return 0.005F; } }
  8. Check out the EntityRegistry.registerModEntity() method you use to register your custom entity: public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) { instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates); } The updateFrequency argument is what you want. Lower that number and your entity will move smoother.
  9. I found this tutorial really helpful for the gun I'm working on: https://emxtutorials.wordpress.com/creating-a-gun/ I actually adjusted it a little to make it more like a hunting rifle. It's still a work in progress but I might be able to answer some questions if you have them.
×
×
  • Create New...

Important Information

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