2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
2020-01-27 11:05:22 +01:00
|
|
|
|
2022-12-30 20:42:18 +01:00
|
|
|
import java.util.Map;
|
2022-10-07 16:52:35 +02:00
|
|
|
import java.util.Optional;
|
|
|
|
|
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
|
|
|
|
2022-10-07 16:52:35 +02:00
|
|
|
import com.minelittlepony.unicopia.ability.magic.CasterView;
|
|
|
|
import com.minelittlepony.unicopia.block.data.Ether;
|
2020-09-22 15:11:20 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.player.dummy.DummyPlayerEntity;
|
2020-01-27 11:05:22 +01:00
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
2022-12-30 20:42:18 +01:00
|
|
|
import net.minecraft.network.PacketByteBuf;
|
2020-01-27 11:05:22 +01:00
|
|
|
import net.minecraft.server.world.ServerWorld;
|
2022-12-30 20:42:18 +01:00
|
|
|
import net.minecraft.util.Identifier;
|
2022-10-07 16:52:35 +02:00
|
|
|
import net.minecraft.world.BlockView;
|
2021-08-18 17:30:59 +02:00
|
|
|
import net.minecraft.world.World;
|
2020-01-27 11:05:22 +01:00
|
|
|
|
2020-01-27 17:37:22 +01:00
|
|
|
public class InteractionManager {
|
2021-08-13 14:46:54 +02:00
|
|
|
public static final int SOUND_EARS_RINGING = 0;
|
|
|
|
public static final int SOUND_CHANGELING_BUZZ = 1;
|
|
|
|
public static final int SOUND_BEE = 2;
|
|
|
|
public static final int SOUND_MINECART = 3;
|
2021-08-18 20:14:22 +02:00
|
|
|
public static final int SOUND_GLIDING = 4;
|
2022-01-11 19:42:50 +01:00
|
|
|
public static final int SOUND_MAGIC_BEAM = 5;
|
2022-12-13 21:32:47 +01:00
|
|
|
public static final int SOUND_HEART_BEAT = 6;
|
2021-08-13 14:46:54 +02:00
|
|
|
|
2021-12-31 23:00:18 +01:00
|
|
|
public static final int SCREEN_DISPELL_ABILITY = 0;
|
|
|
|
|
2020-04-24 15:23:36 +02:00
|
|
|
public static InteractionManager INSTANCE = new InteractionManager();
|
2020-01-27 11:05:22 +01:00
|
|
|
|
2020-01-27 17:37: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
|
|
|
}
|
|
|
|
|
2022-10-07 16:52:35 +02:00
|
|
|
public Optional<CasterView> getCasterView(BlockView view) {
|
|
|
|
if (view instanceof ServerWorld world) {
|
|
|
|
return Optional.of(Ether.get(world));
|
|
|
|
}
|
|
|
|
return Optional.empty();
|
|
|
|
}
|
|
|
|
|
2022-12-30 20:42:18 +01:00
|
|
|
public Map<Identifier, ?> readChapters(PacketByteBuf buf) {
|
|
|
|
throw new RuntimeException("Method not supported");
|
2021-08-13 14:46:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Plays a custom sound instance
|
|
|
|
*/
|
2022-06-25 00:19:55 +02:00
|
|
|
public void playLoopingSound(Entity source, int type, long seed) {
|
2021-08-13 14:46:54 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-23 21:56:57 +02: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;
|
|
|
|
}
|
|
|
|
|
2020-09-23 21:56:57 +02:00
|
|
|
/**
|
|
|
|
* The player's camera mode. Always 0 on the server.
|
|
|
|
*/
|
2020-01-27 11:05:22 +01:00
|
|
|
public int getViewMode() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-12-31 23:00:18 +01:00
|
|
|
public void openScreen(int type) {
|
|
|
|
}
|
|
|
|
|
2020-01-27 11:05:22 +01:00
|
|
|
/**
|
|
|
|
* 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
|
2022-10-13 18:15:21 +02:00
|
|
|
public final PlayerEntity createPlayer(Entity observer, GameProfile profile) {
|
2021-08-18 17:30:59 +02:00
|
|
|
return createPlayer(observer.world, profile);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Side-independent method to create a new player.
|
|
|
|
*
|
|
|
|
* Returns an implementation of PlayerEntity appropriate to the side being called on.
|
|
|
|
*/
|
|
|
|
@NotNull
|
|
|
|
public PlayerEntity createPlayer(World world, GameProfile profile) {
|
|
|
|
return new DummyPlayerEntity(world, profile);
|
2020-01-27 11:05:22 +01:00
|
|
|
}
|
|
|
|
}
|