Closed SiverDX closed 6 months ago
just saw that there is already an issue about this #30
reference what im doing now
@Mixin(LivingEntity.class)
public abstract class MixinLivingEntity {
@Inject(method = "die", at = @At("HEAD"))
private void convert(final DamageSource damageSource, final CallbackInfo callback) {
if ((LivingEntity) (Object) this instanceof Zombie zombie) {
int difficultyLevel = zombie.level.getDifficulty().getId();
// Only convert base zombies | Don't convert below NORMAL difficulty | Convert chance of 50% for NORMAL difficulty
if (zombie.getType() != EntityType.ZOMBIE || difficultyLevel < Difficulty.NORMAL.getId() || (difficultyLevel == Difficulty.NORMAL.getId() && zombie.getRandom().nextBoolean())) {
return;
}
if (zombie.isInLava()) {
zombie.convertTo(RCEntityTypes.BURNED.get(), true);
} else if (zombie.isInPowderSnow || zombie.wasInPowderSnow) {
zombie.convertTo(RCEntityTypes.FROSTBITTEN.get(), true);
}
if (!zombie.isSilent()) {
zombie.level.levelEvent(LevelEvent.SOUND_ZOMBIE_INFECTED, zombie.blockPosition(), 0);
}
}
}
}
oh yeah, that has been fixed in the new version that's in dev, it was a silly mistake 🤔
It's due to this return here
https://github.com/teamfusion/rottencreatures/blob/0d9bff358bc30a4225ad879224292fd17698504e/common/src/main/java/com/github/teamfusion/rottencreatures/mixin/common/ZombieMixin.java#L32
why are you even doing this it's skipping the entire logic in livingentity, including the forge livingdeathevent
(since the entity stays at 0 health it will just be removed in the next tick)
also dont use the level random, use the entity random if you can to avoid concurrency problems