Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Sep 29, 2024
1 parent 9648688 commit 79e61cd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,14 @@ public static void onCoffinUntrack(@Nullable Entity entity, @Nullable CoffinSpaw
entityInterface.trailierTales$setCoffinData(null);
}

if (remove && coffinSpawner != null) {
coffinSpawner.onEntityRemoved(entity);
}

if (entity instanceof Apparition apparition && remove) {
apparition.dropItem();
apparition.level().broadcastEntityEvent(apparition, (byte)60);
apparition.discard();
apparition.dropPreservedEquipment();
if (coffinSpawner != null) {
coffinSpawner.onApparitionRemovedOrKilled(entity.level());
}
} else if (remove && entity instanceof Mob mob && !mob.isPersistenceRequired() && !mob.requiresCustomPersistence()) {
mob.level().broadcastEntityEvent(mob, (byte)60);
mob.discard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ public static boolean isInCatacombsBounds(BlockPos pos, @NotNull StructureManage
return structure != null && structureManager.structureHasPieceAt(pos, structureManager.getStructureAt(pos, structure));
}

public void onEntityRemoved(@NotNull Entity entity) {
if (entity.level() instanceof ServerLevel serverLevel && entity instanceof Apparition) {
public void onApparitionRemovedOrKilled(@NotNull Level level) {
if (level instanceof ServerLevel serverLevel) {
this.data.nextApparitionSpawnsAt = serverLevel.getGameTime() + this.getConfig().ticksBetweenApparitionSpawn();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public record CoffinSpawnerConfig(
400,
4,
1,
1800
1200
);
public static final CoffinSpawnerConfig IRRITATED = new CoffinSpawnerConfig(
5,
Expand All @@ -34,7 +34,7 @@ public record CoffinSpawnerConfig(
300,
6,
1,
9000
900
);
public static final CoffinSpawnerConfig AGGRESSIVE = new CoffinSpawnerConfig(
6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ public boolean trackingEntity(@NotNull Entity entity) {
return this.currentMobs.contains(entity.getUUID());
}

public boolean trackingApparition(@NotNull Entity entity) {
return this.currentApparitions.contains(entity.getUUID());
}

public int getPower() {
return this.power;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public abstract class LivingEntityMixin implements EntityCoffinInterface {
serverLevel.sendParticles(ParticleTypes.POOF, pos.x, pos.y, pos.z, 2, 0.2D, 0D, 0.2D, 0D);
double distance = livingEntity.distanceToSqr(pos);
coffinSpawner.addSoulParticle(40 + (int)(distance * 1.25D));
} else if (spawnerData.trackingApparition(livingEntity)) {
coffinSpawner.onApparitionRemovedOrKilled(serverLevel);
}
}
}
Expand Down

0 comments on commit 79e61cd

Please sign in to comment.