Unicopia/src/main/java/com/minelittlepony/unicopia/InteractionManager.java

49 lines
1.5 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia;
2020-01-27 11:05:22 +01:00
2021-08-04 15:38:03 +02:00
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
2020-01-27 11:05:22 +01:00
import com.minelittlepony.unicopia.entity.player.dummy.DummyPlayerEntity;
import com.minelittlepony.unicopia.entity.player.dummy.DummyServerPlayerEntity;
2020-01-27 11:05:22 +01:00
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.world.ServerWorld;
public class InteractionManager {
2020-04-24 15:23:36 +02:00
public static InteractionManager INSTANCE = new InteractionManager();
2020-01-27 11:05:22 +01:00
public static InteractionManager instance() {
2020-04-24 15:23:36 +02:00
return INSTANCE;
2020-01-27 11:05:22 +01:00
}
/**
* Returns true on the client if the passed in player entity is the client's player.
* Always returns false on the server.
*/
2020-01-27 11:05:22 +01:00
public boolean isClientPlayer(@Nullable PlayerEntity player) {
return false;
}
/**
* The player's camera mode. Always 0 on the server.
*/
2020-01-27 11:05:22 +01:00
public int getViewMode() {
return 0;
}
/**
* Side-independent method to create a new player.
*
* Returns an implementation of PlayerEntity appropriate to the side being called on.
*/
2021-08-04 15:38:03 +02:00
@NotNull
2020-01-27 11:05:22 +01:00
public PlayerEntity createPlayer(Entity observer, GameProfile profile) {
if (observer.world instanceof ServerWorld) {
return new DummyServerPlayerEntity((ServerWorld)observer.world, profile);
}
return new DummyPlayerEntity(observer.world, profile);
}
}