use of WayofTime.bloodmagic.ritual.Ritual in project BloodMagic by WayofTime.
the class ItemRitualDiviner method cycleRitualBackwards.
/**
* Does the same as cycleRitual but instead cycles backwards.
*
* @param stack
* @param player
*/
public void cycleRitualBackwards(ItemStack stack, EntityPlayer player) {
String key = getCurrentRitual(stack);
List<String> idList = RitualRegistry.getOrderedIds();
String firstId = "";
boolean foundId = false;
boolean foundFirst = false;
for (int i = idList.size() - 1; i >= 0; i--) {
String str = idList.get(i);
Ritual ritual = RitualRegistry.getRitualForId(str);
if (!RitualRegistry.ritualEnabled(ritual) || !canDivinerPerformRitual(stack, ritual)) {
continue;
}
if (!foundFirst) {
firstId = str;
foundFirst = true;
}
if (foundId) {
setCurrentRitual(stack, str);
notifyRitualChange(str, player);
return;
} else {
if (str.equals(key)) {
foundId = true;
continue;
}
}
}
if (foundFirst) {
setCurrentRitual(stack, firstId);
notifyRitualChange(firstId, player);
}
}
use of WayofTime.bloodmagic.ritual.Ritual in project BloodMagic by WayofTime.
the class ClientHandler method renderRitualStones.
private static void renderRitualStones(EntityPlayerSP player, float partialTicks) {
World world = player.getEntityWorld();
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
EnumFacing direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
Ritual ritual = RitualRegistry.getRitualForId(ritualDiviner.getCurrentRitual(player.inventory.getCurrentItem()));
if (ritual == null)
return;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 0.6125F);
BlockPos vec3, vX;
vec3 = minecraft.objectMouseOver.getBlockPos();
double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
List<RitualComponent> components = Lists.newArrayList();
ritual.gatherComponents(components::add);
for (RitualComponent ritualComponent : components) {
vX = vec3.add(ritualComponent.getOffset(direction));
double minX = vX.getX() - posX;
double minY = vX.getY() - posY;
double minZ = vX.getZ() - posZ;
if (!world.getBlockState(vX).isOpaqueCube()) {
TextureAtlasSprite texture = null;
switch(ritualComponent.getRuneType()) {
case BLANK:
texture = ritualStoneBlank;
break;
case WATER:
texture = ritualStoneWater;
break;
case FIRE:
texture = ritualStoneFire;
break;
case EARTH:
texture = ritualStoneEarth;
break;
case AIR:
texture = ritualStoneAir;
break;
case DAWN:
texture = ritualStoneDawn;
break;
case DUSK:
texture = ritualStoneDusk;
break;
}
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ);
}
}
GlStateManager.popMatrix();
}
use of WayofTime.bloodmagic.ritual.Ritual in project BloodMagic by WayofTime.
the class RitualHelper method checkValidRitual.
public static boolean checkValidRitual(World world, BlockPos pos, String ritualId, EnumFacing direction) {
Ritual ritual = RitualRegistry.getRitualForId(ritualId);
if (ritual == null) {
return false;
}
List<RitualComponent> components = Lists.newArrayList();
ritual.gatherComponents(components::add);
for (RitualComponent component : components) {
BlockPos newPos = pos.add(component.getOffset(direction));
if (isRuneType(world, newPos, component.getRuneType())) {
continue;
} else {
return false;
}
}
return true;
}
Aggregations