Java 类org.bukkit.BlockChangeDelegate 实例源码

项目:CraftBukkit    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = generateTree(loc, type);
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            net.minecraft.server.Block oldBlock = world.getType(x, y, z);
            int typeId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, typeId, data);
            net.minecraft.server.Block newBlock = world.getType(x, y, z);
            world.notifyAndUpdatePhysics(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    } else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:Almura-Server    文件:WorldGenMegaTree.java   
private void a(BlockChangeDelegate world, int i, int j, int k, int l, Random random) {
    byte b0 = 2;

    for (int i1 = k - b0; i1 <= k; ++i1) {
        int j1 = i1 - k;
        int k1 = l + 1 - j1;

        for (int l1 = i - k1; l1 <= i + k1 + 1; ++l1) {
            int i2 = l1 - i;

            for (int j2 = j - k1; j2 <= j + k1 + 1; ++j2) {
                int k2 = j2 - j;

                if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) {
                    int l2 = world.getTypeId(l1, i1, j2);

                    if (l2 == 0 || l2 == Block.LEAVES.id) {
                        this.setTypeAndData(world, l1, i1, j2, Block.LEAVES.id, this.c);
                    }
                }
            }
        }
    }
}
项目:Almura-Server    文件:WorldGenBigTree.java   
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
    // CraftBukkit end
    this.world = world;
    long l = random.nextLong();

    this.b.setSeed(l);
    this.d[0] = i;
    this.d[1] = j;
    this.d[2] = k;
    if (this.e == 0) {
        this.e = 5 + this.b.nextInt(this.m);
    }

    if (!this.e()) {
        return false;
    } else {
        this.a();
        this.b();
        this.c();
        this.d();
        return true;
    }
}
项目:Tweakkit-Server    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = generateTree(loc, type);
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            net.minecraft.server.Block oldBlock = world.getType(x, y, z);
            int typeId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, typeId, data);
            net.minecraft.server.Block newBlock = world.getType(x, y, z);
            world.notifyAndUpdatePhysics(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    } else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:Craft-city    文件:WorldGenMegaTree.java   
