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());
}
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();
}
Aggregations