diff --git a/StevenDimDoors/mod_pocketDim/DimData.java b/StevenDimDoors/mod_pocketDim/DimData.java index 043856c1..bd56b847 100644 --- a/StevenDimDoors/mod_pocketDim/DimData.java +++ b/StevenDimDoors/mod_pocketDim/DimData.java @@ -8,6 +8,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; + import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -19,7 +21,7 @@ public class DimData implements Serializable public World world; - public LinkData exitDimLink; + public NewLinkData exitDimLink; public boolean isPocket; public boolean hasBeenFilled=false; @@ -27,13 +29,13 @@ public class DimData implements Serializable public boolean isDimRandomRift=false; public DungeonGenerator dungeonGenerator = null; //public boolean isPrivatePocket = false; - public HashMap>> linksInThisDim = new HashMap(); - HashMap dimX; - HashMap> dimY ; + public HashMap>> linksInThisDim = new HashMap(); + HashMap dimX; + HashMap> dimY ; static final long serialVersionUID = 454342L; - public DimData(int dimID, boolean isPocket, int depth, LinkData exitLinkData) + public DimData(int dimID, boolean isPocket, int depth, NewLinkData exitLinkData) { this.dimID=dimID; this.depth=depth; @@ -44,12 +46,12 @@ public class DimData implements Serializable public DimData(int dimID, boolean isPocket, int depth, int exitLinkDimID, int exitX, int exitY, int exitZ) { - this(dimID, isPocket, depth, new LinkData(exitLinkDimID, exitX, exitY, exitZ)); + this(dimID, isPocket, depth, new NewLinkData(exitLinkDimID, exitX, exitY, exitZ)); } - public LinkData findNearestRift(World world, int range, int x, int y, int z) + public NewLinkData findNearestRift(World world, int range, int x, int y, int z) { - LinkData nearest=null; + NewLinkData nearest=null; float distance=range+1; int i=-range; int j=-range; @@ -89,7 +91,7 @@ public class DimData implements Serializable public ArrayList findRiftsInRange(World world, int range, int x, int y, int z) { - LinkData nearest=null; + NewLinkData nearest=null; ArrayList rifts = new ArrayList(); int i=-range; int j=-range; @@ -132,7 +134,7 @@ public class DimData implements Serializable - public LinkData addLinkToDim(LinkData link) + public NewLinkData addLinkToDim(NewLinkData link) { if(this.linksInThisDim.containsKey(link.locZCoord)) { @@ -144,13 +146,13 @@ public class DimData implements Serializable } else { - this.dimX=new HashMap(); + this.dimX=new HashMap(); } } else { - this.dimX=new HashMap(); - this.dimY=new HashMap>(); + this.dimX=new HashMap(); + this.dimY=new HashMap>(); } this.dimX.put(link.locXCoord, link); @@ -162,9 +164,9 @@ public class DimData implements Serializable } - public LinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation) + public NewLinkData addLinkToDim( int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, int linkOrientation) { - LinkData linkData= new LinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation); + NewLinkData linkData= new NewLinkData(this.dimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord,destinationZCoord,this.isPocket,linkOrientation); return this.addLinkToDim(linkData); } @@ -174,7 +176,7 @@ public class DimData implements Serializable return (this.dimID == DDProperties.instance().LimboDimensionID); } - public void removeLinkAtCoords(LinkData link) + public void removeLinkAtCoords(NewLinkData link) { this.removeLinkAtCoords(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord); } @@ -191,13 +193,13 @@ public class DimData implements Serializable } else { - this.dimX=new HashMap(); + this.dimX=new HashMap(); } } else { - this.dimX=new HashMap(); - this.dimY=new HashMap>(); + this.dimX=new HashMap(); + this.dimY=new HashMap>(); } this.dimX.remove(locationXCoord); @@ -205,7 +207,7 @@ public class DimData implements Serializable this.linksInThisDim.put(locationZCoord, dimY); } - public LinkData findLinkAtCoords(int locationXCoord, int locationYCoord, int locationZCoord) + public NewLinkData findLinkAtCoords(int locationXCoord, int locationYCoord, int locationZCoord) { try { @@ -232,21 +234,21 @@ public class DimData implements Serializable return null; } - public ArrayList getLinksInDim() + public ArrayList getLinksInDim() { //TODO: We might want to modify this function, but I'm afraid of breaking something right now. //To begin with, the name is wrong. This doesn't print anything! >_o ~SenseiKiwi - ArrayList links = new ArrayList(); + ArrayList links = new ArrayList(); if (this.linksInThisDim == null) { return links; } - for (HashMap> first : this.linksInThisDim.values()) + for (HashMap> first : this.linksInThisDim.values()) { - for (HashMap second : first.values()) + for (HashMap second : first.values()) { - for (LinkData linkData : second.values()) + for (NewLinkData linkData : second.values()) { links.add(linkData); } diff --git a/StevenDimDoors/mod_pocketDim/DungeonGenerator.java b/StevenDimDoors/mod_pocketDim/DungeonGenerator.java index 0500e76e..861bed7c 100644 --- a/StevenDimDoors/mod_pocketDim/DungeonGenerator.java +++ b/StevenDimDoors/mod_pocketDim/DungeonGenerator.java @@ -5,6 +5,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonType; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; @@ -18,7 +19,7 @@ public class DungeonGenerator implements Serializable public int weight; public String schematicPath; public ArrayList sideRifts = new ArrayList(); - public LinkData exitLink; + public NewLinkData exitLink; public boolean isOpen; public int sideDoorsSoFar=0; diff --git a/StevenDimDoors/mod_pocketDim/EventHookContainer.java b/StevenDimDoors/mod_pocketDim/EventHookContainer.java index d2e12b14..24f67b55 100644 --- a/StevenDimDoors/mod_pocketDim/EventHookContainer.java +++ b/StevenDimDoors/mod_pocketDim/EventHookContainer.java @@ -6,6 +6,7 @@ import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.world.WorldEvent; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -55,7 +56,7 @@ public class EventHookContainer if (dimHelper.dimList.containsKey(dimensionID)) { - for (LinkData link : dimHelper.instance.getDimData(dimensionID).getLinksInDim()) + for (NewLinkData link : dimHelper.instance.getDimData(dimensionID).getLinksInDim()) { if (!mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord)) { diff --git a/StevenDimDoors/mod_pocketDim/LinkData.java b/StevenDimDoors/mod_pocketDim/LinkData.java deleted file mode 100644 index eab4ec67..00000000 --- a/StevenDimDoors/mod_pocketDim/LinkData.java +++ /dev/null @@ -1,68 +0,0 @@ -package StevenDimDoors.mod_pocketDim; - -import java.io.Serializable; - -public class LinkData implements Serializable -{ - - public int locXCoord; - public int locYCoord; - public int locZCoord; - - public int destXCoord; - public int destYCoord; - public int destZCoord; - public int numberofChildren; - public boolean isLocPocket; - public int linkOrientation; - - public int destDimID; - public int locDimID; - - public boolean exists=false; - public boolean hasGennedDoor=false; - - static final long serialVersionUID = 45544342L; - - - public LinkData() - { - this.exists=false; - } - - public LinkData(int exitLinkDimID, int exitX, int exitY, int exitZ) - { - this.destDimID=exitLinkDimID; - this.destXCoord=exitX; - this.destYCoord=exitY; - this.destZCoord=exitZ; - } - - public LinkData(int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord, boolean isPocket,int orientation) - { - this.exists = true; - this.locXCoord=locationXCoord; - this.locYCoord=locationYCoord; - this.locZCoord=locationZCoord; - - this.destXCoord=destinationXCoord; - this.destYCoord=destinationYCoord; - this.destZCoord=destinationZCoord; - - this.destDimID=destinationDimID; - this.locDimID=locationDimID; - this.isLocPocket=isPocket; - this.linkOrientation=orientation; - } - - public String printLinkData() - { - //TODO: Rewrite this to make it prettier. @_@ I'm afraid of changing it to ToString() on the off - //chance it'll cause explosions and sadness. Damn serialization! ~SenseiKiwi - - String linkInfo; - linkInfo = String.valueOf(this.locDimID) + "locDimID "+String.valueOf(this.locXCoord)+":locXCoord "+String.valueOf(this.locYCoord)+":locYCoord "+String.valueOf(this.locZCoord)+":locZCoord "; - linkInfo.concat("\n"+ String.valueOf(this.destDimID)+"DestDimID "+String.valueOf(this.destXCoord)+":destXCoord "+String.valueOf(this.destYCoord)+":destYCoord "+String.valueOf(this.destZCoord)+":destZCoord "); - return linkInfo; - } -} \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/PacketHandler.java b/StevenDimDoors/mod_pocketDim/PacketHandler.java index 38a2d50a..a12ef35d 100644 --- a/StevenDimDoors/mod_pocketDim/PacketHandler.java +++ b/StevenDimDoors/mod_pocketDim/PacketHandler.java @@ -14,6 +14,7 @@ import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import com.google.common.io.ByteArrayDataInput; @@ -105,7 +106,7 @@ public class PacketHandler implements IPacketHandler { DimData dimDataToAddLink= dimHelper.instance.getDimData(dimId); - LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); + NewLinkData linkToAdd = new NewLinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); linkToAdd.hasGennedDoor=data.readBoolean(); dimHelper.instance.createLink(linkToAdd); @@ -130,7 +131,7 @@ public class PacketHandler implements IPacketHandler { DimData dimDataToRemoveFrom= dimHelper.instance.getDimData(dimId); - LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); + NewLinkData linkToAdd = new NewLinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean(),data.readInt()); dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord); } @@ -144,7 +145,7 @@ public class PacketHandler implements IPacketHandler } if(id==this.linkKeyPacketID) { - LinkData link = new LinkData(data.readInt(), data.readInt(), data.readInt(), data.readInt()); + NewLinkData link = new NewLinkData(data.readInt(), data.readInt(), data.readInt(), data.readInt()); dimHelper.instance.interDimLinkList.put(data.readInt(), link); } @@ -168,18 +169,18 @@ public class PacketHandler implements IPacketHandler manager.addToSendQueue(PacketHandler.onDimCreatedPacket(data)); - Collection >> linkList = data.linksInThisDim.values(); + Collection >> linkList = data.linksInThisDim.values(); for(HashMap map : linkList ) { - Collection > linkList2 = map.values(); + Collection > linkList2 = map.values(); for(HashMap map2 : linkList2) { - Collection linkList3 = map2.values(); + Collection linkList3 = map2.values(); - for(LinkData link : linkList3) + for(NewLinkData link : linkList3) { packetsToSend.add(( PacketHandler.onLinkCreatedPacket(link))); @@ -206,7 +207,7 @@ public class PacketHandler implements IPacketHandler } - public static Packet250CustomPayload onLinkCreatedPacket(LinkData link) + public static Packet250CustomPayload onLinkCreatedPacket(NewLinkData link) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bos); @@ -247,7 +248,7 @@ public class PacketHandler implements IPacketHandler } - public static Packet250CustomPayload linkKeyPacket(LinkData link, int key) + public static Packet250CustomPayload linkKeyPacket(NewLinkData link, int key) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bos); @@ -283,7 +284,7 @@ public class PacketHandler implements IPacketHandler } - public static void onLinkRemovedPacket(LinkData link) + public static void onLinkRemovedPacket(NewLinkData link) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bos); diff --git a/StevenDimDoors/mod_pocketDim/RiftGenerator.java b/StevenDimDoors/mod_pocketDim/RiftGenerator.java index 1009b31b..5b02031f 100644 --- a/StevenDimDoors/mod_pocketDim/RiftGenerator.java +++ b/StevenDimDoors/mod_pocketDim/RiftGenerator.java @@ -7,6 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.DimensionManager; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.items.itemDimDoor; import StevenDimDoors.mod_pocketDim.world.LimboProvider; @@ -55,7 +56,7 @@ public class RiftGenerator implements IWorldGenerator int attempts; int correction; boolean valid; - LinkData link; + NewLinkData link; //Check if we're generating things in the Nether if (world.provider.dimensionId == NETHER_DIMENSION_ID) @@ -93,7 +94,7 @@ public class RiftGenerator implements IWorldGenerator //Otherwise, create a one-way link and connect to the destination of the first link. if (link == null) { - link = new LinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 0); + link = new NewLinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 0); link = dimHelper.instance.createPocket(link, true, true); } else @@ -129,7 +130,7 @@ public class RiftGenerator implements IWorldGenerator { //Create a two-way link between the upper block of the gateway and a pocket dimension //That pocket dimension is where we'll start a dungeon! - link = new LinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 0); + link = new NewLinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 0); link = dimHelper.instance.createPocket(link, true, true); //If the current dimension isn't Limbo, build a Rift Gateway out of Stone Bricks diff --git a/StevenDimDoors/mod_pocketDim/SchematicLoader.java b/StevenDimDoors/mod_pocketDim/SchematicLoader.java index 630b21ff..62e357e0 100644 --- a/StevenDimDoors/mod_pocketDim/SchematicLoader.java +++ b/StevenDimDoors/mod_pocketDim/SchematicLoader.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Random; import net.minecraft.world.World; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; @@ -15,7 +16,7 @@ public class SchematicLoader { private SchematicLoader() { } - public static boolean generateDungeonPocket(LinkData link, DDProperties properties) + public static boolean generateDungeonPocket(NewLinkData link, DDProperties properties) { if (link == null || properties == null) { @@ -155,7 +156,7 @@ public class SchematicLoader return dungeon; } - private static long computeDestinationHash(LinkData link) + private static long computeDestinationHash(NewLinkData link) { //Time for some witchcraft. //The code here is inspired by a discussion on Stack Overflow regarding hash codes for 3D. diff --git a/StevenDimDoors/mod_pocketDim/TileEntityRift.java b/StevenDimDoors/mod_pocketDim/TileEntityRift.java index e15ba5ce..cfff50fc 100644 --- a/StevenDimDoors/mod_pocketDim/TileEntityRift.java +++ b/StevenDimDoors/mod_pocketDim/TileEntityRift.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Random; import StevenDimDoors.mod_pocketDim.blocks.BlockRift; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import StevenDimDoors.mod_pocketDim.ticking.MobMonolith; @@ -41,7 +42,7 @@ public class TileEntityRift extends TileEntity public int age = 0; public HashMap renderingCenters = new HashMap(); - public LinkData nearestRiftData; + public NewLinkData nearestRiftData; public int spawnedEndermenID=0; Random rand; DataWatcher watcher = new DataWatcher(); @@ -243,7 +244,7 @@ public class TileEntityRift extends TileEntity if (growCount<100) { - LinkData link = dimHelper.instance.getLinkDataFromCoords(this.xCoord, this.yCoord, this.zCoord, worldObj); + NewLinkData link = dimHelper.instance.getLinkDataFromCoords(this.xCoord, this.yCoord, this.zCoord, worldObj); if(link!=null) { if(!this.hasGrownRifts&&rand.nextInt(3)==0) diff --git a/StevenDimDoors/mod_pocketDim/TransientDoor.java b/StevenDimDoors/mod_pocketDim/TransientDoor.java index 3df173b3..47a04456 100644 --- a/StevenDimDoors/mod_pocketDim/TransientDoor.java +++ b/StevenDimDoors/mod_pocketDim/TransientDoor.java @@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim; import java.util.Random; import StevenDimDoors.mod_pocketDim.blocks.ExitDoor; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.block.Block; @@ -86,7 +87,7 @@ public class TransientDoor extends ExitDoor - LinkData linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); + NewLinkData linkData= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); if(linkData!=null) { if(dimHelper.dimList.containsKey(linkData.destDimID)) diff --git a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java index 95289a98..0e047e58 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java +++ b/StevenDimDoors/mod_pocketDim/blocks/BlockDimWallPerm.java @@ -12,8 +12,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import StevenDimDoors.mod_pocketDim.BlankTeleporter; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import cpw.mods.fml.common.FMLCommonHandler; @@ -51,10 +51,10 @@ public class BlockDimWallPerm extends Block { Random rand = new Random(); - LinkData link=dimHelper.instance.getRandomLinkData(false); + NewLinkData link=dimHelper.instance.getRandomLinkData(false); if(link==null) { - link =new LinkData(0,0,0,0); + link =new NewLinkData(0,0,0,0); } link.destDimID = 0; link.locDimID = par1World.provider.dimensionId; diff --git a/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java b/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java index 82447ee1..bf621ee9 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/ChaosDoor.java @@ -3,8 +3,8 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.block.Block; @@ -76,7 +76,7 @@ public class ChaosDoor extends dimDoor if(newDim) { - LinkData link = new LinkData(par1World.provider.dimensionId, properties.LimboDimensionID, par2, par3, par4, par2, par3+500, par4, false,0); + NewLinkData link = new NewLinkData(par1World.provider.dimensionId, properties.LimboDimensionID, par2, par3, par4, par2, par3+500, par4, false,0); link.linkOrientation= par1World.getBlockMetadata(par2, par3-1, par4); dimHelper.instance.createLink(link); // System.out.println(link.linkOrientation); @@ -118,7 +118,7 @@ public class ChaosDoor extends dimDoor { i++; - LinkData link = (LinkData) dimHelper.instance.getRandomLinkData(false); + NewLinkData link = (NewLinkData) dimHelper.instance.getRandomLinkData(false); if(link!=null) { @@ -127,7 +127,7 @@ public class ChaosDoor extends dimDoor { foundRandomDest=true; - dimHelper.instance.traverseDimDoor(par1World, new LinkData(link.destDimID,link.locDimID,link.destXCoord,link.destYCoord,link.destZCoord,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0), par5Entity); + dimHelper.instance.traverseDimDoor(par1World, new NewLinkData(link.destDimID,link.locDimID,link.destXCoord,link.destYCoord,link.destZCoord,link.locXCoord,link.locYCoord,link.locZCoord,link.isLocPocket,0), par5Entity); if(dimHelper.getWorld(link.locDimID)!=null) { diff --git a/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java b/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java index 1d48443e..346b5cd0 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/ExitDoor.java @@ -3,8 +3,8 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java index 5e94326a..86dc8c91 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimDoor.java @@ -3,9 +3,9 @@ package StevenDimDoors.mod_pocketDim.blocks; import java.util.Random; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; @@ -59,19 +59,19 @@ public class dimDoor extends BlockContainer { if(dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World)!=null) { - LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); + NewLinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3, par4, par1World); par1World.setBlock(par2, par3, par4, properties.RiftBlockID); } if(dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World)!=null) { - LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World); + NewLinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3-1, par4, par1World); par1World.setBlock(par2, par3-1, par4, properties.RiftBlockID); } if(dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World)!=null) { - LinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World); + NewLinkData link= dimHelper.instance.getLinkDataFromCoords(par2, par3+1, par4, par1World); par1World.setBlock(par2, par3+1, par4, properties.RiftBlockID); } @@ -89,7 +89,7 @@ public class dimDoor extends BlockContainer int var12 = (int) (MathHelper.floor_double((double)((par5Entity.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); int num=0; - LinkData linkData=null; + NewLinkData linkData=null; if(par1World.getBlockId(par2, par3-1, par4)==this.blockID) { @@ -264,7 +264,7 @@ public class dimDoor extends BlockContainer - LinkData link = new LinkData(par1World.provider.dimensionId, 0, par2, par3, par4, par2, par3, par4, true,par1World.getBlockMetadata(par2, par3-1, par4)); + NewLinkData link = new NewLinkData(par1World.provider.dimensionId, 0, par2, par3, par4, par2, par3, par4, true,par1World.getBlockMetadata(par2, par3-1, par4)); dimHelper.instance.createPocket(link,true, false); // System.out.println(link.linkOrientation); diff --git a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java index cb278390..a7ad487a 100644 --- a/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java +++ b/StevenDimDoors/mod_pocketDim/blocks/dimHatch.java @@ -1,8 +1,8 @@ package StevenDimDoors.mod_pocketDim.blocks; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.world.PocketProvider; import net.minecraft.block.BlockTrapDoor; @@ -55,7 +55,7 @@ public class dimHatch extends BlockTrapDoor DimData dimData = (DimData) dimHelper.instance.dimList.get(par1World.provider.dimensionId); - LinkData exitLink=dimData.exitDimLink; + NewLinkData exitLink=dimData.exitDimLink; exitLink.locDimID=par1World.provider.dimensionId; diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java index 81c50f70..f444170f 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreateDungeonRift.java @@ -6,7 +6,7 @@ import java.util.Collection; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MathHelper; import StevenDimDoors.mod_pocketDim.DungeonGenerator; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; @@ -60,7 +60,7 @@ public class CommandCreateDungeonRift extends DDCommandBase int x = MathHelper.floor_double(sender.posX); int y = MathHelper.floor_double(sender.posY); int z = MathHelper.floor_double (sender.posZ); - LinkData link = new LinkData(sender.worldObj.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 3); + NewLinkData link = new NewLinkData(sender.worldObj.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 3); if (command[0].equals("random")) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java index 27a0d5f5..7b685f3f 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandCreatePocket.java @@ -1,7 +1,7 @@ package StevenDimDoors.mod_pocketDim.commands; import net.minecraft.entity.player.EntityPlayer; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; public class CommandCreatePocket extends DDCommandBase @@ -39,7 +39,7 @@ public class CommandCreatePocket extends DDCommandBase int x = (int) sender.posX; int y = (int) sender.posY; int z = (int) sender.posZ; - LinkData link = DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z); + NewLinkData link = DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z); //Notify the player sender.sendChatToPlayer("Created a door to a pocket dimension (Dimension ID = " + link.destDimID + "). Please build your dungeon there."); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java index f48b352f..1133cb1c 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteAllLinks.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class CommandDeleteAllLinks extends DDCommandBase @@ -57,9 +57,9 @@ public class CommandDeleteAllLinks extends DDCommandBase if(dimHelper.dimList.containsKey(targetDim)) { DimData dim = dimHelper.instance.getDimData(targetDim); - ArrayList linksInDim = dim.getLinksInDim(); + ArrayList linksInDim = dim.getLinksInDim(); - for (LinkData link : linksInDim) + for (NewLinkData link : linksInDim) { World targetWorld = dimHelper.getWorld(targetDim); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java index 4c2242f1..75b6513d 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteDimensionData.java @@ -5,7 +5,7 @@ import java.util.Collection; import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class CommandDeleteDimensionData extends DDCommandBase @@ -60,10 +60,10 @@ public class CommandDeleteDimensionData extends DDCommandBase { for(DimData dimData :dimHelper.dimList.values()) { - Collection links= new ArrayList(); + Collection links= new ArrayList(); links.addAll( dimData.getLinksInDim()); - for(LinkData link : links) + for(NewLinkData link : links) { if(link.destDimID==targetDim) { diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java index 1e22fea5..d3c925df 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandDeleteRifts.java @@ -5,8 +5,8 @@ import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class CommandDeleteRifts extends DDCommandBase @@ -58,9 +58,9 @@ public class CommandDeleteRifts extends DDCommandBase if(dimHelper.dimList.containsKey(targetDim)) { DimData dim = dimHelper.instance.getDimData(targetDim); - ArrayList linksInDim = dim.getLinksInDim(); + ArrayList linksInDim = dim.getLinksInDim(); - for(LinkData link : linksInDim) + for(NewLinkData link : linksInDim) { World targetWorld = dimHelper.getWorld(targetDim); diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java index 427a8bfe..14105d51 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPrintDimensionData.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class CommandPrintDimensionData extends DDCommandBase @@ -56,11 +56,11 @@ public class CommandPrintDimensionData extends DDCommandBase return DDCommandResult.UNREGISTERED_DIMENSION; } - ArrayList links = dimData.getLinksInDim(); + ArrayList links = dimData.getLinksInDim(); sender.sendChatToPlayer("Dimension ID = " + dimData.dimID); sender.sendChatToPlayer("Dimension Depth = " + dimData.depth); - for (LinkData link : links) + for (NewLinkData link : links) { sender.sendChatToPlayer(link.printLinkData()); } diff --git a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java index dacb16ea..5145b9a5 100644 --- a/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java +++ b/StevenDimDoors/mod_pocketDim/commands/CommandPruneDimensions.java @@ -7,7 +7,7 @@ import java.util.Set; import net.minecraft.entity.player.EntityPlayer; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class CommandPruneDimensions extends DDCommandBase @@ -47,12 +47,12 @@ public class CommandPruneDimensions extends DDCommandBase for (DimData data : allDims) { - for (LinkData link : data.getLinksInDim()) + for (NewLinkData link : data.getLinksInDim()) { linkedDimensions.add(link.destDimID); } } - for (LinkData link : dimHelper.instance.interDimLinkList.values()) + for (NewLinkData link : dimHelper.instance.interDimLinkList.values()) { linkedDimensions.add(link.destDimID); } diff --git a/StevenDimDoors/mod_pocketDim/core/NewLinkData.java b/StevenDimDoors/mod_pocketDim/core/NewLinkData.java new file mode 100644 index 00000000..c2deee18 --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/core/NewLinkData.java @@ -0,0 +1,36 @@ +package StevenDimDoors.mod_pocketDim.core; + +import java.io.Serializable; + +import StevenDimDoors.mod_pocketDim.util.Point4D; + +public class NewLinkData implements Serializable +{ + private static final long serialVersionUID = 1462177151401498444L; + + private Point4D source; + private Point4D destination; + + public NewLinkData(int srcX, int srcY, int srcZ, int srcDimension) + { + source = new Point4D(srcX, srcY, srcZ, srcDimension); + destination = null; + } + + public NewLinkData(int srcX, int srcY, int srcZ, int srcDimension, int dstX, int dstY, int dstZ, int dstDimension) + { + source = new Point4D(srcX, srcY, srcZ, srcDimension); + destination = new Point4D(dstX, dstY, dstZ, dstDimension); + } + + public NewLinkData(Point4D source, Point 4D destination) + { + + } + + @Override + public String toString() + { + return source + " -> " + destination; + } +} \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java b/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java index 23f0156a..60b0073a 100644 --- a/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java +++ b/StevenDimDoors/mod_pocketDim/dungeon/DungeonSchematic.java @@ -17,8 +17,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.Point3D; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; @@ -295,7 +295,7 @@ public class DungeonSchematic extends Schematic { //Set the orientation of the rift exit Point3D entranceRiftLocation = entrance.clone(); BlockRotator.transformPoint(entranceRiftLocation, entrance, rotation, pocketCenter); - LinkData sideLink = dimHelper.instance.getLinkDataFromCoords( + NewLinkData sideLink = dimHelper.instance.getLinkDataFromCoords( entranceRiftLocation.getX(), entranceRiftLocation.getY(), entranceRiftLocation.getZ(), @@ -319,8 +319,8 @@ public class DungeonSchematic extends Schematic { int blockDirection = world.getBlockMetadata(location.getX(), location.getY() - 1, location.getZ()); Point3D linkDestination = location.clone(); - LinkData randomLink = dimHelper.instance.getRandomLinkData(false); - LinkData sideLink = new LinkData(destDimID, + NewLinkData randomLink = dimHelper.instance.getRandomLinkData(false); + NewLinkData sideLink = new NewLinkData(destDimID, dimHelper.instance.getDimData(originDimID).exitDimLink.destDimID, location.getX(), location.getY(), @@ -405,7 +405,7 @@ public class DungeonSchematic extends Schematic { BlockRotator.transformPoint(linkDestination, zeroPoint, blockDirection - BlockRotator.EAST_DOOR_METADATA, location); //Create the link between our current door and its intended exit in destination pocket - LinkData sideLink = new LinkData(destDimID, 0, + NewLinkData sideLink = new NewLinkData(destDimID, 0, location.getX(), location.getY(), location.getZ(), diff --git a/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java b/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java index 3e82c28f..c2388bba 100644 --- a/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java +++ b/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java @@ -8,7 +8,7 @@ import java.util.Random; import net.minecraft.util.WeightedRandom; import StevenDimDoors.mod_pocketDim.DungeonGenerator; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.util.WeightedContainer; @@ -123,7 +123,7 @@ public class DungeonPack } } - public DungeonGenerator getNextDungeon(LinkData inbound, Random random) + public DungeonGenerator getNextDungeon(NewLinkData inbound, Random random) { if (allDungeons.isEmpty()) { diff --git a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java index ac2fcfdf..fa44b8fb 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/DungeonHelper.java @@ -22,8 +22,8 @@ import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; import StevenDimDoors.mod_pocketDim.DungeonGenerator; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.dungeon.DungeonSchematic; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPack; import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfig; @@ -290,10 +290,10 @@ public class DungeonHelper return pack; } - public LinkData createCustomDungeonDoor(World world, int x, int y, int z) + public NewLinkData createCustomDungeonDoor(World world, int x, int y, int z) { //Create a link above the specified position. Link to a new pocket dimension. - LinkData link = new LinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 3); + NewLinkData link = new NewLinkData(world.provider.dimensionId, 0, x, y + 1, z, x, y + 1, z, true, 3); link = dimHelper.instance.createPocket(link, true, false); //Place a Warp Door linked to that pocket @@ -530,7 +530,7 @@ public class DungeonHelper } } - public void generateDungeonLink(LinkData inbound, DungeonPack pack, Random random) + public void generateDungeonLink(NewLinkData inbound, DungeonPack pack, Random random) { DungeonGenerator selection; DungeonPackConfig config; @@ -658,7 +658,7 @@ public class DungeonHelper for (int count = 1; count < maxSize && found; count++) { found = false; - for (LinkData link : tailDim.getLinksInDim()) + for (NewLinkData link : tailDim.getLinksInDim()) { DimData neighbor = dimHelper.instance.getDimData(link.destDimID); if (neighbor.depth == tailDim.depth - 1 && neighbor.dungeonGenerator != null && @@ -674,7 +674,7 @@ public class DungeonHelper return history; } - private static int getPackDepth(LinkData inbound, DungeonPack pack) + private static int getPackDepth(NewLinkData inbound, DungeonPack pack) { //TODO: I've improved this code for the time being. However, searching across links is a flawed approach. A player could //manipulate the output of this function by setting up links to mislead our algorithm or by removing links. @@ -688,7 +688,7 @@ public class DungeonHelper do { found = false; - for (LinkData link : tailDim.getLinksInDim()) + for (NewLinkData link : tailDim.getLinksInDim()) { DimData neighbor = dimHelper.instance.getDimData(link.destDimID); if (neighbor.depth == tailDim.depth - 1 && neighbor.dungeonGenerator != null && @@ -728,7 +728,7 @@ public class DungeonHelper while (dungeons.size() < maxSize && !pendingDimensions.isEmpty()) { DimData current = pendingDimensions.remove(); - for (LinkData link : current.getLinksInDim()) + for (NewLinkData link : current.getLinksInDim()) { DimData child = helper.getDimData(link.destDimID); if (child.depth == current.depth + 1 && child.dungeonGenerator != null && checked.add(child)) diff --git a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java index 03240720..c07f9f5f 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/dimHelper.java @@ -35,13 +35,13 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage; import net.minecraftforge.common.DimensionManager; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.ObjectSaveInputStream; import StevenDimDoors.mod_pocketDim.PacketHandler; import StevenDimDoors.mod_pocketDim.Point3D; import StevenDimDoors.mod_pocketDim.SchematicLoader; import StevenDimDoors.mod_pocketDim.TileEntityRift; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.schematic.BlockRotator; import StevenDimDoors.mod_pocketDim.world.LimboProvider; import StevenDimDoors.mod_pocketDim.world.PocketProvider; @@ -79,7 +79,7 @@ public class dimHelper extends DimensionManager * HashMap for temporary storage of Link Signature damage hash values. See itemLinkSignature for more details * @Return */ - public HashMap interDimLinkList= new HashMap(); + public HashMap interDimLinkList= new HashMap(); /** * ArrayList containing all link data not sorted for easy random access, used for random doors and for recreating rifts if they have a block placed over them. @@ -103,7 +103,7 @@ public class dimHelper extends DimensionManager } // GreyMaria: My god, what a mess. Here, let me clean it up a bit. - public Entity teleportEntity(World world, Entity entity, LinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function. + public Entity teleportEntity(World world, Entity entity, NewLinkData link) //this beautiful teleport method is based off of xCompWiz's teleport function. { WorldServer oldWorld = (WorldServer)world; WorldServer newWorld; @@ -260,7 +260,7 @@ public class dimHelper extends DimensionManager * @param orientation- the orientation of the door used to teleport, determines player orientation and door placement on arrival * @Return */ - public void traverseDimDoor(World world,LinkData linkData, Entity entity) + public void traverseDimDoor(World world,NewLinkData linkData, Entity entity) { DDProperties properties = DDProperties.instance(); @@ -355,7 +355,7 @@ public class dimHelper extends DimensionManager * @return */ - public LinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord) + public NewLinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord) { if(this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID)!=null) { @@ -381,13 +381,13 @@ public class dimHelper extends DimensionManager * @param linkOrientation * @return */ - public LinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord,int linkOrientation) + public NewLinkData createLink( int locationDimID, int destinationDimID, int locationXCoord, int locationYCoord, int locationZCoord, int destinationXCoord, int destinationYCoord, int destinationZCoord,int linkOrientation) { - LinkData linkData =new LinkData( locationDimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord ,destinationZCoord,false,linkOrientation); + NewLinkData linkData =new NewLinkData( locationDimID, destinationDimID, locationXCoord, locationYCoord, locationZCoord, destinationXCoord, destinationYCoord ,destinationZCoord,false,linkOrientation); return this.createLink(linkData); } - public LinkData createLink(LinkData link) + public NewLinkData createLink(NewLinkData link) { DDProperties properties = DDProperties.instance(); @@ -421,11 +421,11 @@ public class dimHelper extends DimensionManager return link; } - public int getDestOrientation(LinkData link) + public int getDestOrientation(NewLinkData link) { if(link !=null) { - LinkData destLink = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); + NewLinkData destLink = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); if(destLink!=null) { return destLink.linkOrientation; @@ -443,7 +443,7 @@ public class dimHelper extends DimensionManager } } - public void removeLink(LinkData link) + public void removeLink(NewLinkData link) { this.removeLink(link.locDimID, link.locXCoord, link.locYCoord, link.locZCoord); } @@ -462,7 +462,7 @@ public class dimHelper extends DimensionManager DimData locationDimData= new DimData(locationDimID, false, 0, locationDimID,locationXCoord,locationYCoord,locationZCoord); dimHelper.dimList.put(locationDimID, locationDimData); } - LinkData link = this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID); + NewLinkData link = this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID); dimHelper.instance.getDimData(locationDimID).removeLinkAtCoords(link); //updates clients that a rift has been removed if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER) @@ -471,7 +471,7 @@ public class dimHelper extends DimensionManager this.save(); } } - public LinkData findNearestRift(World world, int x, int y, int z, int range) + public NewLinkData findNearestRift(World world, int x, int y, int z, int range) { return dimHelper.instance.getDimData(world).findNearestRift(world, range, x, y, z); } @@ -480,7 +480,7 @@ public class dimHelper extends DimensionManager * @param world- door * @param incLink */ - public void generateDoor(World world, LinkData incLink) + public void generateDoor(World world, NewLinkData incLink) { int locX = incLink.locXCoord; int locY = incLink.locYCoord; @@ -504,7 +504,7 @@ public class dimHelper extends DimensionManager { DimensionManager.initDimension(destinationID); } - LinkData destLink = this.getLinkDataFromCoords(destX, destY, destZ, destinationID); + NewLinkData destLink = this.getLinkDataFromCoords(destX, destY, destZ, destinationID); int destOrientation = 0; if(destLink!=null) { @@ -536,7 +536,7 @@ public class dimHelper extends DimensionManager * @param orientation * @return */ - public void generatePocket(LinkData incomingLink) + public void generatePocket(NewLinkData incomingLink) { DDProperties properties = DDProperties.instance(); try @@ -697,10 +697,10 @@ public class dimHelper extends DimensionManager DeleteFolder.deleteFolder(save); dimData.hasBeenFilled = false; dimData.hasDoor = false; - for(LinkData link : dimData.getLinksInDim()) + for(NewLinkData link : dimData.getLinksInDim()) { link.hasGennedDoor = false; - LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); + NewLinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); if (linkOut != null) { linkOut.hasGennedDoor = false; @@ -788,7 +788,7 @@ public class dimHelper extends DimensionManager * @param orientation- determines the orientation of the entrance link to this dim. Should be the metaData of the door occupying the rift. -1 if no door. * @return */ - public LinkData createPocket(LinkData link , boolean isGoingDown, boolean isRandomRift) + public NewLinkData createPocket(NewLinkData link , boolean isGoingDown, boolean isRandomRift) { DDProperties properties = DDProperties.instance(); if(dimHelper.getWorld(0)==null) @@ -821,7 +821,7 @@ public class dimHelper extends DimensionManager } if(rand.nextInt(13-depth)==0) { - LinkData link1=getRandomLinkData(false); + NewLinkData link1=getRandomLinkData(false); } } if(locationDimData.isPocket) //determines the qualites of the pocket dim being created, based on parent dim. @@ -969,7 +969,7 @@ public class dimHelper extends DimensionManager try { - this.interDimLinkList = (HashMap) comboSave.get("interDimLinkList"); + this.interDimLinkList = (HashMap) comboSave.get("interDimLinkList"); } catch(Exception e) { @@ -1020,7 +1020,7 @@ public class dimHelper extends DimensionManager try { - this.interDimLinkList=(HashMap) comboSave.get("interDimLinkList"); + this.interDimLinkList=(HashMap) comboSave.get("interDimLinkList"); } catch(Exception e) { @@ -1073,7 +1073,7 @@ public class dimHelper extends DimensionManager - public LinkData getRandomLinkData(boolean allowInPocket) + public NewLinkData getRandomLinkData(boolean allowInPocket) { boolean foundRandomDest=false; int i=0; @@ -1083,7 +1083,7 @@ public class dimHelper extends DimensionManager { i++; DimData dimData; - ArrayList linksInDim = new ArrayList(); + ArrayList linksInDim = new ArrayList(); for(size--;size>0;) { dimData = dimHelper.instance.getDimData((Integer)dimList.keySet().toArray()[rand.nextInt(dimList.keySet().size())]); @@ -1103,7 +1103,7 @@ public class dimHelper extends DimensionManager break; } - LinkData link1 = (LinkData) linksInDim.get(rand.nextInt(linksInDim.size())); + NewLinkData link1 = (NewLinkData) linksInDim.get(rand.nextInt(linksInDim.size())); if(link1!=null) { @@ -1125,7 +1125,7 @@ public class dimHelper extends DimensionManager * @param link * @return */ - public LinkData getLinkDataAtDestination(LinkData link) + public NewLinkData getLinkDataAtDestination(NewLinkData link) { return this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID); } @@ -1144,9 +1144,9 @@ public class dimHelper extends DimensionManager * @param updateLinksPointingHere * @return */ - public boolean moveLinkDataLocation(LinkData link, int x,int y, int z, int dimID, boolean updateLinksPointingHere) + public boolean moveLinkDataLocation(NewLinkData link, int x,int y, int z, int dimID, boolean updateLinksPointingHere) { - LinkData linkToMove = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); + NewLinkData linkToMove = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); if(linkToMove!=null) { int oldX = linkToMove.locXCoord; @@ -1156,10 +1156,10 @@ public class dimHelper extends DimensionManager if(updateLinksPointingHere) { - ArrayList incomingLinks = new ArrayList(); + ArrayList incomingLinks = new ArrayList(); for(DimData dimData : dimHelper.dimList.values()) { - for(LinkData allLink : dimData.getLinksInDim()) + for(NewLinkData allLink : dimData.getLinksInDim()) { if(this.getLinkDataAtDestination(allLink)==linkToMove) { @@ -1168,7 +1168,7 @@ public class dimHelper extends DimensionManager } } } - this.createLink(new LinkData(dimID,linkToMove.destDimID,x,y,z,linkToMove.destXCoord,linkToMove.destYCoord,linkToMove.destZCoord,linkToMove.isLocPocket,linkToMove.linkOrientation)); + this.createLink(new NewLinkData(dimID,linkToMove.destDimID,x,y,z,linkToMove.destXCoord,linkToMove.destYCoord,linkToMove.destZCoord,linkToMove.isLocPocket,linkToMove.linkOrientation)); if(this.getLinkDataFromCoords(oldX,oldY,oldZ,oldDimID)!=null) { @@ -1189,14 +1189,14 @@ public class dimHelper extends DimensionManager * @param updateLinksAtDestination * @return */ - public boolean moveLinkDataDestination(LinkData link, int x, int y, int z, int dimID, boolean updateLinksAtDestination) + public boolean moveLinkDataDestination(NewLinkData link, int x, int y, int z, int dimID, boolean updateLinksAtDestination) { - LinkData linkToMove = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); + NewLinkData linkToMove = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); if(linkToMove!=null) { if(updateLinksAtDestination) { - LinkData linkAtDestination = this.getLinkDataAtDestination(linkToMove); + NewLinkData linkAtDestination = this.getLinkDataAtDestination(linkToMove); if(linkAtDestination!=null) { this.moveLinkDataLocation(linkAtDestination, x, y, z, dimID, false); @@ -1207,7 +1207,7 @@ public class dimHelper extends DimensionManager linkToMove.destYCoord=y; linkToMove.destZCoord=z; this.createLink(linkToMove); - LinkData testLink = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); + NewLinkData testLink = this.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID); return true; } @@ -1222,7 +1222,7 @@ public class dimHelper extends DimensionManager * @param par1World * @return */ - public LinkData getLinkDataFromCoords(int x, int y, int z, World par1World) + public NewLinkData getLinkDataFromCoords(int x, int y, int z, World par1World) { return this.getLinkDataFromCoords(x, y, z, par1World.provider.dimensionId); } @@ -1234,7 +1234,7 @@ public class dimHelper extends DimensionManager * @param worldID * @return */ - public LinkData getLinkDataFromCoords(int x, int y, int z, int worldID) + public NewLinkData getLinkDataFromCoords(int x, int y, int z, int worldID) { if(dimHelper.dimList.containsKey(worldID)) { @@ -1261,7 +1261,7 @@ public class dimHelper extends DimensionManager { DDProperties properties = DDProperties.instance(); - LinkData nearest=null; + NewLinkData nearest=null; float distance=range+1; int i=-range; int j=-range; diff --git a/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java b/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java index dd148382..3f9a4f58 100644 --- a/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java +++ b/StevenDimDoors/mod_pocketDim/helpers/yCoordHelper.java @@ -1,6 +1,6 @@ package StevenDimDoors.mod_pocketDim.helpers; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; @@ -11,7 +11,7 @@ public class yCoordHelper { private static final int MAXIMUM_UNCOVERED_Y = 245; - public static int getFirstUncovered(LinkData pointerLink) + public static int getFirstUncovered(NewLinkData pointerLink) { return yCoordHelper.getFirstUncovered( pointerLink.destDimID, diff --git a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java index 7737df4a..2ca96a72 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemRiftBlade.java @@ -21,8 +21,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -183,7 +183,7 @@ public class ItemRiftBlade extends ItemSword int z = MathHelper.floor_double(var9); int rotation = (int) (MathHelper.floor_double((double)((par3EntityPlayer.rotationYaw+90) * 4.0F / 360.0F) + 0.5D) & 3); - LinkData link = new LinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true,rotation); + NewLinkData link = new NewLinkData(par2World.provider.dimensionId, 0, x, y, z, x, y, z, true,rotation); if(this.getMaxItemUseDuration(par1ItemStack)-par4>12&&!par2World.isRemote&&itemDimDoor.canPlace(par2World, x, y, z, rotation)) { @@ -212,7 +212,7 @@ public class ItemRiftBlade extends ItemSword { if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID) { - LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); + NewLinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); if(link!=null) { diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java index 3da5016a..504f66c5 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStabilizedRiftSignature.java @@ -3,8 +3,8 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.block.Block; @@ -58,7 +58,7 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { int key; - LinkData linkData; + NewLinkData linkData; int thisWorldID=par3World.provider.dimensionId; Integer[] linkCoords =this.readFromNBT(par1ItemStack); diff --git a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java index a84d2d9a..b5a741ba 100644 --- a/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java +++ b/StevenDimDoors/mod_pocketDim/items/ItemStableFabric.java @@ -2,10 +2,10 @@ package StevenDimDoors.mod_pocketDim.items; import java.util.List; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.SchematicLoader; import StevenDimDoors.mod_pocketDim.Spells; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler; import StevenDimDoors.mod_pocketDimClient.ClientTickHandler; @@ -117,7 +117,7 @@ public class ItemStableFabric extends Item { //if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ)==properties.RiftBlockID) { - LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); + NewLinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); if(link!=null) { Block var11; diff --git a/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java b/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java index c8f3c6c7..c877d691 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java +++ b/StevenDimDoors/mod_pocketDim/items/itemDimDoor.java @@ -14,8 +14,8 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; public class itemDimDoor extends ItemDoor @@ -138,7 +138,7 @@ public class itemDimDoor extends ItemDoor { if(par2World.getBlockId(hit.blockX, hit.blockY, hit.blockZ) == properties.RiftBlockID) { - LinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); + NewLinkData link = dimHelper.instance.getLinkDataFromCoords(hit.blockX, hit.blockY, hit.blockZ, par2World); if(link!=null) { Block var11; diff --git a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java index 9de5a380..6136038d 100644 --- a/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java +++ b/StevenDimDoors/mod_pocketDim/items/itemLinkSignature.java @@ -4,8 +4,8 @@ import java.util.List; import StevenDimDoors.mod_pocketDim.DDProperties; import StevenDimDoors.mod_pocketDim.DimData; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.block.Block; @@ -69,7 +69,7 @@ public class itemLinkSignature extends Item public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { int key; - LinkData linkData; + NewLinkData linkData; int thisWorldID=par3World.provider.dimensionId; diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index b2ca95ab..c8400b54 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -33,6 +33,7 @@ import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData; import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions; import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons; import StevenDimDoors.mod_pocketDim.commands.CommandTeleportPlayer; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.items.ItemBlockDimWall; @@ -426,7 +427,7 @@ public class mod_pocketDim if(!dimHelper.dimList.containsKey(properties.LimboDimensionID)) { - dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new LinkData())); + dimHelper.dimList.put(properties.LimboDimensionID, new DimData( properties.LimboDimensionID, false, 0, new NewLinkData())); } } diff --git a/StevenDimDoors/mod_pocketDim/pocketTeleporter.java b/StevenDimDoors/mod_pocketDim/pocketTeleporter.java index 55133860..1f3e92fc 100644 --- a/StevenDimDoors/mod_pocketDim/pocketTeleporter.java +++ b/StevenDimDoors/mod_pocketDim/pocketTeleporter.java @@ -1,5 +1,6 @@ package StevenDimDoors.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityMinecart; @@ -12,7 +13,7 @@ public class pocketTeleporter { int x,y,z; - LinkData sendingLink; + NewLinkData sendingLink; public pocketTeleporter() @@ -28,7 +29,7 @@ public class pocketTeleporter * Create a new portal near an entity. */ - public void placeInPortal(Entity par1Entity, WorldServer world, LinkData link) + public void placeInPortal(Entity par1Entity, WorldServer world, NewLinkData link) { diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java index 0297638d..536c0b76 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobMonolith.java @@ -13,7 +13,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import StevenDimDoors.mod_pocketDim.world.LimboProvider; import StevenDimDoors.mod_pocketDim.world.PocketProvider; @@ -171,7 +171,7 @@ public class MobMonolith extends EntityFlying implements IMob - LinkData link = new LinkData(this.worldObj.provider.dimensionId, properties.LimboDimensionID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0); + NewLinkData link = new NewLinkData(this.worldObj.provider.dimensionId, properties.LimboDimensionID, (int)this.posX, (int)this.posY, (int)this.posZ, (int)this.posX+rand.nextInt(500)-250, (int)this.posY+500, (int)this.posZ+rand.nextInt(500)-250, false,0); dimHelper.instance.traverseDimDoor(worldObj, link, entityPlayer); this.aggro=0; diff --git a/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java b/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java index 386c73b9..b840e48c 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java +++ b/StevenDimDoors/mod_pocketDim/ticking/RiftRegenerator.java @@ -2,9 +2,9 @@ package StevenDimDoors.mod_pocketDim.ticking; import net.minecraft.world.World; import StevenDimDoors.mod_pocketDim.DDProperties; -import StevenDimDoors.mod_pocketDim.LinkData; import StevenDimDoors.mod_pocketDim.TileEntityRift; import StevenDimDoors.mod_pocketDim.mod_pocketDim; +import StevenDimDoors.mod_pocketDim.core.NewLinkData; import StevenDimDoors.mod_pocketDim.helpers.dimHelper; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; @@ -38,10 +38,10 @@ public class RiftRegenerator implements IRegularTickReceiver { while (i < 15 && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { i++; - LinkData link; + NewLinkData link; //actually gets the random rift based on the size of the list - link = (LinkData) dimHelper.instance.getRandomLinkData(true); + link = (NewLinkData) dimHelper.instance.getRandomLinkData(true); if (link != null) { diff --git a/StevenDimDoors/mod_pocketDim/util/Point4D.java b/StevenDimDoors/mod_pocketDim/util/Point4D.java new file mode 100644 index 00000000..8d8c963b --- /dev/null +++ b/StevenDimDoors/mod_pocketDim/util/Point4D.java @@ -0,0 +1,131 @@ +package StevenDimDoors.mod_pocketDim.util; + +public final class Point4D +{ + private final int x; + private final int y; + private final int z; + private final int dimension; + + public Point4D(int x, int y, int z, int dimension) + { + this.x = x; + this.y = y; + this.z = z; + this.dimension = dimension; + } + + public int getX() + { + return x; + } + + public int getY() + { + return y; + } + + public int getZ() + { + return z; + } + + public int getDimension() + { + return dimension; + } + + @Override + public int hashCode() + { + //Time for some witchcraft. + //The code here is inspired by a discussion on Stack Overflow regarding hash codes for 3D. + //Source: http://stackoverflow.com/questions/9858376/hashcode-for-3d-integer-coordinates-with-high-spatial-coherence + + //I believe that most of the time, any points we might be hashing will be in close proximity to each other. + //For instance, points that are within the same chunk or within a few neighboring chunks. Only the low-order + //bits of each component would differ. I'll use 8 bits from Y and the 12 bits from X and Z. ~SenseiKiwi + + int bit; + int hash; + int index; + + hash = 0; + index = 0; + for (bit = 0; bit < 8; bit++) + { + hash |= ((y >> bit) & 1) << index; + index++; + hash |= ((x >> bit) & 1) << index; + index++; + hash |= ((z >> bit) & 1) << index; + index++; + } + for (; bit < 12; bit++) + { + hash |= ((x >> bit) & 1) << index; + index++; + hash |= ((z >> bit) & 1) << index; + index++; + } + return hash; + } + + public long longHashCode() + { + //Time for some witchcraft. + //The code here is inspired by a discussion on Stack Overflow regarding hash codes for 3D. + //Source: http://stackoverflow.com/questions/9858376/hashcode-for-3d-integer-coordinates-with-high-spatial-coherence + + //Use 8 bits from Y and 24 bits from X and Z. Mix in 8 bits from the destination dim ID too - that means + //even if you aligned two doors perfectly between two pockets, it's unlikely they would lead to the same dungeon. + + int bit; + int index; + long hash; + + hash = 0; + index = 0; + for (bit = 0; bit < 8; bit++) + { + hash |= ((dimension >> bit) & 1) << index; + index++; + hash |= ((x >> bit) & 1) << index; + index++; + hash |= ((y >> bit) & 1) << index; + index++; + hash |= ((z >> bit) & 1) << index; + index++; + } + for (; bit < 24; bit++) + { + hash |= ((x >> bit) & 1) << index; + index++; + hash |= ((z >> bit) & 1) << index; + index++; + } + return hash; + } + + @Override + public boolean equals(Object obj) + { + return equals((Point4D) obj); + } + + public boolean equals(Point4D other) + { + if (this == other) + return true; + if (other == null) + return false; + + return (x == other.x && y == other.y && z == other.z && dimension == other.dimension); + } + + @Override + public String toString() + { + return "(" + x + ", " + y + ", " + z + ", " + dimension + ")"; + } +}