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"; private static final String SUBREGISTRY_DATA_NAME = DimDoors.MODID + "_rifts";
protected Map<Integer, RiftSubregistry> subregistries = new HashMap<>(); 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); protected DefaultDirectedGraph<RegistryVertex, DefaultEdge> graph = new DefaultDirectedGraph<>(DefaultEdge.class);
// TODO: add methods that automatically add vertices/edges and mark appropriate subregistries as dirty // 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"> // <editor-fold defaultstate="collapsed" desc="Code for reading/writing/getting the registry">
public static class RiftSubregistry extends WorldSavedData { public static class RiftSubregistry extends WorldSavedData {
private int dim; private int dim;
RiftRegistry riftRegistry = (RiftRegistry) WorldUtils.getWorld(0).getMapStorage().getOrLoadData(RiftRegistry.class, DATA_NAME);
public RiftSubregistry() { public RiftSubregistry() {
super(SUBREGISTRY_DATA_NAME); super(SUBREGISTRY_DATA_NAME);
@ -152,9 +153,12 @@ public class RiftRegistry extends WorldSavedData {
@Override @Override
public void readFromNBT(NBTTagCompound nbt) { 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 // 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 // them to be read from somewhere else, since this is technically more than just reading the NBT and can cause
// done last since links are only in the subregistries. // 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: If non-dirty but new WorldSavedDatas aren't automatically saved, then create the subregistries here
// TODO: rather then in the markSubregistryDirty method. // TODO: rather then in the markSubregistryDirty method.
// TODO: try to get rid of this code: // 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.ANCIENT_FABRIC.getDefaultState(), // outer wall
ModBlocks.FABRIC.getDefaultState(), // inner wall ModBlocks.FABRIC.getDefaultState(), // inner wall
ModBlocks.DIMENSIONAL_DOOR, // door ModBlocks.DIMENSIONAL_DOOR, // door
PocketExitDestination.builder().build(), PocketExitDestination.builder().build(),// exit rift destination
1)); // exit rift destination 1)); // TODO: pass destination rather than just chaos weight
schematics.add(generatePocketSchematic( schematics.add(generatePocketSchematic(
"private_pocket", // base name "private_pocket", // base name
pocketSize, // size pocketSize, // size
ModBlocks.ANCIENT_FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // outer wall ModBlocks.ANCIENT_FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // outer wall
ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // inner wall ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabricAncient.COLOR, EnumDyeColor.WHITE), // inner wall
ModBlocks.PERSONAL_DIMENSIONAL_DOOR, // door ModBlocks.PERSONAL_DIMENSIONAL_DOOR, // door
PrivatePocketExitDestination.builder().build(), PrivatePocketExitDestination.builder().build(),// exit rift destination
0)); // exit rift destination 0));
} }
return schematics; return schematics;
} }

View file

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

View file

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