Finished the Augments for the Ritual of the Crusher.

This commit is contained in:
WayofTime 2016-11-03 10:52:14 -04:00
parent 655c2880dc
commit da4de55c2e
6 changed files with 206 additions and 10 deletions

View file

@ -6,6 +6,7 @@ Version 2.1.0-67
- Implemented a new model for the Blood Altar to be more in-line with the rest of the mod (Thanks, wiiv!)
- 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.
- 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.

View file

@ -1,13 +1,20 @@
package WayofTime.bloodmagic.api.compress;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.util.Utils;
/**
* A registry aimed to help compress items in an inventory into its compressible
* form.
@ -49,6 +56,45 @@ public class CompressionRegistry
return null;
}
public static Pair<ItemStack, Boolean> compressInventory(TileEntity tile, World world)
{
if (tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))
{
IItemHandler itemHandler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
ItemStack[] inventory = new ItemStack[itemHandler.getSlots()]; //THIS MUST NOT BE EDITED!
ItemStack[] copyInventory = new ItemStack[itemHandler.getSlots()];
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
inventory[slot] = itemHandler.extractItem(slot, 64, true);
copyInventory[slot] = ItemStack.copyItemStack(inventory[slot]);
}
for (CompressionHandler handler : compressionRegistry)
{
ItemStack stack = handler.compressInventory(copyInventory, world);
if (stack != null)
{
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
if (inventory[slot] != null && !ItemStack.areItemStacksEqual(inventory[slot], copyInventory[slot]))
{
itemHandler.extractItem(slot, inventory[slot].stackSize, false);
if (copyInventory[slot] != null)
{
itemHandler.insertItem(slot, copyInventory[slot], false);
}
}
}
return Pair.of(Utils.insertStackIntoTile(stack, itemHandler), true);
}
}
}
return Pair.of(null, false);
}
public static int getItemThreshold(ItemStack stack)
{
for (Map.Entry<ItemStack, Integer> entry : thresholdMap.entrySet())

View file

@ -16,7 +16,11 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
import WayofTime.bloodmagic.api.registry.AlchemyTableRecipeRegistry;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
@ -36,13 +40,17 @@ public class RitualCrushing extends Ritual
public static final String CRUSHING_RANGE = "crushingRange";
public static final String CHEST_RANGE = "chest";
public static double rawWillDrain = 0.5;
public static double rawWillDrain = 0.05;
public static double steadfastWillDrain = 0.2;
public static double destructiveWillDrain = 0.2;
public static double vengefulWillDrain = 0.2;
public static Map<ItemStack, Integer> cuttingFluidLPMap = new HashMap<ItemStack, Integer>();
public static Map<ItemStack, Double> cuttingFluidWillMap = new HashMap<ItemStack, Double>();
public int refreshTime = 40;
public static int defaultRefreshTime = 40;
public RitualCrushing()
{
super("ritualCrushing", 0, 5000, "ritual." + Constants.Mod.MODID + ".crushingRitual");
@ -83,9 +91,15 @@ public class RitualCrushing extends Ritual
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;
boolean isSilkTouch = steadfastWill >= steadfastWillDrain;
boolean useCuttingFluid = corrosiveWill > 0;
@ -93,6 +107,9 @@ public class RitualCrushing extends Ritual
int fortune = destructiveWill > 0 ? 3 : 0;
AreaDescriptor crushingRange = getBlockRange(CRUSHING_RANGE);
boolean hasOperated = false;
double rawDrain = 0;
for (BlockPos newPos : crushingRange.getContainedPositions(pos))
{
@ -236,15 +253,52 @@ public class RitualCrushing extends Ritual
world.destroyBlock(newPos, false);
network.syphon(getRefreshCost());
hasOperated = true;
if (consumeRawWill)
{
rawDrain += rawWillDrain;
rawWill -= rawWillDrain;
}
break;
}
if (hasOperated && tile != null && vengefulWill >= vengefulWillDrain)
{
Pair<ItemStack, Boolean> pair = CompressionRegistry.compressInventory(tile, world);
if (pair.getRight())
{
ItemStack returned = pair.getLeft();
if (returned != null)
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, returned);
}
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulWillDrain, true);
}
}
if (rawDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
}
}
public int getRefreshTimeForRawWill(double rawWill)
{
if (rawWill >= rawWillDrain)
{
return Math.max(1, (int) (40 - rawWill / 5));
}
return defaultRefreshTime;
}
@Override
public int getRefreshTime()
{
return 40;
return refreshTime;
}
@Override
@ -269,7 +323,7 @@ public class RitualCrushing extends Ritual
@Override
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
{
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info"), new TextComponentTranslation(this.getUnlocalizedName() + ".destructive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".corrosive.info"), new TextComponentTranslation(this.getUnlocalizedName() + ".steadfast.info") };
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") };
}
@Override

View file

@ -228,7 +228,7 @@ public class RitualGreenGrove extends Ritual
corrosiveDrain += corrosiveWillDrain;
}
if (corrosiveWillDrain > 0)
if (corrosiveDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.CORROSIVE, corrosiveDrain, true);
}

View file

@ -1,26 +1,35 @@
package WayofTime.bloodmagic.ritual;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.saving.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.saving.SoulNetwork;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.util.Utils;
public class RitualSpeed extends Ritual
{
public static final String SPEED_RANGE = "sanicRange";
public static final double vengefulWillDrain = 0.05;
public static final double destructiveWillDrain = 0.05;
public static final double rawWillDrain = 0.1;
public RitualSpeed()
{
super("ritualSpeed", 0, 1000, "ritual." + Constants.Mod.MODID + ".speedRitual");
@ -41,17 +50,67 @@ public class RitualSpeed extends Ritual
return;
}
BlockPos pos = masterRitualStone.getBlockPos();
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
double destructiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DESTRUCTIVE, willConfig);
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
AreaDescriptor speedRange = getBlockRange(SPEED_RANGE);
double vengefulDrain = 0;
double destructiveDrain = 0;
double rawDrain = 0;
if (rawWill < rawWillDrain)
{
rawWill = 0; //Simplifies later calculations
}
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity.isSneaking())
continue;
double motionY = 1.2;
double speed = 3;
boolean transportChildren = destructiveWill < destructiveWillDrain;
boolean transportAdults = vengefulWill < vengefulWillDrain;
if ((entity.isChild() && !transportChildren) || (!entity.isChild() && !transportAdults))
{
continue;
}
if (entity instanceof EntityPlayer && (transportChildren ^ transportAdults))
{
continue;
}
if (!transportChildren)
{
destructiveWill -= destructiveWillDrain;
destructiveDrain += destructiveWillDrain;
}
if (!transportAdults)
{
vengefulWill -= vengefulWillDrain;
vengefulDrain += vengefulWillDrain;
}
double motionY = getVerticalSpeedForWill(rawWill);
double speed = getHorizontalSpeedForWill(rawWill);
EnumFacing direction = masterRitualStone.getDirection();
if (rawWill >= rawWillDrain)
{
rawWill -= rawWillDrain;
rawDrain += rawWillDrain;
}
entity.motionY = motionY;
entity.fallDistance = 0;
@ -89,6 +148,21 @@ public class RitualSpeed extends Ritual
Utils.setPlayerSpeedFromServer((EntityPlayer) entity, entity.motionX, entity.motionY, entity.motionZ);
}
}
if (rawDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
}
if (vengefulDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
}
if (destructiveDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DESTRUCTIVE, destructiveDrain, true);
}
}
@Override
@ -125,4 +199,20 @@ public class RitualSpeed extends Ritual
{
return new RitualSpeed();
}
@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 double getVerticalSpeedForWill(double rawWill)
{
return 1.2 + rawWill / 200;
}
public double getHorizontalSpeedForWill(double rawWill)
{
return 3 + rawWill / 40;
}
}

View file

@ -626,6 +626,8 @@ ritual.BloodMagic.crushingRitual.info=Breaks blocks within its crushing range an
ritual.BloodMagic.crushingRitual.destructive.info=(Destructive) Blocks are broken down forcefully: all blocks broken are affected by Fortune III.
ritual.BloodMagic.crushingRitual.steadfast.info=(Steadfast) Causes all blocks that are broken to be picked up with silk touch. Overrides Fortune where applicable.
ritual.BloodMagic.crushingRitual.corrosive.info=(Corrosive) All blocks are broken to be processed with a form of cutting fluid. Overrides Silk Touch where applicable.
ritual.BloodMagic.crushingRitual.vengeful.info=(Vengeful) Compresses the inventory on successful opperation. Currently only does one compression per operation.
ritual.BloodMagic.crushingRitual.default.info=(Raw) Increases the speed of the ritual based on total Will.
ritual.BloodMagic.greenGroveRitual.corrosive.info=(Corrosive) Entities within range are attacked by nearby plants, leeching away their life.
ritual.BloodMagic.greenGroveRitual.default.info=(Raw) Increases the speed of all of the ritual operations depending on the total Will in the Aura.
ritual.BloodMagic.greenGroveRitual.vengeful.info=(Vengeful) Increases the rate that a growth tick is successful.
@ -636,6 +638,9 @@ ritual.BloodMagic.featheredKnifeRitual.destructive.info=(Destructive) Increases
ritual.BloodMagic.featheredKnifeRitual.vengeful.info=(Vengeful) Sets the minimum health for sacrificing to 10%%. Overridden by Steadfast for the Owner if active.
ritual.BloodMagic.featheredKnifeRitual.corrosive.info=(Corrosive) Uses the player's Incense to increase the yield.
ritual.BloodMagic.featheredKnifeRitual.steadfast.info=(Steadfast) Sets the minimum health for sacrificing from 30%% to 70%%.
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.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.