Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AWOOoooooooooo
- //
- // Just cram this in tick(event) or any other time you want to fire this bad boy off
- function lycanthrope(event) {
- var P = event.API.getIWorld(0).getAllPlayers()
- for(var n=0;n<P.length;n++) {
- var x = P[n].getX() - 1
- var y = Math.ceil(P[n].getY())
- var z = P[n].getZ()
- var block = P[n].world.getBlock(x,y,z)
- // get MC block, etc, so we can see if it's open to the sky or not
- var thisMCWorld = P[n].world.getMCWorld()
- var thisMCBlock = block.getMCBlock()
- var thisMCBlockPos = block.getPos().getMCBlockPos()
- var thisMCBlockLightLevel = thisMCWorld.func_175724_o(thisMCBlockPos) * 16.0
- var isAboveground = thisMCWorld.func_175710_j(thisMCBlockPos)
- var isDaytime = thisMCWorld.func_72935_r()
- var shouldBurn = ((thisMCBlockLightLevel > 7) && isAboveground && isDaytime)
- if(P[n].getStoreddata().has("Lycanthrope") == true && shouldBurn == true) {
- if(shouldBurn == true) {
- // player burns in sunlight, just like an undead mob
- event.player.getMCEntity().func_70015_d(5)
- }
- // and other werewolf effects. you can add whatever you want under here
- event.player.addPotionEffect(16,2,0,false) // night vision
- event.player.addPotionEffect(8,2,0,false) // leaping
- event.player.addPotionEffect(1,2,0,false) // speed
- // make player "kill" sheep
- var sheep = P[n].rayTraceEntities(8.0,false,false)
- var killedSheep = false
- for(var i = 0;i<sheep.length;i++) {
- if(sheep[i].getName().indexOf("Sheep") > -1 && killedSheep == false) {
- P[n].setPos( sheep[i].getPos() )
- event.player.world.playSoundAt(sheep[i].getPos(),"minecraft:entity.sheep.death",2,1)
- sheep[i].kill()
- killedSheep = true
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement