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()
|
||||
{
|
||||
ArrayList links = new ArrayList();
|
||||
Iterator itr= this.linksInThisDim.keySet().iterator();
|
||||
|
||||
while (itr.hasNext())
|
||||
if(this.linksInThisDim==null)
|
||||
{
|
||||
HashMap first = this.linksInThisDim.get((Integer)itr.next());
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return links;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1182,14 +1182,31 @@ public class dimHelper extends DimensionManager
|
|||
while (!foundRandomDest&&size>0&&i<100)
|
||||
{
|
||||
i++;
|
||||
|
||||
DimData dimData = dimHelper.dimList.get(rand.nextInt(size));
|
||||
|
||||
ArrayList linksInDim = dimData.printAllLinkData();
|
||||
DimData dimData;
|
||||
ArrayList linksInDim=new ArrayList();
|
||||
for(size--;size>=0;)
|
||||
{
|
||||
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()));
|
||||
|
||||
if(link1!=null)
|
||||
|
@ -1206,6 +1223,7 @@ public class dimHelper extends DimensionManager
|
|||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import StevenDimDoors.mod_pocketDim.commands.CommandDeleteDimData;
|
|||
import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
||||
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,
|
||||
clientPacketHandlerSpec =
|
||||
|
|
Loading…
Reference in a new issue