Improve Comments and Readability for AkashicTreeGrower init

This commit is contained in:
gattsuru 2022-07-25 12:55:43 -04:00
parent ffdf675444
commit e677e54313
3 changed files with 12 additions and 2 deletions

View file

@ -26,7 +26,8 @@ public class AkashicTreeGrower extends AbstractTreeGrower {
public static final List<Holder<ConfiguredFeature<TreeConfiguration, ?>>> GROWERS = Lists.newArrayList();
static {
public void RegisterTreeGrowers()
{
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES1, "1"));
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES2, "2"));
GROWERS.add(buildTreeFeature(HexBlocks.AKASHIC_LEAVES3, "3"));

View file

@ -100,7 +100,10 @@ object FabricHexInitializer : ModInitializer {
HexLootFunctions.registerSerializers(bind(Registry.LOOT_FUNCTION_TYPE))
AkashicTreeGrower.INSTANCE
// Because of Java's lazy-loading of classes, can't use Kotlin static initialization for
// any calls that will eventually touch FeatureUtils.register(), as the growers here do,
// unless the class is called in this initialization step.
AkashicTreeGrower.INSTANCE.RegisterTreeGrowers()
// Done with soft implements in forge
val flameOn = FlammableBlockRegistry.getDefaultInstance()

View file

@ -14,6 +14,7 @@ import at.petrak.hexcasting.common.entities.HexEntities;
import at.petrak.hexcasting.common.items.ItemJewelerHammer;
import at.petrak.hexcasting.common.lib.*;
import at.petrak.hexcasting.common.loot.HexLootHandler;
import at.petrak.hexcasting.common.misc.AkashicTreeGrower;
import at.petrak.hexcasting.common.misc.Brainsweeping;
import at.petrak.hexcasting.common.misc.PlayerPositionRecorder;
import at.petrak.hexcasting.common.recipe.HexRecipeSerializers;
@ -104,6 +105,11 @@ public class ForgeHexInitializer {
ArgumentTypes.register(HexAPI.MOD_ID + ":pattern", PatternResLocArgument.class,
new EmptyArgumentSerializer<>(PatternResLocArgument::id));
HexAdvancementTriggers.registerTriggers();
// Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric and Quilt.
// However, all launcher panic if the same resource is registered twice. Explicitly calling here avoids potential
// confusion, or reliance on tricks that may fail under compiler optimization.
AkashicTreeGrower.INSTANCE.RegisterTreeGrowers();
}
// https://github.com/VazkiiMods/Botania/blob/1.18.x/Forge/src/main/java/vazkii/botania/forge/ForgeCommonInitializer.java