Added configuration option to disable the darkroom mechanic. For servers who wish to not risk destruction at one broken pipe.

This commit is contained in:
LexManos 2012-06-22 17:44:04 -07:00
parent f0f7e0e139
commit 3d48b69d4f
5 changed files with 27 additions and 4 deletions

View File

@ -10,6 +10,9 @@ import net.minecraft.src.forge.NetworkMod;
*/
public class mod_MinecraftForge extends NetworkMod
{
@MLProp(info = "Set to true to disable darkrooms, it adds a extra check when planting the grass and plants to check that they won't instantly die.")
public static boolean DISABLE_DARK_ROOMS = false;
@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;

View File

@ -27,6 +27,7 @@ import net.minecraft.src.Packet131MapData;
import net.minecraft.src.Packet1Login;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.World;
import net.minecraft.src.mod_MinecraftForge;
import net.minecraft.src.forge.packets.PacketEntitySpawn;
import net.minecraft.src.forge.packets.PacketHandlerBase;
@ -510,7 +511,11 @@ public class ForgeHooks
{
int index = world.rand.nextInt(plantGrassWeight);
ProbableItem item = getRandomItem(plantGrassList, index);
if (item == null)
if (item == null || Block.blocksList[item.ItemID] == null)
{
return;
}
if (mod_MinecraftForge.DISABLE_DARK_ROOMS && !Block.blocksList[item.ItemID].canBlockStay(world, x, y, z))
{
return;
}

View File

@ -11,6 +11,9 @@ import net.minecraft.src.forge.NetworkMod;
*/
public class mod_MinecraftForge extends NetworkMod
{
@MLProp(info = "Set to true to disable darkrooms, it adds a extra check when planting the grass and plants to check that they won't instantly die.")
public static boolean DISABLE_DARK_ROOMS = false;
@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;

View File

@ -26,8 +26,14 @@
if (var8 == Block.sapling.blockID)
{
@@ -118,13 +131,9 @@
@@ -116,15 +129,15 @@
{
if (itemRand.nextInt(10) != 0)
{
+ if (mod_MinecraftForge.DISABLE_DARK_ROOMS && !Block.tallGrass.canBlockStay(par3World, var10, var11, var12))
+ {
+ continue;
+ }
par3World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1);
}
- else if (itemRand.nextInt(3) != 0)
@ -41,7 +47,7 @@
}
}
}
@@ -155,4 +164,20 @@
@@ -155,4 +168,20 @@
}
}
}

View File

@ -33,8 +33,14 @@
if (var8 == Block.sapling.blockID)
{
if (!par3World.isRemote)
@@ -109,13 +118,9 @@
@@ -107,15 +116,15 @@
{
if (itemRand.nextInt(10) != 0)
{
+ if (mod_MinecraftForge.DISABLE_DARK_ROOMS && !Block.tallGrass.canBlockStay(par3World, var10, var11, var12))
+ {
+ continue;
+ }
par3World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1);
}
- else if (itemRand.nextInt(3) != 0)