mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-28 23:48:00 +01:00
25 lines
1 KiB
Java
25 lines
1 KiB
Java
|
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;
|
||
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||
|
|
||
|
import net.minecraft.container.ContainerListener;
|
||
|
import net.minecraft.entity.player.PlayerEntity;
|
||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||
|
|
||
|
@Mixin(ServerPlayerEntity.class)
|
||
|
abstract class MixinServerPlayerEntity extends PlayerEntity implements ContainerListener, PonyContainer<Pony> {
|
||
|
MixinServerPlayerEntity() {super(null, null);}
|
||
|
|
||
|
@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());
|
||
|
}
|
||
|
}
|