Finally fixed spawn bug. Still no idea why it was happening though
Signed-off-by: StevenRS11 <stevenrs11@aol.com>
This commit is contained in:
parent
f02410f5da
commit
f9c1e41677
17 changed files with 112 additions and 117 deletions
|
@ -40,16 +40,12 @@ public class BlockDimWallPerm extends Block
|
|||
{
|
||||
Random rand = new Random();
|
||||
|
||||
int size = dimHelper.instance.linksForRendering.size();
|
||||
LinkData link;
|
||||
if(size!=0)
|
||||
LinkData link=dimHelper.instance.getRandomLinkData(false);
|
||||
if(link==null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -80,15 +80,14 @@ public class ChaosDoor extends dimDoor
|
|||
|
||||
int i=0;
|
||||
|
||||
int size = dimHelper.instance.linksForRendering.size();
|
||||
|
||||
Random rand= new Random();
|
||||
|
||||
while (!foundRandomDest&&size>0&&i<100)
|
||||
while (!foundRandomDest&&i<100)
|
||||
{
|
||||
i++;
|
||||
|
||||
LinkData link = (LinkData) dimHelper.instance.linksForRendering.get(rand.nextInt(size));
|
||||
LinkData link = (LinkData) dimHelper.instance.getRandomLinkData(false);
|
||||
|
||||
if(link!=null)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public class CommonTickHandler implements ITickHandler
|
|||
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
||||
private void onTickInGame()
|
||||
{
|
||||
/**
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -156,5 +157,7 @@ public class CommonTickHandler implements ITickHandler
|
|||
}
|
||||
|
||||
tickCount2++;
|
||||
**/
|
||||
}
|
||||
|
||||
}
|
|
@ -50,7 +50,6 @@ public class ConnectionHandler
|
|||
dimHelper.instance.save();
|
||||
dimHelper.instance.unregsisterDims();
|
||||
dimHelper.dimList.clear();
|
||||
dimHelper.instance.linksForRendering.clear();
|
||||
|
||||
}
|
||||
connected = false;
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Random;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
|
@ -20,6 +21,7 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
|
@ -54,7 +56,6 @@ public class EventHookContainer
|
|||
dimHelper.instance.unregsisterDims();
|
||||
dimHelper.dimList.clear();
|
||||
dimHelper.instance.interDimLinkList.clear();
|
||||
dimHelper.instance.linksForRendering.clear();
|
||||
|
||||
dimHelper.instance.initPockets();
|
||||
|
||||
|
@ -64,40 +65,34 @@ public class EventHookContainer
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
Iterator itr = ((ArrayList) dimHelper.instance.linksForRendering.clone()).listIterator();
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
|
||||
|
||||
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).setBlockWithNotify(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
|
||||
for(WorldServer world : dimHelper.getWorlds())
|
||||
{
|
||||
int linkCount=0;
|
||||
|
||||
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).setBlockWithNotify(link.locXCoord, link.locYCoord, link.locZCoord, mod_pocketDim.blockRiftID);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -411,12 +411,12 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||
return super.makeString();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
|
||||
// int var4) {
|
||||
// // TODO Auto-generated method stub
|
||||
// return null;
|
||||
//}
|
||||
@Override
|
||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
|
||||
int var4) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkPosition findClosestStructure(World var1, String var2,
|
||||
|
|
|
@ -60,11 +60,11 @@ public class LimboProvider extends WorldProvider
|
|||
}
|
||||
}
|
||||
|
||||
//public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
|
||||
//{
|
||||
// super.setAllowedSpawnTypes(false, false);
|
||||
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
|
||||
{
|
||||
super.setAllowedSpawnTypes(false, false);
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
public float calculateCelestialAngle(long par1, float par3)
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
dimDataToRemoveFrom.removeLinkAtCoords(linkToAdd.locDimID, linkToAdd.locXCoord,linkToAdd.locYCoord, linkToAdd.locZCoord);
|
||||
|
||||
dimHelper.instance.linksForRendering.remove(linkToAdd);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,6 @@ public class CommandDeleteAllLinks extends CommandBase
|
|||
targetWorld = dimHelper.getWorld(targetDim);
|
||||
|
||||
{
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
dim.removeLinkAtCoords(link);
|
||||
|
||||
|
||||
|
|
|
@ -73,12 +73,10 @@ public class CommandDeleteDimData extends CommandBase
|
|||
if(link.destDimID==targetDim)
|
||||
{
|
||||
dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link);
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
linksRemoved++;
|
||||
}
|
||||
if(dimData.dimID==targetDim)
|
||||
{
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
linksRemoved++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,6 @@ public class CommandDeleteRifts extends CommandBase
|
|||
|
||||
if(targetWorld.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord)==mod_pocketDim.blockRiftID)
|
||||
{
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
dim.removeLinkAtCoords(link);
|
||||
|
||||
|
||||
|
|
|
@ -71,12 +71,10 @@ public class CommandPrintDimData extends CommandBase
|
|||
if(link.destDimID==targetDim)
|
||||
{
|
||||
dimHelper.dimList.get(link.locDimID).removeLinkAtCoords(link);
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
linksRemoved++;
|
||||
}
|
||||
if(dimData.dimID==targetDim)
|
||||
{
|
||||
dimHelper.instance.linksForRendering.remove(link);
|
||||
linksRemoved++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
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
|
||||
* @Return
|
||||
*/
|
||||
public ArrayList<LinkData> linksForRendering =new ArrayList<LinkData>();
|
||||
//public ArrayList<LinkData> linksForRendering =new ArrayList<LinkData>();
|
||||
Random rand= new Random();
|
||||
|
||||
//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;
|
||||
|
||||
locationDimData.addLinkToDim(link);
|
||||
this.linksForRendering.add(link);
|
||||
//this.linksForRendering.add(link);
|
||||
|
||||
if(dimHelper.getWorld(link.locDimID)!=null)
|
||||
{
|
||||
|
@ -564,7 +565,7 @@ public class dimHelper extends DimensionManager
|
|||
|
||||
}
|
||||
LinkData link = this.getLinkDataFromCoords(locationXCoord, locationYCoord, locationZCoord, locationDimID);
|
||||
this.linksForRendering.remove(link);
|
||||
// this.linksForRendering.remove(link);
|
||||
|
||||
this.dimList.get(locationDimID).removeLinkAtCoords(link);
|
||||
|
||||
|
@ -898,28 +899,14 @@ public class dimHelper extends DimensionManager
|
|||
}
|
||||
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)
|
||||
{
|
||||
i++;
|
||||
|
||||
if(link1!=null)
|
||||
{
|
||||
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();
|
||||
comboSave.put("dimList", this.dimList);
|
||||
comboSave.put("interDimLinkList", this.interDimLinkList);
|
||||
comboSave.put("linksForRendering", this.linksForRendering);
|
||||
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.");
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -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.");
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -605,7 +605,6 @@ public class mod_pocketDim
|
|||
dimHelper.dimList.clear();
|
||||
dimHelper.blocksToDecay.clear();
|
||||
dimHelper.instance.interDimLinkList.clear();
|
||||
dimHelper.instance.linksForRendering.clear();
|
||||
this.hasInitDims=false;
|
||||
}
|
||||
catch(Exception e)
|
||||
|
|
|
@ -59,12 +59,14 @@ public class pocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
|||
|
||||
|
||||
|
||||
//@Override
|
||||
//public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
|
||||
// int var4) {
|
||||
@Override
|
||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
|
||||
int var4)
|
||||
{
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
// return null;
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkPosition findClosestStructure(World var1, String var2,
|
||||
|
|
|
@ -34,10 +34,10 @@ public class pocketProvider extends WorldProvider
|
|||
|
||||
}
|
||||
|
||||
// public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
|
||||
// {
|
||||
// super.setAllowedSpawnTypes(false, false);
|
||||
//}
|
||||
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
|
||||
{
|
||||
super.setAllowedSpawnTypes(false, false);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2)
|
||||
|
|
|
@ -99,16 +99,18 @@ public class pocketTeleporter extends Teleporter
|
|||
|
||||
|
||||
this.setEntityPosition(par1Entity, x+1.5, y, z+.5 );
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
par1Entity.motionX =.39;
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
|
||||
}
|
||||
else if(id==3||id==7)
|
||||
{
|
||||
|
||||
|
||||
this.setEntityPosition(par1Entity, x+.5, y, z+1.5 );
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
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);
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
par1Entity.motionX =-.39;
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
|
||||
|
||||
}
|
||||
else if(id==1||id==5)
|
||||
{
|
||||
|
||||
this.setEntityPosition(par1Entity,x+.5, y, z-.5);
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
par1Entity.motionZ =-.39;
|
||||
par1Entity.worldObj.updateEntityWithOptionalForce(par1Entity, false);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue