Various Updates #138

Merged
SenseiKiwi merged 20 commits from master into master 2014-03-06 06:23:16 +00:00
4 changed files with 16 additions and 7 deletions
Showing only changes of commit 93f2f6c701 - Show all commits

View File

@@ -5,6 +5,7 @@ import java.io.File;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator; import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
import StevenDimDoors.mod_pocketDim.world.GatewayGenerator; import StevenDimDoors.mod_pocketDim.world.GatewayGenerator;
import StevenDimDoors.mod_pocketDim.world.fortresses.DDStructureNetherBridgeStart;
public class DDProperties public class DDProperties
{ {
@@ -104,6 +105,7 @@ public class DDProperties
public final int NonTntWeight; public final int NonTntWeight;
public final int ClusterGenerationChance; public final int ClusterGenerationChance;
public final int GatewayGenerationChance; public final int GatewayGenerationChance;
public final int FortressGatewayGenerationChance;
public final int MonolithSpawningChance; public final int MonolithSpawningChance;
public final int LimboReturnRange; public final int LimboReturnRange;
public final String CustomSchematicDirectory; public final String CustomSchematicDirectory;
@@ -217,6 +219,10 @@ public class DDProperties
"Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " + "Sets the chance (out of " + GatewayGenerator.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
"generate in a given chunk. The default chance is 15.").getInt(); "generate in a given chunk. The default chance is 15.").getInt();
FortressGatewayGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "Fortress Gateway Generation Chance", 33,
"Sets the chance (out of " + DDStructureNetherBridgeStart.MAX_GATEWAY_GENERATION_CHANCE + ") that a Rift Gateway will " +
"generate as part of a Nether Fortress. The default chance is 33.").getInt();
LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt(); LimboBiomeID = config.get(CATEGORY_BIOME, "Limbo Biome ID", 251).getInt();
PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt(); PocketBiomeID = config.get(CATEGORY_BIOME, "Pocket Biome ID", 250).getInt();

View File

@@ -43,7 +43,10 @@ public class EventHookContainer
@ForgeSubscribe(priority = EventPriority.LOW) @ForgeSubscribe(priority = EventPriority.LOW)
public void onMapGen(InitMapGenEvent event) public void onMapGen(InitMapGenEvent event)
{ {
if (event.type == InitMapGenEvent.EventType.NETHER_BRIDGE) // Replace the Nether fortress generator with our own only if any gateways would ever generate.
// This allows admins to disable our fortress overriding without disabling all gateways.
if (properties.FortressGatewayGenerationChance > 0 && properties.WorldRiftGenerationEnabled &&
event.type == InitMapGenEvent.EventType.NETHER_BRIDGE)
{ {
event.newGen = new DDNetherFortressGenerator(); event.newGen = new DDNetherFortressGenerator();
} }

View File

@@ -1,5 +1,6 @@
package StevenDimDoors.mod_pocketDim.world.fortresses; package StevenDimDoors.mod_pocketDim.world.fortresses;
import StevenDimDoors.mod_pocketDim.DDProperties;
import net.minecraft.world.gen.structure.MapGenNetherBridge; import net.minecraft.world.gen.structure.MapGenNetherBridge;
import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraft.world.gen.structure.StructureStart; import net.minecraft.world.gen.structure.StructureStart;
@@ -19,6 +20,6 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge
protected StructureStart getStructureStart(int chunkX, int chunkZ) protected StructureStart getStructureStart(int chunkX, int chunkZ)
{ {
return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ); return new DDStructureNetherBridgeStart(this.worldObj, this.rand, chunkX, chunkZ, DDProperties.instance());
} }
} }

View File

@@ -6,16 +6,15 @@ import java.util.Random;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.structure.ComponentNetherBridgeCrossing;
import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone; import net.minecraft.world.gen.structure.ComponentNetherBridgeThrone;
import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureNetherBridgeStart; import net.minecraft.world.gen.structure.StructureNetherBridgeStart;
import StevenDimDoors.mod_pocketDim.DDProperties;
public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
{ {
private static int GATEWAY_GENERATION_CHANCE = 1; public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
private static int MAX_GATEWAY_GENERATION_CHANCE = 3;
private boolean hasGateway; private boolean hasGateway;
private int minX; private int minX;
@@ -24,7 +23,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
public DDStructureNetherBridgeStart() { } public DDStructureNetherBridgeStart() { }
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ) public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
{ {
// StructureNetherBridgeStart handles designing the fortress for us // StructureNetherBridgeStart handles designing the fortress for us
super(world, random, chunkX, chunkZ); super(world, random, chunkX, chunkZ);
@@ -36,7 +35,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgeStart
hasGateway = false; hasGateway = false;
// Randomly decide whether to build a gateway in this fortress // Randomly decide whether to build a gateway in this fortress
if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < GATEWAY_GENERATION_CHANCE) if (random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < properties.FortressGatewayGenerationChance)
{ {
// Search for all the blaze spawners in a fortress // Search for all the blaze spawners in a fortress
spawnerRooms = new ArrayList<ComponentNetherBridgeThrone>(); spawnerRooms = new ArrayList<ComponentNetherBridgeThrone>();