Merge branch 'R1.4.0-improvements'
This commit is contained in:
commit
dae6fbfbb8
10 changed files with 227 additions and 193 deletions
|
@ -907,41 +907,37 @@ public class SchematicLoader
|
|||
}
|
||||
}
|
||||
|
||||
//determines necessary rotation, reflection, and translation to build the .schematic by finding the difference between the
|
||||
//.schematic incomingLink location which is relative to the .schematic only, and comparing it with the world incoming link coordinates
|
||||
//must also factor in the orientation of the incoming door.
|
||||
if(orientation==0) //TODO currently broken, only orientation 3 works atm
|
||||
{
|
||||
xCooe=-incomingLink.getX()+incX;
|
||||
yCooe=-incomingLink.getY()+incY;
|
||||
zCooe=-incomingLink.getZ()+incZ;
|
||||
//Compute the Y-axis translation that places our structure correctly
|
||||
yCooe = incY - incomingLink.getY();
|
||||
|
||||
}
|
||||
if(orientation==1)//TODO currently broken, only orientation 3 works atm
|
||||
//Loop to actually place the blocks
|
||||
for ( x = 0; x < width; x++)
|
||||
{
|
||||
xCooe=-incomingLink.getX()+incX;
|
||||
yCooe=-incomingLink.getY()+incY;
|
||||
zCooe=-incomingLink.getZ()+incZ;
|
||||
}
|
||||
if(orientation==2)//TODO currently broken, only orientation 3 works atm
|
||||
for ( z = 0; z < length; z++)
|
||||
{
|
||||
xCooe=-incomingLink.getX()+incX;
|
||||
yCooe=-incomingLink.getY()+incY;
|
||||
zCooe=-incomingLink.getZ()+incZ;
|
||||
}
|
||||
if(orientation==3)//TODO this only works because it is the default orientation of the pocket dim
|
||||
//Compute the X-axis and Z-axis translations that will shift
|
||||
//and rotate our structure properly.
|
||||
switch (orientation)
|
||||
{
|
||||
xCooe=-incomingLink.getX()+incX;
|
||||
yCooe=-incomingLink.getY()+incY;
|
||||
zCooe=-incomingLink.getZ()+incZ;
|
||||
case 0:
|
||||
xCooe = -incomingLink.getX() + incX;
|
||||
zCooe = -incomingLink.getZ() + incZ;
|
||||
break;
|
||||
case 1:
|
||||
xCooe = -incomingLink.getX() + incX;
|
||||
zCooe = -incomingLink.getZ() + incZ;
|
||||
break;
|
||||
case 2:
|
||||
xCooe = -incomingLink.getX() + incX;
|
||||
zCooe = -incomingLink.getZ() + incZ;
|
||||
break;
|
||||
case 3:
|
||||
xCooe = -incomingLink.getX() + incX;
|
||||
zCooe = -incomingLink.getZ() + incZ;
|
||||
break;
|
||||
}
|
||||
|
||||
//loop to actually place the blocks
|
||||
for ( x = 0; x < width; ++x)
|
||||
{
|
||||
for ( y = 0; y < height; ++y)
|
||||
{
|
||||
for ( z = 0; z < length; ++z)
|
||||
for ( y = 0; y < height; y++)
|
||||
{
|
||||
|
||||
int index = y * width * length + z * width + x;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
|||
|
||||
private CommandDeleteAllLinks()
|
||||
{
|
||||
super("dd-deletelinks");
|
||||
super("dd-deletelinks", "FIXME");
|
||||
}
|
||||
|
||||
public static CommandDeleteAllLinks instance()
|
||||
|
@ -80,5 +80,6 @@ public class CommandDeleteAllLinks extends DDCommandBase
|
|||
sender.sendChatToPlayer("Removed " + linksRemoved + " links.");
|
||||
}
|
||||
}
|
||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class CommandDeleteDimensionData extends DDCommandBase
|
|||
|
||||
private CommandDeleteDimensionData()
|
||||
{
|
||||
super("dd-deletedimension");
|
||||
super("dd-deletedimension", "FIXME");
|
||||
}
|
||||
|
||||
public static CommandDeleteDimensionData instance()
|
||||
|
@ -90,5 +90,6 @@ public class CommandDeleteDimensionData extends DDCommandBase
|
|||
sender.sendChatToPlayer("Error- dimension "+targetDim+" not registered with dimDoors");
|
||||
}
|
||||
}
|
||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public class CommandDeleteRifts extends DDCommandBase
|
|||
|
||||
private CommandDeleteRifts()
|
||||
{
|
||||
super("dd-???");
|
||||
super("dd-???", "FIXME");
|
||||
}
|
||||
|
||||
public static CommandDeleteRifts instance()
|
||||
|
@ -84,5 +84,6 @@ public class CommandDeleteRifts extends DDCommandBase
|
|||
sender.sendChatToPlayer("Removed "+linksRemoved+" rifts.");
|
||||
}
|
||||
}
|
||||
return DDCommandResult.SUCCESS; //TEMPORARY HACK
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@ package StevenDimDoors.mod_pocketDim.commands;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import StevenDimDoors.mod_pocketDim.DimData;
|
||||
|
@ -14,7 +16,7 @@ public class CommandPruneDimensions extends DDCommandBase
|
|||
|
||||
private CommandPruneDimensions()
|
||||
{
|
||||
super("dd-prune");
|
||||
super("dd-prune", "['delete']");
|
||||
}
|
||||
|
||||
public static CommandPruneDimensions instance()
|
||||
|
@ -28,36 +30,44 @@ public class CommandPruneDimensions extends DDCommandBase
|
|||
@Override
|
||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||
{
|
||||
int numRemoved=0;
|
||||
ArrayList<Integer> dimsWithLinks = new ArrayList<Integer>();
|
||||
if (command.length > 1)
|
||||
{
|
||||
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
||||
}
|
||||
if (command.length == 1 && !command[0].equalsIgnoreCase("delete"))
|
||||
{
|
||||
return DDCommandResult.INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
int removedCount = 0;
|
||||
boolean deleteFolders = (command.length == 1);
|
||||
Set<Integer> linkedDimensions = new HashSet<Integer>();
|
||||
Collection<DimData> allDims = new ArrayList<DimData>();
|
||||
allDims.addAll(dimHelper.dimList.values());
|
||||
for(DimData data: allDims)
|
||||
|
||||
for (DimData data : allDims)
|
||||
{
|
||||
for(LinkData link:data.printAllLinkData())
|
||||
for (LinkData link : data.printAllLinkData())
|
||||
{
|
||||
if(!dimsWithLinks.contains(link.destDimID))
|
||||
{
|
||||
dimsWithLinks.add(link.destDimID);
|
||||
linkedDimensions.add(link.destDimID);
|
||||
}
|
||||
}
|
||||
for (LinkData link : dimHelper.instance.interDimLinkList.values())
|
||||
{
|
||||
linkedDimensions.add(link.destDimID);
|
||||
}
|
||||
for(LinkData link : dimHelper.instance.interDimLinkList.values())
|
||||
for (DimData data : allDims)
|
||||
{
|
||||
if(!dimsWithLinks.contains(link.destDimID))
|
||||
if (!linkedDimensions.contains(data.dimID))
|
||||
{
|
||||
dimsWithLinks.add(link.destDimID);
|
||||
if (dimHelper.instance.pruneDimension(data, deleteFolders))
|
||||
{
|
||||
removedCount++;
|
||||
}
|
||||
}
|
||||
for(DimData data : allDims)
|
||||
{
|
||||
if(!dimsWithLinks.contains(data.dimID))
|
||||
{
|
||||
dimHelper.dimList.remove(data.dimID);
|
||||
numRemoved++;
|
||||
}
|
||||
}
|
||||
dimHelper.instance.save();
|
||||
sender.sendChatToPlayer("Removed " + numRemoved + " unreachable pocket dims.");
|
||||
sender.sendChatToPlayer("Removed " + removedCount + " unreachable pocket dims.");
|
||||
return DDCommandResult.SUCCESS;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
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 DDCommandResult 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package StevenDimDoors.mod_pocketDim.commands;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import StevenDimDoors.mod_pocketDim.DimData;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
|
||||
public class CommandResetDungeons extends DDCommandBase
|
||||
{
|
||||
private static CommandResetDungeons instance = null;
|
||||
|
||||
private CommandResetDungeons()
|
||||
{
|
||||
super("dd-resetdungeons", "");
|
||||
}
|
||||
|
||||
public static CommandResetDungeons instance()
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new CommandResetDungeons();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
||||
{
|
||||
if (command.length > 0)
|
||||
{
|
||||
return DDCommandResult.TOO_FEW_ARGUMENTS;
|
||||
}
|
||||
|
||||
int dungeonCount = 0;
|
||||
int resetCount = 0;
|
||||
|
||||
for (DimData data : dimHelper.dimList.values())
|
||||
{
|
||||
if (data.isDimRandomRift)
|
||||
{
|
||||
dungeonCount++;
|
||||
if (dimHelper.instance.resetPocket(data))
|
||||
{
|
||||
resetCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Notify the user of the results
|
||||
sender.sendChatToPlayer("Reset complete. " + resetCount + " out of " + dungeonCount + " dungeons were reset.");
|
||||
return DDCommandResult.SUCCESS;
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ public class DDCommandResult {
|
|||
public static final DDCommandResult TOO_MANY_ARGUMENTS = new DDCommandResult(2, "Error: Too many arguments passed to the command", true);
|
||||
public static final DDCommandResult INVALID_DIMENSION_ID = new DDCommandResult(3, "Error: Invalid dimension ID", true);
|
||||
public static final DDCommandResult UNREGISTERED_DIMENSION = new DDCommandResult(4, "Error: Dimension is not registered", false);
|
||||
public static final DDCommandResult INVALID_ARGUMENTS = new DDCommandResult(5, "Error: Invalid arguments passed to the command.", true);
|
||||
|
||||
public static final int CUSTOM_ERROR_CODE = -1;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import StevenDimDoors.mod_pocketDim.DimData;
|
|||
import StevenDimDoors.mod_pocketDim.LinkData;
|
||||
import StevenDimDoors.mod_pocketDim.ObjectSaveInputStream;
|
||||
import StevenDimDoors.mod_pocketDim.PacketHandler;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import StevenDimDoors.mod_pocketDim.TileEntityRift;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||
|
@ -64,7 +65,7 @@ public class dimHelper extends DimensionManager
|
|||
* ArrayList containing any blocks in limbo that have been placed by the player. Cycled through in the common tick manager
|
||||
* @Return
|
||||
*/
|
||||
public static ArrayList blocksToDecay= new ArrayList();
|
||||
public static ArrayList<Point3D> blocksToDecay = new ArrayList<Point3D>();
|
||||
|
||||
/**
|
||||
* instance of the dimHelper
|
||||
|
@ -812,33 +813,48 @@ public class dimHelper extends DimensionManager
|
|||
}
|
||||
}
|
||||
|
||||
public void regenPocket(DimData dimData)
|
||||
public boolean resetPocket(DimData dimData)
|
||||
{
|
||||
if(this.getWorld(dimData.dimID)!=null ||!dimData.isPocket)
|
||||
//TODO: Should we add a check to see if the dimension is currently loaded? How could we check that? ~SenseiKiwi
|
||||
if (!dimData.isPocket || getWorld(dimData.dimID) != null)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
File save = new File( this.getCurrentSaveRootDirectory()+"/DimensionalDoors/pocketDimID" + dimData.dimID);
|
||||
File save = new File(getCurrentSaveRootDirectory() + "/DimensionalDoors/pocketDimID" + dimData.dimID);
|
||||
DeleteFolder.deleteFolder(save);
|
||||
dimData.hasBeenFilled=false;
|
||||
dimData.hasDoor=false;
|
||||
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)
|
||||
link.hasGennedDoor = false;
|
||||
LinkData linkOut = this.getLinkDataFromCoords(link.destXCoord, link.destYCoord, link.destZCoord, link.destDimID);
|
||||
if (linkOut != null)
|
||||
{
|
||||
linkOut.hasGennedDoor=false;
|
||||
|
||||
linkOut.hasGennedDoor = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean pruneDimension(DimData dimData, boolean deleteFolder)
|
||||
{
|
||||
//TODO: Should we add a check to see if the dimension is currently loaded? How could we check that? ~SenseiKiwi
|
||||
//TODO: All the logic for checking that this is an isolated pocket should be moved in here.
|
||||
if (!dimData.isPocket || getWorld(dimData.dimID) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
dimList.remove(dimData.dimID);
|
||||
if (deleteFolder)
|
||||
{
|
||||
File save = new File(getCurrentSaveRootDirectory() + "/DimensionalDoors/pocketDimID" + dimData.dimID);
|
||||
DeleteFolder.deleteFolder(save);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* method called when the client disconects/server stops to unregister dims.
|
||||
* method called when the client disconnects/server stops to unregister dims.
|
||||
* @Return
|
||||
*/
|
||||
public void unregsisterDims()
|
||||
|
|
|
@ -29,7 +29,7 @@ import StevenDimDoors.mod_pocketDim.commands.CommandDeleteRifts;
|
|||
import StevenDimDoors.mod_pocketDim.commands.CommandEndDungeonCreation;
|
||||
import StevenDimDoors.mod_pocketDim.commands.CommandPrintDimensionData;
|
||||
import StevenDimDoors.mod_pocketDim.commands.CommandPruneDimensions;
|
||||
import StevenDimDoors.mod_pocketDim.commands.CommandRegenPocket;
|
||||
import StevenDimDoors.mod_pocketDim.commands.CommandResetDungeons;
|
||||
import StevenDimDoors.mod_pocketDim.commands.CommandStartDungeonCreation;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||
|
@ -391,7 +391,7 @@ public class mod_pocketDim
|
|||
@ServerStarting
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
CommandRegenPocket.instance().register(event);
|
||||
CommandResetDungeons.instance().register(event);
|
||||
CommandCreateDungeonRift.instance().register(event);
|
||||
CommandDeleteAllLinks.instance().register(event);
|
||||
CommandDeleteDimensionData.instance().register(event);
|
||||
|
|
Loading…
Reference in a new issue