Skip to content

Commit

Permalink
Increase boomerang size and fix returning.
Browse files Browse the repository at this point in the history
  • Loading branch information
Provismet committed Feb 10, 2024
1 parent b05371c commit bb100d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class BoomerangProjectileEntity extends ThrownItemEntity implements World
protected int flightTime = 0;
protected int ricochetCount = 1;
protected float power = 4f;
protected boolean isReturning = false;

private int ricochetCounterCooldown = 0;
private boolean resetsCooldown = true;
Expand Down Expand Up @@ -114,7 +115,8 @@ protected boolean ricochet (boolean doFallback, boolean returnToUser) {
this.flightTime = 0;
if (this.ricochetCount < 0) this.ricochetCount = 0;

if ((this.ricochetCount <= 0 || returnToUser) && this.getOwner() != null) {
if ((this.ricochetCount <= 0 || returnToUser) && this.getOwner() != null && !this.isReturning) {
this.isReturning = true;
Entity owner = this.getOwner();
this.setVelocity(owner.getX() - this.getX(), owner.getEyeY() - this.getY(), owner.getZ() - this.getZ(), 1f, 0.5f);
return true;
Expand All @@ -132,11 +134,13 @@ protected boolean ricochet (boolean doFallback, boolean returnToUser) {
if (!potentialTargets.isEmpty()) {
Entity target = potentialTargets.get(this.random.nextBetween(0, potentialTargets.size() - 1));
this.setVelocity(target.getX() - this.getX(), target.getEyeY() - this.getY(), target.getZ() - this.getZ(), 1f, 0.5f);
this.isReturning = false;
return true;
}

if (doFallback) {
this.setVelocity(-this.getVelocity().getX(), -this.getVelocity().getY(), -this.getVelocity().getZ(), 1f, 1f);
this.isReturning = false;
return true;
}

Expand Down Expand Up @@ -167,6 +171,8 @@ protected void ricochetBlock (Direction direction) {
default:
break;
}

this.isReturning = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AAEntityTypes {
public static final EntityType<GhostlySpellEntity> GHOSTLY_ORB = AAEntityTypes.buildSpell(GhostlySpellEntity::new, "ghostly_orb_spell");
public static final EntityType<WindTornadoSpellEntity> WIND_TORNADO = AAEntityTypes.buildSpell(WindTornadoSpellEntity::new, "wind_tornado_spell", EntityDimensions.fixed(1.5f, 1.5f));
public static final EntityType<MissileSpellEntity> MAGIC_MISSILE = AAEntityTypes.buildSpell(MissileSpellEntity::new, "missile_spell");
public static final EntityType<BoomerangProjectileEntity> BOOMERANG = AAEntityTypes.buildEntity(BoomerangProjectileEntity::new, "boomerang_projectile", EntityDimensions.fixed(0.5f, 0.25f));
public static final EntityType<BoomerangProjectileEntity> BOOMERANG = AAEntityTypes.buildEntity(BoomerangProjectileEntity::new, "boomerang_projectile", EntityDimensions.fixed(0.85f, 0.25f));

private static <T extends AbstractSpellEntity> EntityType<T> buildSpell (EntityType.EntityFactory<T> factory, String name) {
return AAEntityTypes.buildSpell(factory, name, EntityDimensions.fixed(0.25f, 0.25f));
Expand Down

0 comments on commit bb100d1

Please sign in to comment.