2020-05-29 20:13:10 +02:00
|
|
|
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.CallbackInfo;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.ducks.PonyContainer;
|
2020-06-26 11:44:47 +02:00
|
|
|
import com.minelittlepony.unicopia.equine.player.Pony;
|
2020-05-29 20:13:10 +02:00
|
|
|
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
2020-06-26 11:44:47 +02:00
|
|
|
import net.minecraft.screen.ScreenHandlerListener;
|
2020-05-29 20:13:10 +02:00
|
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
|
|
|
|
|
|
@Mixin(ServerPlayerEntity.class)
|
2020-06-26 11:44:47 +02:00
|
|
|
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer<Pony> {
|
|
|
|
MixinServerPlayerEntity() {super(null, null, null);}
|
2020-05-29 20:13:10 +02:00
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Inject(method = "copyFrom(Lnet/minecraft/server/network/ServerPlayerEntity;Z)V", at = @At("HEAD"))
|
|
|
|
private void onCopyFrom(ServerPlayerEntity oldPlayer, boolean alive, CallbackInfo info) {
|
|
|
|
get().copyFrom(((PonyContainer<Pony>)oldPlayer).get());
|
|
|
|
}
|
|
|
|
}
|