-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new entities and spawn modules
- Loading branch information
1 parent
4aa28c0
commit e285bb6
Showing
6 changed files
with
70 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
scriptcraft-version=3.1.10 | ||
scriptcraft-version=3.1.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*global __plugin, org, Packages, module, exports*/ | ||
'use strict'; | ||
var entities = {}, | ||
entitytypes, | ||
t, i, name; | ||
if (__plugin.bukkit) { | ||
entitytypes = org.bukkit.entity.EntityType.values(); | ||
} | ||
if (__plugin.canary) { | ||
entitytypes = Packages.net.canarymod.api.entity.EntityType.values(); | ||
} | ||
for (t in entitytypes) { | ||
if (entitytypes[t] && entitytypes[t].ordinal) { | ||
name = entitytypes[t].name(); | ||
entities[name] = entitytypes[t]; | ||
} | ||
} | ||
module.exports = entities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*global require, module, __plugin, Packages*/ | ||
'use strict'; | ||
var entities = require('entities'); | ||
|
||
module.exports = function(entityType, location){ | ||
if (typeof entityType === 'string'){ | ||
entityType = entities[entityType]; | ||
} | ||
var world = location.world; | ||
if (__plugin.bukkit){ | ||
world.spawnEntity( location, entityType); | ||
} | ||
if (__plugin.canary){ | ||
var Canary = Packages.net.canarymod.Canary, | ||
entityInstance = Canary.factory().entityFactory.newEntity(entityType, location); | ||
entityInstance.spawn(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
var spawnFn = require('spawn'), | ||
Drone = require('drone') | ||
; | ||
function spawn(entityType){ | ||
spawnFn(entityType, this.getBlock().location); | ||
} | ||
Drone.extend(spawn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters