blfngl Posted March 11, 2019 Posted March 11, 2019 Exactly the title. I've got this projectile (EntityThrowable extension) that's not registering collisions at point-blank range, but if the player fires it approximately 5-6 blocks away hits register perfectly fine. Projectile: Spoiler public class EntityBullet extends EntityThrowable { private float damage; public EntityBullet(World worldIn) { super(worldIn); } public EntityBullet(World worldIn, EntityLivingBase throwerIn, float damage) { super(worldIn, throwerIn); this.damage = damage; } public EntityBullet(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } // Spawns impact particles @SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == 3) for (int i = 0; i < 8; ++i) this.world.spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } /** * Called when this EntityThrowable hits a block or entity. */ @Override protected void onImpact(RayTraceResult result) { if (result.entityHit != null) result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), damage); if (!this.world.isRemote) { // Make it so that particles will spawn on impact this.world.setEntityState(this, (byte) 3); this.setDead(); } } @Override protected float getGravityVelocity() { return 0.0f; } } Registry: Spoiler EntityRegistry.registerModEntity(new ResourceLocation(Reference.MODID + ":textures/entity/projectile/bullet.png"), EntityBullet.class, "entityBullet", id++, Fallout.instance, 64, 1, false); Any ideas how to fix this? Quote
blfngl Posted March 11, 2019 Author Posted March 11, 2019 Sorry, here's the shoot method, where bulletSpeed is 7.0f: if (!world.isRemote) { EntityBullet bullet = new EntityBullet(world, player, damage); bullet.shoot(player, player.rotationPitch, player.rotationYaw, 0.0f, bulletSpeed, 1.0f); world.spawnEntity(bullet); } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.