Separate pocketID map per PocketType

-Implemented Pockets' UID being determined by their EnumPocketType and
an integer ID
-Fixed some double and triple registering of Pockets
-Fixed a minor major typo in SchematicHandler that prevented
old-format-schematics from being loaded from disk
-Fixed  an "index-out-of-bounds-like" typo and a [ character being read
as a special character in the Schematic class
-Restructured and moved dimension files (again)
-Edited the defaultPublic- and -Personal.json files to a final-ish form
-Added another dummy schematic, but now in the new schematic format
-Added the old dungeon pocket schematics to the assets
-Tested loading of .schem and .schematic files from disk as well as from
the mod jar (successful, btw)
This commit is contained in:
Mathijs Riezebos 2017-02-02 02:43:43 +01:00
parent 3e4c4afa0f
commit ff62ca29ec
134 changed files with 322 additions and 128 deletions

View file

@ -39,7 +39,7 @@ class Pocket {
this.z = z;
this.riftIDs = riftIDs;
playerUUIDs = new ArrayList();
PocketRegistry.Instance.registerNewPocket(this);
PocketRegistry.Instance.registerNewPocket(this, typeID);
for (int riftID : riftIDs) {
DDTileEntityBase rift = (DDTileEntityBase) RiftRegistry.Instance.getRiftLocation(riftID).getTileEntity();
@ -87,15 +87,13 @@ class Pocket {
int doorID = doorsTagList.getIntAt(i);
riftIDs.add(doorID);
}
Pocket pocket = new Pocket(size, depth, typeID, x, z, riftIDs);
Pocket pocket = new Pocket(size, depth, typeID, x, z, riftIDs); //registers the new pocket as well
NBTTagList playersTagList = (NBTTagList) pocketNBT.getTag("playerUUIDs"); //@todo, maybe it is bad practice to put this behind the creation statement of the Pocket?
for (int i = 0; i < playersTagList.tagCount(); i++) {
String playerUUID = playersTagList.getStringTagAt(i);
pocket.playerUUIDs.add(playerUUID);
}
PocketRegistry.Instance.registerNewPocket(pocket);
}
static NBTBase writeToNBT(Pocket pocket) {

View file

@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagList;
/**
@ -27,16 +28,23 @@ public class PocketRegistry {
private int maxPocketSize;
private int privatePocketSize;
private int publicPocketSize;
private int nextUnusedID = 0;
private final Map<String, Integer> privatePockets; //maps the UUID's of players to their private pocket's ID
private final Map<Integer, Pocket> pocketList;
private final Map<EnumPocketType, Integer> nextUnusedIDs;
private final Map<String, Integer> privatePockets; //maps the UUID's of players to their private pocket's ID (ID for EnumPocketType.PRIVATE in pocketLists)
private final Map<EnumPocketType, Map<Integer, Pocket>> pocketLists;
//when adding any new variables, don't forget to add them to the write and load functions
private final List<Map<Integer, Pocket>> pocketListsPerDepth;
// Methods
private PocketRegistry() {
nextUnusedIDs = new HashMap();
for (EnumPocketType pocketType : EnumPocketType.values()) {
nextUnusedIDs.put(pocketType, 0);
}
privatePockets = new HashMap();
pocketList = new HashMap();
pocketLists = new HashMap();
for (EnumPocketType pocketType : EnumPocketType.values()) {
pocketLists.put(pocketType, new HashMap());
}
pocketListsPerDepth = new ArrayList();
}
@ -57,8 +65,12 @@ public class PocketRegistry {
}
public void reset() {
nextUnusedID = 0;
pocketList.clear();
for (EnumPocketType pocketType : EnumPocketType.values()) {
nextUnusedIDs.put(pocketType, 0);
}
for (EnumPocketType pocketType : EnumPocketType.values()) {
pocketLists.get(pocketType).clear();
}
gridSize = DDConfig.getPocketGridSize();
maxPocketSize = DDConfig.getMaxPocketsSize();
privatePocketSize = DDConfig.getPrivatePocketSize();
@ -72,12 +84,21 @@ public class PocketRegistry {
maxPocketSize = nbt.getInteger("maxPocketSize");
privatePocketSize = nbt.getInteger("privatePocketSize");
publicPocketSize = nbt.getInteger("publicPocketSize");
nextUnusedID = nbt.getInteger("nextUnusedID"); //@todo, we might not need to save this
if (nbt.hasKey("nextUnusedIDs")) { //@todo should not be doing this, since all pockets re-register on world-load
NBTTagList nextUnusedIDTagList = (NBTTagList) nbt.getTag("nextUnusedIDs");
for (int i = 0; i < nextUnusedIDTagList.tagCount(); i++) {
int nextUnusedID = nextUnusedIDTagList.getIntAt(i);
nextUnusedIDs.put(EnumPocketType.getFromInt(i), nextUnusedID);
}
}
if (nbt.hasKey("pocketData")) {
NBTTagList pocketTagList = (NBTTagList) nbt.getTag("pocketData");
for (int i = 0; i < pocketTagList.tagCount(); i++) {
NBTTagCompound pocketTag = pocketTagList.getCompoundTagAt(i);
Pocket.readFromNBT(pocketTag); //this also re-registers the pocket
NBTTagList pocketsTagList = (NBTTagList) nbt.getTag("pocketData");
for (int i = 0; i < pocketsTagList.tagCount(); i++) {
NBTTagList pocketTagList = (NBTTagList) pocketsTagList.get(i);
for (int j = 0; j < pocketTagList.tagCount(); j++) {
NBTTagCompound pocketTag = pocketTagList.getCompoundTagAt(j);
Pocket.readFromNBT(pocketTag); //this also re-registers the pocket
}
}
}
} else { //load privates from config
@ -90,40 +111,58 @@ public class PocketRegistry {
nbt.setInteger("maxPocketSize", maxPocketSize);
nbt.setInteger("privatePocketSize", privatePocketSize);
nbt.setInteger("publicPocketSize", publicPocketSize);
nbt.setInteger("nextUnusedID", nextUnusedID);
NBTTagList pocketTagList = new NBTTagList();
for (Map.Entry<Integer, Pocket> entry : pocketList.entrySet()) {
pocketTagList.appendTag(Pocket.writeToNBT(entry.getValue()));
int[] nextUnusedIDArray = new int[nextUnusedIDs.size()]; //@todo do not have to do this, since all pockets re-register on world-load
for (EnumPocketType pocketType : nextUnusedIDs.keySet()) {
nextUnusedIDArray[pocketType.getIntValue()] = nextUnusedIDs.get(pocketType); //this is an extra ensurance that all the IDs end up at the right index in the TagList
}
nbt.setTag("pocketData", pocketTagList);
NBTTagList nextUnusedIDTagList = new NBTTagList();
for (int nextUnusedID : nextUnusedIDArray) {
nextUnusedIDTagList.appendTag(new NBTTagInt(nextUnusedID));
}
nbt.setTag("nextUnusedIDs", nextUnusedIDTagList);
Map<Integer, Pocket>[] pocketListsArray = new Map[pocketLists.size()];
for (EnumPocketType pocketType : pocketLists.keySet()) {
pocketListsArray[pocketType.getIntValue()] = pocketLists.get(pocketType);
}
NBTTagList pocketsTagList = new NBTTagList();
for (Map<Integer, Pocket> pocketList : pocketListsArray) { //this is an extra ensurance that all the IDs end up at the right index in the TagList
NBTTagList pocketTagList = new NBTTagList();
for (Map.Entry<Integer, Pocket> entry : pocketList.entrySet()) {
pocketTagList.appendTag(Pocket.writeToNBT(entry.getValue()));
}
pocketsTagList.appendTag(pocketTagList);
}
nbt.setTag("pocketData", pocketsTagList);
}
public int registerNewPocket(Pocket pocket) {
pocketList.put(nextUnusedID, pocket);
pocket.setID(nextUnusedID);
public int registerNewPocket(Pocket pocket, EnumPocketType pocketType) {
pocketLists.get(pocketType).put(nextUnusedIDs.get(pocketType), pocket);
pocket.setID(nextUnusedIDs.get(pocketType));
nextUnusedID++;
nextUnusedIDs.put(pocketType, nextUnusedIDs.get(pocketType) + 1);
PocketSavedData.get(DimDoors.getDefWorld()).markDirty(); //Notify that this needs to be saved on world save
return nextUnusedID - 1;
return nextUnusedIDs.get(pocketType) - 1;
}
public void removePocket(int pocketID) {
public void removePocket(int pocketID, EnumPocketType pocketType) { //probably will never ever get used, but meh...
Map<Integer, Pocket> pocketList = pocketLists.get(pocketType);
if (pocketList.containsKey(pocketID)) {
pocketList.remove(pocketID);
PocketSavedData.get(DimDoors.getDefWorld()).markDirty(); //Notify that this needs to be saved on world save
}
}
public Pocket getPocket(int ID) {
return pocketList.get(ID);
public Pocket getPocket(int ID, EnumPocketType pocketType) {
return pocketLists.get(pocketType).get(ID);
}
public int getEntranceDoorIDOfNewPocket(EnumPocketType typeID, int depth) {//should return the riftID of the entrance door of the newly generated pocket
Location shortenedLocation = getGenerationlocation(nextUnusedID, typeID); //@todo, we should have different values of "nextUnusedID" for different pocket-types
Location shortenedLocation = getGenerationlocation(nextUnusedIDs.get(typeID), typeID); //@todo, we should have different values of "nextUnusedID" for different pocket-types
int x = shortenedLocation.getPos().getX();
int z = shortenedLocation.getPos().getZ();
Pocket pocket = generateRandomPocketAt(typeID, depth, shortenedLocation);
registerNewPocket(pocket); //nextUnusedID++
Pocket pocket = generateRandomPocketAt(typeID, depth, shortenedLocation); //registers the pocket as well
int entranceDoorID = pocket.getEntranceDoorID();
return entranceDoorID;
}
@ -135,8 +174,7 @@ public class PocketRegistry {
PocketTemplate pocketTemplate = getRandomPocketTemplate(typeID, depth, maxPocketSize);
Pocket pocket = pocketTemplate.place(shortenedX, 0, shortenedZ, gridSize, dimID, nextUnusedID, depth, typeID);
nextUnusedID++;
Pocket pocket = pocketTemplate.place(shortenedX, 0, shortenedZ, gridSize, dimID, nextUnusedIDs.get(typeID), depth, typeID);
return pocket;
}
@ -145,9 +183,9 @@ public class PocketRegistry {
}
private Location getGenerationlocation(int nextUnusedID, EnumPocketType typeID) { //typeID is for determining the dimension
int x = getSimpleX(nextUnusedID);
int x = getSimpleX(nextUnusedID, typeID);
int y = 0;
int z = getSimpleZ(nextUnusedID);;
int z = getSimpleZ(nextUnusedID, typeID);;
int dimID = 0; //@todo should be fetched using typeID
Location location = new Location(x, y, z, dimID);
@ -166,11 +204,11 @@ public class PocketRegistry {
}
}
private int getSimpleX(int ID) { //we can get the previous x from the last entry of the PocketRegistry :D
private int getSimpleX(int ID, EnumPocketType typeID) { //we can get the previous x from the last entry of the PocketRegistry :D
if (ID == 0) {
return 0;
} else {
int baseX = pocketList.get(ID - 1).getX();
int baseX = pocketLists.get(typeID).get(ID - 1).getX();
int group = getDiffToPreviousGroup(ID);
if (group % 2 == 0) {//even
return baseX;
@ -184,11 +222,11 @@ public class PocketRegistry {
}
}
private int getSimpleZ(int ID) {
private int getSimpleZ(int ID, EnumPocketType typeID) {
if (ID == 0) {
return 0;
} else {
int baseZ = pocketList.get(ID - 1).getZ();
int baseZ = pocketLists.get(typeID).get(ID - 1).getZ();
int group = getDiffToPreviousGroup(ID);
if (group % 2 == 1) {//uneven
return baseZ;

View file

@ -142,7 +142,7 @@ public class SchematicHandler {
InputStream schematicStream = DimDoors.class.getResourceAsStream(schematicJarDirectory + template.getName() + ".schem"); //@todo also check for other schematics
InputStream oldVersionSchematicStream = DimDoors.class.getResourceAsStream(schematicJarDirectory + template.getName() + ".schematic"); //@todo also check for other schematics
File schematicFile = new File(schematicFolder, "/" + template.getName() + ".schem");
File oldVersionSchematicFile = new File(schematicFolder, "/" + template.getName() + ".schem");
File oldVersionSchematicFile = new File(schematicFolder, "/" + template.getName() + ".schematic");
NBTTagCompound schematicNBT;
Schematic schematic = null;

View file

@ -1,7 +1,7 @@
package com.zixiken.dimdoors.shared.blocks;
import com.zixiken.dimdoors.shared.world.limbo.LimboDecay;
import com.zixiken.dimdoors.shared.world.limbo.WorldProviderLimbo;
import com.zixiken.dimdoors.shared.world.limbodimension.LimboDecay;
import com.zixiken.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;

View file

@ -99,13 +99,13 @@ public class Schematic {
int paletteID = paletteNBT.getInteger(key);
paletteMap.put(paletteID, key); //basically use the reversed order (key becomes value and value becomes key)
}
for (int i = 0; i <= paletteMap.size(); i++) {
for (int i = 0; i < paletteMap.size(); i++) {
String blockStateString = paletteMap.get(i);
char lastBlockStateStringChar = blockStateString.charAt(blockStateString.length() - 1);
String blockString;
String stateString;
if (lastBlockStateStringChar == ']') {
String[] blockAndStateStrings = blockStateString.split("[");
String[] blockAndStateStrings = blockStateString.split("\\[");
blockString = blockAndStateStrings[0];
stateString = blockAndStateStrings[1];
stateString = stateString.substring(0, stateString.length() - 1); //remove the "]" at the end

View file

@ -1,36 +1,54 @@
package com.zixiken.dimdoors.shared.world;
import com.zixiken.dimdoors.shared.DDConfig;
import com.zixiken.dimdoors.shared.world.limbo.WorldProviderLimbo;
import com.zixiken.dimdoors.shared.world.personalpocket.WorldProviderPersonalPocket;
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPocket;
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPublicPocket;
import com.zixiken.dimdoors.shared.EnumPocketType;
import com.zixiken.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import com.zixiken.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket;
import com.zixiken.dimdoors.shared.world.pocketdimension.WorldProviderPublicPocket;
import com.zixiken.dimdoors.shared.world.pocketdimension.WorldProviderDungeonPocket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
import net.minecraftforge.common.DimensionManager;
public class DimDoorDimensions {
public static DimensionType LIMBO; //@WaterPicker: Why is there no consist ordering...
public static DimensionType DUNGEON;
public static DimensionType PRIVATE;
public static DimensionType PUBLIC;
public static DimensionType LIMBO;
private static Map<EnumPocketType, DimensionType> pocketDimensionTypes = new HashMap();
public static List<DimensionType> CUSTOM;
public static void init() {
int dimID = DDConfig.getBaseDimID();
LIMBO = DimensionType.register("Limbo", "_limbo", dimID, WorldProviderLimbo.class, false);
dimID++;
PRIVATE = DimensionType.register("Private", "_private", dimID, WorldProviderPersonalPocket.class, false);
pocketDimensionTypes.put(EnumPocketType.PRIVATE, DimensionType.register("Private", "_private", dimID, WorldProviderPersonalPocket.class, false));
dimID++;
DUNGEON = DimensionType.register("Dungeon", "_dungeon", dimID, WorldProviderPocket.class, false);
pocketDimensionTypes.put(EnumPocketType.PUBLIC, DimensionType.register("Public", "_public", dimID, WorldProviderPublicPocket.class, false));
dimID++;
PUBLIC = DimensionType.register("Public", "_public", dimID, WorldProviderPublicPocket.class, false);
pocketDimensionTypes.put(EnumPocketType.DUNGEON, DimensionType.register("Dungeon", "_dungeon", dimID, WorldProviderDungeonPocket.class, false));
registerDimension(LIMBO); //@WaterPicker: ...in these lists?
registerDimension(PRIVATE);
registerDimension(DUNGEON);
registerDimension(PUBLIC);
registerDimension(LIMBO);
for(EnumPocketType pocketType: pocketDimensionTypes.keySet()) {
registerDimension(pocketDimensionTypes.get(pocketType));
}
CUSTOM = new ArrayList();
for (int i = 0; i < 0; i++) { //@todo: For future use? Like, server owners can add their own set of DimDoors DimensionTypes via the configs? Or is this nonsense?
dimID++;
DimensionType tempType = DimensionType.register("Name", "_name", dimID, WorldProvider.class, false);
CUSTOM.add(tempType);
registerDimension(tempType);
}
}
public static void registerDimension(DimensionType dimension) {
DimensionManager.registerDimension(dimension.getId(), dimension);
}
public static DimensionType getPocketDimensionType(EnumPocketType pocketType) {
return pocketDimensionTypes.get(pocketType);
}
}

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.limbo;
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.world.biomes.DimDoorsBiome;

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.limbo;
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.blocks.BlockDimWall;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.limbo;
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.blocks.BlockDimWall;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.limbo;
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.shared.world.CustomSkyProvider;
import net.minecraft.util.ResourceLocation;
@ -6,11 +6,10 @@ import net.minecraft.util.ResourceLocation;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class LimboSkyProvider extends CustomSkyProvider
{
public class LimboSkyProvider extends CustomSkyProvider {
@Override
public ResourceLocation getMoonRenderPath()
{
public ResourceLocation getMoonRenderPath() {
return new ResourceLocation("DimDoors:textures/other/limboMoon.png");
}
@ -18,4 +17,4 @@ public class LimboSkyProvider extends CustomSkyProvider
public ResourceLocation getSunRenderPath() {
return new ResourceLocation("DimDoors:textures/other/limboSun.png");
}
}
}

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.limbo;
package com.zixiken.dimdoors.shared.world.limbodimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.blocks.ModBlocks;

View file

@ -1,16 +0,0 @@
package com.zixiken.dimdoors.shared.world.pocket;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import net.minecraft.world.DimensionType;
public class WorldProviderPublicPocket extends WorldProviderPocket {
@Override
public String getSaveFolder() {
return ("DIM" + getDimension() + "DimDoorsPublic");
}
@Override
public DimensionType getDimensionType() {
return DimDoorDimensions.PUBLIC;
}
}

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.pocket;
package com.zixiken.dimdoors.shared.world.pocketdimension;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.math.BlockPos;
@ -12,12 +12,12 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class PocketGenerator implements IChunkGenerator {
public class PocketChunkGenerator implements IChunkGenerator {
private World worldObj;
//private CustomLimboPopulator spawner;
public PocketGenerator(World world, long seed /*CustomLimboPopulator spawner*/) {
public PocketChunkGenerator(World world, long seed /*CustomLimboPopulator spawner*/) {
this.worldObj = world;
//this.spawner = spawner;
@ -47,7 +47,7 @@ public class PocketGenerator implements IChunkGenerator {
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {
return new ArrayList<Biome.SpawnListEntry>();
return new ArrayList();
}
@Nullable

View file

@ -1,4 +1,4 @@
package com.zixiken.dimdoors.shared.world.pocket;
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.shared.world.CustomSkyProvider;
import net.minecraft.util.ResourceLocation;
@ -6,8 +6,8 @@ import net.minecraft.util.ResourceLocation;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class PocketSkyProvider extends CustomSkyProvider
{
public class PocketSkyProvider extends CustomSkyProvider {
@Override
public ResourceLocation getMoonRenderPath() {
return new ResourceLocation("DimDoors:textures/other/limboMoon.png");

View file

@ -0,0 +1,16 @@
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.shared.EnumPocketType;
public class WorldProviderDungeonPocket extends WorldProviderPublicPocket {
@Override
EnumPocketType getPocketType() {
return EnumPocketType.DUNGEON;
}
@Override
public String getSaveFolder() {
return ("DIM" + getDimension() + "DimDoorsDungeon");
}
}

View file

@ -1,28 +1,22 @@
package com.zixiken.dimdoors.shared.world.personalpocket;
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import com.zixiken.dimdoors.shared.world.pocket.WorldProviderPocket;
import com.zixiken.dimdoors.shared.EnumPocketType;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DimensionType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Created by Jared Johnson on 1/24/2017.
*/
public class WorldProviderPersonalPocket extends WorldProviderPocket {
public class WorldProviderPersonalPocket extends WorldProviderPublicPocket {
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks)
{
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
setCloudRenderer(new CloudRenderBlank());
return new Vec3d(1,1,1);
}
public boolean isSurfaceWorld() {
return false;
return new Vec3d(1, 1, 1);
}
@Override
@ -34,27 +28,27 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
@Override
public double getHorizon() {
return world.getHeight()-256;
return world.getHeight() - 256;
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getFogColor(float par1, float par2) {
return new Vec3d(1,1,1);
return new Vec3d(1, 1, 1);
}
@Override
public int getActualHeight() {
return -256;
}
@Override
EnumPocketType getPocketType() {
return EnumPocketType.PRIVATE;
}
@Override
public String getSaveFolder() {
return ("DIM" + getDimension() + "DimDoorsPersonal");
}
@Override
public DimensionType getDimensionType() {
return DimDoorDimensions.PRIVATE;
}
}

View file

@ -1,6 +1,7 @@
package com.zixiken.dimdoors.shared.world.pocket;
package com.zixiken.dimdoors.shared.world.pocketdimension;
import com.zixiken.dimdoors.client.CloudRenderBlank;
import com.zixiken.dimdoors.shared.EnumPocketType;
import com.zixiken.dimdoors.shared.world.DimDoorDimensions;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
@ -13,24 +14,19 @@ import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class WorldProviderPocket extends WorldProvider {
public class WorldProviderPublicPocket extends WorldProvider {//@todo, we might want an abstract super class to this one?
//protected CustomLimboPopulator spawner;
protected IRenderHandler skyRenderer;
public WorldProviderPocket() {
public WorldProviderPublicPocket() {
this.hasNoSky = true;
}
@Override
public String getSaveFolder() {
return ("DIM" + getDimension() + "DimDoorsDungeon");
}
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
setCloudRenderer( new CloudRenderBlank());
setCloudRenderer(new CloudRenderBlank());
return Vec3d.ZERO;
}
@ -47,7 +43,7 @@ public class WorldProviderPocket extends WorldProvider {
@Override
public IChunkGenerator createChunkGenerator() {
return new PocketGenerator(world, 0); //, spawner);
return new PocketChunkGenerator(world, 0); //, spawner);
}
@Override
@ -60,16 +56,22 @@ public class WorldProviderPocket extends WorldProvider {
return false;
}
@Override
public float calculateCelestialAngle(long par1, float par3) {
return .5F;
}
@Override
public boolean isSurfaceWorld() {
return false;
}
@Override
protected void generateLightBrightnessTable() {
for (int steps = 0; steps <= 15; ++steps) {
float var3 = (float) (Math.pow(steps,1.5) / Math.pow(15.0F,1.5));
this.lightBrightnessTable[15-steps] = var3;
System.out.println( this.lightBrightnessTable[steps]+"light");
float var3 = (float) (Math.pow(steps, 1.5) / Math.pow(15.0F, 1.5));
this.lightBrightnessTable[15 - steps] = var3;
System.out.println(this.lightBrightnessTable[steps] + "light");
}
}
@ -88,8 +90,17 @@ public class WorldProviderPocket extends WorldProvider {
return 256;
}
EnumPocketType getPocketType() {
return EnumPocketType.PUBLIC;
}
@Override
public String getSaveFolder() {
return ("DIM" + getDimension() + "DimDoorsPublic");
}
@Override
public DimensionType getDimensionType() {
return DimDoorDimensions.DUNGEON;
return DimDoorDimensions.getPocketDimensionType(getPocketType());
}
}

View file

@ -3,11 +3,46 @@
"pocketType" : 0,
"variations": [
{
"variantName": "defaultPersonal_3",
"variantName": "defaultPersonal_0",
"size": 0,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPersonal_1",
"size": 1,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPersonal_2",
"size": 2,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPersonal_3",
"size": 3,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPersonal_4",
"size": 4,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPersonal_5",
"size": 5,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
}
]
}

View file

@ -3,11 +3,46 @@
"pocketType" : 1,
"variations": [
{
"variantName": "defaultPublic_3",
"variantName": "defaultPublic_0",
"size": 0,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPublic_1",
"size": 1,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPublic_2",
"size": 2,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPublic_3",
"size": 3,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPublic_4",
"size": 4,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
},
{
"variantName": "defaultPublic_5",
"size": 5,
"minDepth": 0,
"maxDepth": 0,
"weights": [100]
}
]
}

View file

@ -0,0 +1,21 @@
Version 1
Types:
SimpleHall
ComplexHall
Maze
Settings:
AllowDuplicatesInChain = false
AllowPackChangeOut = false
DistortDoorCoordinates = false
## Prevent this pack from being selected for transitioning in once we've transitioned out
AllowPackChangeIn = false
Rules:
Maze ? ? ? ? ? ? ? ? ? -> Maze
? -> SimpleHall ComplexHall
-> Maze

Some files were not shown because too many files have changed in this diff Show more