register stuff with events

This commit is contained in:
dfsek
2022-06-20 21:46:06 -07:00
parent c120ab76d0
commit 13497a02a4
3 changed files with 3 additions and 30 deletions

View File

@@ -50,16 +50,8 @@ public class ForgeEntryPoint {
return TERRA_PLUGIN;
}
public static void register() { // register the things
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.FABRIC_CHUNK_GENERATOR_WRAPPER);
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
}
public ForgeEntryPoint() {
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.FABRIC_CHUNK_GENERATOR_WRAPPER);
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.register(this);
}
@@ -69,6 +61,8 @@ public class ForgeEntryPoint {
logger.info("Loading Terra data...");
LifecycleUtil.initialize();
});
event.register(Registry.CHUNK_GENERATOR_KEY, helper -> helper.register(new Identifier("terra:terra"), Codecs.FABRIC_CHUNK_GENERATOR_WRAPPER));
event.register(Registry.BIOME_SOURCE_KEY, helper -> helper.register(new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE));
event.register(Keys.BLOCKS, helper -> logger.debug("Block registration detected."));
}
}

View File

@@ -1,20 +0,0 @@
package com.dfsek.terra.forge.mixin.lifecycle;
import net.minecraft.util.registry.Registry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.dfsek.terra.forge.ForgeEntryPoint;
// Register Terra things to the builtin registries.
@Mixin(Registry.class)
public class RegistryMixin {
@Inject(method = "<clinit>", at = @At("RETURN"))
private static void registerTerraGenerators(CallbackInfo ci) {
ForgeEntryPoint.register();
}
}

View File

@@ -35,8 +35,7 @@
"implementations.terra.world.ChunkRegionMixin",
"implementations.terra.world.ServerWorldMixin",
"lifecycle.DataPackContentsMixin",
"lifecycle.NoiseConfigMixin",
"lifecycle.RegistryMixin"
"lifecycle.NoiseConfigMixin"
],
"client": [
],