38 lines
1.4 KiB
Java
38 lines
1.4 KiB
Java
package io.github.skippyall.minions.mixins;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
import io.github.skippyall.minions.minion.fakeplayer.EntityPlayerActionPack;
|
|
import io.github.skippyall.minions.minion.fakeplayer.ServerPlayerInterface;
|
|
import net.minecraft.network.packet.c2s.common.SyncedClientOptions;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
import net.minecraft.server.world.ServerWorld;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Unique;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
@Mixin(ServerPlayerEntity.class)
|
|
public abstract class ServerPlayerMixin implements ServerPlayerInterface {
|
|
@Unique
|
|
public EntityPlayerActionPack actionPack;
|
|
@Override
|
|
public EntityPlayerActionPack minions$getActionPack()
|
|
{
|
|
return actionPack;
|
|
}
|
|
|
|
@Inject(method = "<init>", at = @At(value = "RETURN"))
|
|
private void onServerPlayerEntityConstructor(MinecraftServer minecraftServer, ServerWorld serverLevel, GameProfile gameProfile, SyncedClientOptions clientInformation, CallbackInfo ci)
|
|
{
|
|
this.actionPack = new EntityPlayerActionPack((ServerPlayerEntity) (Object) this);
|
|
}
|
|
|
|
@Inject(method = "tick", at = @At(value = "HEAD"))
|
|
private void onTick(CallbackInfo ci)
|
|
{
|
|
actionPack.onUpdate();
|
|
}
|
|
}
|