Mild work on Crushing :P
This commit is contained in:
parent
ffae14c397
commit
12f3d5c6e0
|
@ -11,13 +11,15 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
|
||||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
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.api.util.helper.NetworkHelper;
|
||||||
|
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||||
import WayofTime.bloodmagic.util.Utils;
|
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 CRUSHING_RANGE = "crushingRange";
|
||||||
public static final String CHEST_RANGE = "chest";
|
public static final String CHEST_RANGE = "chest";
|
||||||
|
|
||||||
|
public static double rawWillDrain = 0.5;
|
||||||
|
public static double steadfastWillDrain = 0.5;
|
||||||
|
|
||||||
public RitualCrushing()
|
public RitualCrushing()
|
||||||
{
|
{
|
||||||
super("ritualCrushing", 0, 5000, "ritual." + Constants.Mod.MODID + ".crushingRitual");
|
super("ritualCrushing", 0, 5000, "ritual." + Constants.Mod.MODID + ".crushingRitual");
|
||||||
|
@ -49,13 +54,18 @@ public class RitualCrushing extends Ritual
|
||||||
return;
|
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;
|
int fortune = 0;
|
||||||
|
|
||||||
AreaDescriptor crushingRange = getBlockRange(CRUSHING_RANGE);
|
AreaDescriptor crushingRange = getBlockRange(CRUSHING_RANGE);
|
||||||
BlockPos pos = masterRitualStone.getBlockPos();
|
|
||||||
|
|
||||||
for (BlockPos newPos : crushingRange.getContainedPositions(pos))
|
for (BlockPos newPos : crushingRange.getContainedPositions(pos))
|
||||||
{
|
{
|
||||||
|
@ -73,16 +83,29 @@ public class RitualCrushing extends Ritual
|
||||||
|
|
||||||
if (isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
|
if (isSilkTouch && block.canSilkHarvest(world, newPos, state, null))
|
||||||
{
|
{
|
||||||
int meta = block.getMetaFromState(state);
|
ItemStack checkStack = block.getItem(world, newPos, state);
|
||||||
ItemStack item = new ItemStack(block, 1, meta);
|
if (checkStack == null)
|
||||||
ItemStack copyStack = ItemStack.copyItemStack(item);
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack copyStack = checkStack.copy();
|
||||||
|
|
||||||
|
if (steadfastWill >= steadfastWillDrain)
|
||||||
|
{
|
||||||
|
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.STEADFAST, steadfastWillDrain, true);
|
||||||
|
steadfastWill -= steadfastWillDrain;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
|
copyStack = Utils.insertStackIntoTile(copyStack, tile, EnumFacing.DOWN);
|
||||||
else
|
else
|
||||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||||
|
|
||||||
if (copyStack.stackSize > 0)
|
if (copyStack != null && copyStack.stackSize > 0)
|
||||||
{
|
{
|
||||||
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
Utils.spawnStackAtBlock(world, pos, EnumFacing.UP, copyStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.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.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.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.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.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.
|
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.
|
||||||
|
|
Loading…
Reference in a new issue