net.minecraft.world.chunk.NibbleArray Java Examples
The following examples show how to use
net.minecraft.world.chunk.NibbleArray.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
@Override public int getCombinedId4Data(ExtendedBlockStorage ls, int x, int y, int z) { byte[] ids = ls.getBlockLSBArray(); NibbleArray currentDataArray = ls.getMetadataArray(); NibbleArray currentExtraArray = ls.getBlockMSBArray(); int i = FaweCache.CACHE_J[y & 15][z & 15][x & 15]; int id = (ids[i] & 0xFF); if (currentExtraArray != null) { id += (currentExtraArray.get(x & 15, y & 15, z & 15)) << 8; } if (currentDataArray != null && FaweCache.hasData(id)) { return (id << 4) + currentDataArray.get(x & 15, y & 15, z & 15); } else { return (id << 4); } }
Example #2
Source File: HelperActions.java From burlapcraft with GNU Lesser General Public License v3.0 | 6 votes |
public static int getBlockId(int x, int y, int z) { Chunk chunk = mc.theWorld.getChunkFromChunkCoords(x >> 4, z >> 4); chunk.getBlock(x & 0xF, y, z & 0xF); int blockId = 0; ExtendedBlockStorage[] sa = chunk.getBlockStorageArray(); if (y >> 4 < sa.length) { ExtendedBlockStorage extendedblockstorage = sa[(y >> 4)]; if (extendedblockstorage != null) { int lx = x & 0xF; int ly = y & 0xF; int lz = z & 0xF; blockId = extendedblockstorage.getBlockLSBArray()[(ly << 8 | lz << 4 | lx)] & 0xFF; NibbleArray blockMSBArray = extendedblockstorage .getBlockMSBArray(); if (blockMSBArray != null) { blockId |= blockMSBArray.get(lx, ly, lz) << 8; } } } return blockId; }
Example #3
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray()); if (sky) { section.setSkylightArray(new NibbleArray()); } } return section != null; }
Example #4
Source File: SpongeQueue_1_11.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray()); if (sky) { section.setSkylightArray(new NibbleArray()); } } return section != null; }
Example #5
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray()); if (sky) { section.setSkylightArray(new NibbleArray()); } } return section != null; }
Example #6
Source File: SpongeQueue_1_12.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlockLight(new NibbleArray()); if (sky) { section.setSkyLight(new NibbleArray()); } } return section != null; }
Example #7
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlockLight(new NibbleArray()); if (sky) { section.setSkyLight(new NibbleArray()); } } return section != null; }
Example #8
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray(4096, 4)); if (sky) { section.setSkylightArray(new NibbleArray(4096, 4)); } } return section != null; }
Example #9
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray()); if (sky) { section.setSkylightArray(new NibbleArray()); } } return section != null; }
Example #10
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public boolean removeSectionLighting(ExtendedBlockStorage section, int layer, boolean sky) { if (section != null) { section.setBlocklightArray(new NibbleArray()); if (sky) { section.setSkylightArray(new NibbleArray()); } } return section != null; }
Example #11
Source File: PacketChunkInfo.java From LookingGlass with GNU General Public License v3.0 | 4 votes |
public static Extracted getMapChunkData(Chunk chunk, boolean includeinit, int subid) { int j = 0; ExtendedBlockStorage[] aextendedblockstorage = chunk.getBlockStorageArray(); int k = 0; S21PacketChunkData.Extracted extracted = new S21PacketChunkData.Extracted(); if (dataarray == null || dataarray.length < 196864) { dataarray = new byte[196864]; } byte[] abyte = dataarray; if (includeinit) { chunk.sendUpdates = true; } int l; for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { extracted.field_150280_b |= 1 << l; if (aextendedblockstorage[l].getBlockMSBArray() != null) { extracted.field_150281_c |= 1 << l; ++k; } } } for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { byte[] abyte1 = aextendedblockstorage[l].getBlockLSBArray(); System.arraycopy(abyte1, 0, abyte, j, abyte1.length); j += abyte1.length; } } NibbleArray nibblearray; for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getMetadataArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getBlocklightArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } if (!chunk.worldObj.provider.hasNoSky) { for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getSkylightArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } } if (k > 0) { for (l = 0; l < aextendedblockstorage.length; ++l) { if (aextendedblockstorage[l] != null && (!includeinit || !aextendedblockstorage[l].isEmpty()) && aextendedblockstorage[l].getBlockMSBArray() != null && (subid & 1 << l) != 0) { nibblearray = aextendedblockstorage[l].getBlockMSBArray(); System.arraycopy(nibblearray.data, 0, abyte, j, nibblearray.data.length); j += nibblearray.data.length; } } } if (includeinit) { byte[] abyte2 = chunk.getBiomeArray(); System.arraycopy(abyte2, 0, abyte, j, abyte2.length); j += abyte2.length; } extracted.field_150282_a = new byte[j]; System.arraycopy(abyte, 0, extracted.field_150282_a, 0, j); return extracted; }
Example #12
Source File: ForgeChunk_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public ForgeChunk_All(FaweQueue parent, int x, int z) { super(parent, x, z); this.byteIds = new byte[16][]; this.extended = new NibbleArray[16]; this.datas = new NibbleArray[16]; }
Example #13
Source File: ForgeChunk_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public ForgeChunk_All(FaweQueue parent, int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap, byte[][] byteIds, NibbleArray[] datas, NibbleArray[] extended) { super(parent, x, z, ids, count, air, heightMap); this.byteIds = byteIds; this.datas = datas; this.extended = extended; }
Example #14
Source File: ForgeChunk_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public NibbleArray getDataArray(int i) { return datas[i]; }
Example #15
Source File: ForgeChunk_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
public NibbleArray getExtendedIdArray(int i) { return extended[i]; }
Example #16
Source File: ForgeChunk_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public void setBlock(int x, int y, int z, int id, int data) { int i = FaweCache.CACHE_I[y][z][x]; int j = FaweCache.CACHE_J[y][z][x]; byte[] vs = this.byteIds[i]; char[] vs2 = this.ids[i]; if (vs2 == null) { vs2 = this.ids[i] = new char[4096]; } if (vs == null) { vs = this.byteIds[i] = new byte[4096]; } this.count[i]++; switch (id) { case 0: this.air[i]++; vs[j] = 0; vs2[j] = (char) 1; return; case 11: case 39: case 40: case 51: case 74: case 89: case 122: case 124: case 138: case 169: case 213: case 130: case 76: case 62: case 50: case 10: // this.relight[i]++; default: vs2[j] = (char) ((id << 4) + data); vs[j] = (byte) id; if (data != 0) { NibbleArray dataArray = datas[i]; if (dataArray == null) { datas[i] = dataArray = new NibbleArray(4096, 4); } dataArray.set(x, y & 15, z, data); } if (id > 255) { NibbleArray nibble = extended[i]; if (nibble == null) { extended[i] = nibble = new NibbleArray(4096, 4); } nibble.set(x, y & 15, z, id >> 8); } } }