Mild work on Crushing :P

This commit is contained in:
WayofTime 2016-07-11 16:47:27 -04:00
parent ffae14c397
commit 12f3d5c6e0
2 changed files with 32 additions and 10 deletions

View file

@ -11,13 +11,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.registry.ModBlocks;
import WayofTime.bloodmagic.util.Utils;
@ -26,6 +28,9 @@ 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 steadfastWillDrain = 0.5;
public RitualCrushing()
{
super("ritualCrushing", 0, 5000, "ritual." + Constants.Mod.MODID + ".crushingRitual");
@ -49,13 +54,18 @@ public class RitualCrushing extends Ritual
return;
}
TileEntity tile = world.getTileEntity(masterRitualStone.getBlockPos().up());
BlockPos pos = masterRitualStone.getBlockPos();
TileEntity tile = world.getTileEntity(pos.up());
List<EnumDemonWillType> willConfig = masterRitualStone.getActiveWillConfig();
double steadfastWill = willConfig.contains(EnumDemonWillType.STEADFAST) ? WorldDemonWillHandler.getCurrentWill(world, pos, EnumDemonWillType.STEADFAST) : 0;
boolean isSilkTouch = steadfastWill >= steadfastWillDrain;
boolean isSilkTouch = false;
int fortune = 0;
AreaDescriptor crushingRange = getBlockRange(CRUSHING_RANGE);
BlockPos pos = masterRitualStone.getBlockPos();
for (BlockPos newPos : crushingRange.getContainedPositions(pos))
{
@ -73,16 +83,29 @@ public class RitualCrushing extends Ritual
if (isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
{
int meta = block.getMetaFromState(state);
ItemStack item = new ItemStack(block, 1, meta);
ItemStack copyStack = ItemStack.copyItemStack(item);
ItemStack checkStack = block.getItem(world, newPos, state);
if (checkStack == null)
{
continue;
}
ItemStack copyStack = checkStack.copy();
if (steadfastWill >= steadfastWillDrain)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastWillDrain, true);
steadfastWill -= steadfastWillDrain;
} else
{
continue;
}
if (tile != null)
Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
copyStack = Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
else
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
if (copyStack.stackSize > 0)
if (copyStack != null && copyStack.stackSize > 0)
{
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
}

View file

@ -486,7 +486,6 @@ ritual.BloodMagic.armourEvolveRitual.info=Undocumented.
ritual.BloodMagic.animalGrowthRitual.info=Increases the maturity rate of baby animals within its range.
ritual.BloodMagic.forsakenSoulRitual.info=Damages mobs within its damage range and when the mob dies a demon crystal within its crystal range will be grown.
ritual.BloodMagic.crystalHarvestRitual.info=Breaks Demon Will crystal clusters within its range, dropping the results on top of the crystals.
ritual.BloodMagic.placerRitual.info=Grabs blocks that are inside of the connected inventory and places them into the world.
ritual.BloodMagic.fellingRitual.info=A standard tree-cutting machine, this ritual will cut down all trees and leaves within its area and collect the drops.
ritual.BloodMagic.pumpRitual.info=Looks around the world and grabs fluids from the defined area. Will only remove and put the fluid into the connected tank if the tank has at least a bucket's worth of the same fluid.