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.
This commit is contained in:
parent
17a770eaf0
commit
100fa38c52
1 changed files with 8 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue