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


Java BlockChangeDelegate.setTypeIdAndData方法代码示例

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


在下文中一共展示了BlockChangeDelegate.setTypeIdAndData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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.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;
    }
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:78,代码来源:CraftWorld.java


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