use of net.minecraft.command.WrongUsageException in project ArsMagica2 by Mithion.
the class RecoverKeystoneCommand method processCommand.
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
if (astring.length != 1 && astring.length != 0) {
throw new WrongUsageException(this.getCommandUsage(icommandsender), new Object[0]);
}
EntityPlayer player = null;
if (astring.length == 2) {
player = getPlayer(icommandsender, astring[0]);
} else {
player = getCommandSenderAsPlayer(icommandsender);
}
if (player == null)
return;
ExtendedProperties.For(player).isRecoveringKeystone = true;
func_152373_a(icommandsender, this, player.getCommandSenderName() + " is recovering a Keystone combination.", new Object[0]);
}
use of net.minecraft.command.WrongUsageException in project BiomesOPlenty by Glitchfiend.
the class BOPCommand method teleportFoundBiome.
private void teleportFoundBiome(ICommandSender sender, String[] args) throws CommandException {
if (args.length < 2) {
throw new WrongUsageException("commands.biomesoplenty.tpbiome.usage");
}
// Parse args[1] to find the biome to search for - search for a string matching the biome identifier, or an integer matching the biome id
Biome biomeToFind = null;
if (biomeToFind == null) {
try {
int biomeId = parseInt(args[1], 0, 255);
biomeToFind = Biome.getBiome(biomeId);
} catch (NumberInvalidException e) {
biomeToFind = BiomeUtils.getBiomeForLoc(new ResourceLocation(args[1]));
}
}
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
World world = player.world;
BlockPos closestBiomePos = biomeToFind == null ? null : BiomeUtils.spiralOutwardsLookingForBiome(world, biomeToFind, player.posX, player.posZ);
String biomeName = biomeToFind != null && FMLCommonHandler.instance().getSide() == Side.CLIENT ? biomeToFind.getBiomeName() : "Undefined";
if (closestBiomePos != null) {
double x = (double) closestBiomePos.getX();
double y = (double) world.getTopSolidOrLiquidBlock(closestBiomePos).getY();
double z = (double) closestBiomePos.getZ();
player.connection.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
sender.sendMessage(new TextComponentTranslation("commands.biomesoplenty.tpbiome.success", player.getName(), biomeName, x, y, z));
} else {
sender.sendMessage(new TextComponentTranslation("commands.biomesoplenty.tpbiome.error", biomeName));
}
}
use of net.minecraft.command.WrongUsageException in project BiomesOPlenty by Glitchfiend.
the class BOPCommand method getBiomeName.
private void getBiomeName(ICommandSender sender, String[] args) throws CommandException {
if (args.length < 2) {
throw new WrongUsageException("commands.biomesoplenty.biomename.usage");
}
int biomeId = parseInt(args[1], 0, 255);
Biome biome = Biome.getBiome(biomeId);
sender.sendMessage(new TextComponentTranslation("commands.biomesoplenty.biomename.success", biomeId, biome == null ? "Undefined" : biome.getBiomeName()));
}
use of net.minecraft.command.WrongUsageException in project BiomesOPlenty by Glitchfiend.
the class BOPCommand method stripChunk.
private void stripChunk(ICommandSender sender, String[] args) throws CommandException {
if (args.length < 5) {
throw new WrongUsageException("commands.biomesoplenty.stripchunk.usage");
}
int radius = parseInt(args[1]);
String mode = args[2];
boolean blacklist;
if (mode.equals("include"))
blacklist = false;
else if (mode.equals("exclude"))
blacklist = true;
else {
throw new WrongUsageException("commands.biomesoplenty.stripchunk.usage");
}
List<IBlockState> stateList = Lists.newArrayList();
for (int i = 0; i < (args.length - 3) / 2; i++) {
Block block = getBlockByText(sender, args[i * 2 + 3]);
int metadata = parseInt(args[i * 2 + 3 + 1]);
stateList.add(block.getStateFromMeta(metadata));
}
BlockPos playerPos = sender.getPosition();
World world = sender.getEntityWorld();
int playerChunkX = playerPos.getX() >> 4;
int playerChunkZ = playerPos.getZ() >> 4;
for (int chunkX = -radius; chunkX < radius; chunkX++) {
for (int chunkZ = -radius; chunkZ < radius; chunkZ++) {
Chunk chunk = world.getChunkFromChunkCoords(playerChunkX + chunkX, (playerChunkZ + chunkZ));
for (ExtendedBlockStorage blockStorage : chunk.getBlockStorageArray()) {
if (blockStorage != null) {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
BlockPos pos = new BlockPos(chunk.x * 16 + x, blockStorage.getYLocation() + y, chunk.z * 16 + z);
IBlockState state = blockStorage.get(x, y, z);
if (((!blacklist && stateList.contains(state)) || (blacklist && !stateList.contains(state))) && pos.getY() > 0) {
blockStorage.set(x, y, z, Blocks.AIR.getDefaultState());
world.notifyBlockUpdate(pos, state, Blocks.AIR.getDefaultState(), 3);
world.notifyNeighborsRespectDebug(pos, Blocks.AIR, false);
}
}
}
}
}
}
chunk.generateSkylightMap();
}
}
}
use of net.minecraft.command.WrongUsageException in project Armourers-Workshop by RiskyKen.
the class CommandClearSkins method processCommand.
@Override
public void processCommand(ICommandSender commandSender, String[] currentCommand) {
if (currentCommand.length != 2) {
throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
}
String playerName = currentCommand[1];
EntityPlayerMP player = getPlayer(commandSender, playerName);
if (player == null) {
return;
}
ExPropsPlayerSkinData.get(player).clearAllEquipmentStacks();
}
Aggregations