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:
parent
d67ed054ff
commit
f8c734bc96
14 changed files with 125 additions and 143 deletions
|
@ -1,11 +0,0 @@
|
|||
package WayofTime.bloodmagic.apibutnotreally.incense;
|
||||
|
||||
public enum EnumTranquilityType {
|
||||
PLANT(),
|
||||
CROP(),
|
||||
TREE(),
|
||||
EARTHEN(),
|
||||
WATER(),
|
||||
FIRE(),
|
||||
LAVA();
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue