有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java从Aparabi线程返回

我正在与Aparabi合作,我无法返回我想要的数据。 我发现Aparabi的工作原理与线程类似

    private int calculateBlockLightLevel(final int x,final int y,final int z) {
    int blockType = world.getBlockTypeAt(x, z, y);

    //TODO Work out how to edit this, aka not Final!
    final int found[] = new int[]{0};
    Kernel kernel = new Kernel(){
        @Override public void run() {
            int blockLightLevel = getBlockLightLevelAt(x, y + 1, z);
            int highestSurroundingBlockLight = blockLightLevel;

            found[0]=highestSurroundingBlockLight;

            blockLightLevel = getBlockLightLevelAt(x - 1, y, z);
            if (blockLightLevel > highestSurroundingBlockLight) {
                highestSurroundingBlockLight = blockLightLevel;
                found[0]=highestSurroundingBlockLight;
            }
            blockLightLevel = getBlockLightLevelAt(x + 1, y, z);
            if (blockLightLevel > highestSurroundingBlockLight) {
                highestSurroundingBlockLight = blockLightLevel;
                found[0]=highestSurroundingBlockLight;
            }
            blockLightLevel = getBlockLightLevelAt(x, y, z - 1);
            if (blockLightLevel > highestSurroundingBlockLight) {
                highestSurroundingBlockLight = blockLightLevel;
                found[0]=highestSurroundingBlockLight;
            }
            blockLightLevel = getBlockLightLevelAt(x, y, z + 1);
            if (blockLightLevel > highestSurroundingBlockLight) {
                highestSurroundingBlockLight = blockLightLevel;
                found[0]=highestSurroundingBlockLight;
            }
            blockLightLevel = getBlockLightLevelAt(x, y - 1, z);
            if (blockLightLevel > highestSurroundingBlockLight) {
                highestSurroundingBlockLight = blockLightLevel;
                found[0]=highestSurroundingBlockLight;
            }

        }
     };
     kernel.execute(1);

     kernel.dispose();

    return Math.max(found[0] - Math.max(BLOCK_TRANSPARENCY.get(blockType), 1), 0);

}

从这段代码中,我试图将找到的返回到我的返回中


共 (0) 个答案