Implemented new Tranquility value API

For quick compat, mods can now register a static state-based tranquility
value for their blocks. More
This commit is contained in:
Nicholas Ignoffo 2018-02-06 21:24:40 -08:00
parent d67ed054ff
commit f8c734bc96
14 changed files with 125 additions and 143 deletions

View file

@ -1,11 +0,0 @@
package WayofTime.bloodmagic.apibutnotreally.incense;
public enum EnumTranquilityType {
PLANT(),
CROP(),
TREE(),
EARTHEN(),
WATER(),
FIRE(),
LAVA();
}

View file

@ -1,14 +0,0 @@
package WayofTime.bloodmagic.apibutnotreally.incense;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IIncensePath {
/**
* Goes from 0 to however far this path block can be from the altar while
* still functioning. 0 represents a block that can work when it is two
* blocks horizontally away from the altar.
*/
int getLevelOfPath(World world, BlockPos pos, IBlockState state);
}

View file

@ -1,10 +0,0 @@
package WayofTime.bloodmagic.apibutnotreally.incense;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface ITranquilityHandler {
TranquilityStack getTranquilityOfBlock(World world, BlockPos pos, Block block, IBlockState state);
}

View file

@ -1,28 +0,0 @@
package WayofTime.bloodmagic.apibutnotreally.incense;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class IncenseTranquilityRegistry {
public static List<ITranquilityHandler> handlerList = new ArrayList<ITranquilityHandler>();
public static void registerTranquilityHandler(ITranquilityHandler handler) {
handlerList.add(handler);
}
public static TranquilityStack getTranquilityOfBlock(World world, BlockPos pos, Block block, IBlockState state) {
for (ITranquilityHandler handler : handlerList) {
TranquilityStack tranq = handler.getTranquilityOfBlock(world, pos, block, state);
if (tranq != null) {
return tranq;
}
}
return null;
}
}

View file

@ -1,11 +0,0 @@
package WayofTime.bloodmagic.apibutnotreally.incense;
public class TranquilityStack {
public final EnumTranquilityType type;
public double value;
public TranquilityStack(EnumTranquilityType type, double value) {
this.type = type;
this.value = value;
}
}