Added minecart classes and World.spawn*Minecart(). Minecart.getPassenger() is still a stub that needs to be implemented (due to of a need of a MC entity -> CraftBukkit entity lookup) and StorageMinecart.getInventory() is waiting on the implementation of inventory.

This commit is contained in:
sk89q
2011-01-02 21:41:57 -08:00
committed by Dinnerbone
parent ca47ccf674
commit 9d68035410
5 changed files with 151 additions and 1 deletions

View File

@@ -3,15 +3,19 @@ package org.bukkit.craftbukkit;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.server.EntityMinecart;
import java.util.Random;
import net.minecraft.server.WorldGenBigTree;
import net.minecraft.server.WorldGenTrees;
import net.minecraft.server.WorldServer;
import net.minecraft.server.EntityArrow;
import org.bukkit.Arrow;
import org.bukkit.Block;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Minecart;
import org.bukkit.PoweredMinecart;
import org.bukkit.StorageMinecart;
import org.bukkit.Vector;
import org.bukkit.World;
@@ -88,6 +92,33 @@ public class CraftWorld implements World {
return new CraftArrow(world.getServer(), arrow);
}
public Minecart spawnMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart(
world,
loc.getX(), loc.getY(), loc.getZ(),
CraftMinecart.Type.Minecart.getID());
world.a(minecart);
return new CraftMinecart(world.getServer(), minecart);
}
public StorageMinecart spawnStorageMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart(
world,
loc.getX(), loc.getY(), loc.getZ(),
CraftMinecart.Type.StorageMinecart.getID());
world.a(minecart);
return new CraftStorageMinecart(world.getServer(), minecart);
}
public PoweredMinecart spawnPoweredMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart(
world,
loc.getX(), loc.getY(), loc.getZ(),
CraftMinecart.Type.PoweredMinecart.getID());
world.a(minecart);
return new CraftPoweredMinecart(world.getServer(), minecart);
}
public boolean generateTree(Location loc) {
WorldGenTrees treeGen = new WorldGenTrees();
return treeGen.a(world, rand,