mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-12-01 00:37:59 +01:00
23 lines
593 B
Java
23 lines
593 B
Java
package com.minelittlepony.unicopia;
|
|
|
|
import net.minecraft.registry.RegistryKey;
|
|
import net.minecraft.registry.entry.RegistryEntry;
|
|
import net.minecraft.world.World;
|
|
|
|
public interface WorldConvertable {
|
|
/**
|
|
* Gets the minecraft world
|
|
*/
|
|
World asWorld();
|
|
|
|
/**
|
|
* Returns true if we're executing on the client.
|
|
*/
|
|
default boolean isClient() {
|
|
return asWorld().isClient();
|
|
}
|
|
|
|
default <T> RegistryEntry<T> entryFor(RegistryKey<T> key) {
|
|
return asWorld().getRegistryManager().get(key.getRegistryRef()).getEntry(key).orElseThrow();
|
|
}
|
|
}
|