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
src/main/java/WayofTime/bloodmagic/ritual

View file

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