Search in sources :

Example 6 with Ritual

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);
    }
}
Also used : Ritual(WayofTime.bloodmagic.ritual.Ritual)

Example 7 with Ritual

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();
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing) Ritual(WayofTime.bloodmagic.ritual.Ritual) RitualComponent(WayofTime.bloodmagic.ritual.RitualComponent) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) ItemRitualDiviner(WayofTime.bloodmagic.item.ItemRitualDiviner)

Example 8 with Ritual

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;
}
Also used : Ritual(WayofTime.bloodmagic.ritual.Ritual) RitualComponent(WayofTime.bloodmagic.ritual.RitualComponent) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Ritual (WayofTime.bloodmagic.ritual.Ritual)8 RitualComponent (WayofTime.bloodmagic.ritual.RitualComponent)5 BlockPos (net.minecraft.util.math.BlockPos)4 TileMasterRitualStone (WayofTime.bloodmagic.tile.TileMasterRitualStone)2 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 World (net.minecraft.world.World)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ItemRitualDiviner (WayofTime.bloodmagic.item.ItemRitualDiviner)1 EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)1 List (java.util.List)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 ItemBlock (net.minecraft.item.ItemBlock)1