diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index d1dd9d79..f513372a 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -62,7 +62,6 @@ public final class NaturesAura { } private void preInit(FMLCommonSetupEvent event) { - NaturesAuraAPI.setInstance(new InternalHooks()); Helper.registerCap(IAuraContainer.class); Helper.registerCap(IAuraRecharge.class); Helper.registerCap(IAuraChunk.class); diff --git a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java index cc97d765..5cb34366 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java +++ b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java @@ -20,7 +20,6 @@ import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.DimensionType; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -124,28 +123,24 @@ public final class NaturesAuraAPI { */ @CapabilityInject(IWorldData.class) public static Capability capWorldData; - private static IInternalHooks instance; + private static final IInternalHooks INSTANCE; + + static { + try { + INSTANCE = (IInternalHooks) Class.forName("de.ellpeck.naturesaura.InternalHooks").newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + throw new RuntimeException(e); + } + } /** * This method returns the active {@link IInternalHooks} instance which can - * be used to hook into the mod's internal functionalities.This will be - * overriden to a proper implementation. If you want to use this instance, - * use it after Nature's Aura's preInit phase. + * be used to hook into the mod's internal functionalities. * * @return The active {@link IInternalHooks} instance */ public static IInternalHooks instance() { - return instance; - } - - /** - * This is an internal function. Do not use. - */ - public static void setInstance(IInternalHooks inst) { - if (instance == null) - instance = inst; - else - throw new IllegalStateException(); + return INSTANCE; } /** diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java index bdb99b82..e7cd1110 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java @@ -14,7 +14,7 @@ import java.util.function.BiConsumer; /** * A class whose instances hold information about the aura present in any given * {@link Chunk}. To get an instance for a chunk, use {@link - * #getAuraChunk(World, BlockPos)}. + * #getAuraChunk(IWorld, BlockPos)}. *

* It is not intended for API users to create custom implementation of this * class.