-
Notifications
You must be signed in to change notification settings - Fork 285
/
Copy pathZombie_bugFixMixin.java
37 lines (34 loc) · 1.69 KB
/
Zombie_bugFixMixin.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.monster.Zombie;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(Zombie.class)
public abstract class Zombie_bugFixMixin extends Mob {
protected Zombie_bugFixMixin(EntityType<? extends Mob> entityType, Level level) {
super(entityType, level);
}
@Inject(method = "convertToZombieType", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/Zombie;supportsBreakDoorGoal()Z"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void mixin(EntityType<? extends Zombie> entityType, CallbackInfo ci, Zombie zombie) {
if (CarpetSettings.mobConvertKeepNBTTagsFix) {
this.getActiveEffects().forEach(zombie::addEffect);
zombie.setRemainingFireTicks(this.getRemainingFireTicks());
zombie.setLeftHanded(this.isLeftHanded());
zombie.setNoGravity(this.isNoGravity());
zombie.setPortalCooldown(this.getPortalCooldown());
zombie.setXRot(this.getXRot());
zombie.setYRot(this.getYRot());
zombie.setYBodyRot(this.getVisualRotationYInDegrees());
zombie.setYHeadRot(this.getYHeadRot());
zombie.setSilent(this.isSilent());
this.getTags().forEach(zombie::addTag);
zombie.setUUID(this.getUUID());
}
}
}