2020-05-29 20:13:10 +02:00
|
|
|
package com.minelittlepony.unicopia.mixin;
|
|
|
|
|
|
|
|
import org.spongepowered.asm.mixin.Mixin;
|
2021-08-26 18:51:58 +02:00
|
|
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
2020-05-29 20:13:10 +02:00
|
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
|
2022-12-25 16:01:12 +01:00
|
|
|
import com.minelittlepony.unicopia.entity.Equine;
|
2022-09-11 16:58:42 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.duck.ServerPlayerEntityDuck;
|
2020-09-22 15:11:20 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.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)
|
2022-12-25 16:01:12 +01:00
|
|
|
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, Equine.Container<Pony>, ServerPlayerEntityDuck {
|
2022-12-18 22:07:24 +01:00
|
|
|
MixinServerPlayerEntity() {super(null, null, 0, null);}
|
2020-05-29 20:13:10 +02:00
|
|
|
|
2021-08-26 18:51:58 +02:00
|
|
|
@Override
|
|
|
|
@Accessor("inTeleportationState")
|
|
|
|
public abstract void setPreventMotionChecks(boolean enabled);
|
|
|
|
|
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) {
|
2022-12-25 16:01:12 +01:00
|
|
|
get().copyFrom(((Equine.Container<Pony>)oldPlayer).get());
|
2020-05-29 20:13:10 +02:00
|
|
|
}
|
2021-08-26 18:51:58 +02:00
|
|
|
|
2020-05-29 20:13:10 +02:00
|
|
|
}
|