Update pockets and fix registry recursion bug
This commit is contained in:
parent
87416e442d
commit
7fb9e8bd85
36 changed files with 29 additions and 25 deletions
src/main
java/org/dimdev/dimdoors/shared
rifts/registry
tools
world/pocketdimension
resources/assets/dimdoors
models/block
fabric_black.jsonfabric_blue.jsonfabric_brown.jsonfabric_cyan.jsonfabric_gray.jsonfabric_green.jsonfabric_light_blue.jsonfabric_lime.jsonfabric_magenta.jsonfabric_orange.jsonfabric_pink.jsonfabric_purple.jsonfabric_red.jsonfabric_silver.jsonfabric_white.jsonfabric_yellow.json
pockets/schematic
|
@ -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:
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_black" }
|
"textures": { "all": "dimdoors:blocks/fabric_black" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_blue" }
|
"textures": { "all": "dimdoors:blocks/fabric_blue" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_brown" }
|
"textures": { "all": "dimdoors:blocks/fabric_brown" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_cyan" }
|
"textures": { "all": "dimdoors:blocks/fabric_cyan" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_gray" }
|
"textures": { "all": "dimdoors:blocks/fabric_gray" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_green" }
|
"textures": { "all": "dimdoors:blocks/fabric_green" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_lime" }
|
"textures": { "all": "dimdoors:blocks/fabric_lime" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_magenta" }
|
"textures": { "all": "dimdoors:blocks/fabric_magenta" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_orange" }
|
"textures": { "all": "dimdoors:blocks/fabric_orange" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_pink" }
|
"textures": { "all": "dimdoors:blocks/fabric_pink" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_purple" }
|
"textures": { "all": "dimdoors:blocks/fabric_purple" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_red" }
|
"textures": { "all": "dimdoors:blocks/fabric_red" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_silver" }
|
"textures": { "all": "dimdoors:blocks/fabric_silver" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_white" }
|
"textures": { "all": "dimdoors:blocks/fabric_white" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cube_all",
|
"parent": "dimdoors:block/fullbright",
|
||||||
"textures": { "all": "dimdoors:blocks/fabric_yellow" }
|
"textures": { "all": "dimdoors:blocks/fabric_yellow" }
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue