Skip to content

Commit

Permalink
Fix /npc mushroomcow, increase base player speed
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 6, 2020
1 parent e89cd03 commit e1f7492
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void llama(CommandContext args, CommandSender sender, NPC npc) throws Com
min = 1,
max = 1,
permission = "citizens.npc.mushroomcow")
@Requirements(selected = true, ownership = true, types = { EntityType.SHULKER })
@Requirements(selected = true, ownership = true, types = { EntityType.MUSHROOM_COW })
public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class);
boolean hasArg = false;
Expand Down Expand Up @@ -375,6 +375,29 @@ public void shulker(CommandContext args, CommandSender sender, NPC npc) throws C
}
}

@Command(
aliases = { "npc" },
usage = "snowman (-d[erp])",
desc = "Sets snowman modifiers.",
modifiers = { "snowman" },
min = 1,
max = 1,
flags = "d",
permission = "citizens.npc.snowman")
@Requirements(selected = true, ownership = true, types = { EntityType.SNOWMAN })
public void snowman(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
SnowmanTrait trait = npc.getTrait(SnowmanTrait.class);
boolean hasArg = false;
if (args.hasFlag('d')) {
boolean isDerp = trait.toggleDerp();
Messaging.sendTr(sender, isDerp ? Messages.SNOWMAN_DERP_SET : Messages.SNOWMAN_DERP_STOPPED, npc.getName());
hasArg = true;
}
if (!hasArg) {
throw new CommandUsageException();
}
}

@Command(
aliases = { "npc" },
usage = "tfish (--body color) (--pattern pattern) (--patterncolor color)",
Expand Down Expand Up @@ -464,27 +487,4 @@ public void villager(CommandContext args, CommandSender sender, NPC npc) throws
throw new CommandUsageException();
}
}

@Command(
aliases = { "npc" },
usage = "snowman (-d[erp])",
desc = "Sets snowman modifiers.",
modifiers = { "snowman" },
min = 1,
max = 1,
flags = "d",
permission = "citizens.npc.snowman")
@Requirements(selected = true, ownership = true, types = { EntityType.SNOWMAN })
public void snowman(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
SnowmanTrait trait = npc.getTrait(SnowmanTrait.class);
boolean hasArg = false;
if (args.hasFlag('d')) {
boolean isDerp = trait.toggleDerp();
Messaging.sendTr(sender, isDerp ? Messages.SNOWMAN_DERP_SET : Messages.SNOWMAN_DERP_STOPPED, npc.getName());
hasArg = true;
}
if (!hasArg) {
throw new CommandUsageException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void llama(CommandContext args, CommandSender sender, NPC npc) throws Com
min = 1,
max = 1,
permission = "citizens.npc.mushroomcow")
@Requirements(selected = true, ownership = true, types = { EntityType.SHULKER })
@Requirements(selected = true, ownership = true, types = { EntityType.MUSHROOM_COW })
public void mushroomcow(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
MushroomCowTrait trait = npc.getTrait(MushroomCowTrait.class);
boolean hasArg = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public void a() {
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (this.a instanceof EntitySlime) {
speed.setValue(0.3D * this.e);
} else {
speed.setValue(0.2D * this.e);
}
float movement = (float) (this.e * speed.getValue());
this.a.o(movement);
Expand Down

0 comments on commit e1f7492

Please sign in to comment.