Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Cube(Chunk column, int cubeY, CubePrimer primer) {
- this(column, cubeY);
- int miny = cubeToMinBlock(cubeY);
- IHeightMap opindex = ((IColumn) column).getOpacityIndex();
- for (int x = 0; x < Cube.SIZE; x++) {
- for (int z = 0; z < Cube.SIZE; z++) {
- for (int y = Cube.SIZE - 1; y >= 0; y--) {
- IBlockState newstate = primer.getBlockState(x, y, z);
- if (newstate.getMaterial() != Material.AIR) {
- if (storage == NULL_STORAGE) {
- newStorage();
- }
- storage.set(x, y, z, newstate);
- //int opacity = newstate.getLightOpacity();
- //if (false || opacity != 0) {
- // column.setModified(true); //TODO: this is a bit of am abstraction leak... maybe ServerHeightMap needs its own isModified
- // opindex.onOpacityChange(x, miny | y, z, opacity);
- //}
- }
- }
- }
- }
- isSurfaceTracked = true;
- isModified = true;
- }
- private void newStorage() {
- storage = new ExtendedBlockStorage(cubeToMinBlock(getY()), world.provider.hasSkyLight());
- }
- CubePrimer:
- public class CubePrimer {
- public static final IBlockState DEFAULT_STATE = Blocks.AIR.getDefaultState();
- private final char[] data = new char[4096];
- public IBlockState getBlockState(int x, int y, int z) {
- @SuppressWarnings("deprecation")
- IBlockState iblockstate = Block.BLOCK_STATE_IDS.getByValue(this.data[getBlockIndex(x, y, z)]);
- return iblockstate == null ? DEFAULT_STATE : iblockstate;
- }
- public void setBlockState(int x, int y, int z, @Nonnull IBlockState state) {
- @SuppressWarnings("deprecation")
- char value = (char) Block.BLOCK_STATE_IDS.get(state);
- this.data[getBlockIndex(x, y, z)] = value;
- }
- private static int getBlockIndex(int x, int y, int z) {
- return x << 8 | z << 4 | y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement