summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-01-17 07:34:31 +0800
committerDinner Bone <dinnerbone@dinnerbone.com>2011-01-18 00:13:32 +0800
commit3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b (patch)
treef413b0452c10327c74ba5eddda7f622cde646ff0
parent2de3e2e7e406baaaddd5c71fa283d81dacabf815 (diff)
downloadcraftbukkit-3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b.tar
craftbukkit-3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b.tar.gz
craftbukkit-3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b.tar.lz
craftbukkit-3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b.tar.xz
craftbukkit-3400eafaf1ba56b43dbdbb9e0aac3ebf5930538b.zip
added handling of powered and storage minecarts
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index 59cf2d51..c555fd1f 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -7,6 +7,8 @@ import java.util.Random;
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEgg;
import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.craftbukkit.entity.CraftPoweredMinecart;
+import org.bukkit.craftbukkit.entity.CraftStorageMinecart;
import org.bukkit.craftbukkit.CraftMappable;
import org.bukkit.craftbukkit.entity.CraftMinecart;
import org.bukkit.craftbukkit.CraftServer;
@@ -96,6 +98,8 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
private double at;
// CraftBukkit start
+ protected org.bukkit.entity.Entity bukkitPoweredMinecart; //CraftBukkit
+ protected org.bukkit.entity.Entity bukkitStorageMinecart; //CraftBukkit
private CraftMinecart minecart;
private boolean slowWhenEmpty = true;
@@ -128,9 +132,10 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
handleCreation(world); // CraftBukkit
//CraftBukkit start
- //TODO need to handle powered and storage minecarts
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftMinecart(server, this);
+ this.bukkitPoweredMinecart = new CraftPoweredMinecart(server, this);
+ this.bukkitStorageMinecart = new CraftStorageMinecart(server, this);
//CraftBukkit end
}
@@ -802,4 +807,17 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
}
return entityplayer.b(((Entity) (this))) <= 64D;
}
+
+ //CraftBukkit start
+ @Override
+ public org.bukkit.entity.Entity getBukkitEntity(){
+ if (this.d == CraftMinecart.Type.StorageMinecart.getId()) {
+ return this.bukkitStorageMinecart;
+ } else if (this.d == CraftMinecart.Type.PoweredMinecart.getId()) {
+ return this.bukkitPoweredMinecart;
+ } else {
+ return this.bukkitEntity;
+ }
+ }
+ //CraftBukkit end
}