Did more work on the Ritual Reader - functionally, it is at about 80%.

This commit is contained in:
WayofTime 2016-04-10 22:09:32 -04:00
parent 30f233b81a
commit 057a951732
5 changed files with 77 additions and 7 deletions

View file

@ -1,14 +1,16 @@
package WayofTime.bloodmagic.api.ritual;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
public abstract class AreaDescriptor implements Iterator<BlockPos>
{
public List<BlockPos> getContainedPositions(BlockPos pos)
@ -27,6 +29,16 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
public abstract void resetIterator();
public void readFromNBT(NBTTagCompound tag)
{
}
public void writeToNBT(NBTTagCompound tag)
{
}
/**
* This method changes the area descriptor so that its range matches the two
* blocks that are selected. When implementing this method, assume that
@ -189,6 +201,24 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
resetIterator();
resetCache();
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
minimumOffset = new BlockPos(tag.getInteger(Constants.NBT.X_COORD + "min"), tag.getInteger(Constants.NBT.Y_COORD + "min"), tag.getInteger(Constants.NBT.Z_COORD + "min"));
maximumOffset = new BlockPos(tag.getInteger(Constants.NBT.X_COORD + "max"), tag.getInteger(Constants.NBT.Y_COORD + "max"), tag.getInteger(Constants.NBT.Z_COORD + "max"));
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
tag.setInteger(Constants.NBT.X_COORD + "min", minimumOffset.getX());
tag.setInteger(Constants.NBT.Y_COORD + "min", minimumOffset.getY());
tag.setInteger(Constants.NBT.Z_COORD + "min", minimumOffset.getZ());
tag.setInteger(Constants.NBT.X_COORD + "max", maximumOffset.getX());
tag.setInteger(Constants.NBT.Y_COORD + "max", maximumOffset.getY());
tag.setInteger(Constants.NBT.Z_COORD + "max", maximumOffset.getZ());
}
}
public static class HemiSphere extends AreaDescriptor