diff options
Diffstat (limited to 'YWD/src/main/java/fyresmodjam/worldgen')
4 files changed, 200 insertions, 625 deletions
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java b/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java index 07cbd84..bcc5372 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/FyresWorldData.java @@ -25,36 +25,20 @@ public class FyresWorldData extends WorldSavedData { /*
* @formatter:off
*/
- public static String[] validDisadvantages = {
- "Tougher Mobs",
- "Weak",
- "Explosive Traps",
- "Increased Mob Spawn",
- //"Neverending Rain",
- //"Neverending Night",
- "Permadeath",
- "Trigger-happy",
- "Diabolic",
- "Organized Foes"
- };
-
- public static String[] disadvantageDescriptions = {
- "Hostile enemies takes 25% less damage",
- "-25% melee damage",
- "Traps also trigger explosions when set off",
- "+33% hostile mob spawn rate",
- //"Constantly rains",
- //"Constant night",
- "Items dropped upon death are permanently lost",
- "Mobs have a chance to explode on death",
+ public static String[] validDisadvantages = { "Tougher Mobs", "Weak", "Explosive Traps", "Increased Mob Spawn",
+ // "Neverending Rain",
+ // "Neverending Night",
+ "Permadeath", "Trigger-happy", "Diabolic", "Organized Foes" };
+
+ public static String[] disadvantageDescriptions = { "Hostile enemies takes 25% less damage", "-25% melee damage",
+ "Traps also trigger explosions when set off", "+33% hostile mob spawn rate",
+ // "Constantly rains",
+ // "Constant night",
+ "Items dropped upon death are permanently lost", "Mobs have a chance to explode on death",
"All mobs have a chance to recieve a random blessing",
- "Mobs spawn with armor and weapons, increasing with level"
- };
+ "Mobs spawn with armor and weapons, increasing with level" };
- public static String[] validTasks = {
- "Kill",
- "Burn"
- };
+ public static String[] validTasks = { "Kill", "Burn" };
/*
* @formatter:on
@@ -62,59 +46,39 @@ public class FyresWorldData extends WorldSavedData { public static String key = "FyresWorldData";
- public int[] potionValues = null;
- public int[] potionDurations = null;
+ public int[] potionValues = null;
+ public int[] potionDurations = null;
public int[][] mushroomColors = null;
public String currentDisadvantage = null;
- public String currentTask = null;
- public int currentTaskID = -1;
- public int currentTaskAmount = 0;
- public int progress = 0;
- public int tasksCompleted = 0;
- public int rewardLevels = -1;
+ public String currentTask = null;
+ public int currentTaskID = -1;
+ public int currentTaskAmount = 0;
+ public int progress = 0;
+ public int tasksCompleted = 0;
+ public int rewardLevels = -1;
public boolean enderDragonKilled = false;
// TODO pull these into a class instead of using parallel arrays
@SuppressWarnings("rawtypes")
- public static Class[] validMobs = {
- EntityDragon.class, EntityGhast.class,
- EntityWither.class
- };
- public static String[] validMobNames = {
- "Ender Dragon", "Ghast", "Wither"
- };
- public static int[][] mobNumbers = {
- new int[] {
- 1, 1
- }, new int[] {
- 5, 15
- }, new int[] {
- 1, 1
- }
- };
-
- public HashMap<String, String> blessingByPlayer = new HashMap<String, String>();
- public HashMap<String, int[]> potionKnowledgeByPlayer = new HashMap<String, int[]>();
-
- public HashMap<String, NBTTagCompound> killStatsByPlayer = new HashMap<String, NBTTagCompound>();
- public HashMap<String, NBTTagCompound> weaponStatsByPlayer = new HashMap<String, NBTTagCompound>();
- public HashMap<String, NBTTagCompound> craftingStatsByPlayer = new HashMap<String, NBTTagCompound>();
-
- public static ItemStack[] validItems = {
- new ItemStack(Blocks.diamond_block),
- new ItemStack(Blocks.gold_block),
- new ItemStack(Blocks.emerald_block),
- new ItemStack(Blocks.lapis_block),
- new ItemStack(Items.diamond),
- new ItemStack(Items.emerald),
- new ItemStack(Items.gold_ingot),
- new ItemStack(Items.nether_star),
- new ItemStack(Items.ghast_tear)
- };
+ public static Class[] validMobs = { EntityDragon.class, EntityGhast.class, EntityWither.class };
+ public static String[] validMobNames = { "Ender Dragon", "Ghast", "Wither" };
+ public static int[][] mobNumbers = { new int[] { 1, 1 }, new int[] { 5, 15 }, new int[] { 1, 1 } };
+
+ public HashMap<String, String> blessingByPlayer = new HashMap<String, String>();
+ public HashMap<String, int[]> potionKnowledgeByPlayer = new HashMap<String, int[]>();
+
+ public HashMap<String, NBTTagCompound> killStatsByPlayer = new HashMap<String, NBTTagCompound>();
+ public HashMap<String, NBTTagCompound> weaponStatsByPlayer = new HashMap<String, NBTTagCompound>();
+ public HashMap<String, NBTTagCompound> craftingStatsByPlayer = new HashMap<String, NBTTagCompound>();
+
+ public static ItemStack[] validItems = { new ItemStack(Blocks.diamond_block), new ItemStack(Blocks.gold_block),
+ new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.lapis_block), new ItemStack(Items.diamond),
+ new ItemStack(Items.emerald), new ItemStack(Items.gold_ingot), new ItemStack(Items.nether_star),
+ new ItemStack(Items.ghast_tear) };
public FyresWorldData() {
super(key);
@@ -127,8 +91,7 @@ public class FyresWorldData extends WorldSavedData { public static FyresWorldData forWorld(World world) {
MapStorage storage = world.perWorldStorage;
- FyresWorldData result = (FyresWorldData) storage
- .loadData(FyresWorldData.class, key);
+ FyresWorldData result = (FyresWorldData) storage.loadData(FyresWorldData.class, key);
if (result == null) {
result = new FyresWorldData();
@@ -144,61 +107,48 @@ public class FyresWorldData extends WorldSavedData { @Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKey("values")) {
- potionValues = nbttagcompound
- .getIntArray("values");
+ potionValues = nbttagcompound.getIntArray("values");
}
if (nbttagcompound.hasKey("durations")) {
- potionDurations = nbttagcompound
- .getIntArray("durations");
+ potionDurations = nbttagcompound.getIntArray("durations");
}
if (nbttagcompound.hasKey("currentDisadvantage")) {
- currentDisadvantage = nbttagcompound
- .getString("currentDisadvantage");
+ currentDisadvantage = nbttagcompound.getString("currentDisadvantage");
}
if (nbttagcompound.hasKey("currentTask")) {
- currentTask = nbttagcompound
- .getString("currentTask");
+ currentTask = nbttagcompound.getString("currentTask");
}
if (nbttagcompound.hasKey("currentTaskID")) {
- currentTaskID = nbttagcompound
- .getInteger("currentTaskID");
+ currentTaskID = nbttagcompound.getInteger("currentTaskID");
}
if (nbttagcompound.hasKey("currentTaskAmount")) {
- currentTaskAmount = nbttagcompound
- .getInteger("currentTaskAmount");
+ currentTaskAmount = nbttagcompound.getInteger("currentTaskAmount");
}
if (nbttagcompound.hasKey("progress")) {
progress = nbttagcompound.getInteger("progress");
}
if (nbttagcompound.hasKey("tasksCompleted")) {
- tasksCompleted = nbttagcompound
- .getInteger("tasksCompleted");
+ tasksCompleted = nbttagcompound.getInteger("tasksCompleted");
}
if (nbttagcompound.hasKey("enderDragonKilled")) {
- enderDragonKilled = nbttagcompound
- .getBoolean("enderDragonKilled");
+ enderDragonKilled = nbttagcompound.getBoolean("enderDragonKilled");
}
if (nbttagcompound.hasKey("rewardLevels")) {
- rewardLevels = nbttagcompound
- .getInteger("rewardLevels");
+ rewardLevels = nbttagcompound.getInteger("rewardLevels");
}
mushroomColors = new int[13][];
for (int i = 0; i < 13; i++) {
- if (nbttagcompound.hasKey(
- "mushroomColors_" + (i + 1))) {
- mushroomColors[i] = nbttagcompound
- .getIntArray("mushroomColors_"
- + (i + 1));
+ if (nbttagcompound.hasKey("mushroomColors_" + (i + 1))) {
+ mushroomColors[i] = nbttagcompound.getIntArray("mushroomColors_" + (i + 1));
}
}
if (nbttagcompound.hasKey("TempPlayerStats")) {
- NBTTagCompound tempStats = nbttagcompound
- .getCompoundTag("TempPlayerStats");
+ NBTTagCompound tempStats = nbttagcompound.getCompoundTag("TempPlayerStats");
for (Object o : tempStats.func_150296_c()) {
if (o == null || !(o instanceof NBTTagCompound)) {
@@ -206,32 +156,17 @@ public class FyresWorldData extends WorldSavedData { }
NBTTagCompound player = (NBTTagCompound) o;
- blessingByPlayer.put(
- player.getString("Name"),
- player.getString(
- "Blessing"));
- potionKnowledgeByPlayer.put(
- player.getString("Name"),
- player.getIntArray(
- "PotionKnowledge"));
+ blessingByPlayer.put(player.getString("Name"), player.getString("Blessing"));
+ potionKnowledgeByPlayer.put(player.getString("Name"), player.getIntArray("PotionKnowledge"));
if (player.hasKey("KillStats")) {
- killStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "KillStats"));
+ killStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("KillStats"));
}
if (player.hasKey("WeaponStats")) {
- weaponStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "WeaponStats"));
+ weaponStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("WeaponStats"));
}
if (player.hasKey("CraftingStats")) {
- craftingStatsByPlayer.put(player
- .getString("Name"),
- player.getCompoundTag(
- "CraftingStats"));
+ craftingStatsByPlayer.put(player.getString("Name"), player.getCompoundTag("CraftingStats"));
}
}
}
@@ -245,26 +180,20 @@ public class FyresWorldData extends WorldSavedData { nbttagcompound.setIntArray("values", potionValues);
nbttagcompound.setIntArray("durations", potionDurations);
- nbttagcompound.setString("currentDisadvantage",
- currentDisadvantage);
+ nbttagcompound.setString("currentDisadvantage", currentDisadvantage);
nbttagcompound.setString("currentTask", currentTask);
nbttagcompound.setInteger("currentTaskID", currentTaskID);
- nbttagcompound.setInteger("currentTaskAmount",
- currentTaskAmount);
+ nbttagcompound.setInteger("currentTaskAmount", currentTaskAmount);
nbttagcompound.setInteger("progress", progress);
- nbttagcompound.setInteger("tasksCompleted",
- tasksCompleted);
+ nbttagcompound.setInteger("tasksCompleted", tasksCompleted);
- nbttagcompound.setBoolean("enderDragonKilled",
- enderDragonKilled);
+ nbttagcompound.setBoolean("enderDragonKilled", enderDragonKilled);
nbttagcompound.setInteger("rewardLevels", rewardLevels);
for (int i = 0; i < 13; i++) {
- nbttagcompound.setIntArray(
- "mushroomColors_" + (i + 1),
- mushroomColors[i]);
+ nbttagcompound.setIntArray("mushroomColors_" + (i + 1), mushroomColors[i]);
}
fillBlessingsByPlayer(nbttagcompound);
@@ -282,33 +211,23 @@ public class FyresWorldData extends WorldSavedData { NBTTagCompound player = new NBTTagCompound();
player.setString("Name", s);
- player.setString("Blessing",
- blessingByPlayer.get(s));
- player.setIntArray("PotionKnowledge",
- potionKnowledgeByPlayer
- .get(s));
+ player.setString("Blessing", blessingByPlayer.get(s));
+ player.setIntArray("PotionKnowledge", potionKnowledgeByPlayer.get(s));
if (killStatsByPlayer.containsKey(s)) {
- player.setTag("KillStats",
- killStatsByPlayer
- .get(s));
+ player.setTag("KillStats", killStatsByPlayer.get(s));
}
if (weaponStatsByPlayer.containsKey(s)) {
- player.setTag("WeaponStats",
- weaponStatsByPlayer
- .get(s));
+ player.setTag("WeaponStats", weaponStatsByPlayer.get(s));
}
if (craftingStatsByPlayer.containsKey(s)) {
- player.setTag("CraftingStats",
- craftingStatsByPlayer
- .get(s));
+ player.setTag("CraftingStats", craftingStatsByPlayer.get(s));
}
tempPlayerStats.setTag(s, player);
}
- nbttagcompound.setTag("TempPlayerStats",
- tempPlayerStats);
+ nbttagcompound.setTag("TempPlayerStats", tempPlayerStats);
}
}
@@ -347,9 +266,7 @@ public class FyresWorldData extends WorldSavedData { }
}
- boolean alreadyKilledDragon = currentTask != null
- && currentTask.equals("Kill")
- && currentTaskID == 0
+ boolean alreadyKilledDragon = currentTask != null && currentTask.equals("Kill") && currentTaskID == 0
&& enderDragonKilled;
if (changeTask || alreadyKilledDragon) {
@@ -369,20 +286,15 @@ public class FyresWorldData extends WorldSavedData { if (currentDisadvantage != null) {
boolean valid = validateDisadvantage();
- changeDisadvantage = !valid && !currentDisadvantage
- .equals("None");
+ changeDisadvantage = !valid && !currentDisadvantage.equals("None");
}
if (changeDisadvantage) {
currentDisadvantage = chooseDisadvantage();
- MinecraftServer server = FMLCommonHandler
- .instance()
- .getMinecraftServerInstance();
+ MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
- boolean permadeathOnHardcore = server.isHardcore()
- && currentDisadvantage.equals(
- "Permadeath");
+ boolean permadeathOnHardcore = server.isHardcore() && currentDisadvantage.equals("Permadeath");
while (server != null && permadeathOnHardcore) {
currentDisadvantage = chooseDisadvantage();
@@ -392,17 +304,13 @@ public class FyresWorldData extends WorldSavedData { private void checkPotionValues() {
if (potionValues == null) {
- potionValues = new int[] {
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1
- };
+ potionValues = new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
for (int i = 0; i < 13 - 1; i++) {
int randPotionID = getRandomPotionID();
boolean stop = false;
- while (potionIDIsValid(randPotionID)
- || !stop) {
+ while (potionIDIsValid(randPotionID) || !stop) {
stop = true;
randPotionID = getRandomPotionID();
@@ -421,8 +329,7 @@ public class FyresWorldData extends WorldSavedData { if (Potion.potionTypes[potionValues[i]] == null) {
int randPotionID = getRandomPotionID();
- while (potionIDIsValid(
- randPotionID)) {
+ while (potionIDIsValid(randPotionID)) {
randPotionID = getRandomPotionID();
}
@@ -456,9 +363,7 @@ public class FyresWorldData extends WorldSavedData { }
private int randomRGBColor() {
- return Color.HSBtoRGB(ModjamMod.r.nextFloat(),
- ModjamMod.r.nextFloat(),
- ModjamMod.r.nextFloat());
+ return Color.HSBtoRGB(ModjamMod.r.nextFloat(), ModjamMod.r.nextFloat(), ModjamMod.r.nextFloat());
}
private boolean validateDisadvantage() {
@@ -474,8 +379,7 @@ public class FyresWorldData extends WorldSavedData { }
private String chooseDisadvantage() {
- return validDisadvantages[ModjamMod.r
- .nextInt(validDisadvantages.length)];
+ return validDisadvantages[ModjamMod.r.nextInt(validDisadvantages.length)];
}
public void giveNewTask() {
@@ -488,8 +392,7 @@ public class FyresWorldData extends WorldSavedData { int baseMobNumber = mobNumbers[currentTaskID][0];
- currentTaskAmount = baseMobNumber
- + getMobNumberAdjuster();
+ currentTaskAmount = baseMobNumber + getMobNumberAdjuster();
} else if (currentTask.equals("Burn")) {
currentTaskID = getTaskItem();
@@ -506,11 +409,9 @@ public class FyresWorldData extends WorldSavedData { }
private int setTaskItemCount() {
- boolean isNetherStar = validItems[currentTaskID]
- .getItem() == Items.nether_star;
+ boolean isNetherStar = validItems[currentTaskID].getItem() == Items.nether_star;
- boolean isBlock = validItems[currentTaskID]
- .getItem() instanceof ItemBlock;
+ boolean isBlock = validItems[currentTaskID].getItem() instanceof ItemBlock;
int taskAmount;
@@ -543,13 +444,11 @@ public class FyresWorldData extends WorldSavedData { if (!dragonKilled) {
return ModjamMod.r.nextInt(validMobs.length);
} else {
- return 1 + ModjamMod.r
- .nextInt(validMobs.length - 1);
+ return 1 + ModjamMod.r.nextInt(validMobs.length - 1);
}
}
public String getDisadvantage() {
- return ConfigData.disableDisadvantages ? "None"
- : currentDisadvantage;
+ return ConfigData.disableDisadvantages ? "None" : currentDisadvantage;
}
}
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java b/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java index d76af7c..8b08825 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/PillarGen.java @@ -12,79 +12,32 @@ import net.minecraft.world.chunk.IChunkProvider; public class PillarGen implements IWorldGenerator {
@Override
- public void generate(Random random, int chunkX, int chunkZ,
- World world, IChunkProvider chunkGenerator,
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
- if (ConfigData.spawnRandomPillars
- && world.provider.dimensionId == 0
- && random.nextInt(
- ConfigData.pillarGenChance) == 0) {
+ if (ConfigData.spawnRandomPillars && world.provider.dimensionId == 0
+ && random.nextInt(ConfigData.pillarGenChance) == 0) {
boolean placed = false;
- int max = random.nextInt(
- ConfigData.maxPillarsPerChunk) + 1;
+ int max = random.nextInt(ConfigData.maxPillarsPerChunk) + 1;
- for (int y = 127, added = 0; y > 30 && !placed
- && added < max; y--) {
- for (int x = chunkX * 16; x < chunkX * 16
- + 16 && !placed
- && added < max; x++) {
- for (int z = chunkZ
- * 16; z < chunkZ * 16
- + 16
- && !placed
- && added < max; z++) {
- if (random.nextInt(15) != 0
- || world.isAirBlock(
- x,
- y,
- z)
- || world.getBlock(
- x,
- y,
- z)
- .isReplaceable(world,
- x,
- y,
- z)
- || world.getBlock(
- x,
- y,
- z) == ModjamMod.blockTrap
- || world.getBlock(
- x,
- y,
- z) == Blocks.leaves) {
+ for (int y = 127, added = 0; y > 30 && !placed && added < max; y--) {
+ for (int x = chunkX * 16; x < chunkX * 16 + 16 && !placed && added < max; x++) {
+ for (int z = chunkZ * 16; z < chunkZ * 16 + 16 && !placed && added < max; z++) {
+ if (random.nextInt(15) != 0 || world.isAirBlock(x, y, z)
+ || world.getBlock(x, y, z).isReplaceable(world, x, y, z)
+ || world.getBlock(x, y, z) == ModjamMod.blockTrap
+ || world.getBlock(x, y, z) == Blocks.leaves) {
continue;
}
Block block = ModjamMod.blockPillar;
- if (block.canPlaceBlockAt(
- world, x,
- y + 1,
- z)) {
- world.setBlock(x, y
- + 1,
- z,
- block);
- world.setBlockMetadataWithNotify(
- x,
- y + 1,
- z,
- 0,
- 0);
+ if (block.canPlaceBlockAt(world, x, y + 1, z)) {
+ world.setBlock(x, y + 1, z, block);
+ world.setBlockMetadataWithNotify(x, y + 1, z, 0, 0);
- world.setBlock(x, y
- + 2,
- z,
- block);
- world.setBlockMetadataWithNotify(
- x,
- y + 2,
- z,
- 1,
- 0);
+ world.setBlock(x, y + 2, z, block);
+ world.setBlockMetadataWithNotify(x, y + 2, z, 1, 0);
placed = random.nextBoolean();
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java index 79a4378..ebd6838 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenMoreDungeons.java @@ -7,12 +7,10 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenDungeons;
-public class WorldGenMoreDungeons extends WorldGenDungeons
- implements IWorldGenerator {
+public class WorldGenMoreDungeons extends WorldGenDungeons implements IWorldGenerator {
@Override
- public void generate(Random random, int chunkX, int chunkZ,
- World world, IChunkProvider chunkGenerator,
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
for (int k1 = 0; k1 < 24; ++k1) {
int l1 = chunkX * 16 + random.nextInt(16) + 8;
diff --git a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java index d2a5a54..acff5bd 100755 --- a/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java +++ b/YWD/src/main/java/fyresmodjam/worldgen/WorldGenTrapsTowersAndMore.java @@ -19,417 +19,151 @@ import net.minecraftforge.common.DungeonHooks; public class WorldGenTrapsTowersAndMore implements IWorldGenerator {
public static final WeightedRandomChestContent[] field_111189_a = new WeightedRandomChestContent[] {
- new WeightedRandomChestContent(Items.iron_ingot, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.bread, 0, 1,
- 1, 10),
- new WeightedRandomChestContent(Items.wheat, 0, 1,
- 4, 10),
- new WeightedRandomChestContent(Items.gunpowder, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.string, 0, 1,
- 4, 10),
- new WeightedRandomChestContent(Items.bucket, 0, 1,
- 1, 10),
- new WeightedRandomChestContent(Items.redstone, 0,
- 1, 4, 10),
- new WeightedRandomChestContent(Items.name_tag, 0,
- 1, 1, 10),
- };
+ new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.bread, 0, 1, 1, 10),
+ new WeightedRandomChestContent(Items.wheat, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.gunpowder, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.string, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.bucket, 0, 1, 1, 10),
+ new WeightedRandomChestContent(Items.redstone, 0, 1, 4, 10),
+ new WeightedRandomChestContent(Items.name_tag, 0, 1, 1, 10), };
public static boolean genning = false;
public static final String TOWER_CHESTS = "towerChests";
- public static ChestGenHooks chestGenInfo = new ChestGenHooks(
- TOWER_CHESTS, field_111189_a, 8, 8);
+ public static ChestGenHooks chestGenInfo = new ChestGenHooks(TOWER_CHESTS, field_111189_a, 8, 8);
@Override
- public void generate(Random random, int chunkX, int chunkZ,
- World world, IChunkProvider chunkGenerator,
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
genning = true;
- boolean addedDungeon = !ConfigData.spawnTowers || random
- .nextInt(ConfigData.towerGenChance) != 0;
+ boolean addedDungeon = !ConfigData.spawnTowers || random.nextInt(ConfigData.towerGenChance) != 0;
for (int y = 1; y < 127; y++) {
- for (int x = chunkX * 16; x < chunkX * 16
- + 16; x++) {
- for (int z = chunkZ * 16; z < chunkZ * 16
- + 16; z++) {
- if ((world.isAirBlock(x, y, z)
- || (world.getBlock(
- x,
- y,
- z)
- .isReplaceable(world,
- x,
- y,
- z)
- && world.getBlock(
- x,
- y,
- z) != Blocks.water
- && world.getBlock(
- x,
- y,
- z) != Blocks.flowing_water
- && world.getBlock(
- x,
- y,
- z) != Blocks.lava
- && world.getBlock(
- x,
- y,
- z) != Blocks.flowing_lava))
- && (!world.isAirBlock(
- x,
- y - 1,
- z)
- && world.getBlock(
- x,
- y - 1,
- z) != ModjamMod.blockTrap
- && !world.getBlock(
- x,
- y - 1,
- z)
- .isReplaceable(world,
- x,
- y - 1,
- z))
- && random.nextInt(
- ConfigData.trapGenChance) == 0) {
- boolean skip = ConfigData.trapsBelowGroundOnly
- && (world.getBlock(
- x,
- y - 1,
- z) == Blocks.grass
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.log
- || world.getBlock(
- x,
- y - 1,
- z) == Blocks.log2
- || world.canBlockSeeTheSky(
- x,
- y,
- z));
- if (!skip && ModjamMod.blockTrap
- .canPlaceBlockAt(
- world,
- x,
- y,
- z)) {
- world.setBlock(x,
- y,
- z,
- ModjamMod.blockTrap,
- random.nextInt(BlockTrap.trapTypes),
- 0);
+ for (int x = chunkX * 16; x < chunkX * 16 + 16; x++) {
+ for (int z = chunkZ * 16; z < chunkZ * 16 + 16; z++) {
+ if ((world.isAirBlock(x, y, z) || (world.getBlock(x, y, z).isReplaceable(world, x, y, z)
+ && world.getBlock(x, y, z) != Blocks.water
+ && world.getBlock(x, y, z) != Blocks.flowing_water && world.getBlock(x, y, z) != Blocks.lava
+ && world.getBlock(x, y, z) != Blocks.flowing_lava))
+ && (!world.isAirBlock(x, y - 1, z) && world.getBlock(x, y - 1, z) != ModjamMod.blockTrap
+ && !world.getBlock(x, y - 1, z).isReplaceable(world, x, y - 1, z))
+ && random.nextInt(ConfigData.trapGenChance) == 0) {
+ boolean skip = ConfigData.trapsBelowGroundOnly && (world.getBlock(x, y - 1, z) == Blocks.grass
+ || world.getBlock(x, y - 1, z) == Blocks.sand
+ || world.getBlock(x, y - 1, z) == Blocks.log
+ || world.getBlock(x, y - 1, z) == Blocks.log2 || world.canBlockSeeTheSky(x, y, z));
+ if (!skip && ModjamMod.blockTrap.canPlaceBlockAt(world, x, y, z)) {
+ world.setBlock(x, y, z, ModjamMod.blockTrap, random.nextInt(BlockTrap.trapTypes), 0);
}
}
- if ((world.getBlock(x, y,
- z) == Blocks.brown_mushroom
- || world.getBlock(
- x,
- y,
- z) == Blocks.red_mushroom)
- && random.nextInt(
- ConfigData.mushroomReplaceChance) == 0) {
- world.setBlock(x, y, z,
- ModjamMod.mysteryMushroomBlock,
- random.nextInt(13),
- 0);
+ if ((world.getBlock(x, y, z) == Blocks.brown_mushroom
+ || world.getBlock(x, y, z) == Blocks.red_mushroom)
+ && random.nextInt(ConfigData.mushroomReplaceChance) == 0) {
+ world.setBlock(x, y, z, ModjamMod.mysteryMushroomBlock, random.nextInt(13), 0);
}
- if (!addedDungeon && ((world
- .getBlock(x, y, z) == Blocks.grass
- || ((world.getBlock(
- x,
- y,
- z) == Blocks.sand
- || world.getBlock(
- x,
- y,
- z) == Blocks.netherrack
- || world.getBlock(
- x,
- y,
- z) == Blocks.soul_sand
- || world.getBlock(
- x,
- y,
- z) == Blocks.gravel)
- && world.isAirBlock(
- x,
- y + 1,
- z))))
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.water
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.flowing_water
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.lava
- && world.getBlock(
- x,
- y + 1,
- z) != Blocks.flowing_lava
- && ModjamMod.r.nextInt(
- 100) == 0) {
-
- boolean obsidian = !world.provider.isHellWorld
- && ModjamMod.r.nextInt(
- 100) == 0;
+ if (!addedDungeon
+ && ((world.getBlock(x, y, z) == Blocks.grass || ((world.getBlock(x, y, z) == Blocks.sand
+ || world.getBlock(x, y, z) == Blocks.netherrack
+ || world.getBlock(x, y, z) == Blocks.soul_sand
+ || world.getBlock(x, y, z) == Blocks.gravel) && world.isAirBlock(x, y + 1, z))))
+ && world.getBlock(x, y + 1, z) != Blocks.water
+ && world.getBlock(x, y + 1, z) != Blocks.flowing_water
+ && world.getBlock(x, y + 1, z) != Blocks.lava
+ && world.getBlock(x, y + 1, z) != Blocks.flowing_lava && ModjamMod.r.nextInt(100) == 0) {
+
+ boolean obsidian = !world.provider.isHellWorld && ModjamMod.r.nextInt(100) == 0;
y--;
- int floors = 3 + random
- .nextInt(6);
+ int floors = 3 + random.nextInt(6);
- for (int y2 = 0; y2 <= floors
- * 6; y2++) {
+ for (int y2 = 0; y2 <= floors * 6; y2++) {
for (int x2 = -5; x2 <= 5; x2++) {
for (int z2 = -5; z2 <= 5; z2++) {
- if (((y2 / 6) % 2 == 0
- ^ y2 % 6 < 2)
- && x2 == -2
- && z2 == -5
- && y2 > 1
- && y2 <= floors * 6
- - 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2 + 2,
- Blocks.ladder,
- 3,
- 0);
+ if (((y2 / 6) % 2 == 0 ^ y2 % 6 < 2) && x2 == -2 && z2 == -5 && y2 > 1
+ && y2 <= floors * 6 - 5) {
+ world.setBlock(x + x2, y + y2, z + z2 + 2, Blocks.ladder, 3, 0);
}
- if (((y2 / 6) % 2 == 1
- ^ y2 % 6 < 2)
- && x2 == 2
- && z2 == 5
- && y2 > 1
- && y2 <= floors * 6
- - 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2 - 2,
- Blocks.ladder,
- 2,
- 0);
+ if (((y2 / 6) % 2 == 1 ^ y2 % 6 < 2) && x2 == 2 && z2 == 5 && y2 > 1
+ && y2 <= floors * 6 - 5) {
+ world.setBlock(x + x2, y + y2, z + z2 - 2, Blocks.ladder, 2, 0);
}
- if ((x2 * x2 + z2
- * z2 <= 25)
- && ((y2 % 6 == 0 || y2
- % 6 == 1)
- || z2 > 3 + (y2 < 6
- ? 1
- : 0)
- || z2 < -3
- || Math.abs(x2) > 3
- + (y2 < 5 ? 1
- : 0))) {
- if (world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.ladder
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.obsidian) {
- if (!obsidian && Math
- .abs(x2) <= 1
- && Math.abs(z2) <= 1
- && y2 != floors * 6
- && y2 != 1
- && y2 % 6 == 1) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.obsidian);
+ if ((x2 * x2 + z2 * z2 <= 25)
+ && ((y2 % 6 == 0 || y2 % 6 == 1) || z2 > 3 + (y2 < 6 ? 1 : 0) || z2 < -3
+ || Math.abs(x2) > 3 + (y2 < 5 ? 1 : 0))) {
+ if (world.getBlock(x + x2, y + y2, z + z2) != Blocks.ladder
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.obsidian) {
+ if (!obsidian && Math.abs(x2) <= 1 && Math.abs(z2) <= 1 && y2 != floors * 6
+ && y2 != 1 && y2 % 6 == 1) {
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.obsidian);
} else {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- !world.provider.isHellWorld
- ? (!obsidian ? (random
- .nextBoolean() ? Blocks.mossy_cobblestone
- : Blocks.cobblestone)
- : Blocks.obsidian)
- : Blocks.nether_brick);
+ world.setBlock(x + x2, y + y2, z + z2, !world.provider.isHellWorld
+ ? (!obsidian ? (random.nextBoolean() ? Blocks.mossy_cobblestone
+ : Blocks.cobblestone) : Blocks.obsidian)
+ : Blocks.nether_brick);
}
}
- } else if (y2 % 6 == 2
- && x2 == 0
- && z2 == ((y2 / 6)
- % 2 == 1 ? 3
- : -3)
- && (y2 / 6 >= floors
- - 1
- || random.nextInt(
- 3) == 0)
- && y2 >= 5) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.chest,
- 0,
- 2);
-
- boolean b = (y2 / 6)
- % 2 == 1;
-
- TileEntityChest tileentitychest = (TileEntityChest) world
- .getTileEntity(x + x2,
- y + y2,
- z + z2);
+ } else if (y2 % 6 == 2 && x2 == 0 && z2 == ((y2 / 6) % 2 == 1 ? 3 : -3)
+ && (y2 / 6 >= floors - 1 || random.nextInt(3) == 0) && y2 >= 5) {
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.chest, 0, 2);
+
+ boolean b = (y2 / 6) % 2 == 1;
+
+ TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(x + x2,
+ y + y2, z + z2);
if (tileentitychest != null) {
- WeightedRandomChestContent
- .generateChestContents(
- random,
- ((y2 / 6 >= floors
- - 1
- || obsidian) ? ChestGenHooks
- .getInfo(ChestGenHooks.DUNGEON_CHEST)
- : chestGenInfo).getItems(
- random),
- tileentitychest,
- chestGenInfo.getCount(
- random));
+ WeightedRandomChestContent.generateChestContents(random,
+ ((y2 / 6 >= floors - 1 || obsidian)
+ ? ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
+ : chestGenInfo).getItems(random),
+ tileentitychest, chestGenInfo.getCount(random));
}
if (!obsidian) {
- world.setBlock(x + x2,
- y + y2 - 1,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2 + 2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2,
- z + z2 + (b ? 1
- : -1),
- Blocks.obsidian);
- world.setBlock(x + x2,
- y + y2 + 1,
- z + z2 + (b ? 1
- : -1),
- Blocks.obsidian);
- world.setBlock(x + x2
- + 1,
- y + y2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- - 1,
- y + y2,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- + 1,
- y + y2 + 1,
- z + z2,
- Blocks.obsidian);
- world.setBlock(x + x2
- - 1,
- y + y2 + 1,
- z + z2,
- Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 - 1, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 + 2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2, y + y2, z + z2 + (b ? 1 : -1), Blocks.obsidian);
+ world.setBlock(x + x2, y + y2 + 1, z + z2 + (b ? 1 : -1), Blocks.obsidian);
+ world.setBlock(x + x2 + 1, y + y2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 - 1, y + y2, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 + 1, y + y2 + 1, z + z2, Blocks.obsidian);
+ world.setBlock(x + x2 - 1, y + y2 + 1, z + z2, Blocks.obsidian);
}
- } else if (y2 % 6 == 2
- && x2 == 0
- && z2 == 0) {
+ } else if (y2 % 6 == 2 && x2 == 0 && z2 == 0) {
if (y2 != 2) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- Blocks.mob_spawner,
- 0,
- 2);
+ world.setBlock(x + x2, y + y2, z + z2, Blocks.mob_spawner, 0, 2);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world
- .getTileEntity(x + x2,
- y + y2,
- z + z2);
+ .getTileEntity(x + x2, y + y2, z + z2);
if (tileentitymobspawner != null) {
- tileentitymobspawner
- .func_145881_a()
- .setEntityName(DungeonHooks
- .getRandomDungeonMob(
- ModjamMod.r));
+ tileentitymobspawner.func_145881_a()
+ .setEntityName(DungeonHooks.getRandomDungeonMob(ModjamMod.r));
;
}
} else {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- ModjamMod.blockPillar);
- world.setBlockMetadataWithNotify(
- x + x2,
- y + y2,
- z + z2,
- 0,
- 0);
-
- world.setBlock(x + x2,
- y + y2 + 1,
- z + z2,
- ModjamMod.blockPillar);
- world.setBlockMetadataWithNotify(
- x + x2,
- y + y2 + 1,
- z + z2,
- 1,
- 0);
+ world.setBlock(x + x2, y + y2, z + z2, ModjamMod.blockPillar);
+ world.setBlockMetadataWithNotify(x + x2, y + y2, z + z2, 0, 0);
+
+ world.setBlock(x + x2, y + y2 + 1, z + z2, ModjamMod.blockPillar);
+ world.setBlockMetadataWithNotify(x + x2, y + y2 + 1, z + z2, 1, 0);
}
- } else if ((x2 * x2
- + z2 * z2 <= 25)
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != ModjamMod.blockPillar
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.mob_spawner
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.ladder
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.chest
- && world.getBlock(
- x + x2,
- y + y2,
- z + z2) != Blocks.obsidian) {
- world.setBlockToAir(
- x + x2,
- y + y2,
- z + z2);
+ } else if ((x2 * x2 + z2 * z2 <= 25)
+ && world.getBlock(x + x2, y + y2, z + z2) != ModjamMod.blockPillar
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.mob_spawner
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.ladder
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.chest
+ && world.getBlock(x + x2, y + y2, z + z2) != Blocks.obsidian) {
+ world.setBlockToAir(x + x2, y + y2, z + z2);
}
}
@@ -443,26 +177,17 @@ public class WorldGenTrapsTowersAndMore implements IWorldGenerator { for (int x2 = -5; x2 <= 5; x2++) {
for (int z2 = -5; z2 <= 5; z2++) {
- if (x2 * x2 + z2 * z2 <= 25
- && world.isAirBlock(
- x + x2,
- y + y2,
- z + z2)) {
- world.setBlock(x + x2,
- y + y2,
- z + z2,
- !obsidian ? (random
- .nextBoolean() ? Blocks.mossy_cobblestone
- : Blocks.cobblestone)
- : Blocks.obsidian);
+ if (x2 * x2 + z2 * z2 <= 25 && world.isAirBlock(x + x2, y + y2, z + z2)) {
+ world.setBlock(x + x2, y + y2, z + z2, !obsidian
+ ? (random.nextBoolean() ? Blocks.mossy_cobblestone : Blocks.cobblestone)
+ : Blocks.obsidian);
changes++;
}
}
}
y2--;
- } while (changes != 0 && y
- + y2 >= 0);
+ } while (changes != 0 && y + y2 >= 0);
addedDungeon = true;
|
