use of WayofTime.bloodmagic.ritual.RitualComponent in project BloodMagic by WayofTime.
the class ClientHandler method renderRitualStones.
public static void renderRitualStones(TileMasterRitualStone masterRitualStone, float partialTicks) {
EntityPlayerSP player = minecraft.player;
World world = player.getEntityWorld();
EnumFacing direction = mrsHoloDirection;
Ritual ritual = mrsHoloRitual;
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.5F);
BlockPos vec3, vX;
vec3 = masterRitualStone.getPos();
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.RitualComponent in project BloodMagic by WayofTime.
the class ItemRitualDiviner method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
if (!stack.hasTagCompound())
return;
Ritual ritual = RitualRegistry.getRitualForId(this.getCurrentRitual(stack));
if (ritual != null) {
tooltip.add(TextHelper.localize("tooltip.bloodmagic.diviner.currentRitual") + TextHelper.localize(ritual.getUnlocalizedName()));
boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
boolean extraInfo = sneaking && Keyboard.isKeyDown(Keyboard.KEY_M);
if (extraInfo) {
tooltip.add("");
for (EnumDemonWillType type : EnumDemonWillType.values()) {
if (TextHelper.canTranslate(ritual.getUnlocalizedName() + "." + type.getName().toLowerCase() + ".info")) {
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect(ritual.getUnlocalizedName() + "." + type.getName().toLowerCase() + ".info"))));
}
}
} else if (sneaking) {
tooltip.add(TextHelper.localize(tooltipBase + "currentDirection", Utils.toFancyCasing(getDirection(stack).getName())));
tooltip.add("");
List<RitualComponent> components = Lists.newArrayList();
ritual.gatherComponents(components::add);
int blankRunes = 0;
int airRunes = 0;
int waterRunes = 0;
int fireRunes = 0;
int earthRunes = 0;
int duskRunes = 0;
int dawnRunes = 0;
int totalRunes = components.size();
for (RitualComponent component : components) {
switch(component.getRuneType()) {
case BLANK:
blankRunes++;
break;
case AIR:
airRunes++;
break;
case EARTH:
earthRunes++;
break;
case FIRE:
fireRunes++;
break;
case WATER:
waterRunes++;
break;
case DUSK:
duskRunes++;
break;
case DAWN:
dawnRunes++;
break;
}
}
if (blankRunes > 0)
tooltip.add(EnumRuneType.BLANK.colorCode + TextHelper.localize(tooltipBase + "blankRune", blankRunes));
if (waterRunes > 0)
tooltip.add(EnumRuneType.WATER.colorCode + TextHelper.localize(tooltipBase + "waterRune", waterRunes));
if (airRunes > 0)
tooltip.add(EnumRuneType.AIR.colorCode + TextHelper.localize(tooltipBase + "airRune", airRunes));
if (fireRunes > 0)
tooltip.add(EnumRuneType.FIRE.colorCode + TextHelper.localize(tooltipBase + "fireRune", fireRunes));
if (earthRunes > 0)
tooltip.add(EnumRuneType.EARTH.colorCode + TextHelper.localize(tooltipBase + "earthRune", earthRunes));
if (duskRunes > 0)
tooltip.add(EnumRuneType.DUSK.colorCode + TextHelper.localize(tooltipBase + "duskRune", duskRunes));
if (dawnRunes > 0)
tooltip.add(EnumRuneType.DAWN.colorCode + TextHelper.localize(tooltipBase + "dawnRune", dawnRunes));
tooltip.add("");
tooltip.add(TextHelper.localize(tooltipBase + "totalRune", totalRunes));
} else {
tooltip.add("");
if (TextHelper.canTranslate(ritual.getUnlocalizedName() + ".info")) {
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect(ritual.getUnlocalizedName() + ".info"))));
tooltip.add("");
}
tooltip.add(TextHelper.localizeEffect(tooltipBase + "extraInfo"));
tooltip.add(TextHelper.localizeEffect(tooltipBase + "extraExtraInfo"));
}
}
}
use of WayofTime.bloodmagic.ritual.RitualComponent in project BloodMagic by WayofTime.
the class ItemRitualDiviner method addRuneToRitual.
/**
* Adds a single rune to the ritual.
*
* @param stack - The Ritual Diviner stack
* @param world - The World
* @param pos - Block Position of the MRS.
* @param player - The Player attempting to place the ritual
* @return - True if a rune was successfully added
*/
public boolean addRuneToRitual(ItemStack stack, World world, BlockPos pos, EntityPlayer player) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileMasterRitualStone) {
Ritual ritual = RitualRegistry.getRitualForId(this.getCurrentRitual(stack));
if (ritual != null) {
EnumFacing direction = getDirection(stack);
List<RitualComponent> components = Lists.newArrayList();
ritual.gatherComponents(components::add);
for (RitualComponent component : components) {
if (!canPlaceRitualStone(component.getRuneType(), stack)) {
return false;
}
BlockPos offset = component.getOffset(direction);
BlockPos newPos = pos.add(offset);
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (RitualHelper.isRune(world, newPos)) {
if (RitualHelper.isRuneType(world, newPos, component.getRuneType())) {
if (world.isRemote) {
undisplayHologram();
}
} else {
// Replace existing ritual stone
RitualHelper.setRuneType(world, newPos, component.getRuneType());
return true;
}
} else if (block.isAir(state, world, newPos) || block.isReplaceable(world, newPos)) {
if (!consumeStone(stack, world, player)) {
return false;
}
int meta = component.getRuneType().ordinal();
IBlockState newState = RegistrarBloodMagicBlocks.RITUAL_STONE.getStateFromMeta(meta);
world.setBlockState(newPos, newState);
return true;
} else {
// TODO: Possibly replace the block with a
return false;
// ritual stone
}
}
}
}
return false;
}
use of WayofTime.bloodmagic.ritual.RitualComponent in project BloodMagic by WayofTime.
the class ItemRitualDiviner method canDivinerPerformRitual.
public boolean canDivinerPerformRitual(ItemStack stack, Ritual ritual) {
if (ritual == null) {
return false;
}
List<RitualComponent> components = Lists.newArrayList();
ritual.gatherComponents(components::add);
for (RitualComponent component : components) {
if (!canPlaceRitualStone(component.getRuneType(), stack)) {
return false;
}
}
return true;
}
use of WayofTime.bloodmagic.ritual.RitualComponent 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