![JAR search and dependency download from the Maven repository](/logo.png)
personthecat.catlib.registry.DynamicRegistries Maven / Gradle / Ivy
package personthecat.catlib.registry;
import java.util.function.Consumer;
import net.minecraft.class_1959;
import net.minecraft.class_2378;
import net.minecraft.class_2874;
import net.minecraft.class_2975;
import net.minecraft.class_5321;
import net.minecraft.class_5455;
import net.minecraft.class_6796;
public class DynamicRegistries {
public static final RegistryHandle BIOMES =
DynamicRegistryHandle.createHandle(class_2378.field_25114);
public static final RegistryHandle DIMENSION_TYPES =
DynamicRegistryHandle.createHandle(class_2378.field_25095);
public static final RegistryHandle> CONFIGURED_FEATURES =
DynamicRegistryHandle.createHandle(class_2378.field_25914);
public static final RegistryHandle PLACED_FEATURES =
DynamicRegistryHandle.createHandle(class_2378.field_35758);
public static void updateRegistries(final class_5455 registries) {
updateRegistry(BIOMES, registries, class_2378.field_25114);
updateRegistry(DIMENSION_TYPES, registries, class_2378.field_25095);
updateRegistry(CONFIGURED_FEATURES, registries, class_2378.field_25914);
updateRegistry(PLACED_FEATURES, registries, class_2378.field_35758);
}
private static void updateRegistry(final RegistryHandle handle,
final class_5455 registries, final class_5321> key) {
((DynamicRegistryHandle) handle).updateRegistry(new MojangRegistryHandle<>(registries.method_30530(key)));
}
public static Consumer>> listen(final RegistryHandle handle, final Object mutex) {
if (handle instanceof DynamicRegistryHandle) {
return consumer -> ((DynamicRegistryHandle) handle).listen(mutex, consumer);
}
return consumer -> {};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy