Renamed printAllLinkData and limbo decay
This commit is contained in:
@@ -232,7 +232,7 @@ public class DimData implements Serializable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<LinkData> printAllLinkData()
|
public ArrayList<LinkData> getLinksInDim()
|
||||||
{
|
{
|
||||||
//TODO: We might want to modify this function, but I'm afraid of breaking something right now.
|
//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
|
//To begin with, the name is wrong. This doesn't print anything! >_o ~SenseiKiwi
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@@ -17,6 +18,7 @@ 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;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
@@ -46,7 +48,6 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onSoundLoad(SoundLoadEvent event)
|
public void onSoundLoad(SoundLoadEvent event)
|
||||||
{
|
{
|
||||||
@@ -60,7 +61,6 @@ public class EventHookContainer
|
|||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onWorldLoad(WorldEvent.Load event)
|
public void onWorldLoad(WorldEvent.Load event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
||||||
{
|
{
|
||||||
System.out.println("Registering Pocket Dims");
|
System.out.println("Registering Pocket Dims");
|
||||||
@@ -69,9 +69,7 @@ public class EventHookContainer
|
|||||||
dimHelper.dimList.clear();
|
dimHelper.dimList.clear();
|
||||||
dimHelper.instance.interDimLinkList.clear();
|
dimHelper.instance.interDimLinkList.clear();
|
||||||
dimHelper.instance.initPockets();
|
dimHelper.instance.initPockets();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Integer ids : dimHelper.getIDs())
|
for(Integer ids : dimHelper.getIDs())
|
||||||
{
|
{
|
||||||
World world = dimHelper.getWorld(ids);
|
World world = dimHelper.getWorld(ids);
|
||||||
@@ -79,8 +77,10 @@ public class EventHookContainer
|
|||||||
|
|
||||||
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
||||||
{
|
{
|
||||||
|
//TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at
|
||||||
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).printAllLinkData())
|
try
|
||||||
|
{
|
||||||
|
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).getLinksInDim())
|
||||||
{
|
{
|
||||||
if(linkCount>100)
|
if(linkCount>100)
|
||||||
{
|
{
|
||||||
@@ -92,127 +92,55 @@ public class EventHookContainer
|
|||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
||||||
{
|
{
|
||||||
if(event.entity instanceof EntityPlayer)
|
if(event.entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
// System.out.println(event.entity.worldObj.provider.dimensionId);
|
// System.out.println(event.entity.worldObj.provider.dimensionId);
|
||||||
|
|
||||||
// PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity);
|
// PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerFall(LivingFallEvent event)
|
public void onPlayerFall(LivingFallEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
|
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
|
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int x = event.x;
|
int x = event.x;
|
||||||
int y = event.y;
|
int y = event.y;
|
||||||
|
|
||||||
int z = event.z;
|
int z = event.z;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(event.entityPlayer.getHeldItem()!=null)
|
if(event.entityPlayer.getHeldItem()!=null)
|
||||||
{
|
{
|
||||||
if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock)
|
if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock)
|
||||||
{
|
{
|
||||||
// if(event.entityPlayer instanceof EntityPlayerMP)
|
if(event.entityPlayer instanceof EntityPlayerMP)
|
||||||
{
|
{
|
||||||
|
|
||||||
Point3D point = new Point3D(x,y,z);
|
Point3D point = new Point3D(x,y,z);
|
||||||
dimHelper.blocksToDecay.add(point);
|
dimHelper.blocksToDecay.add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @ForgeSubscribe
|
|
||||||
public void onPlayerEvent(PlayerEvent event)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
if(!event.entity.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
ItemStack item = event.entityPlayer.inventory.getCurrentItem();
|
|
||||||
if(item!=null)
|
|
||||||
{
|
|
||||||
if(item.getItem() instanceof ItemRiftBlade)
|
|
||||||
{
|
|
||||||
List<EntityLiving> list = event.entity.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox( event.entityPlayer.posX-7,event.entityPlayer.posY-7, event.entityPlayer.posZ-7, event.entityPlayer.posX+7,event.entityPlayer.posY+7, event.entityPlayer.posZ+7));
|
|
||||||
list.remove(event.entity);
|
|
||||||
|
|
||||||
|
|
||||||
for(EntityLiving ent : list)
|
|
||||||
{
|
|
||||||
|
|
||||||
Vec3 var3 = event.entityPlayer.getLook(1.0F).normalize();
|
|
||||||
Vec3 var4 = event.entityPlayer.worldObj.getWorldVec3Pool().getVecFromPool(ent.posX - event.entityPlayer.posX, ent.boundingBox.minY + (double)((ent.height) / 2.0F) - ( event.entityPlayer.posY + (double) event.entityPlayer.getEyeHeight()), ent.posZ - event.entityPlayer.posZ);
|
|
||||||
double var5 = var4.lengthVector();
|
|
||||||
var4 = var4.normalize();
|
|
||||||
double var7 = var3.dotProduct(var4);
|
|
||||||
if( (var7+.1) > 1.0D - 0.025D / var5 ? event.entityPlayer.canEntityBeSeen(ent) : false)
|
|
||||||
{
|
|
||||||
System.out.println(list.size());
|
|
||||||
ItemRiftBlade.class.cast(item.getItem()).teleportToEntity(item,ent, event.entityPlayer);
|
|
||||||
break;
|
|
||||||
|
|
||||||
//ItemRiftBlade.class.cast(item.getItem()).teleportTo(event.entityPlayer, ent.posX, ent.posY, ent.posZ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
**/
|
|
||||||
}
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerDrops(PlayerDropsEvent event)
|
public void onPlayerDrops(PlayerDropsEvent event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
|||||||
if(dimHelper.dimList.containsKey(targetDim))
|
if(dimHelper.dimList.containsKey(targetDim))
|
||||||
{
|
{
|
||||||
DimData dim = dimHelper.dimList.get(targetDim);
|
DimData dim = dimHelper.dimList.get(targetDim);
|
||||||
ArrayList<LinkData> linksInDim = dim.printAllLinkData();
|
ArrayList<LinkData> linksInDim = dim.getLinksInDim();
|
||||||
|
|
||||||
for (LinkData link : linksInDim)
|
for (LinkData link : linksInDim)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class CommandDeleteDimensionData extends DDCommandBase
|
|||||||
for(DimData dimData :dimHelper.dimList.values())
|
for(DimData dimData :dimHelper.dimList.values())
|
||||||
{
|
{
|
||||||
Collection<LinkData> links= new ArrayList<LinkData>();
|
Collection<LinkData> links= new ArrayList<LinkData>();
|
||||||
links.addAll( dimData.printAllLinkData());
|
links.addAll( dimData.getLinksInDim());
|
||||||
|
|
||||||
for(LinkData link : links)
|
for(LinkData link : links)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class CommandDeleteRifts extends DDCommandBase
|
|||||||
if(dimHelper.dimList.containsKey(targetDim))
|
if(dimHelper.dimList.containsKey(targetDim))
|
||||||
{
|
{
|
||||||
DimData dim = dimHelper.dimList.get(targetDim);
|
DimData dim = dimHelper.dimList.get(targetDim);
|
||||||
ArrayList<LinkData> linksInDim = dim.printAllLinkData();
|
ArrayList<LinkData> linksInDim = dim.getLinksInDim();
|
||||||
|
|
||||||
for(LinkData link : linksInDim)
|
for(LinkData link : linksInDim)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class CommandPrintDimensionData extends DDCommandBase
|
|||||||
return DDCommandResult.UNREGISTERED_DIMENSION;
|
return DDCommandResult.UNREGISTERED_DIMENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<LinkData> links = dimData.printAllLinkData();
|
ArrayList<LinkData> links = dimData.getLinksInDim();
|
||||||
|
|
||||||
sender.sendChatToPlayer("Dimension ID = " + dimData.dimID);
|
sender.sendChatToPlayer("Dimension ID = " + dimData.dimID);
|
||||||
sender.sendChatToPlayer("Dimension Depth = " + dimData.depth);
|
sender.sendChatToPlayer("Dimension Depth = " + dimData.depth);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class CommandPruneDimensions extends DDCommandBase
|
|||||||
|
|
||||||
for (DimData data : allDims)
|
for (DimData data : allDims)
|
||||||
{
|
{
|
||||||
for (LinkData link : data.printAllLinkData())
|
for (LinkData link : data.getLinksInDim())
|
||||||
{
|
{
|
||||||
linkedDimensions.add(link.destDimID);
|
linkedDimensions.add(link.destDimID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ public class dimHelper extends DimensionManager
|
|||||||
DeleteFolder.deleteFolder(save);
|
DeleteFolder.deleteFolder(save);
|
||||||
dimData.hasBeenFilled = false;
|
dimData.hasBeenFilled = false;
|
||||||
dimData.hasDoor = false;
|
dimData.hasDoor = false;
|
||||||
for(LinkData link : dimData.printAllLinkData())
|
for(LinkData link : dimData.getLinksInDim())
|
||||||
{
|
{
|
||||||
link.hasGennedDoor = false;
|
link.hasGennedDoor = false;
|
||||||
LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
||||||
@@ -1248,7 +1248,7 @@ public class dimHelper extends DimensionManager
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
linksInDim = dimData.printAllLinkData();
|
linksInDim = dimData.getLinksInDim();
|
||||||
if(!linksInDim.isEmpty())
|
if(!linksInDim.isEmpty())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user