remove api stubs

This commit is contained in:
Ellpeck 2020-03-29 21:10:31 +02:00
parent b40bed2447
commit d47520f8cf
3 changed files with 5 additions and 188 deletions

View file

@ -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<IWorldData> 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();

View file

@ -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<Tuple<Vec3d, Integer>> 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<BlockPos, Integer> 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;
}
}

View file

@ -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<BlockPos, Matcher, Boolean> 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<BlockPos, Matcher> 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];
}
}