More rituals

More rituals

Comment out unimplemented portion

some thing useful

Renamed to something more useful
This commit is contained in:
Arcaratus 2016-01-11 18:07:06 -05:00
parent 9950b32d53
commit 203a48d526
14 changed files with 886 additions and 27 deletions

View file

@ -28,8 +28,8 @@ public abstract class AreaDescriptor
private BlockPos minimumOffset;
private BlockPos maximumOffset; // Non-inclusive maximum offset.
private ArrayList<BlockPos> blockPosCache = new ArrayList<BlockPos>();
private BlockPos cachedPosition = new BlockPos(0, 0, 0);
private ArrayList<BlockPos> blockPosCache;
private BlockPos cachedPosition;
private boolean cache = true;
@ -122,4 +122,92 @@ public abstract class AreaDescriptor
return x >= minimumOffset.getX() && x < maximumOffset.getX() && y >= minimumOffset.getY() && y < maximumOffset.getY() && z >= minimumOffset.getZ() && z < maximumOffset.getZ();
}
}
public static class HemiSphere extends AreaDescriptor
{
private BlockPos minimumOffset;
private int radius;
private ArrayList<BlockPos> blockPosCache;
private BlockPos cachedPosition;
private boolean cache = true;
public HemiSphere(BlockPos minimumOffset, int radius)
{
setRadius(minimumOffset, radius);
}
public void setRadius(BlockPos minimumOffset, int radius)
{
this.minimumOffset = new BlockPos(Math.min(minimumOffset.getX(), minimumOffset.getX()), Math.min(minimumOffset.getY(), minimumOffset.getY()), Math.min(minimumOffset.getZ(), minimumOffset.getZ()));
this.radius = radius;
blockPosCache = new ArrayList<BlockPos>();
}
@Override
public List<BlockPos> getContainedPositions(BlockPos pos)
{
if (!cache || !pos.equals(cachedPosition) || blockPosCache.isEmpty())
{
ArrayList<BlockPos> posList = new ArrayList<BlockPos>();
int i = -radius;
int j = minimumOffset.getY();
int k = -radius;
//TODO For some reason the bottom of the hemisphere is not going up with the minOffset
while (i <= radius)
{
while (j <= radius)
{
while (k <= radius)
{
if (i * i + j * j + k * k >= (radius + 0.5F) * (radius + 0.5F))
{
k++;
continue;
}
posList.add(pos.add(i, j, k));
k++;
}
k = -radius;
j++;
}
j = minimumOffset.getY();
i++;
}
blockPosCache = posList;
cachedPosition = pos;
}
return Collections.unmodifiableList(blockPosCache);
}
/**
* Since you can't make a box using a sphere, this returns null
*/
@Override
public AxisAlignedBB getAABB(BlockPos pos)
{
return null;
}
@Override
public void resetCache()
{
this.blockPosCache = new ArrayList<BlockPos>();
}
@Override
public boolean isWithinArea(BlockPos pos)
{
return blockPosCache.contains(pos);
}
}
}

View file

