1.9 KiB
IScriptWorld.testForBlock
Parça 1/16 · sonraki
testForBlock(int x, int y, int z, java.lang.String blockId, int meta)
boolean Test for a specific block and meta in a specific coordinates.
Method Detail getMinecraftWorld
World getMinecraftWorld()
Get Minecraft world instance. BEWARE: you need to know the MCP mappings in order to directly call methods on this instance!
function main(c) { var seaLevel = c.getWorld().getMinecraftWorld().field_181546_a //Sea level
c.send(seaLevel) }
setGameRule
void setGameRule(java.lang.String gameRule, java.lang.Object value)
Set a game rule to a given value.
c.getWorld().setGameRule("keepInventory", true); //btw you can NOT write 1 instead of true c.getWorld().setGameRule("randomTickSpeed", 100);
Parameters: gameRule - The name of the game rule to be set. value - The value to set the game rule to. The type of the value should match the expected type for the game rule.
getGameRule
java.lang.Object getGameRule(java.lang.String gameRule)
Get a game rule value.
var keepInventory = c.getWorld().getGameRule("keepInventory"); var randomTickSpeed = c.getWorld().getGameRule("randomTickSpeed");
c.send("Keep inventory: " + keepInventory); c.send("Random tick speed: " + randomTickSpeed);
Parameters: gameRule - The name of the game rule to get the value of.
Returns: The value of the game rule. The type of the value will match the expected type for the game rule.
setBlock
void setBlock(IScriptBlockState state, int x, int y, int z)
Set a block at XYZ, use IScriptFactory.createBlockState(String, int) to get the block state.
var coarse_dirt = mappet.createBlockState("minecraft:dirt", 1);
c.getWorld().setBlock(coarse_dirt, 214, 3, 509);
removeBlock