private void a(BlockChangeDelegate world, int i, int j, int k, int l, Random random) {
    byte b0 = 2;

    for (int i1 = k - b0; i1 <= k; ++i1) {
        int j1 = i1 - k;
        int k1 = l + 1 - j1;

        for (int l1 = i - k1; l1 <= i + k1 + 1; ++l1) {
            int i2 = l1 - i;

            for (int j2 = j - k1; j2 <= j + k1 + 1; ++j2) {
                int k2 = j2 - j;

                if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) {
                    int l2 = world.getTypeId(l1, i1, j2);

                    if (l2 == 0 || l2 == Block.LEAVES.id) {
                        this.setTypeAndData(world, l1, i1, j2, Block.LEAVES.id, this.c);
                    }
                }
            }
        }
    }
}
项目:Craft-city    文件:WorldGenBigTree.java   
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
    // CraftBukkit end
    this.world = world;
    long l = random.nextLong();

    this.b.setSeed(l);
    this.d[0] = i;
    this.d[1] = j;
    this.d[2] = k;
    if (this.e == 0) {
        this.e = 5 + this.b.nextInt(this.m);
    }

    if (!this.e()) {
        return false;
    } else {
        this.a();
        this.b();
        this.c();
        this.d();
        return true;
    }
}
项目:FastAsyncWorldedit    文件:AsyncWorld.java   
@Override
public boolean generateTree(final Location loc, final TreeType type, final BlockChangeDelegate delegate) {
    return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
        @Override
        public void run(Boolean value) {
            this.value = parent.generateTree(loc, type, delegate);
        }
    });
}
项目:Craftbukkit    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = generateTree(loc, type);
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            BlockPosition position = new BlockPosition(x, y, z);
            net.minecraft.server.Block oldBlock = world.getType(position).getBlock();
            int typeId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, typeId, data);
            net.minecraft.server.Block newBlock = world.getType(position).getBlock();
            world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    } else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:Almura-Server    文件:WorldGenGroundBush.java   
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
    // CraftBukkit end
    int l;

    for (boolean flag = false; ((l = world.getTypeId(i, j, k)) == 0 || l == Block.LEAVES.id) && j > 0; --j) {
        ;
    }

    int i1 = world.getTypeId(i, j, k);

    if (i1 == Block.DIRT.id || i1 == Block.GRASS.id) {
        ++j;
        this.setTypeAndData(world, i, j, k, Block.LOG.id, this.b);

        for (int j1 = j; j1 <= j + 2; ++j1) {
            int k1 = j1 - j;
            int l1 = 2 - k1;

            for (int i2 = i - l1; i2 <= i + l1; ++i2) {
                int j2 = i2 - i;

                for (int k2 = k - l1; k2 <= k + l1; ++k2) {
                    int l2 = k2 - k;

                    if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.t[world.getTypeId(i2, j1, k2)]) {
                        this.setTypeAndData(world, i2, j1, k2, Block.LEAVES.id, this.a);
                    }
                }
            }
        }
    // CraftBukkit start - Return false if gen was unsuccessful
    } else {
        return false;
    }
    // CraftBukkit end

    return true;
}
项目:Almura-Server    文件:WorldGenerator.java   
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
    if (this.a) {
        // CraftBukkit - BlockChangeDelegate doesn't have the 6th parameter
        world.setTypeIdAndData(i, j, k, l, i1);
    } else {
        // CraftBukkit start - Layering violation :(
        if (world instanceof World) {
            ((World) world).setTypeIdAndData(i, j, k, l, i1, 2);
        } else {
            world.setRawTypeIdAndData(i, j, k, l, i1);
        }
        // CraftBukkit end
    }
}
项目:Almura-Server    文件:WorldGenTrees.java   
private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
    int i1 = 4;

    while (true) {
        --j;
        if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
            return;
        }

        this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
        --i1;
    }
}
项目:Almura-Server    文件:WorldGenBigTree.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    // sk: The idea is to have (our) WorldServer implement
    // BlockChangeDelegate and then we can implicitly cast World to
    // WorldServer (a safe cast, AFAIK) and no code will be broken. This
    // then allows plugins to catch manually-invoked generation events
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenSwampTree.java   
private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
    int i1 = 4;

    while (true) {
        --j;
        if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
            return;
        }

        this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
        --i1;
    }
}
项目:SpigotSource    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = generateTree(loc, type);
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            BlockPosition position = new BlockPosition(x, y, z);
            net.minecraft.server.IBlockData oldBlock = world.getType(position);
            int typeId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, typeId, data);
            net.minecraft.server.IBlockData newBlock = world.getType(position);
            world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    } else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:Craft-city    文件:WorldGenGroundBush.java   
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
    // CraftBukkit end
    int l;

    for (boolean flag = false; ((l = world.getTypeId(i, j, k)) == 0 || l == Block.LEAVES.id) && j > 0; --j) {
        ;
    }

    int i1 = world.getTypeId(i, j, k);

    if (i1 == Block.DIRT.id || i1 == Block.GRASS.id) {
        ++j;
        this.setTypeAndData(world, i, j, k, Block.LOG.id, this.b);

        for (int j1 = j; j1 <= j + 2; ++j1) {
            int k1 = j1 - j;
            int l1 = 2 - k1;

            for (int i2 = i - l1; i2 <= i + l1; ++i2) {
                int j2 = i2 - i;

                for (int k2 = k - l1; k2 <= k + l1; ++k2) {
                    int l2 = k2 - k;

                    if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.s[world.getTypeId(i2, j1, k2)]) {
                        this.setTypeAndData(world, i2, j1, k2, Block.LEAVES.id, this.a);
                    }
                }
            }
        }
    // CraftBukkit start - Return false if gen was unsuccessful
    } else {
        return false;
    }
    // CraftBukkit end

    return true;
}
项目:Craft-city    文件:WorldGenerator.java   
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
    if (this.a) {
        world.setTypeIdAndData(i, j, k, l, i1);
    } else {
        world.setTypeIdAndData(i, j, k, l, i1);
    }
}
项目:Craft-city    文件:WorldGenTrees.java   
private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
    int i1 = 4;

    while (true) {
        --j;
        if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
            return;
        }

        this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
        --i1;
    }
}
项目:Craft-city    文件:WorldGenBigTree.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    // sk: The idea is to have (our) WorldServer implement
    // BlockChangeDelegate and then we can implicitly cast World to
    // WorldServer (a safe cast, AFAIK) and no code will be broken. This
    // then allows plugins to catch manually-invoked generation events
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Craft-city    文件:WorldGenSwampTree.java   
private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
    int i1 = 4;

    while (true) {
        --j;
        if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
            return;
        }

        this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
        --i1;
    }
}
项目:Uranium    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    CaptureTree tCapture=world.mCapture.startTreeGenCapture(null,loc);
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    tCapture.markHandled();
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : tCapture.mCapturedBlocks) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        return true;
    }
    else {
        return false;
    }
}
项目:MockBukkit    文件:WorldMock.java   
@Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:ThermosRebased    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockSnapshots = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockSnapshots = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : world.capturedBlockSnapshots) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockSnapshots.clear();
        return true;
    }
    else {
        world.capturedBlockSnapshots.clear();
        return false;
    }
}
项目:Pokkit    文件:PokkitWorld.java   
@Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    throw Pokkit.unsupported();

}
项目:Thermos    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockSnapshots = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockSnapshots = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : world.capturedBlockSnapshots) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockSnapshots.clear();
        return true;
    }
    else {
        world.capturedBlockSnapshots.clear();
        return false;
    }
}
项目:KCauldron    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockSnapshots = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockSnapshots = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : world.capturedBlockSnapshots) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockSnapshots.clear();
        return true;
    }
    else {
        world.capturedBlockSnapshots.clear();
        return false;
    }
}
项目:CauldronGit    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    }
    else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:CanaryBukkit    文件:CanaryWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    throw new NotImplementedException(" generateTree(Location, TreeType, BlockChangeDelegate)");
}
项目:Cauldron-Old    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockStates = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockStates = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockState blockstate : world.capturedBlockStates) {
            int x = blockstate.getX();
            int y = blockstate.getY();
            int z = blockstate.getZ();
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = blockstate.getTypeId();
            int data = blockstate.getRawData();
            int flag = ((CraftBlockState)blockstate).getFlag();
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockStates.clear();
        return true;
    }
    else {
        world.capturedBlockStates.clear();
        return false;
    }
}
项目:Cauldron-Reloaded    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockSnapshots = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockSnapshots = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : world.capturedBlockSnapshots) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockSnapshots.clear();
        return true;
    }
    else {
        world.capturedBlockSnapshots.clear();
        return false;
    }
}
项目:FFoKC    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    net.minecraft.world.gen.feature.WorldGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new net.minecraft.world.gen.feature.WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, false);
        break;
    case REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaJungle(true, 10, 20, 3, 3); // Magic values as in BlockSapling
        break;
    case SMALL_JUNGLE:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new net.minecraft.world.gen.feature.WorldGenShrub(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new net.minecraft.world.gen.feature.WorldGenBigMushroom(0);
        break;
    case SWAMP:
        gen = new net.minecraft.world.gen.feature.WorldGenSwamp();
        break;
    case ACACIA:
        gen = new net.minecraft.world.gen.feature.WorldGenSavannaTree(true);
        break;
    case DARK_OAK:
        gen = new net.minecraft.world.gen.feature.WorldGenCanopyTree(true);
        break;
    case MEGA_REDWOOD:
        gen = new net.minecraft.world.gen.feature.WorldGenMegaPineTree(true, rand.nextBoolean());
        break;
    case TALL_BIRCH:
        gen = new net.minecraft.world.gen.feature.WorldGenForest(true, true);
        break;
    case TREE:
    default:
        gen = new net.minecraft.world.gen.feature.WorldGenTrees(true);
        break;
    }

    world.captureTreeGeneration = true;
    world.captureBlockSnapshots = true;
    boolean grownTree = gen.generate(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
    world.captureBlockSnapshots = false;
    world.captureTreeGeneration = false;
    if (grownTree) { // Copy block data to delegate
        for (BlockSnapshot blocksnapshot : world.capturedBlockSnapshots) {
            int x = blocksnapshot.x;
            int y = blocksnapshot.y;
            int z = blocksnapshot.z;
            net.minecraft.block.Block oldBlock = world.getBlock(x, y, z); 
            int newId = net.minecraft.block.Block.getIdFromBlock(blocksnapshot.replacedBlock);
            int data = blocksnapshot.meta;
            int flag = blocksnapshot.flag;
            delegate.setTypeIdAndData(x, y, z, newId, data);
            net.minecraft.block.Block newBlock = world.getBlock(x, y, z); 
            world.markAndNotifyBlock(x, y, z, null, oldBlock, newBlock, flag);
        }
        world.capturedBlockSnapshots.clear();
        return true;
    }
    else {
        world.capturedBlockSnapshots.clear();
        return false;
    }
}
项目:Almura-Server    文件:CraftWorld.java   
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
    BlockSapling.TreeGenerator gen;
    switch (type) {
    case BIG_TREE:
        gen = new WorldGenBigTree(true);
        break;
    case BIRCH:
        gen = new WorldGenForest(true);
        break;
    case REDWOOD:
        gen = new WorldGenTaiga2(true);
        break;
    case TALL_REDWOOD:
        gen = new WorldGenTaiga1();
        break;
    case JUNGLE:
        gen = new WorldGenMegaTree(true, 10 + rand.nextInt(20), 3, 3);
        break;
    case SMALL_JUNGLE:
        gen = new WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false);
        break;
    case JUNGLE_BUSH:
        gen = new WorldGenGroundBush(3, 0);
        break;
    case RED_MUSHROOM:
        gen = new WorldGenHugeMushroom(1);
        break;
    case BROWN_MUSHROOM:
        gen = new WorldGenHugeMushroom(0);
        break;
    case SWAMP:
        gen = new WorldGenSwampTree();
        break;
    case TREE:
    default:
        gen = new WorldGenTrees(true);
        break;
    }

    return gen.generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}
项目:Almura-Server    文件:WorldGenTaiga1.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenForest.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenGroundBush.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenerator.java   
protected void setType(BlockChangeDelegate world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, l, 0);
}
项目:Almura-Server    文件:WorldGenMegaTree.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenTrees.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenTaiga2.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenSwampTree.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
项目:Almura-Server    文件:WorldGenHugeMushroom.java   
public boolean a(World world, Random random, int i, int j, int k) {
    // CraftBukkit start - Moved to generate
    return grow((BlockChangeDelegate) world, random, i, j, k, null, null, null);
}