Skip to content

Commit

Permalink
Add Horse to dEntity, thus allowing the spawning of donkeys, mules, c…
Browse files Browse the repository at this point in the history
…olored horses, skeleton horses and undead horses.
  • Loading branch information
davidcernat committed Jul 13, 2013
1 parent e74d012 commit ca264cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
28 changes: 26 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -17,7 +17,18 @@
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftAnimals;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.entity.*;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Villager;
import org.bukkit.inventory.ItemStack;

import java.util.HashMap;
Expand Down Expand Up @@ -423,19 +434,31 @@ public void spawnAt(Location location) {
if (data1 != null) {

try {

// Allow creepers to be powered
if (ent instanceof Creeper && data1.equalsIgnoreCase("POWERED")) {
((Creeper) entity).setPowered(true);
}

// Allow setting of blocks held by endermen
else if (ent instanceof Enderman && dMaterial.matches(data1)) {
((Enderman) entity).setCarriedMaterial(dMaterial.valueOf(data1).getMaterialData());
}

// Allow setting of horse variants and colors
else if (ent instanceof Horse) {
setSubtype(Horse.class, "Variant", "setVariant", data1);

if (data2 != null) {
setSubtype(Horse.class, "Color", "setColor", data2);
}
}

// Allow setting of ocelot types
else if (ent instanceof Ocelot) {
setSubtype(Ocelot.class, "Type", "setCatType", data1);
}

// Allow setting of skeleton types and their weapons
else if (ent instanceof Skeleton) {
setSubtype(Skeleton.class, "SkeletonType", "setSkeletonType", data1);
Expand All @@ -453,6 +476,7 @@ else if (ent instanceof Skeleton) {
else if (ent instanceof Slime && aH.matchesInteger(data1)) {
((Slime) entity).setSize(aH.getIntegerFrom(data1));
}

// Allow setting of villager professions
else if (ent instanceof Villager) {
setSubtype(Villager.class, "Profession", "setProfession", data1);
Expand Down
Expand Up @@ -209,7 +209,7 @@ public void registerCoreMembers() {
"NAMEPLATE", "nameplate [<chatcolor>] [set:<text>] (target:<player>) +--> Requires ProtocolLib", 1);

registerCoreMember(NarrateCommand.class,
"NARRATE", "narrate [\"<text>\"] (targets:<entity>|...) (format:<name>)", 1);
"NARRATE", "narrate [\"<text>\"] (targets:<player>|...) (format:<name>)", 1);

registerCoreMember(NewCommand.class,
"NEW", "new [itemstack/entity/npc] [id:<name>] (<item> qty:<#>)", 2);
Expand Down Expand Up @@ -257,7 +257,7 @@ public void registerCoreMembers() {
"SCOREBOARD", "scoreboard [set/remove/show/hide] [<name>] [value:<name>] (priority:<#>)", 1);

registerCoreMember(ScribeCommand.class,
"SCRIBE", " - scribe [script:<name>] (give/drop/equip) (<item>) (<location>)", 1);
"SCRIBE", "scribe [script:<name>] (give/drop/equip) (<item>) (<location>)", 1);

registerCoreMember(ShootCommand.class,
"SHOOT", "shoot [entities:<entity>|...] (origin:<player>/<npc>) (destination:<location>) (speed:<#.#>) (script:<name>)", 1);
Expand Down

0 comments on commit ca264cb

Please sign in to comment.