Merge branch 'master' of git@github.com:StevenRS11/DimDoors.git into 1.5udpate

Conflicts:
	StevenDimDoors/mod_pocketDim/EventHookContainer.java
	StevenDimDoors/mod_pocketDim/mod_pocketDim.java
This commit is contained in:
StevenRS11
2013-04-01 04:04:59 -04:00
14 changed files with 101 additions and 99 deletions

View File

@@ -46,17 +46,13 @@ public class BlockDimWallPerm extends Block
{ {
Random rand = new Random(); Random rand = new Random();
int size = dimHelper.instance.linksForRendering.size(); LinkData link=dimHelper.instance.getRandomLinkData(false);
LinkData link; if(link==null)
if(size!=0)
{
link = (LinkData) dimHelper.instance.linksForRendering.get(rand.nextInt(size));
}
else
{ {
link =new LinkData(0,0,0,0); link =new LinkData(0,0,0,0);
} }
if(dimHelper.getWorld(0)==null) if(dimHelper.getWorld(0)==null)
{ {
dimHelper.initDimension(0); dimHelper.initDimension(0);

View File

@@ -106,15 +106,14 @@ public class ChaosDoor extends dimDoor
int i=0; int i=0;
int size = dimHelper.instance.linksForRendering.size();
Random rand= new Random(); Random rand= new Random();
while (!foundRandomDest&&size>0&&i<100) while (!foundRandomDest&&i<100)
{ {
i++; i++;
LinkData link = (LinkData) dimHelper.instance.linksForRendering.get(rand.nextInt(size)); LinkData link = (LinkData) dimHelper.instance.getRandomLinkData(false);
if(link!=null) if(link!=null)
{ {

View File

@@ -40,6 +40,7 @@ public class CommonTickHandler implements ITickHandler
//replaces rifts in game that have been destroyed/have blocks placed over them. //replaces rifts in game that have been destroyed/have blocks placed over them.
private void onTickInGame() private void onTickInGame()
{ {
/**
try try
{ {
@@ -156,5 +157,7 @@ public class CommonTickHandler implements ITickHandler
} }
tickCount2++; tickCount2++;
**/
} }
} }

View File

@@ -50,7 +50,6 @@ public class ConnectionHandler
dimHelper.instance.save(); dimHelper.instance.save();
dimHelper.instance.unregsisterDims(); dimHelper.instance.unregsisterDims();
dimHelper.dimList.clear(); dimHelper.dimList.clear();
dimHelper.instance.linksForRendering.clear();
} }
connected = false; connected = false;

View File

@@ -8,6 +8,7 @@ import java.util.Random;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityEnderman;
@@ -20,6 +21,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingFallEvent;
@@ -54,7 +56,6 @@ public class EventHookContainer
dimHelper.instance.unregsisterDims(); dimHelper.instance.unregsisterDims();
dimHelper.dimList.clear(); dimHelper.dimList.clear();
dimHelper.instance.interDimLinkList.clear(); dimHelper.instance.interDimLinkList.clear();
dimHelper.instance.linksForRendering.clear();
dimHelper.instance.initPockets(); dimHelper.instance.initPockets();
@@ -66,38 +67,35 @@ public class EventHookContainer
Iterator itr = ((ArrayList) dimHelper.instance.linksForRendering.clone()).listIterator(); for(WorldServer world : dimHelper.getWorlds())
{
int linkCount=0;
while (itr.hasNext()) if(dimHelper.dimList.containsKey(world.provider.dimensionId))
{ {
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).printAllLinkData())
{
if(linkCount>100)
{
break;
}
linkCount++;
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
if(mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
{
break;
}
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
LinkData link = (LinkData) itr.next(); }
if(link!=null) }
{ }
if(dimHelper.getWorld(link.locDimID)!=null)
{
// link.printLinkData();
World world=dimHelper.getWorld(link.locDimID);
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
{
if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID)==null)
{
dimHelper.instance.linksForRendering.remove(link);
}
else
{
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
}
}
}
}
}

View File

@@ -127,7 +127,6 @@ public class PacketHandler implements IPacketHandler
LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean()); LinkData linkToAdd = new LinkData(dimId, data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readBoolean());
dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord); dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord);
dimHelper.instance.linksForRendering.remove(linkToAdd);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -81,7 +81,6 @@ public class CommandDeleteAllLinks extends CommandBase
targetWorld = dimHelper.getWorld(targetDim); targetWorld = dimHelper.getWorld(targetDim);
{ {
dimHelper.instance.linksForRendering.remove(link);
dim.removeLinkAtCoords(link); dim.removeLinkAtCoords(link);

View File

@@ -73,12 +73,10 @@ public class CommandDeleteDimData extends CommandBase
if(link.destDimID==targetDim) if(link.destDimID==targetDim)
{ {
dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link); dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link);
dimHelper.instance.linksForRendering.remove(link);
linksRemoved++; linksRemoved++;
} }
if(dimData.dimID==targetDim) if(dimData.dimID==targetDim)
{ {
dimHelper.instance.linksForRendering.remove(link);
linksRemoved++; linksRemoved++;
} }
} }

