2020-01-18 20:00:24 +00:00
|
|
|
package party._2a03.mc.mixin;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
|
|
import party._2a03.mc.server.Config;
|
|
|
|
import party._2a03.mc.server.PlayerPosition;
|
|
|
|
|
|
|
|
@Mixin(ServerPlayerEntity.class)
|
|
|
|
public abstract class MixinServerPlayerEntity extends PlayerEntity {
|
|
|
|
public MixinServerPlayerEntity() {
|
|
|
|
super(null, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Inject(method = "moveToSpawn", at = @At("HEAD"), cancellable = true)
|
|
|
|
private void OnServerPlayerSpawn(CallbackInfo ci) {
|
|
|
|
PlayerPosition position = new PlayerPosition(Config.getData("spawn"));
|
|
|
|
if (position.dimensiontype == this.dimension) {
|
2020-05-29 07:26:18 +00:00
|
|
|
this.updatePositionAndAngles(position.x, position.y, position.z, position.yaw, position.pitch);
|
2020-01-18 20:00:24 +00:00
|
|
|
ci.cancel();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|