final update for 1.4.7- optimized random rift code, reverted name change
Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
parent
f9c1e41677
commit
49b5925ae5
3 changed files with 44 additions and 31 deletions
|
@ -228,35 +228,30 @@ public class DimData implements Serializable
|
||||||
public ArrayList<LinkData> printAllLinkData()
|
public ArrayList<LinkData> printAllLinkData()
|
||||||
{
|
{
|
||||||
ArrayList links = new ArrayList();
|
ArrayList links = new ArrayList();
|
||||||
Iterator itr= this.linksInThisDim.keySet().iterator();
|
if(this.linksInThisDim==null)
|
||||||
|
|
||||||
while (itr.hasNext())
|
|
||||||
{
|
{
|
||||||
HashMap first = this.linksInThisDim.get((Integer)itr.next());
|
return links;
|
||||||
|
|
||||||
Iterator itrfirst= first.keySet().iterator();
|
|
||||||
|
|
||||||
while (itrfirst.hasNext())
|
|
||||||
{
|
|
||||||
HashMap second = (HashMap) first.get((Integer)itrfirst.next());
|
|
||||||
|
|
||||||
Iterator itrsecond= second.keySet().iterator();
|
|
||||||
|
|
||||||
while (itrsecond.hasNext())
|
|
||||||
{
|
|
||||||
|
|
||||||
//TODO make a for(each : in) loops, and make it so that it returns the links instead of printing them
|
|
||||||
|
|
||||||
LinkData link = (LinkData) second.get((Integer)itrsecond.next());
|
|
||||||
|
|
||||||
links.add(link);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for(HashMap<Integer, HashMap<Integer, LinkData>> first : this.linksInThisDim.values())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for(HashMap<Integer, LinkData> second : first.values())
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for(LinkData linkData :second.values())
|
||||||
|
{
|
||||||
|
links.add(linkData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1182,14 +1182,31 @@ public class dimHelper extends DimensionManager
|
||||||
while (!foundRandomDest&&size>0&&i<100)
|
while (!foundRandomDest&&size>0&&i<100)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
DimData dimData;
|
||||||
DimData dimData = dimHelper.dimList.get(rand.nextInt(size));
|
ArrayList linksInDim=new ArrayList();
|
||||||
|
for(size--;size>=0;)
|
||||||
ArrayList linksInDim = dimData.printAllLinkData();
|
{
|
||||||
|
dimData = dimHelper.dimList.get(rand.nextInt(dimList.size()));
|
||||||
|
if(dimData==null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
linksInDim = dimData.printAllLinkData();
|
||||||
|
if(!linksInDim.isEmpty())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(linksInDim.isEmpty())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
LinkData link1 = (LinkData) linksInDim.get(rand.nextInt(linksInDim.size()));
|
LinkData link1 = (LinkData) linksInDim.get(rand.nextInt(linksInDim.size()));
|
||||||
|
|
||||||
if(link1!=null)
|
if(link1!=null)
|
||||||
|
@ -1206,6 +1223,7 @@ public class dimHelper extends DimensionManager
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDims;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDims;
|
||||||
|
|
||||||
@Mod(modid = "Dimensional_Doors", name = "Dimensional Doors", version = mod_pocketDim.version)
|
@Mod(modid = "DimensionalDoors", name = "Dimensional Doors", version = mod_pocketDim.version)
|
||||||
|
|
||||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false,
|
@NetworkMod(clientSideRequired = true, serverSideRequired = false,
|
||||||
clientPacketHandlerSpec =
|
clientPacketHandlerSpec =
|
||||||
|
|
Loading…
Reference in a new issue