Create CraftHorse Instance for EntityHorse

Handle creating instance of CraftHorse for EntityHorse instances and spawn()
Pulls Bukkit/CraftBukkit#1185
This commit is contained in:
Mike Primm 2013-07-05 12:04:50 +10:00 committed by md_5
parent 93c7b77399
commit a7014a3eb7

View File

@ -0,0 +1,35 @@
From f4021d998e46e7453c071ed237055ffb1db2e41d Mon Sep 17 00:00:00 2001
From: Mike Primm <mike@primmhome.com>
Date: Thu, 4 Jul 2013 00:03:42 -0500
Subject: [PATCH] Create CraftHorse Instance for EntityHorse
Handle creating instance of CraftHorse for EntityHorse instances and spawn()
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 9da1a47..88745a4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -893,6 +893,8 @@ public class CraftWorld implements World {
entity = new EntityCreeper(world);
} else if (Ghast.class.isAssignableFrom(clazz)) {
entity = new EntityGhast(world);
+ } else if (Horse.class.isAssignableFrom(clazz)) {
+ entity = new EntityHorse(world);
} else if (Pig.class.isAssignableFrom(clazz)) {
entity = new EntityPig(world);
} else if (Player.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 97f3c1d..4aec8e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -51,6 +51,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityOcelot) { return new CraftOcelot(server, (EntityOcelot) entity); }
}
else if (entity instanceof EntitySheep) { return new CraftSheep(server, (EntitySheep) entity); }
+ else if (entity instanceof EntityHorse) { return new CraftHorse(server, (EntityHorse) entity); }
else { return new CraftAnimals(server, (EntityAnimal) entity); }
}
// Monsters
--
1.8.1.2