More rituals
More rituals Comment out unimplemented portion some thing useful Renamed to something more useful
This commit is contained in:
parent
9950b32d53
commit
203a48d526
14 changed files with 886 additions and 27 deletions
102
src/main/java/WayofTime/bloodmagic/ritual/RitualZephyr.java
Normal file
102
src/main/java/WayofTime/bloodmagic/ritual/RitualZephyr.java
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue