MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / setBlockState

Method setBlockState

src/main/java/net/minecraft/world/chunk/Chunk.java:660–779  ·  view source on GitHub ↗
(BlockPos pos, IBlockState state)

Source from the content-addressed store, hash-verified

658 }
659
660 public IBlockState setBlockState(BlockPos pos, IBlockState state)
661 {
662 int i = pos.getX() & 15;
663 int j = pos.getY();
664 int k = pos.getZ() & 15;
665 int l = k << 4 | i;
666
667 if (j >= this.precipitationHeightMap[l] - 1)
668 {
669 this.precipitationHeightMap[l] = -999;
670 }
671
672 int i1 = this.heightMap[l];
673 IBlockState iblockstate = this.getBlockState(pos);
674
675 if (iblockstate == state)
676 {
677 return null;
678 }
679 else
680 {
681 Block block = state.getBlock();
682 Block block1 = iblockstate.getBlock();
683 ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];
684 boolean flag = false;
685
686 if (extendedblockstorage == null)
687 {
688 if (block == Blocks.air)
689 {
690 return null;
691 }
692
693 extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky());
694 flag = j >= i1;
695 }
696
697 extendedblockstorage.set(i, j & 15, k, state);
698
699 if (block1 != block)
700 {
701 if (!this.worldObj.isRemote)
702 {
703 block1.breakBlock(this.worldObj, pos, iblockstate);
704 }
705 else if (block1 instanceof ITileEntityProvider)
706 {
707 this.worldObj.removeTileEntity(pos);
708 }
709 }
710
711 if (extendedblockstorage.getBlockByExtId(i, j & 15, k) != block)
712 {
713 return null;
714 }
715 else
716 {
717 if (flag)

Callers 5

setBlockStateMethod · 0.95
genTerrainBlocksMethod · 0.45
generateBiomeTerrainMethod · 0.45
genTerrainBlocksMethod · 0.45
decorateMethod · 0.45

Calls 15

getBlockStateMethod · 0.95
getBlockMethod · 0.95
setMethod · 0.95
breakBlockMethod · 0.95
getBlockByExtIdMethod · 0.95
generateSkylightMapMethod · 0.95
getLightOpacityMethod · 0.95
relightBlockMethod · 0.95
getLightForMethod · 0.95
getTileEntityMethod · 0.95

Tested by

no test coverage detected