本文整理汇总了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;
}
}
示例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;
}
}
示例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
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}