Add option to randomize potential spawn locations to have a more randomly dispersed spawn patern, useful for games like FTB vs.
This commit is contained in:
parent
53fc30d29d
commit
f0f7e0e139
4 changed files with 53 additions and 8 deletions
|
@ -13,6 +13,9 @@ public class mod_MinecraftForge extends NetworkMod
|
|||
@MLProp(info = "Set to false to reproduce a vinella bug that prevents mobs from spawning on inverted half-slabs and inverted stairs.")
|
||||
public static boolean SPAWNER_ALLOW_ON_INVERTED = true;
|
||||
|
||||
@MLProp(info = "Set to true to randomly shuffle the potential chunks for spawning, this is useful in FTB challange maps where you don't want one side hogging the spawns")
|
||||
public static boolean SPAWNER_MAKE_MORE_RANDOM = false;
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,9 @@ public class mod_MinecraftForge extends NetworkMod
|
|||
|
||||
@MLProp(info = "The kick message used when a client tries to connect but does nto have Minecraft Forge installed.")
|
||||
public static String NO_FORGE_KICK_MESSAGE = "This server requires you to have Minecraft Forge installed. http://MinecraftForge.net/";
|
||||
|
||||
@MLProp(info = "Set to true to randomly shuffle the potential chunks for spawning, this is useful in FTB challange maps where you don't want one side hogging the spawns")
|
||||
public static boolean SPAWNER_MAKE_MORE_RANDOM = false;
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,8 @@
|
||||
@@ -1,10 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -9,7 +15,7 @@
|
|||
public final class SpawnerAnimals
|
||||
{
|
||||
/** The 17x17 area around the player where mobs can spawn */
|
||||
@@ -20,7 +22,7 @@
|
||||
@@ -20,7 +24,7 @@
|
||||
{
|
||||
Chunk var3 = par0World.getChunkFromChunkCoords(par1, par2);
|
||||
int var4 = par1 * 16 + par0World.rand.nextInt(16);
|
||||
|
@ -18,7 +24,20 @@
|
|||
int var6 = par2 * 16 + par0World.rand.nextInt(16);
|
||||
return new ChunkPosition(var4, var5, var6);
|
||||
}
|
||||
@@ -202,7 +204,8 @@
|
||||
@@ -78,6 +82,12 @@
|
||||
if ((!var34.getPeacefulCreature() || par2) && (var34.getPeacefulCreature() || par1) && par0World.countEntities(var34.getCreatureClass()) <= var34.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256)
|
||||
{
|
||||
Iterator var35 = eligibleChunksForSpawning.keySet().iterator();
|
||||
+ if (mod_MinecraftForge.SPAWNER_MAKE_MORE_RANDOM)
|
||||
+ {
|
||||
+ ArrayList<ChunkCoordIntPair> tmp = new ArrayList(eligibleChunksForSpawning.keySet());
|
||||
+ Collections.shuffle(tmp);
|
||||
+ var35 = tmp.iterator();
|
||||
+ }
|
||||
label108:
|
||||
|
||||
while (var35.hasNext())
|
||||
@@ -202,7 +212,8 @@
|
||||
else
|
||||
{
|
||||
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
|
||||
|
@ -28,7 +47,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +214,16 @@
|
||||
@@ -211,6 +222,16 @@
|
||||
*/
|
||||
private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
--- ../src_base/minecraft_server/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,8 @@
|
||||
@@ -1,10 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -9,7 +15,7 @@
|
|||
public final class SpawnerAnimals
|
||||
{
|
||||
/** The 17x17 area around the player where mobs can spawn */
|
||||
@@ -20,7 +22,7 @@
|
||||
@@ -20,7 +24,7 @@
|
||||
{
|
||||
Chunk var3 = par0World.getChunkFromChunkCoords(par1, par2);
|
||||
int var4 = par1 * 16 + par0World.rand.nextInt(16);
|
||||
|
@ -18,7 +24,21 @@
|
|||
int var6 = par2 * 16 + par0World.rand.nextInt(16);
|
||||
return new ChunkPosition(var4, var5, var6);
|
||||
}
|
||||
@@ -202,7 +204,8 @@
|
||||
@@ -78,6 +82,13 @@
|
||||
if ((!var34.getPeacefulCreature() || par2) && (var34.getPeacefulCreature() || par1) && par0World.countEntities(var34.getCreatureClass()) <= var34.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256)
|
||||
{
|
||||
Iterator var35 = eligibleChunksForSpawning.keySet().iterator();
|
||||
+ if (mod_MinecraftForge.SPAWNER_MAKE_MORE_RANDOM)
|
||||
+ {
|
||||
+ ArrayList<ChunkCoordIntPair> tmp = new ArrayList(eligibleChunksForSpawning.keySet());
|
||||
+ Collections.shuffle(tmp);
|
||||
+ var35 = tmp.iterator();
|
||||
+ //Note for cpw: this can be done by Collections.shuffle(b)
|
||||
+ }
|
||||
label108:
|
||||
|
||||
while (var35.hasNext())
|
||||
@@ -202,7 +213,8 @@
|
||||
else
|
||||
{
|
||||
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
|
||||
|
@ -28,7 +48,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +214,16 @@
|
||||
@@ -211,6 +223,16 @@
|
||||
*/
|
||||
private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue