Skip to content

Commit

Permalink
add kill count to butterfly kill command (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
temp1011 authored and Nedelosk committed Jun 27, 2018
1 parent 8a431e5 commit b92a1a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Expand Up @@ -10,13 +10,15 @@
******************************************************************************/
package forestry.lepidopterology.commands;

import forestry.core.commands.CommandHelpers;
import forestry.core.commands.SubCommand;
import forestry.lepidopterology.entities.EntityButterfly;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.text.TextComponentTranslation;

import forestry.core.commands.CommandHelpers;
import forestry.core.commands.SubCommand;
import forestry.lepidopterology.entities.EntityButterfly;

/**
* @author CovertJaguar <http://www.railcraft.info/>
Expand All @@ -42,12 +44,13 @@ public void executeSubCommand(MinecraftServer server, ICommandSender sender, Str
if (args.length > 1) {
CommandHelpers.throwWrongUsage(sender, this);
}

int killCount = 0;
for (EntityButterfly butterfly : sender.getEntityWorld().getEntities(EntityButterfly.class, EntitySelectors.IS_ALIVE)) {
butterfly.setDead();
killCount++;
}
sender.sendMessage(new TextComponentTranslation("for.chat.command.forestry.butterfly.kill.response", killCount));
}

}

}
1 change: 1 addition & 0 deletions src/main/resources/assets/forestry/lang/en_us.lang
Expand Up @@ -1496,6 +1496,7 @@ for.chat.command.forestry.butterfly.format=Format: /%s <sub-command>
for.chat.command.forestry.butterfly.kill.desc=- %s : Kills all Butterflies
for.chat.command.forestry.butterfly.kill.help=Kills all Butterflies in loaded chunks
for.chat.command.forestry.butterfly.kill.format=Format: /%s [<dimension#>]
for.chat.command.forestry.butterfly.kill.response=Killed %d butterflies

for.butterflies.hybrid=Hybrid: %PRIMARY-%SECONDARY

Expand Down

0 comments on commit b92a1a1

Please sign in to comment.