@ -143,32 +143,37 @@ public abstract class Ritual
*/
public abstract ArrayList<RitualComponent> getComponents();
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune)
public void addRune(ArrayList<RitualComponent> components, int offset1, int y, int offset2, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, offset2), rune));
components.add(new RitualComponent(new BlockPos(offset2, y, -offset1), rune));
components.add(new RitualComponent(new BlockPos(-offset1, y, -offset2), rune));
components.add(new RitualComponent(new BlockPos(-offset2, y, -offset1), rune));
}
public void addOffsetRunes(ArrayList<RitualComponent> components, int offset1, int offset2, int y, EnumRuneType rune)
{
addRune(components, offset1, y, offset2, rune);
addRune(components, offset2, y, offset1, rune);
addRune(components, offset1, y, -offset2, rune);
addRune(components, -offset2, y, offset1, rune);
addRune(components, -offset1, y, offset2, rune);
addRune(components, offset2, y, -offset1, rune);
addRune(components, -offset1, y, -offset2, rune);
addRune(components, -offset2, y, -offset1, rune);
}
public void addCornerRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset, y, offset), rune));
components.add(new RitualComponent(new BlockPos(offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, offset), rune));
addRune(components, offset, y, offset, rune);
addRune(components, offset, y, -offset, rune);
addRune(components, -offset, y, -offset, rune);
addRune(components, -offset, y, offset, rune);
}
public void addParallelRunes(ArrayList<RitualComponent> components, int offset, int y, EnumRuneType rune)
{
components.add(new RitualComponent(new BlockPos(offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(-offset, y, 0), rune));
components.add(new RitualComponent(new BlockPos(0, y, -offset), rune));
components.add(new RitualComponent(new BlockPos(0, y, offset), rune));
addRune(components, offset, y, 0, rune);
addRune(components, -offset, y, 0, rune);
addRune(components, 0, y, -offset, rune);
addRune(components, 0, y, offset, rune);
}
public enum BreakType

View file

@ -71,6 +71,10 @@ public class ItemBoundTool extends ItemBindable
EntityPlayer player = (EntityPlayer) entityIn;
setHeldDownCount(stack, Math.min(player.getItemInUseDuration(), chargeTime));
}
// else if (!isSelected)
// {
// //TODO Make it so that if you scroll of while charging, does not show the charge bar
// }
}
protected int getHeldDownCount(ItemStack stack)
@ -200,7 +204,6 @@ public class ItemBoundTool extends ItemBindable
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
if (StatCollector.canTranslate(tooltipBase + "desc"))
tooltip.add(TextHelper.localizeEffect(tooltipBase + "desc"));

View file

@ -1,13 +1,13 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.tile.TileSpectralBlock;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.IFluidBlock;
public class ItemSigilSuppression extends ItemSigilToggleable
{
@ -39,7 +39,7 @@ public class ItemSigilSuppression extends ItemSigilToggleable
BlockPos blockPos = new BlockPos(x + i, y + j, z + k);
Block block = world.getBlockState(blockPos).getBlock();
if (isBlockLiquid(block) && world.getTileEntity(blockPos) == null)
if (Utils.isBlockLiquid(block) && world.getTileEntity(blockPos) == null)
TileSpectralBlock.createSpectralBlock(world, blockPos, refresh);
else
{
@ -52,8 +52,5 @@ public class ItemSigilSuppression extends ItemSigilToggleable
}
}
private boolean isBlockLiquid(Block block)
{
return (block instanceof IFluidBlock || block.getMaterial().isLiquid());
}
}

View file

@ -27,6 +27,12 @@ public class ModRituals
public static Ritual magneticRitual;
public static Ritual crushingRitual;
public static Ritual stomachRitual;
public static Ritual interdictionRitual;
public static Ritual containmentRitual;
public static Ritual speedRitual;
public static Ritual suppressionRitual;
public static Ritual expulsionRitual;
public static Ritual zephyrRitual;
public static ImperfectRitual imperfectNight;
public static ImperfectRitual imperfectRain;
@ -60,6 +66,18 @@ public class ModRituals
RitualRegistry.registerRitual(crushingRitual, crushingRitual.getName());
stomachRitual = new RitualFullStomach();
RitualRegistry.registerRitual(stomachRitual, stomachRitual.getName());
interdictionRitual = new RitualInterdiction();
RitualRegistry.registerRitual(interdictionRitual, interdictionRitual.getName());
containmentRitual = new RitualContainment();
RitualRegistry.registerRitual(containmentRitual, containmentRitual.getName());
speedRitual = new RitualSpeed();
RitualRegistry.registerRitual(speedRitual, speedRitual.getName());
suppressionRitual = new RitualSuppression();
RitualRegistry.registerRitual(suppressionRitual, suppressionRitual.getName());
zephyrRitual = new RitualZephyr();
RitualRegistry.registerRitual(zephyrRitual, zephyrRitual.getName());
expulsionRitual = new RitualExpulsion();
RitualRegistry.registerRitual(expulsionRitual, expulsionRitual.getName());
}
public static void initImperfectRituals()

