Skip to content

Commit

Permalink
glop particles
Browse files Browse the repository at this point in the history
  • Loading branch information
tazercopter committed Sep 27, 2024
1 parent 28ab03d commit dc7a1dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions src/main/java/com/thebeyond/client/particle/GlopParticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ public class GlopParticle extends TextureSheetParticle {
public GlopParticle(ClientLevel level, double x, double y, double z, SpriteSet spriteSet) {
super(level, x, y, z);
this.setSprite(spriteSet.get(this.random.nextInt(4), 4));
this.lifetime = (int) (16.0 / (Math.random() * 0.8 + 0.2));
this.lifetime = (int) (64.0 / (Math.random() * 0.8 + 0.2));
}

@Override
public void tick() {
super.tick();
EnderglopEntity nearestGlop = this.level.getNearestEntity(EnderglopEntity.class, TargetingConditions.DEFAULT, null, this.x, this.y, this.z,
new AABB(this.x+10, this.y+10, this.z+10, this.x-10, this.y-10, this.z-10));
EnderglopEntity nearestGlop = level.getNearestEntity(EnderglopEntity.class, TargetingConditions.forNonCombat(), null, x, y, z,
new AABB(x+10, y+10, z+10, x-10, y-10, z-10));
if (nearestGlop != null) {
Vec3 nearestGlopPos = nearestGlop.position();
this.move((nearestGlopPos.x - this.x) / 20, (nearestGlopPos.y - this.y) / 20, (nearestGlopPos.z - this.z) / 20);
double xd = nearestGlopPos.x - x;
double yd = nearestGlopPos.y - y;
double zd = nearestGlopPos.z - z;

this.move(xd*age / lifetime, yd*age / lifetime, zd*age / lifetime);
if (this.getPos().distanceTo(nearestGlopPos) < nearestGlop.getSize()*0.3) this.remove();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected void registerGoals() {
this.goalSelector.addGoal(2, new SlimeAttackGoal(this));
this.goalSelector.addGoal(3, new SlimeRandomDirectionGoal(this));
this.goalSelector.addGoal(5, new SlimeKeepOnJumpingGoal(this));
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal(this, Player.class, true){
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<Player>(this, Player.class, true){
@Override
public boolean canUse() {
return super.canUse() && !EnderglopEntity.this.isTiny();
Expand Down Expand Up @@ -140,7 +140,7 @@ public static AttributeSupplier.Builder createAttributes() {
public void jumpFromGround() {
Vec3 vec3 = this.getDeltaMovement();
float f = (float)this.getSize() * 0.1F;
this.setDeltaMovement(vec3.x, (double)(this.getJumpPower() + f), vec3.z);
this.setDeltaMovement(vec3.x, this.getJumpPower() + f, vec3.z);
this.hasImpulse = true;
CommonHooks.onLivingJump(this);
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public void tick() {
float f3 = this.random.nextFloat() * 0.5F + 0.5F;
float f4 = Mth.sin(f2) * f1 * f3;
float f5 = Mth.cos(f2) * f1 * f3;
this.level().addParticle(this.getParticleType(), this.getX() + (double)f4, this.getY(), this.getZ() + (double)f5, 0.0, 0.0, 0.0);
this.level().addParticle(this.getParticleType(), this.getX() + (double)f4, this.getY() - 0.1, this.getZ() + (double)f5, 0.0, 0.0, 0.0);
}
}

Expand Down

0 comments on commit dc7a1dc

Please sign in to comment.