Finished most of the Augments for the Ritual of the Shepherd.
This commit is contained in:
parent
d1e6076cca
commit
0419800a86
|
@ -7,6 +7,7 @@ Version 2.1.0-67
|
|||
- Made the Blood Altar respect the new capability system for fluid management.
|
||||
- Finished the Augments for the Ritual of the Feathered Knife.
|
||||
- Finished the Augments for the Ritual of the Crusher.
|
||||
- Finished most of the Augments for the Ritual of the Shepherd.
|
||||
- Changed the Ritual of the Feathered Knife so it respects the Tough Palms Living Armour Upgrade.
|
||||
- Fixed the Ritual of the Feathered Knife so that its health threshold is percent-based.
|
||||
- Made the aspected Sentient Tools drop their corresponding Will type on killing enemies.
|
||||
|
|
|
@ -9,7 +9,9 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -21,6 +23,24 @@ public class MeteorComponent
|
|||
|
||||
public IBlockState getStateFromOre()
|
||||
{
|
||||
if (oreName.contains(":"))
|
||||
{
|
||||
String[] stringList = oreName.split(":");
|
||||
String domain = stringList[0];
|
||||
String block = stringList[1];
|
||||
int meta = 0;
|
||||
if (stringList.length > 2 && Utils.isInteger(stringList[2]))
|
||||
{
|
||||
meta = Integer.parseInt(stringList[2]);
|
||||
}
|
||||
|
||||
Block ore = Block.REGISTRY.getObject(new ResourceLocation(domain, block));
|
||||
if (ore != null)
|
||||
{
|
||||
return ore.getStateFromMeta(meta);
|
||||
}
|
||||
}
|
||||
|
||||
List<ItemStack> list = OreDictionary.getOres(oreName);
|
||||
if (list != null && !list.isEmpty())
|
||||
{
|
||||
|
|
|
@ -128,7 +128,7 @@ public class MeteorConfigHandler
|
|||
diamondMeteorList.add(new MeteorComponent(250, "oreDiamond"));
|
||||
diamondMeteorList.add(new MeteorComponent(180, "oreEmerald"));
|
||||
diamondMeteorList.add(new MeteorComponent(50, "oreRedstone"));
|
||||
diamondMeteorList.add(new MeteorComponent(400, "oreCoal"));
|
||||
diamondMeteorList.add(new MeteorComponent(400, "minecraft:diamond_block"));
|
||||
|
||||
Meteor diamondMeteor = new Meteor(new ItemStack(Blocks.DIAMOND_BLOCK), diamondMeteorList, 10, 3, 1000);
|
||||
goldMeteor.setVersion(3);
|
||||
|
|
|
@ -23,6 +23,7 @@ public class ModPotions
|
|||
|
||||
public static Potion bounce;
|
||||
public static Potion cling;
|
||||
public static Potion sacrificialLamb;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
@ -52,6 +53,7 @@ public class ModPotions
|
|||
deafness = registerPotion("Deaf", new ResourceLocation("deafness"), true, 0x000000, 0, 1);
|
||||
bounce = registerPotion("Bounce", new ResourceLocation("bounce"), false, 0x000000, 1, 1);
|
||||
cling = registerPotion("Cling", new ResourceLocation("cling"), false, 0x000000, 2, 1);
|
||||
sacrificialLamb = registerPotion("S. Lamb", new ResourceLocation("lamb"), false, 0x000000, 3, 1);
|
||||
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
|
||||
// ResourceLocation(resourceLocation +
|
||||
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);
|
||||
|
|
|
@ -1,26 +1,53 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
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.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class RitualAnimalGrowth extends Ritual
|
||||
{
|
||||
public static final double rawWillDrain = 0.05;
|
||||
public static final double vengefulWillDrain = 0.02;
|
||||
public static final double steadfastWillDrain = 0.1;
|
||||
public static final double destructiveWillDrain = 1;
|
||||
|
||||
public static final String GROWTH_RANGE = "growing";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public int refreshTime = 20;
|
||||
public static int defaultRefreshTime = 20;
|
||||
|
||||
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));
|
||||
setMaximumVolumeAndDistanceOfRange(GROWTH_RANGE, 0, 3, 3);
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(GROWTH_RANGE, 0, 7, 7);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,17 +65,108 @@ public class RitualAnimalGrowth extends Ritual
|
|||
|
||||
int maxGrowths = currentEssence / getRefreshCost();
|
||||
int totalGrowths = 0;
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity chest = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
IItemHandler itemHandler = null;
|
||||
if (chest != null)
|
||||
{
|
||||
itemHandler = Utils.getInventory(chest, null);
|
||||
}
|
||||
|
||||
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
|
||||
|
||||
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
|
||||
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
|
||||
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
|
||||
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
|
||||
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
|
||||
|
||||
refreshTime = getRefreshTimeForRawWill(rawWill);
|
||||
|
||||
boolean consumeRawWill = rawWill >= rawWillDrain && refreshTime != defaultRefreshTime;
|
||||
|
||||
double vengefulDrain = 0;
|
||||
double steadfastDrain = 0;
|
||||
double destructiveDrain = 0;
|
||||
|
||||
boolean decreaseBreedTimer = vengefulWill >= vengefulWillDrain;
|
||||
boolean breedAnimals = steadfastWill >= steadfastWillDrain && itemHandler != null;
|
||||
boolean kamikaze = destructiveWill >= destructiveWillDrain;
|
||||
|
||||
AreaDescriptor growingRange = getBlockRange(GROWTH_RANGE);
|
||||
AxisAlignedBB axis = growingRange.getAABB(masterRitualStone.getBlockPos());
|
||||
List<EntityAgeable> animalList = world.getEntitiesWithinAABB(EntityAgeable.class, axis);
|
||||
List<EntityAnimal> animalList = world.getEntitiesWithinAABB(EntityAnimal.class, axis);
|
||||
|
||||
for (EntityAgeable entity : animalList)
|
||||
boolean performedEffect = false;
|
||||
|
||||
for (EntityAnimal animal : animalList)
|
||||
{
|
||||
if (entity.getGrowingAge() < 0)
|
||||
if (animal.getGrowingAge() < 0)
|
||||
{
|
||||
entity.addGrowth(5);
|
||||
animal.addGrowth(5);
|
||||
totalGrowths++;
|
||||
performedEffect = true;
|
||||
} else if (animal.getGrowingAge() > 0)
|
||||
{
|
||||
if (decreaseBreedTimer)
|
||||
{
|
||||
if (vengefulWill >= vengefulWillDrain)
|
||||
{
|
||||
animal.setGrowingAge(Math.max(0, animal.getGrowingAge() - getBreedingDecreaseForWill(vengefulWill)));
|
||||
vengefulDrain += vengefulWillDrain;
|
||||
vengefulWill -= vengefulWillDrain;
|
||||
performedEffect = true;
|
||||
} else
|
||||
{
|
||||
decreaseBreedTimer = false;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (kamikaze)
|
||||
{
|
||||
if (destructiveWill >= destructiveWillDrain)
|
||||
{
|
||||
if (!animal.isPotionActive(ModPotions.sacrificialLamb))
|
||||
{
|
||||
animal.addPotionEffect(new PotionEffect(ModPotions.sacrificialLamb, 1200));
|
||||
destructiveDrain += destructiveWillDrain;
|
||||
destructiveWill -= destructiveWillDrain;
|
||||
performedEffect = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
kamikaze = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (breedAnimals)
|
||||
{
|
||||
if (steadfastWill >= steadfastWillDrain)
|
||||
{
|
||||
if (!animal.isInLove())
|
||||
{
|
||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||
{
|
||||
ItemStack foodStack = itemHandler.getStackInSlot(slot);
|
||||
if (foodStack != null && animal.isBreedingItem(foodStack) && itemHandler.extractItem(slot, 1, true) != null)
|
||||
{
|
||||
animal.setInLove(null);
|
||||
itemHandler.extractItem(slot, 1, false);
|
||||
steadfastDrain += steadfastWillDrain;
|
||||
steadfastWill -= steadfastWillDrain;
|
||||
performedEffect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
breedAnimals = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalGrowths >= maxGrowths)
|
||||
|
@ -57,13 +175,27 @@ public class RitualAnimalGrowth extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
network.syphon(totalGrowths * getRefreshCost());
|
||||
}
|
||||
if (performedEffect && consumeRawWill)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawWillDrain, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return 20;
|
||||
if (vengefulDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
|
||||
}
|
||||
|
||||
if (steadfastDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastDrain, true);
|
||||
}
|
||||
|
||||
if (destructiveDrain > 0)
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
|
||||
}
|
||||
|
||||
network.syphon(totalGrowths * getRefreshCost());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,4 +228,31 @@ public class RitualAnimalGrowth extends Ritual
|
|||
{
|
||||
return new RitualAnimalGrowth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".default.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".vengeful.info") };
|
||||
}
|
||||
|
||||
public int getBreedingDecreaseForWill(double vengefulWill)
|
||||
{
|
||||
return (int) (10 + vengefulWill / 5);
|
||||
}
|
||||
|
||||
public int getRefreshTimeForRawWill(double rawWill)
|
||||
{
|
||||
if (rawWill >= rawWillDrain)
|
||||
{
|
||||
return (int) Math.max(defaultRefreshTime - rawWill / 10, 1);
|
||||
}
|
||||
|
||||
return defaultRefreshTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return refreshTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,12 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIAttackMelee;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAITarget;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -228,6 +233,9 @@ public class GenericHandler
|
|||
}
|
||||
}
|
||||
|
||||
private static Map<EntityAnimal, EntityAITarget> targetTaskMap = new HashMap<EntityAnimal, EntityAITarget>();
|
||||
private static Map<EntityAnimal, EntityAIBase> attackTaskMap = new HashMap<EntityAnimal, EntityAIBase>();
|
||||
|
||||
// Handles sending the client the Demon Will Aura updates
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event)
|
||||
|
@ -239,6 +247,34 @@ public class GenericHandler
|
|||
{
|
||||
sendPlayerDemonWillAura((EntityPlayer) entity);
|
||||
}
|
||||
|
||||
if (event.getEntityLiving() instanceof EntityAnimal)
|
||||
{
|
||||
EntityAnimal animal = (EntityAnimal) event.getEntityLiving();
|
||||
if (animal.isPotionActive(ModPotions.sacrificialLamb))
|
||||
{
|
||||
if (!targetTaskMap.containsKey(animal))
|
||||
{
|
||||
EntityAITarget task = new EntityAINearestAttackableTarget<EntityMob>(animal, EntityMob.class, false);
|
||||
EntityAIBase attackTask = new EntityAIAttackMelee(animal, 1.0D, false);
|
||||
animal.targetTasks.addTask(1, task);
|
||||
animal.tasks.addTask(1, attackTask);
|
||||
targetTaskMap.put(animal, task);
|
||||
attackTaskMap.put(animal, attackTask);
|
||||
}
|
||||
|
||||
if (animal.getAttackTarget() != null && animal.getDistanceSqToEntity(animal.getAttackTarget()) < 4)
|
||||
{
|
||||
animal.worldObj.createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(ModPotions.sacrificialLamb).getAmplifier() * 1.5f, false);
|
||||
targetTaskMap.remove(animal);
|
||||
attackTaskMap.remove(animal);
|
||||
}
|
||||
} else if (targetTaskMap.containsKey(animal))
|
||||
{
|
||||
targetTaskMap.remove(animal);
|
||||
attackTaskMap.remove(animal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
|
|
|
@ -641,6 +641,11 @@ ritual.BloodMagic.featheredKnifeRitual.steadfast.info=(Steadfast) Sets the minim
|
|||
ritual.BloodMagic.speedRitual.default.info=(Raw) Increases the velocity caused by the ritual based on total Will.
|
||||
ritual.BloodMagic.speedRitual.vengeful.info=(Vengeful) Prevents adult mobs and players from being transported. Players are transported if paired with Destructive.
|
||||
ritual.BloodMagic.speedRitual.destructive.info=(Destructive) Prevents child mobs and players from being transported. Players are transported if paired with Vengeful.
|
||||
ritual.BloodMagic.animalGrowthRitual.vengeful.info=(Vengeful) Decreases the time it takes for adults to breed again.
|
||||
ritual.BloodMagic.animalGrowthRitual.steadfast.info=(Steadfast) Automatically breeds adults within its area using items in the connected chest.
|
||||
ritual.BloodMagic.animalGrowthRitual.default.info=(Raw) Increases the speed of the ritual based on the total Will in the Aura.
|
||||
ritual.BloodMagic.animalGrowthRitual.destructive.info=(Destructive) Causes adults that have not bred lately to run at mobs and explode.
|
||||
ritual.BloodMagic.animalGrowthRitual.corrosive.info=(Corrosive) Unimplemented.
|
||||
|
||||
ritual.BloodMagic.fullStomachRitual.info=Takes food from the linked chest and fills the player's saturation with it.
|
||||
ritual.BloodMagic.interdictionRitual.info=Pushes all mobs within its area away from the master ritual stone.
|
||||
|
@ -690,6 +695,7 @@ ritual.BloodMagic.expulsionRitual.expulsionRange.info=(Expulsion)
|
|||
ritual.BloodMagic.zephyrRitual.zephyrRange.info=(Suction) Items within this range will be sucked into the linked chest.
|
||||
ritual.BloodMagic.zephyrRitual.chest.info=(Chest) The location of the inventory that the ritual will place the picked up items into.
|
||||
ritual.BloodMagic.animalGrowthRitual.growing.info=(Growth) Animals within this range will grow much faster.
|
||||
ritual.BloodMagic.animalGrowthRitual.chest.info=(Chest) Chest for breeding items if properly augmented.
|
||||
ritual.BloodMagic.forsakenSoulRitual.crystal.info=(Crystal) Demon Crystals in this range receive an increase in growth speed when a mob is killed by the ritual.
|
||||
ritual.BloodMagic.forsakenSoulRitual.damage.info=(Damage) Mobs within this range will be slowly damaged, and when killed will grow the crystals.
|
||||
ritual.BloodMagic.crystalHarvestRitual.crystal.info=(Crystal) All Demon Will crystal clusters have a single crystal broken off, spawning the crystal into the world. If there is only one crystal on the cluster, it will not break it.
|
||||
|
|
Loading…
Reference in a new issue