View file

@ -0,0 +1,84 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualContainment extends Ritual
{
public static final String CONTAINMENT_RANGE = "containmentRange";
public RitualContainment()
{
super("ritualContainment", 0, 2000, "ritual." + Constants.Mod.MODID + ".containmentRitual");
addBlockRange(CONTAINMENT_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-3, 0, -3), 7));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
AreaDescriptor containmentRange = getBlockRange(CONTAINMENT_RANGE);
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, containmentRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity instanceof EntityPlayer && (((EntityPlayer) entity).capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer((EntityPlayer) entity).toString().equals(masterRitualStone.getOwner())))
continue;
double xDif = entity.posX - masterRitualStone.getBlockPos().getX() + 0.5;
double yDif = entity.posY - masterRitualStone.getBlockPos().getY() + 3;
double zDif = entity.posZ - masterRitualStone.getBlockPos().getZ() + 0.5;
entity.setVelocity(-0.05 * xDif, -0.05 * yDif, -0.05 * zDif);
entity.fallDistance = 0;
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 1;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addParallelRunes(components, 1, 0, EnumRuneType.EARTH);
this.addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
this.addParallelRunes(components, 1, 5, EnumRuneType.EARTH);
this.addCornerRunes(components, 2, 5, EnumRuneType.EARTH);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualContainment();
}
}

View file

@ -0,0 +1,272 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RitualExpulsion extends Ritual
{
public static final String EXPULSION_RANGE = "expulsionRange";
public RitualExpulsion()
{
super("ritualExpulsion", 0, 10000, "ritual." + Constants.Mod.MODID + ".expulsionRitual");
addBlockRange(EXPULSION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-12, 0, -12), 25));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
if (masterRitualStone.getWorldObj().isRemote)
return;
AreaDescriptor expulsionRange = getBlockRange(EXPULSION_RANGE);
List<String> allowedNames = new ArrayList<String>();
if (world.getTileEntity(masterRitualStone.getBlockPos().up()) != null && world.getTileEntity(masterRitualStone.getBlockPos().up()) instanceof IInventory)
{
IInventory inventory = (IInventory) world.getTileEntity(masterRitualStone.getBlockPos().up());
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.getItem() instanceof IBindable && !Strings.isNullOrEmpty(BindableHelper.getOwnerName(itemStack)) && !allowedNames.contains(BindableHelper.getOwnerName(itemStack)))
allowedNames.add(BindableHelper.getOwnerName(itemStack));
}
}
final int teleportDistance = 100;
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, expulsionRange.getAABB(masterRitualStone.getBlockPos())))
{
if (player.capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer(player).toString().equals(masterRitualStone.getOwner()) || allowedNames.contains(PlayerHelper.getUUIDFromPlayer(player).toString()))
continue;
if (teleportRandomly(player, teleportDistance))
network.syphon(getRefreshCost() * 1000);
}
allowedNames.clear();
}
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
{
if (entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entityLiving;
if (player.capabilities.isCreativeMode)
return false;
}
double x = entityLiving.posX;
double y = entityLiving.posY;
double z = entityLiving.posZ;
Random rand = new Random();
double randX = x + (rand.nextDouble() - 0.5D) * distance;
double randY = y + (rand.nextInt((int) distance) - (distance) / 2);
double randZ = z + (rand.nextDouble() - 0.5D) * distance;
int i = 0;
while (!teleportTo(entityLiving, randX, randY, randZ, x, y, z) && i < 100)
{
randX = x + (rand.nextDouble() - 0.5D) * distance;
randY = y + (rand.nextInt((int) distance) - (distance) / 2);
randZ = z + (rand.nextDouble() - 0.5D) * distance;
i++;
}
return i >= 100;
}
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ);
boolean flag = false;
int i = MathHelper.floor_double(entityLiving.posX);
int j = MathHelper.floor_double(entityLiving.posY);
int k = MathHelper.floor_double(entityLiving.posZ);
int l;
if (!entityLiving.worldObj.isAirBlock(new BlockPos(i, j, k)))
{
boolean flag1 = false;
while (!flag1 && j > 0)
{
Block block = entityLiving.worldObj.getBlockState(new BlockPos(i, j - 1, k)).getBlock();
if (block != null && block.getMaterial().blocksMovement())
{
flag1 = true;
}
else
{
--entityLiving.posY;
--j;
}
}
if (flag1)
{
moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.getEntityBoundingBox()).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.getEntityBoundingBox()))
{
flag = true;
}
}
}
if (!flag)
{
moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ);
return false;
}
else
{
for (l = 0; l < 128; ++l)
{
double lengthVal = (double) l / ((double) 128 - 1.0D);
float randF1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float randF2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float randF3 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
double lengthValX = lastX + (entityLiving.posX - lastX) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double lengthValY = lastY + (entityLiving.posY - lastY) * lengthVal + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height;
double lengthValZ = lastZ + (entityLiving.posZ - lastZ) * lengthVal + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle(EnumParticleTypes.PORTAL, lengthValX, lengthValY, lengthValZ, (double) randF1, (double) randF2, (double) randF3);
}
return true;
}
}
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z)
{
if (entityLiving != null && entityLiving instanceof EntityPlayer)
{
if (entityLiving instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
if (entityplayermp.worldObj == entityLiving.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event))
{
if (entityLiving.isRiding())
{
entityLiving.mountEntity(null);
}
entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
}
}
}
}
else if (entityLiving != null)
{
entityLiving.setPosition(x, y, z);
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 2;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
this.addRune(components, 2, 0, 1, EnumRuneType.EARTH);
this.addRune(components, 1, 0, 2, EnumRuneType.EARTH);
this.addRune(components, 2, 0, -1, EnumRuneType.EARTH);
this.addRune(components, -1, 0, 2, EnumRuneType.EARTH);
this.addRune(components, -2, 0, 1, EnumRuneType.EARTH);
this.addRune(components, 1, 0, -2, EnumRuneType.EARTH);
this.addRune(components, -2, 0, -1, EnumRuneType.EARTH);
this.addRune(components, -1, 0, -2, EnumRuneType.EARTH);
this.addRune(components, 4, 0, 2, EnumRuneType.AIR);
this.addRune(components, 5, 0, 2, EnumRuneType.AIR);
this.addRune(components, 4, 0, -2, EnumRuneType.AIR);
this.addRune(components, 5, 0, -2, EnumRuneType.AIR);
this.addRune(components, -4, 0, 2, EnumRuneType.AIR);
this.addRune(components, -5, 0, 2, EnumRuneType.AIR);
this.addRune(components, -4, 0, -2, EnumRuneType.AIR);
this.addRune(components, -5, 0, -2, EnumRuneType.AIR);
this.addRune(components, 2, 0, 4, EnumRuneType.AIR);
this.addRune(components, 2, 0, 5, EnumRuneType.AIR);
this.addRune(components, -2, 0, 4, EnumRuneType.AIR);
this.addRune(components, -2, 0, 5, EnumRuneType.AIR);
this.addRune(components, 2, 0, -4, EnumRuneType.AIR);
this.addRune(components, 2, 0, -5, EnumRuneType.AIR);
this.addRune(components, -2, 0, -4, EnumRuneType.AIR);
this.addRune(components, -2, 0, -5, EnumRuneType.AIR);
this.addParallelRunes(components, 5, 0, EnumRuneType.DUSK);
this.addParallelRunes(components, 6, 0, EnumRuneType.EARTH);
this.addRune(components, -6, 0, 1, EnumRuneType.DUSK);
this.addRune(components, -6, 0, -1, EnumRuneType.DUSK);
this.addRune(components, 6, 0, 1, EnumRuneType.DUSK);
this.addRune(components, 6, 0, -1, EnumRuneType.DUSK);
this.addRune(components, 1, 0, 6, EnumRuneType.DUSK);
this.addRune(components, -1, 0, 6, EnumRuneType.DUSK);
this.addRune(components, 1, 0, -6, EnumRuneType.DUSK);
this.addRune(components, -1, 0, -6, EnumRuneType.DUSK);
this.addCornerRunes(components, 4, 0, EnumRuneType.FIRE);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualExpulsion();
}
}

