diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java
index 38848ad..23bd064 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java
@@ -184,11 +184,11 @@ public class DungeonSchematic extends Schematic {
{
if (notifyClients)
{
- copyToWorld(world, pocketCenter, targetOrientation, entryLink, random, properties, new WorldBlockSetter(false, true));
+ copyToWorld(world, pocketCenter, targetOrientation, entryLink, random, properties, new WorldBlockSetter(false, true, false));
}
else
{
- copyToWorld(world, pocketCenter, targetOrientation, entryLink, random, properties, new ChunkBlockSetter());
+ copyToWorld(world, pocketCenter, targetOrientation, entryLink, random, properties, new ChunkBlockSetter(false));
}
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java
index e7203fb..b00195c 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/ChunkBlockSetter.java
@@ -7,11 +7,16 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
public class ChunkBlockSetter implements IBlockSetter
{
- public ChunkBlockSetter() { }
+ private boolean ignoreAir;
+
+ public ChunkBlockSetter(boolean ignoreAir)
+ {
+ this.ignoreAir = ignoreAir;
+ }
public void setBlock(World world, int x, int y, int z, int blockID, int metadata)
{
- if (blockID != 0 && Block.blocksList[blockID] == null)
+ if ((blockID == 0 && ignoreAir) || (blockID != 0 && Block.blocksList[blockID] == null))
{
return;
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java
index 8bf7dbb..dbb912f 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/Schematic.java
@@ -362,15 +362,15 @@ public class Schematic {
return filter.apply(this, this.blocks, this.metadata);
}
- public void copyToWorld(World world, int x, int y, int z, boolean notifyClients)
+ public void copyToWorld(World world, int x, int y, int z, boolean notifyClients, boolean ignoreAir)
{
if (notifyClients)
{
- copyToWorld(world, x, y, z, new WorldBlockSetter(false, true));
+ copyToWorld(world, x, y, z, new WorldBlockSetter(false, true, ignoreAir));
}
else
{
- copyToWorld(world, x, y, z, new ChunkBlockSetter());
+ copyToWorld(world, x, y, z, new ChunkBlockSetter(ignoreAir));
}
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java
index 3ac4563..2ff9e08 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/schematic/WorldBlockSetter.java
@@ -11,16 +11,21 @@ public class WorldBlockSetter implements IBlockSetter
public final int NOTIFY_CLIENT_FLAG = 2;
private int flags;
+ private boolean ignoreAir;
- public WorldBlockSetter(boolean doBlockUpdates, boolean notifyClients)
+ public WorldBlockSetter(boolean doBlockUpdates, boolean notifyClients, boolean ignoreAir)
{
- flags = 0;
- flags += doBlockUpdates ? BLOCK_UPDATES_FLAG : 0;
- flags += notifyClients ? NOTIFY_CLIENT_FLAG : 0;
+ this.flags = 0;
+ this.flags += doBlockUpdates ? BLOCK_UPDATES_FLAG : 0;
+ this.flags += notifyClients ? NOTIFY_CLIENT_FLAG : 0;
+ this.ignoreAir = ignoreAir;
}
public void setBlock(World world, int x, int y, int z, int blockID, int metadata)
{
- world.setBlock(x, y, z, blockID, metadata, flags);
+ if (!ignoreAir || blockID != 0)
+ {
+ world.setBlock(x, y, z, blockID, metadata, flags);
+ }
}
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseGateway.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseGateway.java
index b19e8df..58567b0 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseGateway.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseGateway.java
@@ -1,144 +1,41 @@
package StevenDimDoors.mod_pocketDim.world.gateways;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Random;
-import java.util.TreeMap;
-import java.util.Map.Entry;
-
-import StevenDimDoors.mod_pocketDim.Point3D;
-import StevenDimDoors.mod_pocketDim.mod_pocketDim;
-import StevenDimDoors.mod_pocketDim.config.DDProperties;
-import StevenDimDoors.mod_pocketDim.core.DimLink;
-import StevenDimDoors.mod_pocketDim.core.LinkTypes;
-import StevenDimDoors.mod_pocketDim.core.NewDimData;
-import StevenDimDoors.mod_pocketDim.core.PocketManager;
-import StevenDimDoors.mod_pocketDim.dungeon.DungeonData;
-import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
-import StevenDimDoors.mod_pocketDim.dungeon.ModBlockFilter;
-import StevenDimDoors.mod_pocketDim.dungeon.SpecialBlockFinder;
-import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
-import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
-import StevenDimDoors.mod_pocketDim.schematic.CompoundFilter;
-import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException;
-import StevenDimDoors.mod_pocketDim.schematic.ReplacementFilter;
-import StevenDimDoors.mod_pocketDim.schematic.Schematic;
-import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
-import StevenDimDoors.mod_pocketDim.world.PocketBuilder;
-import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
+import StevenDimDoors.mod_pocketDim.config.DDProperties;
public abstract class BaseGateway
{
- DDProperties properties;
+ protected DDProperties properties;
public BaseGateway(DDProperties properties)
{
- this.properties=properties;
+ this.properties = properties;
}
/**
- * Generates the gateway centered on the given coords
- * @param world
- * @param x
- * @param y
- * @param z
+ * Generates the gateway centered on the given coordinates
+ * @param world - the world in which to generate the gateway
+ * @param x - the x-coordinate at which to center the gateway; usually where the door is placed
+ * @param y - the y-coordinate of the block on which the gateway may be built
+ * @param z - the z-coordinate at which to center the gateway; usually where the door is placed
*/
- public boolean generate(World world, int x, int y, int z)
- {
- int orientation = 0;
-
- if (this.getSchematicPath()!=null)
- {
- //Get the correct filters
- GatewayBlockFilter filter = new GatewayBlockFilter();
- DungeonSchematic schematic = this.getSchematicToBuild(world, x, y, z);
-
- //apply filters
- schematic.applyFilter(filter);
- schematic.applyImportFilters(properties);
-
- Point3D doorLocation = filter.getEntranceDoorLocation();
- orientation = filter.getEntranceOrientation();
-
- // I suspect that the location used below is wrong. Gateways should be placed vertically based on
- // the Y position of the surface where they belong. I'm pretty sure including doorLocation.getY()
- // messes up the calculation. ~SenseiKiwi
-
- //schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ());
- schematic.copyToWorld(world, x - doorLocation.getX(), y + 1 - doorLocation.getY(), z - doorLocation.getZ(), true);
- }
-
- this.generateRandomBits(world, x, y, z);
-
- DimLink link = PocketManager.getDimensionData(world).createLink(x, y + 1, z, LinkTypes.DUNGEON, orientation);
- DungeonData dungeon = this.getStartingDungeon(PocketManager.getDimensionData(world), world.rand);
- if (dungeon != null)
- {
- PocketBuilder.generateSelectedDungeonPocket(link, mod_pocketDim.properties, dungeon);
- }
- else
- {
- System.err.println("Warning: Dimensional Doors was unable to assign a dungeon to a Rift Gateway.");
- }
-
- return true;
- }
+ public abstract boolean generate(World world, int x, int y, int z);
/**
- * Gets a .schematic to generate for this gateway
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
+ * Determines whether the specified biome is a valid biome in which to generate this gateway
+ * @param biome - the biome to be checked
+ * @return true true if the specified biome is a valid for generating this gateway, otherwise false
*/
- public DungeonSchematic getSchematicToBuild(World world, int x, int y, int z)
+ protected boolean isBiomeValid(BiomeGenBase biome)
{
- //TODO- refine selection criteria here, this is the default case
- try
+ String biomeName = biome.biomeName.toLowerCase();
+ String[] keywords = this.getBiomeKeywords();
+ if (keywords != null)
{
- return DungeonSchematic.readFromResource(this.getSchematicPath());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- System.err.println("Could not load schematic for gateway");
- return null;
- }
- }
-
- /**
- * returns a dungeon from the assigned pack to start with
- * @return
- */
- public DungeonData getStartingDungeon(NewDimData dimension, Random random)
- {
- return getStartingPack().getNextDungeon(dimension, random);
- }
-
- /**
- * determines if a given location is valid for the gateway to be generated, based on height, biome, and world.
- * @param world
- * @param x
- * @param y
- * @param z
- * @param biome
- * @return
- */
- public boolean isLocationValid(World world, int x, int y, int z, BiomeGenBase biome)
- {
- return this.isBiomeValid(biome)&&areCoordsValid(world, x, y, z);
- }
-
- public boolean isBiomeValid(BiomeGenBase biome)
- {
- if(this.getBiomeNames()!=null)
- {
- for(String biomeName : this.getBiomeNames())
+ for (String keyword : keywords)
{
- if(biome.biomeName.contains(biomeName))
+ if (biomeName.contains(keyword))
{
return true;
}
@@ -149,43 +46,33 @@ public abstract class BaseGateway
}
/**
- * Use this function to generate randomized bits of the structure.
- * @param world
- * @param x
- * @param y
- * @param z
+ * Determines whether the specified world and coordinates are a valid location for generating this gateway
+ * @param world - the world in which to generate the gateway
+ * @param x - the x-coordinate at which to center the gateway; usually where the door is placed
+ * @param y - the y-coordinate of the block on which the gateway may be built
+ * @param z - the z-coordinate at which to center the gateway; usually where the door is placed
+ * @return true if the location is valid, otherwise false
*/
- abstract void generateRandomBits(World world, int x, int y, int z);
-
- /**
- * Decides if the given coords/world are valid
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- public abstract boolean areCoordsValid(World world, int x, int y, int z);
+ public boolean isLocationValid(World world, int x, int y, int z)
+ {
+ return isBiomeValid(world.getBiomeGenForCoords(x, z));
+ }
/**
- * @return the pack the dungeon initially generates into from this gateway.
+ * Gets the dungeon pack associated with this gateway
+ * @return the dungeon pack to use for this gateway
*/
- public abstract DungeonPack getStartingPack();
+ /*protected DungeonPack getDungeonPack()
+ {
+ return DungeonHelper.instance().getDungeonPack("RUINS");
+ }*/
/**
- * Is by default a whitelist, but the isBiomeValid method
- * can be overriden for specific gateways. For example, any biome containing 'forest' would be valid if we added 'forest',
- * even from other mods.
- * @return List of biome names that we check against.
+ * Gets the lowercase keywords to be used in checking whether a given biome is a valid location for this gateway
+ * @return an array of biome keywords to match against
*/
- public abstract String[] getBiomeNames();
-
- /**
- * @return List containing all the .schematics attached to this gateway. Selection is random by default
- */
- public abstract String getSchematicPath();
-
- //TODO not yet implemented
- public abstract boolean isSurfaceGateway();
-
+ public String[] getBiomeKeywords()
+ {
+ return new String[] { "" };
+ }
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseSchematicGateway.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseSchematicGateway.java
new file mode 100644
index 0000000..6eaa0da
--- /dev/null
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/BaseSchematicGateway.java
@@ -0,0 +1,66 @@
+package StevenDimDoors.mod_pocketDim.world.gateways;
+
+import net.minecraft.world.World;
+import StevenDimDoors.mod_pocketDim.Point3D;
+import StevenDimDoors.mod_pocketDim.config.DDProperties;
+import StevenDimDoors.mod_pocketDim.core.LinkTypes;
+import StevenDimDoors.mod_pocketDim.core.PocketManager;
+import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic;
+import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException;
+
+public abstract class BaseSchematicGateway extends BaseGateway
+{
+ public BaseSchematicGateway(DDProperties properties)
+ {
+ super(properties);
+ }
+
+ @Override
+ public boolean generate(World world, int x, int y, int z)
+ {
+ DungeonSchematic schematic;
+
+ try
+ {
+ schematic = DungeonSchematic.readFromResource(this.getSchematicPath());
+ }
+ catch (InvalidSchematicException e)
+ {
+ System.err.println("Could not load the schematic for a gateway. The following exception occurred:");
+ e.printStackTrace();
+ return false;
+ }
+
+ // Apply filters - the order is important!
+ GatewayBlockFilter gatewayFilter = new GatewayBlockFilter();
+ schematic.applyFilter(gatewayFilter);
+ schematic.applyImportFilters(properties);
+
+ Point3D doorLocation = gatewayFilter.getEntranceDoorLocation();
+ int orientation = gatewayFilter.getEntranceOrientation();
+
+ // Build the gateway into the world
+ schematic.copyToWorld(world, x - doorLocation.getX(), y, z - doorLocation.getZ(), true, true);
+ this.generateRandomBits(world, x, y, z);
+
+ // Generate a dungeon link in the door
+ PocketManager.getDimensionData(world).createLink(x, y + doorLocation.getY(), z, LinkTypes.DUNGEON, orientation);
+
+ return true;
+ }
+
+ /**
+ * Generates randomized portions of the gateway structure (e.g. rubble, foliage)
+ * @param world - the world in which to generate the gateway
+ * @param x - the x-coordinate at which to center the gateway; usually where the door is placed
+ * @param y - the y-coordinate of the block on which the gateway may be built
+ * @param z - the z-coordinate at which to center the gateway; usually where the door is placed
+ */
+ protected void generateRandomBits(World world, int x, int y, int z) { }
+
+ /**
+ * Gets the path for the schematic file to be used for this gateway. Subsequent calls to this method may return other schematic paths.
+ * @return the path to the schematic file for this gateway
+ */
+ protected abstract String getSchematicPath();
+}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java
index 9936150..d2d9c0f 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayGenerator.java
@@ -25,7 +25,7 @@ public class GatewayGenerator implements IWorldGenerator
private static final int CLUSTER_GROWTH_CHANCE = 80;
private static final int MAX_CLUSTER_GROWTH_CHANCE = 100;
private static final int MIN_RIFT_Y = 4;
- private static final int MAX_RIFT_Y = 250;
+ private static final int MAX_RIFT_Y = 240;
private static final int CHUNK_LENGTH = 16;
private static final int GATEWAY_RADIUS = 4;
private static final int MAX_GATEWAY_GENERATION_ATTEMPTS = 10;
@@ -50,7 +50,6 @@ public class GatewayGenerator implements IWorldGenerator
defaultGateway = new GatewayTwoPillars(properties);
// Add gateways here
- gateways.add(defaultGateway);
gateways.add(new GatewaySandstonePillars(properties));
gateways.add(new GatewayLimbo(properties));
}
@@ -135,26 +134,24 @@ public class GatewayGenerator implements IWorldGenerator
valid = checkGatewayLocation(world, x, y, z);
}
- //Build the gateway if we found a valid location
+ // Build the gateway if we found a valid location
if (valid)
{
- //TODO I feel like this is slow and should be optimized. We are linear time with total # of generation restrictions
- //Create an array and copy valid gateways into it
ArrayList validGateways = new ArrayList();
- for(BaseGateway gateway:gateways)
+ for (BaseGateway gateway : gateways)
{
- if(gateway.isLocationValid(world, x, y, z, world.getBiomeGenForCoords(x, z)))
+ if (gateway.isLocationValid(world, x, y, z))
{
validGateways.add(gateway);
}
}
- //Add default gateway if we where unable to find a suitable gateway
- if(validGateways.isEmpty())
+ // Add the default gateway if the rest were rejected
+ if (validGateways.isEmpty())
{
- validGateways.add(this.defaultGateway);
+ validGateways.add(defaultGateway);
}
- //randomly select a gateway from the pool of viable gateways
- validGateways.get(random.nextInt(validGateways.size())).generate(world, x, y, z);
+ // Randomly select a gateway from the pool of viable gateways
+ validGateways.get(random.nextInt(validGateways.size())).generate(world, x, y - 1, z);
}
}
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java
index 6dbf10b..c202fcd 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayLimbo.java
@@ -3,67 +3,37 @@ package StevenDimDoors.mod_pocketDim.world.gateways;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
-import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
-import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
public class GatewayLimbo extends BaseGateway
{
-
- public GatewayLimbo(DDProperties properties) {
+ public GatewayLimbo(DDProperties properties)
+ {
super(properties);
- // TODO Auto-generated constructor stub
}
@Override
- void generateRandomBits(World world, int x, int y, int z)
+ public boolean generate(World world, int x, int y, int z)
{
int blockID = mod_pocketDim.blockLimbo.blockID;
- //Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of
- //that type, there is no point replacing the ground.
+ // Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of
+ // that type, there is no point replacing the ground.
world.setBlock(x, y + 2, z + 1, blockID, 0, 3);
world.setBlock(x, y + 2, z - 1, blockID, 0, 3);
- //Build the columns around the door
+ // Build the columns around the door
world.setBlock(x, y + 1, z - 1, blockID, 0, 3);
world.setBlock(x, y + 1, z + 1, blockID, 0, 3);
world.setBlock(x, y, z - 1, blockID, 0, 3);
world.setBlock(x, y, z + 1, blockID, 0, 3);
BaseItemDoor.placeDoorBlock(world, x, y, z, 0, mod_pocketDim.transientDoor);
-
-
- }
-
- @Override
- public DungeonPack getStartingPack() {
- // TODO Auto-generated method stub
- return DungeonHelper.instance().getDungeonPack("RUINS");
- }
-
- @Override
- public String[] getBiomeNames() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getSchematicPath() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isSurfaceGateway() {
- // TODO Auto-generated method stub
return true;
}
@Override
- public boolean areCoordsValid(World world, int x, int y, int z) {
- // TODO Auto-generated method stub
- return world.provider instanceof LimboProvider;
+ public boolean isLocationValid(World world, int x, int y, int z) {
+ return (world.provider instanceof LimboProvider);
}
-
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewaySandstonePillars.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewaySandstonePillars.java
index cab1e12..65e53a8 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewaySandstonePillars.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewaySandstonePillars.java
@@ -1,61 +1,23 @@
package StevenDimDoors.mod_pocketDim.world.gateways;
-import java.util.ArrayList;
-import java.util.Random;
-
-import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
-import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
-import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
-import net.minecraft.block.Block;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.IChunkProvider;
-public class GatewaySandstonePillars extends BaseGateway
+public class GatewaySandstonePillars extends BaseSchematicGateway
{
-
- private static final int GATEWAY_RADIUS = 4;
-
public GatewaySandstonePillars(DDProperties properties)
{
super(properties);
-
}
+
@Override
- public boolean generate(World world, int x, int y, int z)
+ public String[] getBiomeKeywords()
{
- //simple to transform the generation location here.
- //Do you think this is the best way to do this?
- return super.generate(world, x, y+2, z);
- }
- @Override
- public void generateRandomBits(World world, int x, int y, int z)
- {
- }
- @Override
- public DungeonPack getStartingPack()
- {
- return DungeonHelper.instance().getDungeonPack("RUINS");
- }
- @Override
- public String[] getBiomeNames()
- {
- return new String[]{"desert"};
+ return new String[] { "desert" };
}
+
@Override
public String getSchematicPath()
{
return "/schematics/gateways/sandstonePillars.schematic";
}
- @Override
- public boolean isSurfaceGateway()
- {
- return true;
- }
- @Override
- public boolean areCoordsValid(World world, int x, int y, int z) {
- // TODO Auto-generated method stub
- return true;
- }
-
}
diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java
index 9e1ea33..13507a4 100644
--- a/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java
+++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/gateways/GatewayTwoPillars.java
@@ -1,26 +1,20 @@
package StevenDimDoors.mod_pocketDim.world.gateways;
-import java.util.ArrayList;
-
-import StevenDimDoors.mod_pocketDim.mod_pocketDim;
-import StevenDimDoors.mod_pocketDim.config.DDProperties;
-import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack;
-import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
-import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import net.minecraft.block.Block;
import net.minecraft.world.World;
+import StevenDimDoors.mod_pocketDim.config.DDProperties;
-public class GatewayTwoPillars extends BaseGateway
+public class GatewayTwoPillars extends BaseSchematicGateway
{
-
private static final int GATEWAY_RADIUS = 4;
public GatewayTwoPillars(DDProperties properties)
{
super(properties);
}
+
@Override
- void generateRandomBits(World world, int x, int y, int z)
+ protected void generateRandomBits(World world, int x, int y, int z)
{
final int blockID = Block.stoneBrick.blockID;
@@ -32,48 +26,27 @@ public class GatewayTwoPillars extends BaseGateway
//Check that the block is supported by an opaque block.
//This prevents us from building over a cliff, on the peak of a mountain,
//or the surface of the ocean or a frozen lake.
- if (world.isBlockOpaqueCube(x + xc, y - 2, z + zc))
+ if (world.isBlockOpaqueCube(x + xc, y - 1, z + zc))
{
//Randomly choose whether to place bricks or not. The math is designed so that the
//chances of placing a block decrease as we get farther from the gateway's center.
if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(2) + 3)
{
//Place Stone Bricks
- world.setBlock(x + xc, y - 1, z + zc, blockID, 0, 3);
+ world.setBlock(x + xc, y, z + zc, blockID, 0, 3);
}
else if (Math.abs(xc) + Math.abs(zc) < world.rand.nextInt(3) + 3)
{
//Place Cracked Stone Bricks
- world.setBlock(x + xc, y - 1, z + zc, blockID, 2, 3);
+ world.setBlock(x + xc, y, z + zc, blockID, 2, 3);
}
}
}
}
}
- @Override
- public DungeonPack getStartingPack() {
- // TODO Auto-generated method stub
- return DungeonHelper.instance().getDungeonPack("RUINS");
- }
- @Override
- public String[] getBiomeNames() {
- // TODO Auto-generated method stub
- return null;
- }
+
@Override
public String getSchematicPath() {
- // TODO Auto-generated method stub
return "/schematics/gateways/twoPillars.schematic";
}
- @Override
- public boolean isSurfaceGateway() {
- // TODO Auto-generated method stub
- return true;
- }
- @Override
- public boolean areCoordsValid(World world, int x, int y, int z) {
- // TODO Auto-generated method stub
- return !(world.provider instanceof LimboProvider);
- }
-
}