View File

@@ -81,7 +81,6 @@ public class CommandDeleteRifts extends CommandBase
if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==mod_pocketDim.blockRiftID) if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==mod_pocketDim.blockRiftID)
{ {
dimHelper.instance.linksForRendering.remove(link);
dim.removeLinkAtCoords(link); dim.removeLinkAtCoords(link);

View File

@@ -71,12 +71,10 @@ public class CommandPrintDimData extends CommandBase
if(link.destDimID==targetDim) if(link.destDimID==targetDim)
{ {
dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link); dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link);
dimHelper.instance.linksForRendering.remove(link);
linksRemoved++; linksRemoved++;
} }
if(dimData.dimID==targetDim) if(dimData.dimID==targetDim)
{ {
dimHelper.instance.linksForRendering.remove(link);
linksRemoved++; linksRemoved++;
} }
} }

View File

@@ -10,6 +10,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
@@ -73,7 +74,7 @@ public class dimHelper extends DimensionManager
* See the common tick manager and the Chaos door for details on useage * See the common tick manager and the Chaos door for details on useage
* @Return * @Return
*/ */
public ArrayList<LinkData> linksForRendering =new ArrayList<LinkData>(); //public ArrayList<LinkData> linksForRendering =new ArrayList<LinkData>();
Random rand= new Random(); Random rand= new Random();
//Stupid function I use because I dont understand bitwise operations yet. Used in door orientation //Stupid function I use because I dont understand bitwise operations yet. Used in door orientation
@@ -481,7 +482,7 @@ public class dimHelper extends DimensionManager
link.isLocPocket=locationDimData.isPocket; link.isLocPocket=locationDimData.isPocket;
locationDimData.addLinkToDim(link); locationDimData.addLinkToDim(link);
this.linksForRendering.add(link); //this.linksForRendering.add(link);
if(dimHelper.getWorld(link.locDimID)!=null) if(dimHelper.getWorld(link.locDimID)!=null)
{ {
@@ -564,7 +565,7 @@ public class dimHelper extends DimensionManager
} }
LinkData link = this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID); LinkData link = this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID);
this.linksForRendering.remove(link); // this.linksForRendering.remove(link);
this.dimList.get(locationDimID).removeLinkAtCoords(link); this.dimList.get(locationDimID).removeLinkAtCoords(link);
@@ -898,28 +899,14 @@ public class dimHelper extends DimensionManager
} }
if(rand.nextInt(13-depth)==0) if(rand.nextInt(13-depth)==0)
{ {
LinkData link1=getRandomLinkData(false);
boolean foundRandomDest=false;
int i=0;
int size = dimHelper.instance.linksForRendering.size();
while (!foundRandomDest&&size>0&&i<100) if(link1!=null)
{ {
i++; locationDimData.exitDimLink=new LinkData(link1.locDimID, link1.locDimID, link1.locXCoord, link1.locYCoord, link1.locZCoord, link1.locXCoord, link1.locYCoord, link1.locZCoord, false);
}
LinkData link1 = (LinkData) dimHelper.instance.linksForRendering.get(rand.nextInt(size));
if(link1!=null)
{
if(!link1.isLocPocket)
{
foundRandomDest=true;
locationDimData.exitDimLink=new LinkData(link1.locDimID, link1.locDimID, link1.locXCoord, link1.locYCoord, link1.locZCoord, link1.locXCoord, link1.locYCoord, link1.locZCoord, false);
}
}
}
} }
} }
@@ -1003,7 +990,6 @@ public class dimHelper extends DimensionManager
HashMap comboSave=new HashMap(); HashMap comboSave=new HashMap();
comboSave.put("dimList", this.dimList); comboSave.put("dimList", this.dimList);
comboSave.put("interDimLinkList", this.interDimLinkList); comboSave.put("interDimLinkList", this.interDimLinkList);
comboSave.put("linksForRendering", this.linksForRendering);
comboSave.put("blocksToDecay", this.blocksToDecay); comboSave.put("blocksToDecay", this.blocksToDecay);
@@ -1099,14 +1085,7 @@ public class dimHelper extends DimensionManager
System.out.println("Could not load pocket dim list. Saves probably lost, but repairable. Move the files from indivual pocket dim files to active ones. See MC thread for details."); System.out.println("Could not load pocket dim list. Saves probably lost, but repairable. Move the files from indivual pocket dim files to active ones. See MC thread for details.");
} }
try
{
this.linksForRendering=(ArrayList) comboSave.get("linksForRendering");
}
catch(Exception e)
{
System.out.println("Could not load link rendering list. Not really a big deal.");
}
try try
{ {
@@ -1157,14 +1136,7 @@ public class dimHelper extends DimensionManager
System.out.println("Could not load pocket dim list. Saves probably lost, but repairable. Move the files from indivual pocket dim files to active ones. See MC thread for details."); System.out.println("Could not load pocket dim list. Saves probably lost, but repairable. Move the files from indivual pocket dim files to active ones. See MC thread for details.");
} }
try
{
this.linksForRendering=(ArrayList) comboSave.get("linksForRendering");
}
catch(Exception e)
{
System.out.println("Could not load link rendering list. Not really a big deal.");
}
try try
{ {
@@ -1196,11 +1168,44 @@ public class dimHelper extends DimensionManager
} }
} }
public LinkData getRandomLinkData(boolean allowInPocket)
{
boolean foundRandomDest=false;
int i=0;
int size = dimHelper.dimList.size();
while (!foundRandomDest&&size>0&&i<100)
{
i++;
DimData dimData = dimHelper.dimList.get(rand.nextInt(size));
ArrayList linksInDim = dimData.printAllLinkData();
LinkData link1 = (LinkData) linksInDim.get(rand.nextInt(linksInDim.size()));
if(link1!=null)
{
if(!link1.isLocPocket||allowInPocket)
{
foundRandomDest=true;
return link1;
}
}
}
return null;
}

