Update pockets and fix registry recursion bug

This commit is contained in:
Runemoro 2018-01-18 22:30:51 -05:00
parent 87416e442d
commit 7fb9e8bd85
36 changed files with 29 additions and 25 deletions

View file

@ -26,6 +26,7 @@ public class RiftRegistry extends WorldSavedData {
private static final String SUBREGISTRY_DATA_NAME = DimDoors.MODID + "_rifts";
protected Map<Integer, RiftSubregistry> subregistries = new HashMap<>();
private static RiftRegistry riftRegistry = null; // For use by RiftSubregistry only
protected DefaultDirectedGraph<RegistryVertex, DefaultEdge> graph = new DefaultDirectedGraph<>(DefaultEdge.class);
// TODO: add methods that automatically add vertices/edges and mark appropriate subregistries as dirty
@ -41,9 +42,9 @@ public class RiftRegistry extends WorldSavedData {
// <editor-fold defaultstate="collapsed" desc="Code for reading/writing/getting the registry">
public static class RiftSubregistry extends WorldSavedData {
private int dim;
RiftRegistry riftRegistry = (RiftRegistry) WorldUtils.getWorld(0).getMapStorage().getOrLoadData(RiftRegistry.class, DATA_NAME);
public RiftSubregistry() {
super(SUBREGISTRY_DATA_NAME);
@ -152,9 +153,12 @@ public class RiftRegistry extends WorldSavedData {
@Override
public void readFromNBT(NBTTagCompound nbt) {
riftRegistry = this;
// Trigger the subregistry reading code for all dimensions. It would be better if there was some way of forcing
// them to be read from somewhere else, since this is technically more than just reading the NBT. This has to be
// done last since links are only in the subregistries.
// them to be read from somewhere else, since this is technically more than just reading the NBT and can cause
// problems with recursion without riftRegistry. This has to be done last since links are only
// in the subregistries.
// TODO: If non-dirty but new WorldSavedDatas aren't automatically saved, then create the subregistries here
// TODO: rather then in the markSubregistryDirty method.
// TODO: try to get rid of this code:

View file

@ -99,16 +99,16 @@ public final class PocketSchematicGenerator {
ModBlocks.ANCIENT_FABRIC.getDefaultState(), // outer wall
ModBlocks.FABRIC.getDefaultState(), // inner wall
ModBlocks.DIMENSIONAL_DOOR, // door
PocketExitDestination.builder().build(),
1)); // exit rift destination
PocketExitDestination.builder().build(),// exit rift destination
1)); // TODO: pass destination rather than just chaos weight
schematics.add(generatePocketSchematic(
"private_pocket", // base name
pocketSize, // size
ModBlocks.ANCIENT_FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // outer wall
ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // inner wall
ModBlocks.PERSONAL_DIMENSIONAL_DOOR, // door
PrivatePocketExitDestination.builder().build(),
0)); // exit rift destination
PrivatePocketExitDestination.builder().build(),// exit rift destination
0));
}
return schematics;
}

View file

@ -14,6 +14,7 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
@Override
public void init() {
super.init();
hasSkyLight = false; // TODO: figure out why relighting takes so long with private pockets only...
biomeProvider = new BiomeProviderSingle(ModBiomes.WHITE_VOID);
}

View file

@ -15,8 +15,7 @@ public abstract class WorldProviderPocket extends WorldProvider {
@Override
public void init() {
// TODO: save pocket registry nbt here? (see WorldProviderEnd)
hasSkyLight = true; // TODO: this is only a temporary fix
hasSkyLight = true;
generateLightBrightnessTable();
DimDoors.proxy.setCloudRenderer(this, new CloudRenderBlank());
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_black" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_blue" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_brown" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_cyan" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_gray" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_green" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_light_blue" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_lime" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_magenta" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_orange" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_pink" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_purple" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_red" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_silver" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_white" }
}

View file

@ -1,4 +1,4 @@
{
"parent": "block/cube_all",
"parent": "dimdoors:block/fullbright",
"textures": { "all": "dimdoors:blocks/fabric_yellow" }
}