DimDoors/StevenDimDoors/mod_pocketDim/commands/CommandStartDungeonCreation.java
SenseiKiwi ecaa90a438 Partially Overhauled Commands
Partially overhauled our command classes. Added DDCommandBase - it
extends CommandBase and acts as a new base class for our commands. It
removes a little redundancy in our code and provides increased
convenience. Removed the static fields for our commands in
mod_pocketDim. There was no point in keeping them when nothing was using
them. Changed in-game command names to be shorter yet relevant.
Converted all commands to singletons so proper instances can be
retrieved if necessary. Migrated some of the custom dungeon start/ending
logic to DungeonHelper and made customDungeonStatus private. Except for
data objects, we shouldn't be exposing state variables like that without
any kind of checks. I've rewritten the code in some commands but it's
been quite tiring. Still need to fix up lots of things.
2013-06-18 10:23:31 -04:00

40 lines
No EOL
1.2 KiB
Java

package StevenDimDoors.mod_pocketDim.commands;
import net.minecraft.entity.player.EntityPlayer;
import StevenDimDoors.mod_pocketDim.LinkData;
import StevenDimDoors.mod_pocketDim.helpers.DungeonHelper;
public class CommandStartDungeonCreation extends DDCommandBase
{
private static CommandStartDungeonCreation instance = null;
private CommandStartDungeonCreation()
{
super("dd-create");
}
public static CommandStartDungeonCreation instance()
{
if (instance == null)
instance = new CommandStartDungeonCreation();
return instance;
}
@Override
protected void processCommand(EntityPlayer sender, String[] command)
{
if (!sender.worldObj.isRemote)
{
//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);
//Notify the player
sender.sendChatToPlayer("Created a door to a pocket dimension (ID = " + link.destDimID + "). Please build your dungeon there.");
}
}
}