mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 22:11:07 +00:00
add /summon <entity_name> command
This commit is contained in:
parent
f522dfac97
commit
d87e9a3a31
1 changed files with 17 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ var util = require('util');
|
|||
var EventEmitter = require('events').EventEmitter;
|
||||
util.inherits(Entity, EventEmitter);
|
||||
var Vec3 = require("vec3").Vec3;
|
||||
var entitiesByName=require("minecraft-data")(require("../version")).entitiesByName;
|
||||
|
||||
var path = require('path');
|
||||
var requireIndex = require('requireindex');
|
||||
|
|
@ -87,6 +88,22 @@ module.exports.player=function(player,serv){
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
player.commands.add({
|
||||
base: 'summon',
|
||||
info: 'Summon an entity',
|
||||
usage: '/summon <entity_name>',
|
||||
action(name) {
|
||||
var entity=entitiesByName[name];
|
||||
if(!entity) {
|
||||
player.chat("No entity named "+name);
|
||||
return;
|
||||
}
|
||||
serv.spawnMob(entity.id, player.world, player.entity.position.scaled(1/32), {
|
||||
velocity: Vec3((Math.random() - 0.5) * 10, Math.random()*10 + 10, (Math.random() - 0.5) * 10)
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.entity=function(entity,serv){
|
||||
|
|
|
|||
Loading…
Reference in a new issue