View file

@ -0,0 +1,82 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualInterdiction extends Ritual
{
public static final String INTERDICTION_RANGE = "interdictionRange";
public RitualInterdiction()
{
super("ritualInterdiction", 0, 1000, "ritual." + Constants.Mod.MODID + ".interdictionRitual");
addBlockRange(INTERDICTION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 0, -2), 5));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
AreaDescriptor interdictionRange = getBlockRange(INTERDICTION_RANGE);
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, interdictionRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity instanceof EntityPlayer && (((EntityPlayer) entity).capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer((EntityPlayer) entity).toString().equals(masterRitualStone.getOwner())))
continue;
double xDif = entity.posX - masterRitualStone.getBlockPos().getX();
double yDif = entity.posY - masterRitualStone.getBlockPos().getY() + 1;
double zDif = entity.posZ - masterRitualStone.getBlockPos().getZ();
entity.setVelocity(0.1 * xDif, 0.1 * yDif, 0.1 * zDif);
entity.fallDistance = 0;
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 1;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 1, 0, EnumRuneType.AIR);
this.addParallelRunes(components, 1, 0, EnumRuneType.AIR);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualInterdiction();
}
}

View file

@ -61,8 +61,6 @@ public class RitualJumping extends Ritual
((EntityPlayerMP) entity).fallDistance = 0;
if (entity.isSneaking())
continue;
// TODO Packet handlers if needed
// BloodMagicPacketHandler.INSTANCE.sendTo();
((EntityPlayerMP) entity).motionY = motionY;
totalEffects++;
} else

View file

@ -0,0 +1,106 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualSpeed extends Ritual
{
public static final String SPEED_RANGE = "sanicRange";
public RitualSpeed()
{
super("ritualSpeed", 0, 1000, "ritual." + Constants.Mod.MODID + ".speedRitual");
addBlockRange(SPEED_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 1, -2), new BlockPos(2, 5, 2)));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
AreaDescriptor speedRange = getBlockRange(SPEED_RANGE);
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity.isSneaking()) continue;
double motionY = 1.2;
double speed = 3;
EnumFacing direction = masterRitualStone.getDirection();
entity.motionY = motionY;
entity.fallDistance = 0;
switch (direction)
{
case NORTH:
entity.setVelocity(0, motionY, -speed);
break;
case SOUTH:
entity.setVelocity(0, motionY, speed);
break;
case WEST:
entity.setVelocity(-speed, motionY, 0);
break;
case EAST:
entity.setVelocity(speed, motionY, 0);
break;
}
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 5;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addRune(components, 0, 0, -2, EnumRuneType.DUSK);
this.addRune(components, 1, 0, -1, EnumRuneType.AIR);
this.addRune(components, -1, 0, -1, EnumRuneType.AIR);
for (int i = 0; i < 2; i++)
{
this.addRune(components, 2, 0, i, EnumRuneType.AIR);
this.addRune(components, -2, 0, i, EnumRuneType.AIR);
}
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualSpeed();
}
}

View file

