Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minecraft javascript error

Tags:

java

minecraft

I am trying to make a script that draws a circle for minecraft using singleplayer commands. For starting, I tried to do the basics; here is my code:

importPackage(Packages.com.sk89q.worldedit.blocks);
importPackage(Packages.com.sk89q.worldedit);

var sess = context.remember();
var playerBlock = player.getBlockOn();
var other = playerBlock.setY(playerBlock.getY + 1);
sess.setBlock(other, new BaseBlock(BlockID.CLOTH, argv[1]));

But when I run it, it says:

Failed to execute: The choice of Java constructor setY matching JavaScript argument types (string) is ambiguous; candidate constructors are: class com.sk89q.worldedit.Vector setY(int) (C:\Users\Darcy\AppData\Roaming.minecraft\craftscripts\circle.js#6) in C:\Users\Darcy\AppData\Roaming.minecraft\craftscripts\circle.js at line nuber 6

Any suggestions?

like image 632
DJRyan Avatar asked Jul 14 '11 11:07

DJRyan


1 Answers

It seems playerBlock.getY is a function, the result of which you should pass. Now you pass the function itself (which gets converted to it's source code, i.e. a string).

var other = playerBlock.setY(playerBlock.getY() + 1);
like image 170
katspaugh Avatar answered Oct 02 '22 04:10

katspaugh