2022-12-19 18:13:15 +01:00
|
|
|
package com.minelittlepony.unicopia;
|
|
|
|
|
2024-09-28 23:27:46 +02:00
|
|
|
import net.minecraft.registry.RegistryKey;
|
|
|
|
import net.minecraft.registry.entry.RegistryEntry;
|
2022-12-19 18:13:15 +01:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public interface WorldConvertable {
|
|
|
|
/**
|
|
|
|
* Gets the minecraft world
|
|
|
|
*/
|
|
|
|
World asWorld();
|
2022-12-19 19:50:15 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if we're executing on the client.
|
|
|
|
*/
|
|
|
|
default boolean isClient() {
|
|
|
|
return asWorld().isClient();
|
|
|
|
}
|
2024-09-28 23:27:46 +02:00
|
|
|
|
|
|
|
default <T> RegistryEntry<T> entryFor(RegistryKey<T> key) {
|
|
|
|
return asWorld().getRegistryManager().get(key.getRegistryRef()).getEntry(key).orElseThrow();
|
|
|
|
}
|
2022-12-19 18:13:15 +01:00
|
|
|
}
|