Pegasi can walk on powdered snow

This commit is contained in:
Sollace 2022-09-21 23:19:29 +02:00
parent a664a52bbe
commit 4636ed267b
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package com.minelittlepony.unicopia.mixin;
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.CallbackInfoReturnable;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.Pony;
import net.minecraft.block.PowderSnowBlock;
import net.minecraft.entity.Entity;
@Mixin(PowderSnowBlock.class)
abstract class MixinPowderSnowBlock {
@Inject(method = "canWalkOnPowderSnow", at = @At("HEAD"), cancellable = true)
private static void onCanWalkOnPowderSnow(Entity entity, CallbackInfoReturnable<Boolean> info) {
if (Pony.of(entity).map(Pony::getSpecies).filter(Race::canFly).isPresent()) {
info.setReturnValue(true);
}
}
}

View file

@ -22,6 +22,7 @@
"MixinMobEntity",
"MixinPersistentProjectileEntity",
"MixinPlayerEntity",
"MixinPowderSnowBlock",
"MixinProjectileEntity",
"MixinReachDistanceFix",
"MixinServerPlayerEntity",