From d47520f8cf631e939d940b12da175cfe94d52da7 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 29 Mar 2020 21:10:31 +0200 Subject: [PATCH] remove api stubs --- .../naturesaura/api/NaturesAuraAPI.java | 13 +-- .../naturesaura/api/internal/StubHooks.java | 98 ------------------- .../api/internal/StubMultiblock.java | 82 ---------------- 3 files changed, 5 insertions(+), 188 deletions(-) delete mode 100644 src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java delete mode 100644 src/main/java/de/ellpeck/naturesaura/api/internal/StubMultiblock.java diff --git a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java index bf9ecaf7..75bb4ad5 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java +++ b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java @@ -8,7 +8,6 @@ import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; import de.ellpeck.naturesaura.api.aura.type.BasicAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import de.ellpeck.naturesaura.api.internal.StubHooks; import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.Matcher; @@ -157,15 +156,13 @@ public final class NaturesAuraAPI { */ @CapabilityInject(IWorldData.class) public static Capability capWorldData; - private static IInternalHooks instance = new StubHooks(); + private static IInternalHooks instance; /** * This method returns the active {@link IInternalHooks} instance which can - * be used to hook into the mod's internal functionalities. This is - * instantiated as {@link StubHooks} by default which has no functionality, - * but, in the mod's preInit phase, 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.This will be + * overriden to a proper implementation. If you want to use this instance, + * use it after Nature's Aura's preInit phase. * * @return The active {@link IInternalHooks} instance */ @@ -177,7 +174,7 @@ public final class NaturesAuraAPI { * This is an internal function. Do not use. */ public static void setInstance(IInternalHooks inst) { - if (instance instanceof StubHooks) + if (instance == null) instance = inst; else throw new IllegalStateException(); diff --git a/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java b/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java deleted file mode 100644 index d1bba219..00000000 --- a/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java +++ /dev/null @@ -1,98 +0,0 @@ -package de.ellpeck.naturesaura.api.internal; - -import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; -import de.ellpeck.naturesaura.api.multiblock.IMultiblock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Tuple; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -import java.util.Collections; -import java.util.List; -import java.util.function.BiConsumer; - -public class StubHooks implements NaturesAuraAPI.IInternalHooks { - @Override - public boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate) { - return false; - } - - @Override - public boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate) { - return false; - } - - @Override - public void spawnMagicParticle(double posX, double posY, double posZ, double motionX, double motionY, double motionZ, int color, float scale, int maxAge, float gravity, boolean collision, boolean fade) { - - } - - @Override - public void spawnParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) { - - } - - @Override - public void setParticleDepth(boolean depth) { - - } - - @Override - public void setParticleSpawnRange(int range) { - - } - - @Override - public void setParticleCulling(boolean cull) { - - } - - @Override - public IMultiblock createMultiblock(ResourceLocation name, String[][] pattern, Object... rawMatchers) { - return new StubMultiblock(); - } - - @Override - public List> getActiveEffectPowders(World world, AxisAlignedBB area, ResourceLocation name) { - return Collections.emptyList(); - } - - @Override - public boolean isEffectPowderActive(World world, BlockPos pos, ResourceLocation name) { - return false; - } - - @Override - public void getAuraSpotsInArea(World world, BlockPos pos, int radius, BiConsumer consumer) { - - } - - @Override - public int getSpotAmountInArea(World world, BlockPos pos, int radius) { - return 0; - } - - @Override - public int getAuraInArea(World world, BlockPos pos, int radius) { - return IAuraChunk.DEFAULT_AURA; - } - - @Override - public int triangulateAuraInArea(World world, BlockPos pos, int radius) { - return IAuraChunk.DEFAULT_AURA; - } - - @Override - public BlockPos getLowestAuraDrainSpot(World world, BlockPos pos, int radius, BlockPos defaultSpot) { - return BlockPos.ZERO; - } - - @Override - public BlockPos getHighestAuraDrainSpot(World world, BlockPos pos, int radius, BlockPos defaultSpot) { - return BlockPos.ZERO; - } -} diff --git a/src/main/java/de/ellpeck/naturesaura/api/internal/StubMultiblock.java b/src/main/java/de/ellpeck/naturesaura/api/internal/StubMultiblock.java deleted file mode 100644 index 670985db..00000000 --- a/src/main/java/de/ellpeck/naturesaura/api/internal/StubMultiblock.java +++ /dev/null @@ -1,82 +0,0 @@ -package de.ellpeck.naturesaura.api.internal; - -import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import de.ellpeck.naturesaura.api.multiblock.IMultiblock; -import de.ellpeck.naturesaura.api.multiblock.Matcher; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IWorld; - -import java.util.Collections; -import java.util.Map; -import java.util.function.BiFunction; - -public class StubMultiblock implements IMultiblock { - - private static final ResourceLocation NAME = new ResourceLocation(NaturesAuraAPI.MOD_ID, "stub"); - - @Override - public boolean isComplete(IWorld world, BlockPos center) { - return false; - } - - @Override - public boolean forEach(BlockPos center, char c, BiFunction function) { - return false; - } - - @Override - public BlockPos getStart(BlockPos center) { - return BlockPos.ZERO; - } - - @Override - public char getChar(BlockPos offset) { - return 0; - } - - @Override - public ResourceLocation getName() { - return NAME; - } - - @Override - public Map getMatchers() { - return Collections.emptyMap(); - } - - @Override - public int getWidth() { - return 0; - } - - @Override - public int getHeight() { - return 0; - } - - @Override - public int getDepth() { - return 0; - } - - @Override - public int getXOffset() { - return 0; - } - - @Override - public int getYOffset() { - return 0; - } - - @Override - public int getZOffset() { - return 0; - } - - @Override - public char[][][] getRawPattern() { - return new char[0][0][0]; - } -}