A lot more implementation work for custom areas for rituals.

This commit is contained in:
WayofTime 2016-04-11 15:36:27 -04:00
parent 51c79f15a9
commit 91ddb8b761
13 changed files with 127 additions and 26 deletions

View file

@ -18,6 +18,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
/**
* Abstract class for creating new rituals. Rituals need be registered with
@ -230,9 +231,10 @@ public abstract class Ritual
protected boolean canBlockRangeBeModified(String range, AreaDescriptor descriptor, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
{
int maxVolume = volumeRangeMap.get(range);
int maxVertical = verticalRangeMap.get(range);
int maxHorizontal = horizontalRangeMap.get(range);
List<EnumDemonWillType> willConfig = master.getCurrentActiveWillConfig();
int maxVolume = getMaxVolumeForRange(range, willConfig);
int maxVertical = getMaxVerticalRadiusForRange(range, willConfig);
int maxHorizontal = getMaxHorizontalRadiusForRange(range, willConfig);
return (maxVolume <= 0 || descriptor.getVolumeForOffsets(offset1, offset2) <= maxVolume) && descriptor.isWithinRange(offset1, offset2, maxVertical, maxHorizontal);
}
@ -244,6 +246,26 @@ public abstract class Ritual
verticalRangeMap.put(range, verticalRadius);
}
protected boolean checkDescriptorIsWithinRange(AreaDescriptor descriptor, int maxVolume, int maxHorizontal, int maxVertical)
{
return descriptor.getVolume() <= maxVolume && descriptor.isWithinRange(maxVertical, maxHorizontal);
}
public int getMaxVolumeForRange(String range, List<EnumDemonWillType> activeTypes)
{
return volumeRangeMap.get(range);
}
public int getMaxVerticalRadiusForRange(String range, List<EnumDemonWillType> activeTypes)
{
return verticalRangeMap.get(range);
}
public int getMaxHorizontalRadiusForRange(String range, List<EnumDemonWillType> activeTypes)
{
return horizontalRangeMap.get(range);
}
public ITextComponent getErrorForBlockRangeOnFail(EntityPlayer player, String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2)
{
AreaDescriptor descriptor = this.getBlockRange(range);