Search in sources :

Example 1 with ItemRitualDiviner

use of WayofTime.bloodmagic.item.ItemRitualDiviner in project BloodMagic by WayofTime.

the class ClientHandler method render.

@SubscribeEvent
public static void render(RenderWorldLastEvent event) {
    EntityPlayerSP player = minecraft.player;
    World world = player.getEntityWorld();
    if (mrsHoloTile != null) {
        if (world.getTileEntity(mrsHoloTile.getPos()) instanceof TileMasterRitualStone) {
            if (mrsHoloDisplay)
                renderRitualStones(mrsHoloTile, event.getPartialTicks());
            else
                ClientHandler.setRitualHoloToNull();
        } else {
            ClientHandler.setRitualHoloToNull();
        }
    }
    if (minecraft.objectMouseOver == null || minecraft.objectMouseOver.typeOfHit != RayTraceResult.Type.BLOCK)
        return;
    TileEntity tileEntity = world.getTileEntity(minecraft.objectMouseOver.getBlockPos());
    if (tileEntity instanceof TileMasterRitualStone && !player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ItemRitualDiviner)
        renderRitualStones(player, event.getPartialTicks());
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileMasterRitualStone(WayofTime.bloodmagic.tile.TileMasterRitualStone) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) World(net.minecraft.world.World) ItemRitualDiviner(WayofTime.bloodmagic.item.ItemRitualDiviner) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with ItemRitualDiviner

use of WayofTime.bloodmagic.item.ItemRitualDiviner 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)

Aggregations

ItemRitualDiviner (WayofTime.bloodmagic.item.ItemRitualDiviner)2 World (net.minecraft.world.World)2 Ritual (WayofTime.bloodmagic.ritual.Ritual)1 RitualComponent (WayofTime.bloodmagic.ritual.RitualComponent)1 TileMasterRitualStone (WayofTime.bloodmagic.tile.TileMasterRitualStone)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 TileEntity (net.minecraft.tileentity.TileEntity)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1