Added animal growth ritual.
This commit is contained in:
parent
828edf298e
commit
f379351e88
|
@ -6,6 +6,8 @@ Version 2.0.0-4
|
|||
- Added melee damage upgrade (Fierce strike)
|
||||
- Added trick shot upgrade (Have fun finding it! :D)
|
||||
- Added T5 orb recipe and Demonic Activation Crystal
|
||||
- Added Rituals:
|
||||
- Animal Growth ritual
|
||||
|
||||
------------------------------------------------------
|
||||
Version 2.0.0-3
|
||||
|
|
|
@ -16,6 +16,7 @@ public class ModRituals
|
|||
public static Ritual sufferingRitual;
|
||||
public static Ritual featheredKnifeRitual;
|
||||
public static Ritual regenerationRitual;
|
||||
public static Ritual animalGrowthRitual;
|
||||
|
||||
public static ImperfectRitual imperfectNight;
|
||||
public static ImperfectRitual imperfectRain;
|
||||
|
@ -38,6 +39,8 @@ public class ModRituals
|
|||
RitualRegistry.registerRitual(featheredKnifeRitual, featheredKnifeRitual.getName());
|
||||
regenerationRitual = new RitualRegeneration();
|
||||
RitualRegistry.registerRitual(regenerationRitual, regenerationRitual.getName());
|
||||
animalGrowthRitual = new RitualAnimalGrowth();
|
||||
RitualRegistry.registerRitual(animalGrowthRitual, animalGrowthRitual.getName());
|
||||
}
|
||||
|
||||
public static void initImperfectRituals()
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
|
||||
public class RitualAnimalGrowth extends Ritual
|
||||
{
|
||||
public static final String GROWTH_RANGE = "growing";
|
||||
|
||||
public RitualAnimalGrowth()
|
||||
{
|
||||
super("ritualAnimalGrowth", 0, 10000, "ritual." + Constants.Mod.MODID + ".animalGrowthRitual");
|
||||
addBlockRange(GROWTH_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 1, -2), 5, 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;
|
||||
}
|
||||
|
||||
int maxGrowths = currentEssence / getRefreshCost();
|
||||
int totalGrowths = 0;
|
||||
|
||||
AreaDescriptor growingRange = getBlockRange(GROWTH_RANGE);
|
||||
AxisAlignedBB axis = growingRange.getAABB(masterRitualStone.getBlockPos());
|
||||
List<EntityAgeable> animalList = world.getEntitiesWithinAABB(EntityAgeable.class, axis);
|
||||
|
||||
for (EntityAgeable entity : animalList)
|
||||
{
|
||||
if (entity.getGrowingAge() < 0)
|
||||
{
|
||||
entity.addGrowth(5);
|
||||
totalGrowths++;
|
||||
}
|
||||
|
||||
if (totalGrowths >= maxGrowths)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
network.syphon(totalGrowths * getRefreshCost());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.DUSK);
|
||||
this.addParallelRunes(components, 1, 0, EnumRuneType.WATER);
|
||||
components.add(new RitualComponent(new BlockPos(1, 0, 2), EnumRuneType.EARTH));
|
||||
components.add(new RitualComponent(new BlockPos(1, 0, -2), EnumRuneType.EARTH));
|
||||
components.add(new RitualComponent(new BlockPos(-1, 0, 2), EnumRuneType.EARTH));
|
||||
components.add(new RitualComponent(new BlockPos(-1, 0, -2), EnumRuneType.EARTH));
|
||||
components.add(new RitualComponent(new BlockPos(2, 0, 1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(2, 0, -1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(-2, 0, 1), EnumRuneType.AIR));
|
||||
components.add(new RitualComponent(new BlockPos(-2, 0, -1), EnumRuneType.AIR));
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
return new RitualAnimalGrowth();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue