Readded commands
Also implemented dungeon regeneration
This commit is contained in:
@@ -4,8 +4,9 @@ import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.ILinkData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
||||
public class CommandDeleteAllLinks extends DDCommandBase
|
||||
@@ -32,53 +33,34 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
||||
int targetDim;
|
||||
boolean shouldGo= true;
|
||||
|
||||
if(command.length==0)
|
||||
{
|
||||
targetDim= sender.worldObj.provider.dimensionId;
|
||||
}
|
||||
else if(command.length==1)
|
||||
if(command.length==1)
|
||||
{
|
||||
targetDim = parseInt(sender, command[0]);
|
||||
if (!PocketManager.dimList.containsKey(targetDim))
|
||||
{
|
||||
sender.sendChatToPlayer("Error- dim "+targetDim+" not registered");
|
||||
shouldGo=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetDim=0;
|
||||
shouldGo=false;
|
||||
sender.sendChatToPlayer("Error-Invalid argument, delete_all_links <targetDimID> or blank for current dim");
|
||||
sender.sendChatToPlayer("Error-Invalid argument, delete_all_links <targetDimID>");
|
||||
}
|
||||
|
||||
if(shouldGo)
|
||||
{
|
||||
if(PocketManager.dimList.containsKey(targetDim))
|
||||
{
|
||||
NewDimData dim = PocketManager.instance.getDimData(targetDim);
|
||||
ArrayList<ILinkData> linksInDim = dim.getLinksInDim();
|
||||
|
||||
NewDimData dim = PocketManager.getDimensionData(targetDim);
|
||||
ArrayList<DimLink> linksInDim = dim.getAllLinks();
|
||||
|
||||
for (ILinkData link : linksInDim)
|
||||
for (DimLink link : linksInDim)
|
||||
{
|
||||
World targetWorld = PocketManager.getWorld(targetDim);
|
||||
World targetWorld = PocketManager.loadDimension(targetDim);
|
||||
targetWorld.setBlock(link.source().getX(), link.source().getY(), link.source().getZ(), 0);
|
||||
dim.deleteLink(link);
|
||||
//TODO Probably should check what the block is, but thats annoying so Ill do it later.
|
||||
|
||||
if(targetWorld==null)
|
||||
{
|
||||
PocketManager.initDimension(targetDim);
|
||||
}
|
||||
else if(targetWorld.provider==null)
|
||||
{
|
||||
PocketManager.initDimension(targetDim);
|
||||
}
|
||||
targetWorld = PocketManager.getWorld(targetDim);
|
||||
dim.removeLinkAtCoords(link);
|
||||
targetWorld.setBlock(link.locXCoord, link.locYCoord, link.locZCoord, 0);
|
||||
linksRemoved++;
|
||||
}
|
||||
//dim.linksInThisDim.clear();
|
||||
sender.sendChatToPlayer("Removed " + linksRemoved + " links.");
|
||||
}
|
||||
|
||||
}
|
||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user