forked from mirrors/SpecialMobs
Update Blaze Mixin to 1.18.2
This commit is contained in:
parent
8771104a31
commit
f7a6b83578
4 changed files with 28 additions and 31 deletions
|
@ -1,29 +0,0 @@
|
|||
package fathertoast.specialmobs.common.mixin;
|
||||
|
||||
import fathertoast.specialmobs.common.util.mixin_hooks.CommonMixinHooks;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.monster.BlazeEntity;
|
||||
import net.minecraft.entity.monster.MonsterEntity;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
@Mixin(BlazeEntity.class)
|
||||
public abstract class BlazeEntityMixin extends MonsterEntity {
|
||||
|
||||
protected BlazeEntityMixin(EntityType<? extends MonsterEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Redirect(method = "aiStep",
|
||||
slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playLocalSound(DDDLnet/minecraft/util/SoundEvent;Lnet/minecraft/util/SoundCategory;FFZ)V")),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particles/IParticleData;DDDDDD)V", ordinal = 0))
|
||||
public void onAiStep(World instance, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
CommonMixinHooks.handleBlazeSmoke((BlazeEntity) (Object) this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package fathertoast.specialmobs.common.mixin;
|
||||
|
||||
import fathertoast.specialmobs.common.util.mixin_hooks.CommonMixinHooks;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.monster.Blaze;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
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;
|
||||
|
||||
@Mixin(Blaze.class)
|
||||
public abstract class BlazeMixin extends Monster {
|
||||
|
||||
protected BlazeMixin(EntityType<? extends Monster> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
@Inject(at=@At("HEAD"), method="aiStep")
|
||||
public void aiStep(CallbackInfo ci) {
|
||||
CommonMixinHooks.handleBlazeSmoke((Blaze)(Object)this);
|
||||
}
|
||||
|
||||
}
|
|
@ -4,10 +4,11 @@ import fathertoast.specialmobs.common.entity.blaze.CinderBlazeEntity;
|
|||
import net.minecraft.entity.monster.BlazeEntity;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.world.entity.monster.Blaze;
|
||||
|
||||
public class CommonMixinHooks {
|
||||
|
||||
public static void handleBlazeSmoke(BlazeEntity blaze) {
|
||||
public static void handleBlazeSmoke(Blaze blaze) {
|
||||
IParticleData smoke = blaze instanceof CinderBlazeEntity ? ParticleTypes.SMOKE : ParticleTypes.LARGE_SMOKE;
|
||||
blaze.level.addParticle(smoke, blaze.getRandomX(0.5D), blaze.getRandomY(), blaze.getRandomZ(0.5D), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"minVersion": "0.8",
|
||||
"refmap": "specialmobs.mixins.refmap.json",
|
||||
"mixins": [
|
||||
"BlazeEntityMixin"
|
||||
"BlazeMixin"
|
||||
],
|
||||
"client": [],
|
||||
"server": [],
|
||||
|
|
Loading…
Add table
Reference in a new issue