2013-06-02 03:43:56 +02:00
|
|
|
package StevenDimDoors.mod_pocketDim.commands;
|
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-06-02 03:43:56 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.LinkData;
|
2013-06-10 23:03:52 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
|
2013-06-02 03:43:56 +02:00
|
|
|
|
2013-07-26 08:09:14 +02:00
|
|
|
public class CommandCreatePocket extends DDCommandBase
|
2013-06-02 03:43:56 +02:00
|
|
|
{
|
2013-07-26 08:09:14 +02:00
|
|
|
private static CommandCreatePocket instance = null;
|
2013-06-18 16:23:31 +02:00
|
|
|
|
2013-07-26 08:09:14 +02:00
|
|
|
private CommandCreatePocket()
|
2013-06-14 01:01:54 +02:00
|
|
|
{
|
2013-06-25 19:55:13 +02:00
|
|
|
super("dd-create", "");
|
2013-06-14 01:01:54 +02:00
|
|
|
}
|
|
|
|
|
2013-07-26 08:09:14 +02:00
|
|
|
public static CommandCreatePocket instance()
|
2013-06-02 03:43:56 +02:00
|
|
|
{
|
2013-06-18 16:23:31 +02:00
|
|
|
if (instance == null)
|
2013-07-26 08:09:14 +02:00
|
|
|
instance = new CommandCreatePocket();
|
2013-06-18 16:23:31 +02:00
|
|
|
|
|
|
|
return instance;
|
2013-06-02 03:43:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-06-25 19:55:13 +02:00
|
|
|
protected DDCommandResult processCommand(EntityPlayer sender, String[] command)
|
2013-06-02 03:43:56 +02:00
|
|
|
{
|
2013-06-25 19:55:13 +02:00
|
|
|
//TODO: Some commands have isRemote checks, some do not. Why? Can commands even run locally anyway?
|
|
|
|
//What does it mean when you run a command locally? ~SenseiKiwi
|
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
if (!sender.worldObj.isRemote)
|
2013-06-10 06:16:49 +02:00
|
|
|
{
|
2013-06-25 19:55:13 +02:00
|
|
|
if (command.length > 0)
|
|
|
|
{
|
|
|
|
return DDCommandResult.TOO_MANY_ARGUMENTS;
|
|
|
|
}
|
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
//Place a door leading to a pocket dimension where the player is standing.
|
|
|
|
//The pocket dimension will be serve as a room for the player to build a dungeon.
|
|
|
|
int x = (int) sender.posX;
|
|
|
|
int y = (int) sender.posY;
|
|
|
|
int z = (int) sender.posZ;
|
|
|
|
LinkData link = DungeonHelper.instance().createCustomDungeonDoor(sender.worldObj, x, y, z);
|
2013-06-11 06:41:40 +02:00
|
|
|
|
2013-06-18 16:23:31 +02:00
|
|
|
//Notify the player
|
2013-06-25 19:55:13 +02:00
|
|
|
sender.sendChatToPlayer("Created a door to a pocket dimension (Dimension ID = " + link.destDimID + "). Please build your dungeon there.");
|
2013-06-10 06:16:49 +02:00
|
|
|
}
|
2013-06-25 19:55:13 +02:00
|
|
|
return DDCommandResult.SUCCESS;
|
2013-06-02 03:43:56 +02:00
|
|
|
}
|
|
|
|
}
|