当前位置: 首页>>代码示例>>Java>>正文


Java BlockChangeDelegate类代码示例

本文整理汇总了Java中org.bukkit.BlockChangeDelegate的典型用法代码示例。如果您正苦于以下问题:Java BlockChangeDelegate类的具体用法?Java BlockChangeDelegate怎么用?Java BlockChangeDelegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlockChangeDelegate类属于org.bukkit包,在下文中一共展示了BlockChangeDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:27,代码来源:CraftWorld.java

示例2: a

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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);
                    }
                }
            }
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:25,代码来源:WorldGenMegaTree.java

示例3: generate

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:24,代码来源:WorldGenBigTree.java

示例4: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
@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);
        }
    });
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:AsyncWorld.java

示例5: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:28,代码来源:CraftWorld.java

示例6: generate

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:39,代码来源:WorldGenGroundBush.java

示例7: setTypeAndData

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:15,代码来源:WorldGenerator.java

示例8: b

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:15,代码来源:WorldGenTrees.java

示例9: a

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:9,代码来源:WorldGenBigTree.java

示例10: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:28,代码来源:CraftWorld.java

示例11: generate

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:39,代码来源:WorldGenGroundBush.java

示例12: setTypeAndData

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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);
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:8,代码来源:WorldGenerator.java

示例13: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:74,代码来源:CraftWorld.java

示例14: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
@Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate)
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:WorldMock.java

示例15: generateTree

import org.bukkit.BlockChangeDelegate; //导入依赖的package包/类
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;
    }
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:78,代码来源:CraftWorld.java


注:本文中的org.bukkit.BlockChangeDelegate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。