Added regen dungeon command & removed hasMark
This commit is contained in:
parent
8bbd1384c5
commit
06a8abbf74
7 changed files with 104 additions and 4 deletions
|
@ -26,7 +26,6 @@ public class DimData implements Serializable
|
||||||
public boolean hasDoor=false;
|
public boolean hasDoor=false;
|
||||||
public boolean isDimRandomRift=false;
|
public boolean isDimRandomRift=false;
|
||||||
public DungeonGenerator dungeonGenerator = null;
|
public DungeonGenerator dungeonGenerator = null;
|
||||||
public boolean hasMarks=false;
|
|
||||||
//public boolean isPrivatePocket = false;
|
//public boolean isPrivatePocket = false;
|
||||||
public HashMap<Integer, HashMap<Integer, HashMap<Integer, LinkData>>> linksInThisDim=new HashMap();
|
public HashMap<Integer, HashMap<Integer, HashMap<Integer, LinkData>>> linksInThisDim=new HashMap();
|
||||||
HashMap<Integer, LinkData> dimX;
|
HashMap<Integer, LinkData> dimX;
|
||||||
|
|
|
@ -1140,7 +1140,6 @@ public class SchematicLoader
|
||||||
Entity mob = new MobObelisk(world);
|
Entity mob = new MobObelisk(world);
|
||||||
mob.setLocationAndAngles(point.getX(),point.getY(), point.getZ(), 1, 1);
|
mob.setLocationAndAngles(point.getX(),point.getY(), point.getZ(), 1, 1);
|
||||||
world.spawnEntityInWorld(mob);
|
world.spawnEntityInWorld(mob);
|
||||||
dimHelper.dimList.get(link.destDimID).hasMarks=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package StevenDimDoors.mod_pocketDim.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||||
|
import StevenDimDoors.mod_pocketDim.DimData;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
|
||||||
|
public class CommandRegenPocket extends DDCommandBase
|
||||||
|
{
|
||||||
|
private static CommandRegenPocket instance = null;
|
||||||
|
|
||||||
|
private CommandRegenPocket()
|
||||||
|
{
|
||||||
|
super("dd-regenDungeons");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CommandRegenPocket instance()
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
instance = new CommandRegenPocket();
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processCommand(EntityPlayer sender, String[] command)
|
||||||
|
{
|
||||||
|
DungeonHelper dungeonHelper = DungeonHelper.instance();
|
||||||
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
|
for(DimData data : dimHelper.dimList.values())
|
||||||
|
{
|
||||||
|
if(data.isDimRandomRift)
|
||||||
|
{
|
||||||
|
dimHelper.instance.regenPocket(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
32
StevenDimDoors/mod_pocketDim/helpers/DeleteFolder.java
Normal file
32
StevenDimDoors/mod_pocketDim/helpers/DeleteFolder.java
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
package StevenDimDoors.mod_pocketDim.helpers;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
|
public class DeleteFolder
|
||||||
|
{
|
||||||
|
public static boolean deleteFolder(File file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File[] files = file.listFiles();
|
||||||
|
|
||||||
|
if(files==null)
|
||||||
|
{
|
||||||
|
file.delete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for(File inFile : files)
|
||||||
|
{
|
||||||
|
DeleteFolder.deleteFolder(inFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -810,6 +810,32 @@ public class dimHelper extends DimensionManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void regenPocket(DimData dimData)
|
||||||
|
{
|
||||||
|
if(this.getWorld(dimData.dimID)!=null ||!dimData.isPocket)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File save = new File( this.getCurrentSaveRootDirectory()+"/DimensionalDoors/pocketDimID" + dimData.dimID);
|
||||||
|
DeleteFolder.deleteFolder(save);
|
||||||
|
dimData.hasBeenFilled=false;
|
||||||
|
dimData.hasDoor=false;
|
||||||
|
for(LinkData link : dimData.printAllLinkData())
|
||||||
|
{
|
||||||
|
link.hasGennedDoor=false;
|
||||||
|
LinkData linkOut =this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
||||||
|
if(linkOut!=null)
|
||||||
|
{
|
||||||
|
linkOut.hasGennedDoor=false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* method called when the client disconects/server stops to unregister dims.
|
* method called when the client disconects/server stops to unregister dims.
|
||||||
|
|
|
@ -29,6 +29,7 @@ import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandEndDungeonCreation;
|
import StevenDimDoors.mod_pocketDim.commands.CommandEndDungeonCreation;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
||||||
|
import StevenDimDoors.mod_pocketDim.commands.CommandRegenPocket;
|
||||||
import StevenDimDoors.mod_pocketDim.commands.CommandStartDungeonCreation;
|
import StevenDimDoors.mod_pocketDim.commands.CommandStartDungeonCreation;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
@ -390,6 +391,7 @@ public class mod_pocketDim
|
||||||
@ServerStarting
|
@ServerStarting
|
||||||
public void serverStarting(FMLServerStartingEvent event)
|
public void serverStarting(FMLServerStartingEvent event)
|
||||||
{
|
{
|
||||||
|
CommandRegenPocket.instance().register(event);
|
||||||
CommandCreateDungeonRift.instance().register(event);
|
CommandCreateDungeonRift.instance().register(event);
|
||||||
CommandDeleteAllLinks.instance().register(event);
|
CommandDeleteAllLinks.instance().register(event);
|
||||||
CommandDeleteDimensionData.instance().register(event);
|
CommandDeleteDimensionData.instance().register(event);
|
||||||
|
|
|
@ -70,8 +70,7 @@ public class PocketGenerator extends ChunkProviderGenerate implements IChunkProv
|
||||||
|
|
||||||
if (dimData == null ||
|
if (dimData == null ||
|
||||||
dimData.dungeonGenerator == null ||
|
dimData.dungeonGenerator == null ||
|
||||||
dimData.dungeonGenerator.isOpen||
|
dimData.dungeonGenerator.isOpen)
|
||||||
dimData.hasMarks)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue