Search in sources :

Example 1 with PacketCommandGetGlobalVariableOutput

use of pneumaticCraft.common.network.PacketCommandGetGlobalVariableOutput in project PneumaticCraft by MineMaarten.

the class CommandGetGlobalVariable method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (sender instanceof EntityPlayerMP) {
        if (args.length != 1)
            throw new WrongUsageException("command.deliverAmazon.args");
        String varName = args[0].startsWith("#") ? args[0].substring(1) : args[0];
        ChunkPosition pos = GlobalVariableManager.getInstance().getPos(varName);
        ItemStack stack = GlobalVariableManager.getInstance().getItem(varName);
        NetworkHandler.sendTo(new PacketCommandGetGlobalVariableOutput(varName, pos, stack), (EntityPlayerMP) sender);
    }
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) ChunkPosition(net.minecraft.world.ChunkPosition) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(net.minecraft.item.ItemStack) PacketCommandGetGlobalVariableOutput(pneumaticCraft.common.network.PacketCommandGetGlobalVariableOutput)

Aggregations

WrongUsageException (net.minecraft.command.WrongUsageException)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemStack (net.minecraft.item.ItemStack)1 ChunkPosition (net.minecraft.world.ChunkPosition)1 PacketCommandGetGlobalVariableOutput (pneumaticCraft.common.network.PacketCommandGetGlobalVariableOutput)1