private void setBits(int bitsIn) { if (bitsIn != this.bits) { this.bits = bitsIn; if (this.bits <= 4) { this.bits = 4; this.palette = new BlockStatePaletteLinear(this.bits, this); } else if (this.bits <= 8) { this.palette = new BlockStatePaletteHashMap(this.bits, this); } else { this.palette = REGISTRY_BASED_PALETTE; this.bits = MathHelper.log2DeBruijn(Block.BLOCK_STATE_IDS.size()); } this.palette.idFor(AIR_BLOCK_STATE); this.storage = new BitArray(this.bits, 4096); } }
public int onResize(int p_186008_1_, IBlockState state) { BitArray bitarray = this.storage; IBlockStatePalette iblockstatepalette = this.palette; this.setBits(p_186008_1_); for (int i = 0; i < bitarray.size(); ++i) { IBlockState iblockstate = iblockstatepalette.getBlockState(bitarray.getAt(i)); if (iblockstate != null) { this.set(i, iblockstate); } } return this.palette.idFor(state); }
public void setBits(int bitsIn) { if (bitsIn != bits) { bits = bitsIn; if (bits <= 4) { bits = 4; this.palette = new BlockStatePaletteLinear(bits, this); } else if (bits <= 8) { this.palette = new BlockStatePaletteHashMap(bits, this); } else { this.palette = REGISTRY_BASED_PALETTE; bits = MathHelper.calculateLogBaseTwoDeBruijn(Block.BLOCK_STATE_IDS.size()); } this.palette.idFor(AIR_BLOCK_STATE); this.storage = new BitArray(bits, 4096); } }
@Override public int onResize(int size, IBlockState state) { BitArray bitarray = this.storage; IBlockStatePalette iblockstatepalette = this.palette; setBits(size); for (int i = 0; i < bitarray.size(); ++i) { IBlockState iblockstate = iblockstatepalette.getBlockState(bitarray.getAt(i)); if (iblockstate != null) { this.set(i, iblockstate); } } return palette.idFor(state); }
private void setBits(int bitsIn, boolean forceBits) { if (bitsIn != this.bits) { this.bits = bitsIn; if (this.bits <= 4) { this.bits = 4; this.palette = new BlockStatePaletteLinear(this.bits, this); } else if (this.bits <= 8) { this.palette = new BlockStatePaletteHashMap(this.bits, this); } else { this.palette = REGISTRY_BASED_PALETTE; this.bits = MathHelper.calculateLogBaseTwoDeBruijn(Block.BLOCK_STATE_IDS.size()); if (forceBits) this.bits = bitsIn; } this.palette.idFor(AIR_BLOCK_STATE); this.storage = new BitArray(this.bits, 4096); } }
@Override public BitArray copy() { InternalBitArray bitArray = (InternalBitArray) new BitArray(bitsPerEntry, arraySize); bitArray.setLongArray(Arrays.copyOf(longArray, longArray.length)); return (BitArray) bitArray; }
BitArray copy();