From 1d1d0a767cbadcd73d4b81238e7a85993da78745 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Sat, 7 Sep 2013 20:14:14 -0400 Subject: [PATCH] Fixed Doors and Minor Dungeon Change Fixed the regression bug that caused some of our doors to get placed in the wrong direction. Changing doors to inherit from BaseDimDoor caused BlockRotator to assume they weren't dimensional doors because it used "instanceof DimensionalDoor" to check. Thanks for figuring it out, Steven! ^_^ Also made a minor change to dungeon generation. We now check the game rule doMobSpawning and don't spawn Monoliths from DungeonSchematic if the value is false. This is useful for testing without Monoliths around. We still do work to remove the portal frame blocks even if the mobs aren't spawned. --- .../mod_pocketDim/dungeon/DungeonSchematic.java | 17 +++++++++++------ .../mod_pocketDim/schematic/BlockRotator.java | 4 ++-- .../mod_pocketDim/ticking/MonolithSpawner.java | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java b/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java index 2389c82..1d2664b 100644 --- a/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java +++ b/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java @@ -27,6 +27,7 @@ import StevenDimDoors.mod_pocketDim.schematic.InvalidSchematicException; import StevenDimDoors.mod_pocketDim.schematic.ReplacementFilter; import StevenDimDoors.mod_pocketDim.schematic.Schematic; import StevenDimDoors.mod_pocketDim.ticking.MobMonolith; +import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner; import StevenDimDoors.mod_pocketDim.util.Point4D; public class DungeonSchematic extends Schematic { @@ -251,10 +252,11 @@ public class DungeonSchematic extends Schematic { createExitDoorLink(world, dimension, location, entranceDoorLocation, turnAngle, pocketCenter); } - //Remove end portal frames and spawn Monoliths + //Remove end portal frames and spawn Monoliths, if allowed + boolean canSpawn = MonolithSpawner.isMobSpawningAllowed(); for (Point3D location : monolithSpawnLocations) { - spawnMonolith(world, location, entranceDoorLocation, turnAngle, pocketCenter); + spawnMonolith(world, location, entranceDoorLocation, turnAngle, pocketCenter, canSpawn); } } @@ -317,7 +319,7 @@ public class DungeonSchematic extends Schematic { dimension.createLink(location.getX(), location.getY(), location.getZ(), LinkTypes.DUNGEON); } - private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter) + private static void spawnMonolith(World world, Point3D point, Point3D entrance, int rotation, Point3D pocketCenter, boolean canSpawn) { //Transform the frame block's location to the pocket coordinate system Point3D location = point.clone(); @@ -325,8 +327,11 @@ public class DungeonSchematic extends Schematic { //Remove frame block setBlockDirectly(world, location.getX(), location.getY(), location.getZ(), 0, 0); //Spawn Monolith - Entity mob = new MobMonolith(world); - mob.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), 1, 1); - world.spawnEntityInWorld(mob); + if (canSpawn) + { + Entity mob = new MobMonolith(world); + mob.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), 1, 1); + world.spawnEntityInWorld(mob); + } } } diff --git a/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java b/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java index 06f14c8..f32c0dc 100644 --- a/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java +++ b/StevenDimDoors/mod_pocketDim/schematic/BlockRotator.java @@ -7,7 +7,7 @@ import net.minecraft.block.BlockRedstoneRepeater; import net.minecraft.block.BlockStairs; import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.mod_pocketDim; -import StevenDimDoors.mod_pocketDim.blocks.DimensionalDoor; +import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; public class BlockRotator { @@ -379,7 +379,7 @@ public class BlockRotator break; } } - else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || Block.blocksList[blockID] instanceof DimensionalDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator) + else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater || Block.blocksList[blockID] instanceof BlockDoor || Block.blocksList[blockID] instanceof BaseDimDoor || blockID== Block.tripWireSource.blockID || Block.blocksList[blockID] instanceof BlockComparator) { switch (metadata) { diff --git a/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java b/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java index 59f8fb5..fac59e4 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MonolithSpawner.java @@ -194,7 +194,7 @@ public class MonolithSpawner implements IRegularTickReceiver { } } - private static boolean isMobSpawningAllowed() + public static boolean isMobSpawningAllowed() { //This function is used to retrieve the value of doMobSpawning. The code is the same //as the code used by Minecraft. Jaitsu requested this to make testing easier. ~SenseiKiwi