@ -0,0 +1,92 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.tile.TileSpectralBlock;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualSuppression extends Ritual
{
public static final String SUPPRESSION_RANGE = "suppressionRange";
public RitualSuppression()
{
super("ritualSuppression", 0, 10000, "ritual." + Constants.Mod.MODID + ".suppressionRitual");
addBlockRange(SUPPRESSION_RANGE, new AreaDescriptor.HemiSphere(new BlockPos(0, 0, 0), 10));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
final int refresh = 100;
AreaDescriptor suppressionRange = getBlockRange(SUPPRESSION_RANGE);
for (BlockPos blockPos : suppressionRange.getContainedPositions(masterRitualStone.getBlockPos()))
{
Block block = world.getBlockState(blockPos).getBlock();
if (Utils.isBlockLiquid(block) && world.getTileEntity(blockPos) == null)
TileSpectralBlock.createSpectralBlock(world, blockPos, refresh);
else
{
TileEntity tile = world.getTileEntity(blockPos);
if (tile instanceof TileSpectralBlock)
((TileSpectralBlock) tile).resetDuration(refresh);
}
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 2;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 2, 0, EnumRuneType.WATER);
this.addRune(components, -2, 0, -1, EnumRuneType.AIR);
this.addRune(components, -1, 0, -2, EnumRuneType.AIR);
this.addRune(components, -2, 0, 1, EnumRuneType.AIR);
this.addRune(components, 1, 0, -2, EnumRuneType.AIR);
this.addRune(components, 2, 0, 1, EnumRuneType.AIR);
this.addRune(components, 1, 0, 2, EnumRuneType.AIR);
this.addRune(components, 2, 0, -1, EnumRuneType.AIR);
this.addRune(components, -1, 0, 2, EnumRuneType.AIR);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualSuppression();
}
}

View file

@ -0,0 +1,102 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class RitualZephyr extends Ritual
{
public static final String ZEPHYR_RANGE = "zephyrRange";
public RitualZephyr()
{
super("ritualZephyr", 0, 1000, "ritual." + Constants.Mod.MODID + ".zephyrRitual");
addBlockRange(ZEPHYR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-4, 1, -4), 10));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
TileEntity tileInventory = world.getTileEntity(masterRitualStone.getBlockPos().up());
if (!masterRitualStone.getWorldObj().isRemote && tileInventory != null && tileInventory instanceof IInventory)
{
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
AreaDescriptor zephyrRange = getBlockRange(ZEPHYR_RANGE);
List<EntityItem> itemList = world.getEntitiesWithinAABB(EntityItem.class, zephyrRange.getAABB(masterRitualStone.getBlockPos()));
int count = 0;
if (itemList != null)
{
for (EntityItem entityItem : itemList)
{
ItemStack copyStack = entityItem.getEntityItem().copy();
int originalAmount = copyStack.stackSize;
ItemStack newStack = Utils.insertStackIntoInventory(copyStack, (IInventory) tileInventory, EnumFacing.DOWN);
if (newStack != null && newStack.stackSize < originalAmount)
{
count++;
if (newStack.stackSize <= 0)
entityItem.setDead();
entityItem.getEntityItem().stackSize = newStack.stackSize;
}
}
}
network.syphon(this.getRefreshCost() * Math.min(count, 100));
}
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public int getRefreshCost()
{
return 1;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addParallelRunes(components, 2, 0, EnumRuneType.AIR);
this.addCornerRunes(components, 1, 1, EnumRuneType.AIR);
this.addParallelRunes(components, 1, -1, EnumRuneType.AIR);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualZephyr();
}
}

View file

@ -15,6 +15,7 @@ import net.minecraft.util.EnumFacing;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraftforge.fluids.IFluidBlock;
public class Utils
{
@ -471,4 +472,9 @@ public class Utils
return stack;
}
public static boolean isBlockLiquid(Block block)
{
return (block instanceof IFluidBlock || block.getMaterial().isLiquid());
}
}

View file

@ -267,6 +267,12 @@ ritual.BloodMagic.harvestRitual=Reap of the Harvest Moon
ritual.BloodMagic.magneticRitual=Ritual of Magnetism
ritual.BloodMagic.crushingRitual=Ritual of the Crusher
ritual.BloodMagic.fullStomachRitual=Ritual of the Satiated Stomach
ritual.BloodMagic.interdictionRitual=Ritual of Interdiction
ritual.BloodMagic.containmentRitual=Ritual of Containment
ritual.BloodMagic.speedRitual=Ritual of Speed
ritual.BloodMagic.suppressionRitual=Ritual of Suppression
ritual.BloodMagic.expulsionRitual=Aura of Expulsion
ritual.BloodMagic.zephyrRitual=Call of the Zephyr
# Chat
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d