Added chest ranges to the rituals that have chests, allowing the location of the chest to be assigned by the player.
This commit is contained in:
parent
9fe525b74b
commit
51c79f15a9
6 changed files with 48 additions and 14 deletions
|
@ -22,11 +22,16 @@ import java.util.List;
|
|||
public class RitualCrushing extends Ritual
|
||||
{
|
||||
public static final String CRUSHING_RANGE = "crushingRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualCrushing()
|
||||
{
|
||||
super("ritualCrushing", 0, 5000, "ritual." + Constants.Mod.MODID + ".crushingRitual");
|
||||
addBlockRange(CRUSHING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-1, -3, -1), 3));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(CRUSHING_RANGE, 50, 10, 10);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,8 +19,8 @@ import java.util.Iterator;
|
|||
|
||||
public class RitualFelling extends Ritual
|
||||
{
|
||||
|
||||
public static final String FELLING_RANGE = "fellingRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
private ArrayList<BlockPos> treePartsCache;
|
||||
private Iterator<BlockPos> blockPosIterator;
|
||||
|
@ -30,8 +30,12 @@ public class RitualFelling extends Ritual
|
|||
|
||||
public RitualFelling()
|
||||
{
|
||||
super("ritualFelling", 0, 500, "ritual." + Constants.Mod.MODID + ".fellingRitual");
|
||||
super("ritualFelling", 0, 20000, "ritual." + Constants.Mod.MODID + ".fellingRitual");
|
||||
addBlockRange(FELLING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -3, -10), new BlockPos(11, 27, 11)));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(FELLING_RANGE, 14000, 15, 30);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
|
||||
treePartsCache = new ArrayList<BlockPos>();
|
||||
}
|
||||
|
@ -43,6 +47,10 @@ public class RitualFelling extends Ritual
|
|||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
|
||||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
network.causeNauseaToPlayer();
|
||||
|
@ -64,11 +72,11 @@ public class RitualFelling extends Ritual
|
|||
blockPosIterator = treePartsCache.iterator();
|
||||
}
|
||||
|
||||
if (blockPosIterator.hasNext() && world.getTileEntity(masterRitualStone.getBlockPos().up()) != null && world.getTileEntity(masterRitualStone.getBlockPos().up()) instanceof IInventory)
|
||||
if (blockPosIterator.hasNext() && tileInventory != null && tileInventory instanceof IInventory)
|
||||
{
|
||||
network.syphon(getRefreshCost());
|
||||
currentPos = blockPosIterator.next();
|
||||
placeInInventory(world.getBlockState(currentPos), world, currentPos, masterRitualStone.getBlockPos().up());
|
||||
placeInInventory(world.getBlockState(currentPos), world, currentPos, chestRange.getContainedPositions(masterPos).get(0));
|
||||
world.setBlockToAir(currentPos);
|
||||
blockPosIterator.remove();
|
||||
}
|
||||
|
|
|
@ -20,11 +20,16 @@ import java.util.List;
|
|||
public class RitualFullStomach extends Ritual
|
||||
{
|
||||
public static final String FILL_RANGE = "fillRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualFullStomach()
|
||||
{
|
||||
super("ritualFullStomach", 0, 100000, "ritual." + Constants.Mod.MODID + ".fullStomachRitual");
|
||||
addBlockRange(FILL_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-25, -25, -25), 51));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(FILL_RANGE, 0, 25, 25);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +44,8 @@ public class RitualFullStomach extends Ritual
|
|||
int maxEffects = currentEssence / getRefreshCost();
|
||||
int totalEffects = 0;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos.up());
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tile = world.getTileEntity(chestRange.getContainedPositions(pos).get(0));
|
||||
if (!(tile instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -19,11 +19,16 @@ import java.util.ArrayList;
|
|||
public class RitualPlacer extends Ritual
|
||||
{
|
||||
public static final String PLACER_RANGE = "placerRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualPlacer()
|
||||
{
|
||||
super("ritualPlacer", 0, 5000, "ritual." + Constants.Mod.MODID + ".placerRitual");
|
||||
addBlockRange(PLACER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 0, -2), 5, 1, 5));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(PLACER_RANGE, 300, 7, 7);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +36,9 @@ public class RitualPlacer extends Ritual
|
|||
{
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
||||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tileEntity = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
|
||||
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
|
||||
|
@ -97,6 +104,7 @@ public class RitualPlacer extends Ritual
|
|||
iInventory.decrStackSize(inv, 1);
|
||||
iInventory.markDirty();
|
||||
network.syphon(getRefreshCost());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,16 @@ import java.util.List;
|
|||
public class RitualZephyr extends Ritual
|
||||
{
|
||||
public static final String ZEPHYR_RANGE = "zephyrRange";
|
||||
public static final String CHEST_RANGE = "chest";
|
||||
|
||||
public RitualZephyr()
|
||||
{
|
||||
super("ritualZephyr", 0, 1000, "ritual." + Constants.Mod.MODID + ".zephyrRitual");
|
||||
addBlockRange(ZEPHYR_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11));
|
||||
addBlockRange(CHEST_RANGE, new AreaDescriptor.Rectangle(new BlockPos(0, 1, 0), 1));
|
||||
|
||||
setMaximumVolumeAndDistanceOfRange(ZEPHYR_RANGE, 0, 10, 10);
|
||||
setMaximumVolumeAndDistanceOfRange(CHEST_RANGE, 1, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +37,9 @@ public class RitualZephyr extends Ritual
|
|||
World world = masterRitualStone.getWorldObj();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
|
||||
int currentEssence = network.getCurrentEssence();
|
||||
TileEntity tileInventory = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
||||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
AreaDescriptor chestRange = getBlockRange(CHEST_RANGE);
|
||||
TileEntity tileInventory = world.getTileEntity(chestRange.getContainedPositions(masterPos).get(0));
|
||||
|
||||
if (!masterRitualStone.getWorldObj().isRemote && tileInventory != null && tileInventory instanceof IInventory)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue