mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Add -w flag to butcher for water mobs
beb784e0ffe1d8a8cf678912dbd6207e96afcfc8 Co-Authored-By: Lewis B <17665267+lewisjb@users.noreply.github.com>
This commit is contained in:
@ -1003,7 +1003,9 @@ public class BrushCommands {
|
||||
@Switch(name = 'f', desc = "Also kill all friendly mobs (Applies the flags `-abgnpt`)")
|
||||
boolean killFriendly,
|
||||
@Switch(name = 'r', desc = "Also destroy armor stands")
|
||||
boolean killArmorStands, InjectedValueAccess context) throws WorldEditException {
|
||||
boolean killArmorStands,
|
||||
@Switch(name = 'w', desc = "Also kill water mobs")
|
||||
boolean killWater, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
CreatureButcher flags = new CreatureButcher(player);
|
||||
@ -1015,6 +1017,7 @@ public class BrushCommands {
|
||||
flags.or(CreatureButcher.Flags.AMBIENT, killAmbient, "worldedit.butcher.ambient");
|
||||
flags.or(CreatureButcher.Flags.TAGGED, killWithName, "worldedit.butcher.tagged");
|
||||
flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands");
|
||||
flags.or(CreatureButcher.Flags.WATER, killWater, "worldedit.butcher.water");
|
||||
|
||||
set(context, new ButcherBrush(flags)).setSize(radius);
|
||||
}
|
||||
|
@ -569,7 +569,9 @@ public class UtilityCommands {
|
||||
@Switch(name = 'f', desc = "Also kill all friendly mobs (Applies the flags `-abgnpt`)")
|
||||
boolean killFriendly,
|
||||
@Switch(name = 'r', desc = "Also destroy armor stands")
|
||||
boolean killArmorStands) throws WorldEditException {
|
||||
boolean killArmorStands,
|
||||
@Switch(name = 'w', desc = "Also kill water mobs")
|
||||
boolean killWater) throws WorldEditException {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (radius == null) {
|
||||
@ -595,6 +597,7 @@ public class UtilityCommands {
|
||||
flags.or(CreatureButcher.Flags.AMBIENT, killAmbient, "worldedit.butcher.ambient");
|
||||
flags.or(CreatureButcher.Flags.TAGGED, killWithName, "worldedit.butcher.tagged");
|
||||
flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands");
|
||||
flags.or(CreatureButcher.Flags.WATER, killWater, "worldedit.butcher.water");
|
||||
|
||||
int killed = killMatchingEntities(radius, actor, flags::createFunction);
|
||||
|
||||
|
@ -36,8 +36,9 @@ public class CreatureButcher {
|
||||
public static final int GOLEMS = 1 << 3;
|
||||
public static final int AMBIENT = 1 << 4;
|
||||
public static final int TAGGED = 1 << 5;
|
||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT | TAGGED;
|
||||
public static final int ARMOR_STAND = 1 << 6;
|
||||
public static final int WATER = 1 << 7;
|
||||
public static final int FRIENDLY = PETS | NPCS | ANIMALS | GOLEMS | AMBIENT | TAGGED | WATER;
|
||||
|
||||
private Flags() {
|
||||
}
|
||||
@ -73,6 +74,7 @@ public class CreatureButcher {
|
||||
boolean killAmbient = (flags & Flags.AMBIENT) != 0;
|
||||
boolean killTagged = (flags & Flags.TAGGED) != 0;
|
||||
boolean killArmorStands = (flags & Flags.ARMOR_STAND) != 0;
|
||||
boolean killWaterCreatures = (flags & Flags.WATER) != 0;
|
||||
|
||||
EntityProperties type = entity.getFacet(EntityProperties.class);
|
||||
|
||||
@ -116,6 +118,10 @@ public class CreatureButcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!killWaterCreatures && type.isWaterCreature()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
entity.remove();
|
||||
return true;
|
||||
};
|
||||
|
@ -161,4 +161,11 @@ public interface EntityProperties {
|
||||
* @return true if pasteable
|
||||
*/
|
||||
boolean isPasteable();
|
||||
|
||||
/**
|
||||
* Test whether the entity is a water creature.
|
||||
*
|
||||
* @return true if water creature
|
||||
*/
|
||||
boolean isWaterCreature();
|
||||
}
|
||||
|
Reference in New Issue
Block a user