From 100fa38c52b67f31ac4e7343bd7beff5ea722be6 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Sat, 5 Jul 2014 14:18:18 -0400 Subject: [PATCH] Minor Changes to DDTeleporter Made some minor changes to DDTeleporter to get rid of a few warnings. Also tweaked and commented DDTeleporter.initializeDestination(). There were inappropriate references to a link's internal variables instead of using its getters and there was a subtle link overwrite for blacklist destinations. Without comments, it would probably be unclear that overwriting that link is safe. This changes are in preparation for fixing issues with blacklisted destination redirection. --- .../mod_pocketDim/core/DDTeleporter.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java index c7d0c2b7..fc793e50 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/core/DDTeleporter.java @@ -25,7 +25,6 @@ import StevenDimDoors.mod_pocketDim.mod_pocketDim; import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor; import StevenDimDoors.mod_pocketDim.config.DDProperties; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; -import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.util.Point4D; @@ -483,9 +482,12 @@ public class DDTeleporter { if (link.hasDestination()) { - if(PocketManager.isBlackListed(link.destination().getDimension())) + if (PocketManager.isBlackListed(link.destination().getDimension())) { - link=PocketManager.getDimensionData(link.source().getDimension()).createLink(link.link.point,LinkTypes.SAFE_EXIT,link.link.orientation); + // Overwrite this link to a blacklisted destination with a safe exit link + // We don't need to change 'link' to a different reference. + // NewDimData will overwrite the existing link in-place. + PocketManager.getDimensionData(link.source().getDimension()).createLink(link.source(), LinkTypes.SAFE_EXIT, link.orientation()); } else { @@ -499,7 +501,7 @@ public class DDTeleporter case LinkTypes.DUNGEON: return PocketBuilder.generateNewDungeonPocket(link, properties); case LinkTypes.POCKET: - return PocketBuilder.generateNewPocket(link, properties,door); + return PocketBuilder.generateNewPocket(link, properties, door); case LinkTypes.SAFE_EXIT: return generateSafeExit(link, properties); case LinkTypes.DUNGEON_EXIT: @@ -544,10 +546,7 @@ public class DDTeleporter { return matches.get( random.nextInt(matches.size()) ); } - else - { - return null; - } + return null; } private static boolean generateUnsafeExit(DimLink link) @@ -749,7 +748,7 @@ public class DDTeleporter // Set up the warp door at the destination orientation = BlockRotator.transformMetadata(orientation, 2, properties.WarpDoorID); - ItemDimensionalDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor); + ItemDoor.placeDoorBlock(world, x, y + 1, z, orientation, mod_pocketDim.warpDoor); // Complete the link to the destination // This comes last so the destination isn't set unless everything else works first