Added directionality to rituals.

This commit is contained in:
WayofTime 2015-12-29 09:10:03 -05:00
parent 971d4c4d1e
commit 0e1173ef5d
5 changed files with 34 additions and 11 deletions

View file

@ -48,17 +48,30 @@ public class RitualHelper {
* @param direction
* @return The ID of the valid ritual
*/
public static String getValidRitual(World world, BlockPos pos, EnumFacing direction) {
public static String getValidRitual(World world, BlockPos pos) {
for(String key : RitualRegistry.getIds()) {
boolean test = checkValidRitual(world, pos, key, direction);
if(test) {
return key;
for(EnumFacing direction : EnumFacing.HORIZONTALS) {
boolean test = checkValidRitual(world, pos, key, direction);
if(test) {
return key;
}
}
}
return "";
}
public static EnumFacing getDirectionOfRitual(World world, BlockPos pos, String key) {
for(EnumFacing direction : EnumFacing.HORIZONTALS) {
boolean test = checkValidRitual(world, pos, key, direction);
if(test) {
return direction;
}
}
return null;
}
public static boolean checkValidRitual(World world, BlockPos pos, String ritualId, EnumFacing direction) {
Ritual ritual = RitualRegistry.getRitualForId(ritualId);
if(ritual == null) {
@ -71,7 +84,7 @@ public class RitualHelper {
return false;
for (RitualComponent component : components) {
BlockPos newPos = pos.add(component.getOffset());
BlockPos newPos = pos.add(component.getOffset(direction));
IBlockState worldState = world.getBlockState(newPos);
Block block = worldState.getBlock();
if (block instanceof BlockRitualStone) {