Mostly improved dart collision.

This commit is contained in:
bconlon 2020-07-13 23:47:54 -07:00
parent 1beab1999a
commit a1ef4b6690
3 changed files with 28 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.legacy.aether; package com.legacy.aether;
import com.legacy.aether.entities.passive.mountable.EntityAerbunny; import com.legacy.aether.entities.passive.mountable.EntityAerbunny;
import com.legacy.aether.entities.projectile.darts.EntityDartBase;
import com.legacy.aether.network.AetherNetwork; import com.legacy.aether.network.AetherNetwork;
import com.legacy.aether.network.packets.PacketSendEternalDay; import com.legacy.aether.network.packets.PacketSendEternalDay;
import com.legacy.aether.network.packets.PacketSendShouldCycle; import com.legacy.aether.network.packets.PacketSendShouldCycle;

View file

@ -39,6 +39,7 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile,
private int ticksInGround; private int ticksInGround;
private int ticksInAir; private int ticksInAir;
private double damage = 2.0D; private double damage = 2.0D;
private float gravityVelocity;
public EntityDartBase(World world) { public EntityDartBase(World world) {
super(world); super(world);
@ -308,6 +309,11 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile,
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.func_145775_I(); this.func_145775_I();
} }
if (this.ticksInAir == 500)
{
this.setDead();
}
} }
public void onDartHit(MovingObjectPosition movingobjectposition) { public void onDartHit(MovingObjectPosition movingobjectposition) {
@ -386,10 +392,25 @@ public abstract class EntityDartBase extends EntityArrow implements IProjectile,
this.inTile.onEntityCollidedWithBlock(this.worldObj, this.tileX, this.tileY, this.tileZ, this); this.inTile.onEntityCollidedWithBlock(this.worldObj, this.tileX, this.tileY, this.tileZ, this);
} }
} }
if (movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && movingobjectposition.entityHit != this.shootingEntity.riddenByEntity)
{
this.setDead();
}
else
{
this.setGravityVelocity(0.03F);
}
} }
protected float getGravityVelocity() { protected float getGravityVelocity()
return 0.99F; {
return this.gravityVelocity;
}
public void setGravityVelocity(float gravityVelocity)
{
this.gravityVelocity = gravityVelocity;
} }
@Override @Override

View file

@ -150,6 +150,10 @@ public class ItemDartShooter extends Item {
if (!world.isRemote) { if (!world.isRemote) {
world.spawnEntityInWorld(dart); world.spawnEntityInWorld(dart);
if (dart != null)
{
dart.setGravityVelocity(0.99F);
}
if (!(entityplayer.capabilities.isCreativeMode)) { if (!(entityplayer.capabilities.isCreativeMode)) {
dart.canBePickedUp = 1; dart.canBePickedUp = 1;