Added getNewCopy() to Ritual to allow tiles to hold their own copy of a Ritual. Created caching in AreaDescriptor for faster BlockPos access.

This commit is contained in:
WayofTime 2015-12-31 08:01:39 -05:00
parent 69355f76fb
commit d7a96c061d
7 changed files with 72 additions and 14 deletions

View file

@ -30,16 +30,26 @@ public class RitualWater extends Ritual
if (currentEssence < getRefreshCost())
return;
AreaDescriptor lavaRange = getBlockRange(WATER_RANGE);
int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0;
AreaDescriptor waterRange = getBlockRange(WATER_RANGE);
for (BlockPos newPos : lavaRange.getContainedPositions(masterRitualStone.getPos()))
for (BlockPos newPos : waterRange.getContainedPositions(masterRitualStone.getPos()))
{
if (world.isAirBlock(newPos))
{
world.setBlockState(newPos, Blocks.water.getDefaultState());
network.syphon(getRefreshCost());
totalEffects++;
}
if (totalEffects >= maxEffects)
{
break;
}
}
network.syphon(getRefreshCost() * totalEffects);
}
@Override
@ -63,4 +73,10 @@ public class RitualWater extends Ritual
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualWater();
}
}