Move from ForgeRegistries.BIOME
This commit is contained in:
parent
5524b1ef1e
commit
56f613782f
|
@ -58,7 +58,7 @@ public class ArclightServer {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ArclightMod.LOGGER.info("registry.begin");
|
ArclightMod.LOGGER.info("registry.begin");
|
||||||
BukkitRegistry.registerAll();
|
BukkitRegistry.registerAll(console);
|
||||||
org.spigotmc.SpigotConfig.init(new File("./spigot.yml"));
|
org.spigotmc.SpigotConfig.init(new File("./spigot.yml"));
|
||||||
org.spigotmc.SpigotConfig.registerCommands();
|
org.spigotmc.SpigotConfig.registerCommands();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
import net.minecraft.stats.StatType;
|
import net.minecraft.stats.StatType;
|
||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
import net.minecraft.world.effect.MobEffect;
|
import net.minecraft.world.effect.MobEffect;
|
||||||
|
@ -96,7 +97,7 @@ public class BukkitRegistry {
|
||||||
private static final Map<Integer, Art> ART_BY_ID = Unsafe.getStatic(Art.class, "BY_ID");
|
private static final Map<Integer, Art> ART_BY_ID = Unsafe.getStatic(Art.class, "BY_ID");
|
||||||
private static final BiMap<ResourceLocation, Statistic> STATS = HashBiMap.create(Unsafe.getStatic(CraftStatistic.class, "statistics"));
|
private static final BiMap<ResourceLocation, Statistic> STATS = HashBiMap.create(Unsafe.getStatic(CraftStatistic.class, "statistics"));
|
||||||
|
|
||||||
public static void registerAll() {
|
public static void registerAll(DedicatedServer console) {
|
||||||
CrashReportCallables.registerCrashCallable("Arclight Release", ArclightVersion.current()::getReleaseName);
|
CrashReportCallables.registerCrashCallable("Arclight Release", ArclightVersion.current()::getReleaseName);
|
||||||
CrashReportCallables.registerCrashCallable("Arclight", new CraftCrashReport());
|
CrashReportCallables.registerCrashCallable("Arclight", new CraftCrashReport());
|
||||||
loadMaterials();
|
loadMaterials();
|
||||||
|
@ -104,7 +105,7 @@ public class BukkitRegistry {
|
||||||
loadEnchantments();
|
loadEnchantments();
|
||||||
loadEntities();
|
loadEntities();
|
||||||
loadVillagerProfessions();
|
loadVillagerProfessions();
|
||||||
loadBiomes();
|
loadBiomes(console);
|
||||||
loadArts();
|
loadArts();
|
||||||
loadStats();
|
loadStats();
|
||||||
loadCreativeTab();
|
loadCreativeTab();
|
||||||
|
@ -240,13 +241,14 @@ public class BukkitRegistry {
|
||||||
EnumHelper.addEnums(Art.class, newTypes);
|
EnumHelper.addEnums(Art.class, newTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadBiomes() {
|
private static void loadBiomes(DedicatedServer console) {
|
||||||
int i = Biome.values().length;
|
int i = Biome.values().length;
|
||||||
List<Biome> newTypes = new ArrayList<>();
|
List<Biome> newTypes = new ArrayList<>();
|
||||||
Field key = Arrays.stream(Biome.class.getDeclaredFields()).filter(it -> it.getName().equals("key")).findAny().orElse(null);
|
Field key = Arrays.stream(Biome.class.getDeclaredFields()).filter(it -> it.getName().equals("key")).findAny().orElse(null);
|
||||||
long keyOffset = Unsafe.objectFieldOffset(key);
|
long keyOffset = Unsafe.objectFieldOffset(key);
|
||||||
for (net.minecraft.world.level.biome.Biome biome : ForgeRegistries.BIOMES) {
|
var registry = console.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||||
var location = ForgeRegistries.BIOMES.getKey(biome);
|
for (net.minecraft.world.level.biome.Biome biome : registry) {
|
||||||
|
var location = registry.getKey(biome);
|
||||||
String name = ResourceLocationUtil.standardize(location);
|
String name = ResourceLocationUtil.standardize(location);
|
||||||
Biome bukkit;
|
Biome bukkit;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user