View File

@@ -39,8 +39,10 @@ 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 = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version) @Mod(modid = mod_pocketDim.modid, name = "Dimensional Doors", version = mod_pocketDim.version)
@NetworkMod(clientSideRequired = true, serverSideRequired = false, @NetworkMod(clientSideRequired = true, serverSideRequired = false,
clientPacketHandlerSpec = clientPacketHandlerSpec =
@SidedPacketHandler(channels = {"pocketDim" }, packetHandler = ClientPacketHandler.class), @SidedPacketHandler(channels = {"pocketDim" }, packetHandler = ClientPacketHandler.class),
@@ -51,8 +53,10 @@ import StevenDimDoors.mod_pocketDim.commands.CommandPruneDims;
public class mod_pocketDim public class mod_pocketDim
{ {
public static final String version = "1.4.7R1.3.3B2"; public static final String version = "1.4.7R1.3.3B2";
public static final String modid = "Dimensional_Doors"; public static final String modid = "Dimensional_Doors";
//need to clean up //need to clean up
@SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy") @SidedProxy(clientSide = "StevenDimDoors.mod_pocketDimClient.ClientProxy", serverSide = "StevenDimDoors.mod_pocketDim.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
@@ -606,7 +610,6 @@ public class mod_pocketDim
dimHelper.dimList.clear(); dimHelper.dimList.clear();
dimHelper.blocksToDecay.clear(); dimHelper.blocksToDecay.clear();
dimHelper.instance.interDimLinkList.clear(); dimHelper.instance.interDimLinkList.clear();
dimHelper.instance.linksForRendering.clear();
this.hasInitDims=false; this.hasInitDims=false;
} }
catch(Exception e) catch(Exception e)

View File

@@ -61,7 +61,9 @@ public class pocketGenerator extends ChunkProviderGenerate implements IChunkProv
@Override @Override
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
int var4) { int var4)
{
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }

View File

@@ -99,16 +99,18 @@ public class pocketTeleporter extends Teleporter
this.setEntityPosition(par1Entity, x+1.5, y, z+.5 ); this.setEntityPosition(par1Entity, x+1.5, y, z+.5 );
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
par1Entity.motionX =.39; par1Entity.motionX =.39;
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
} }
else if(id==3||id==7) else if(id==3||id==7)
{ {
this.setEntityPosition(par1Entity, x+.5, y, z+1.5 ); this.setEntityPosition(par1Entity, x+.5, y, z+1.5 );
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
par1Entity.motionZ =.39; par1Entity.motionZ =.39;
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
} }
@@ -117,16 +119,18 @@ public class pocketTeleporter extends Teleporter
this.setEntityPosition(par1Entity,x-.5, y, z+.5); this.setEntityPosition(par1Entity,x-.5, y, z+.5);
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
par1Entity.motionX =-.39; par1Entity.motionX =-.39;
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
} }
else if(id==1||id==5) else if(id==1||id==5)
{ {
this.setEntityPosition(par1Entity,x+.5, y, z-.5); this.setEntityPosition(par1Entity,x+.5, y, z-.5);
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
par1Entity.motionZ =-.39; par1Entity.motionZ =-.39;
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
} }
else else