Added ritual range rendering

Currently WIP.
Added the ability for the selected Ritual Range to be rendered when holding the RItual Tinkerer.
Also fixed the saving issue for the ritual's Ranges.
This commit is contained in:
WayofTime 2020-11-10 12:51:20 -05:00
parent bac2af8857
commit 0e6c57076d
4 changed files with 203 additions and 20 deletions

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import javax.annotation.Nullable;
@ -114,6 +115,13 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
{
currentRitual.readFromNBT(ritualTag);
}
addBlockRanges(currentRitual.getModableRangeMap());
for (Entry<String, AreaDescriptor> entry : modableRangeMap.entrySet())
{
CompoundNBT descriptorTag = ritualTag.getCompound(entry.getKey());
entry.getValue().readFromNBT(descriptorTag);
// ritualTag.put(entry.getKey(), descriptorTag);
}
}
active = tag.getBoolean(Constants.NBT.IS_RUNNING);
activeTime = tag.getInt(Constants.NBT.RUNTIME);
@ -140,6 +148,12 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
{
CompoundNBT ritualTag = new CompoundNBT();
currentRitual.writeToNBT(ritualTag);
for (Entry<String, AreaDescriptor> entry : modableRangeMap.entrySet())
{
CompoundNBT descriptorTag = new CompoundNBT();
entry.getValue().writeToNBT(descriptorTag);
ritualTag.put(entry.getKey(), descriptorTag);
}
tag.put(Constants.NBT.CURRENT_RITUAL_TAG, ritualTag);
}
tag.putBoolean(Constants.NBT.IS_RUNNING, isActive());
@ -393,6 +407,8 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
if (modificationType == EnumReaderBoundaries.SUCCESS)
descriptor.modifyAreaByBlockPositions(offset1, offset2);
world.notifyBlockUpdate(pos, this.getBlockState(), this.getBlockState(), 3);
return modificationType;
}