2020-04-25 13:32:33 +02:00
|
|
|
package com.minelittlepony.unicopia.client;
|
|
|
|
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.InteractionManager;
|
2020-09-22 15:11:20 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
|
|
|
import com.minelittlepony.unicopia.entity.player.dummy.DummyClientPlayerEntity;
|
2020-04-25 13:32:33 +02:00
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
|
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
|
|
import net.minecraft.client.world.ClientWorld;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
|
|
|
|
public class ClientInteractionManager extends InteractionManager {
|
|
|
|
@Override
|
|
|
|
@Nonnull
|
|
|
|
public PlayerEntity createPlayer(Entity observer, GameProfile profile) {
|
|
|
|
if (observer.world instanceof ClientWorld) {
|
|
|
|
return new DummyClientPlayerEntity((ClientWorld)observer.world, profile);
|
|
|
|
}
|
|
|
|
return super.createPlayer(observer, profile);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isClientPlayer(@Nullable PlayerEntity player) {
|
2020-09-23 21:56:57 +02:00
|
|
|
return (MinecraftClient.getInstance().player != null && player != null)
|
|
|
|
&& (MinecraftClient.getInstance().player == player
|
|
|
|
|| Pony.equal(MinecraftClient.getInstance().player, player));
|
2020-04-25 13:32:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getViewMode() {
|
2020-09-22 15:11:20 +02:00
|
|
|
return MinecraftClient.getInstance().options.getPerspective().ordinal();
|
2020-04-25 13:32:33 +02:00
|
|
|
}
|
|
|
|
}
|