2023-10-15 17:51:57 +02:00
|
|
|
package com.minelittlepony.unicopia.mixin;
|
|
|
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
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 com.minelittlepony.unicopia.EquineContext;
|
|
|
|
import net.minecraft.block.EntityShapeContext;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.fluid.FluidState;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
@Mixin(EntityShapeContext.class)
|
2024-03-28 16:32:21 +01:00
|
|
|
abstract class MixinEntityShapeContext implements EquineContext.Container {
|
2023-10-15 17:51:57 +02:00
|
|
|
private EquineContext equineContext;
|
|
|
|
|
|
|
|
@Inject(method = "<init>", at = @At("TAIL"))
|
|
|
|
private void init(boolean descending, double minY, ItemStack heldItem, Predicate<FluidState> walkOnFluidPredicate, @Nullable Entity entity, CallbackInfo into) {
|
|
|
|
equineContext = EquineContext.of(entity);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2024-03-28 16:32:21 +01:00
|
|
|
public EquineContext get() {
|
|
|
|
return equineContext;
|
2023-10-21 21:30:13 +02:00
|
|
|
}
|
2023-10-15 17:51:57 +02:00
|
|
|
}
|