本文整理了Java中net.minecraft.world.chunk.Chunk.setBlockState()
方法的一些代码示例,展示了Chunk.setBlockState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Chunk.setBlockState()
方法的具体详情如下:
包路径:net.minecraft.world.chunk.Chunk
类名称:Chunk
方法名:setBlockState
暂无
代码示例来源:origin: EngineHub/WorldEdit
Map<Property<?>, Object> states = block.getStates();
newState = applyProperties(mcBlock.getBlockState(), newState, states);
IBlockState successState = chunk.setBlockState(pos, newState);
boolean successful = successState != null;
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
private void fillChunk( Chunk chunk, IBlockState defaultState )
{
for( int cx = 0; cx < 16; cx++ )
{
for( int cz = 0; cz < 16; cz++ )
{
for( int cy = 0; cy < 256; cy++ )
{
chunk.setBlockState( new BlockPos( cx, cy, cz ), defaultState );
}
}
}
}
代码示例来源:origin: MCTCP/TerrainControl
@Override
public void setBlock(int x, int y, int z, LocalMaterialData material) {
/*
* This method usually breaks on every Minecraft update. Always check
* whether the names are still correct. Often, you'll also need to
* rewrite parts of this method for newer block place logic.
*/
if (y < TerrainControl.WORLD_DEPTH || y >= TerrainControl.WORLD_HEIGHT) {
return;
}
BlockFalling.fallInstantly=true;
IBlockState newState = ((ForgeMaterialData) material).internalBlock();
// Get chunk from (faster) custom cache
Chunk chunk = this.getChunk(x, y, z);
if (chunk == null) {
// Chunk is unloaded
return;
}
BlockPos pos = new BlockPos(x, y, z);
IBlockState oldState = chunk.setBlockState(pos, newState);
if (oldState == null) {
return;
}
// Notify world: (2 | 16) == update client, don't update observers
this.world.markAndNotifyBlock(pos, chunk, oldState, newState, 2 | 16);
BlockFalling.fallInstantly=false;
}
代码示例来源:origin: superckl/BiomeTweaker
primer.setBlockState(x, y, z, toUse.getConstraints().getState());
else
chunk.setBlockState(blockSetPos.setPos(x, y, z), toUse.getConstraints().getState());
代码示例来源:origin: CoFH/CoFHCore
IBlockState state = chunk.getBlockState(pos);
if (state.getMaterial().isLiquid()) {
if (chunk.setBlockState(pos, replState) != null) {
++blockCounter;
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
if (state.getBlock().isWood(world, pos) || state.getBlock().isLeaves(state, world, pos)) {
if (chunk.setBlockState(pos, replState) != null) {
++blockCounter;
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
if (state.getBlock().isReplaceable(world, pos)) {
if (chunk.setBlockState(pos, replState) != null) {
++blockCounter;
set.add(chunk);
Block block = state.getBlock();
if (block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.STONE)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.NETHERRACK)) || block.isReplaceableOreGen(state, world, pos, BlockMatcher.forBlock(Blocks.END_STONE))) {
if (chunk.setBlockState(pos, replState) != null) {
++blockCounter;
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
if (state.getMaterial() == Material.ROCK) {
if (chunk.setBlockState(pos, replState) != null) {
++blockCounter;
set.add(chunk);
代码示例来源:origin: CoFH/CoFHCore
IBlockState state = chunk.getBlockState(pos);
if (state.getMaterial().isLiquid()) {
if (chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState()) != null) {
++blockCounter;
set.add(chunk);
if (state.getBlock().isWood(world, bPos) || state.getBlock().isLeaves(state, world, bPos)) {
++blockCounter;
if (chunk.setBlockState(bPos, Blocks.AIR.getDefaultState()) != null) {
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
if (state.getBlock().isReplaceable(world, bPos)) {
if (chunk.setBlockState(bPos, Blocks.AIR.getDefaultState()) != null) {
++blockCounter;
set.add(chunk);
if (block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.STONE)) || block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.NETHERRACK)) || block.isReplaceableOreGen(state, world, bPos, BlockMatcher.forBlock(Blocks.END_STONE))) {
++blockCounter;
if (chunk.setBlockState(bPos, Blocks.AIR.getDefaultState()) != null) {
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
if (state.getMaterial() == Material.ROCK) {
if (chunk.setBlockState(bPos, Blocks.AIR.getDefaultState()) != null) {
++blockCounter;
set.add(chunk);
IBlockState state = chunk.getBlockState(pos);
内容来源于网络,如有侵权,请联系作者删除!