mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Implementation of spawnCreature(Location, CreatureType)
By: Andrew Ardill <andrew.ardill@gmail.com>
This commit is contained in:
parent
4a3c54648b
commit
a816dcad82
1 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import net.minecraft.server.*;
|
import net.minecraft.server.*;
|
||||||
|
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Boat;
|
import org.bukkit.entity.Boat;
|
||||||
|
@ -277,6 +278,20 @@ public class CraftWorld implements World {
|
||||||
return (Boat) boat.getBukkitEntity();
|
return (Boat) boat.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Creature spawnCreature(Location loc, CreatureType creatureType) {
|
||||||
|
Creature creature;
|
||||||
|
try {
|
||||||
|
EntityCreature entityCreature = (EntityCreature) EntityTypes.a(creatureType.getName(), world);
|
||||||
|
entityCreature.a(loc.getX(), loc.getY(), loc.getZ());
|
||||||
|
creature = (Creature) CraftEntity.getEntity(server, entityCreature);
|
||||||
|
world.a(entityCreature);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// if we fail, for any reason, return null.
|
||||||
|
creature = null;
|
||||||
|
}
|
||||||
|
return creature;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean generateTree(Location loc, TreeType type) {
|
public boolean generateTree(Location loc, TreeType type) {
|
||||||
return generateTree(loc, type, world);
|
return generateTree(loc, type, world);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue