本文整理汇总了Java中net.minecraft.world.chunk.NibbleArray类的典型用法代码示例。如果您正苦于以下问题:Java NibbleArray类的具体用法?Java NibbleArray怎么用?Java NibbleArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NibbleArray类属于net.minecraft.world.chunk包,在下文中一共展示了NibbleArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCombinedId4Data
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
@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);
}
}
示例2: getBlockId
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
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;
}
示例3: ExtendedBlockStorage
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public ExtendedBlockStorage(int y, boolean flag, byte[] blkIds, byte[] extBlkIds)
{
this.yBase = y;
this.blockLSBArray = blkIds;
if (extBlkIds != null)
{
this.blockMSBArray = new NibbleArray(extBlkIds, 4);
}
this.blockMetadataArray = new NibbleArray(this.blockLSBArray.length, 4);
this.blocklightArray = new NibbleArray(this.blockLSBArray.length, 4);
if (flag)
{
this.skylightArray = new NibbleArray(this.blockLSBArray.length, 4);
}
this.removeInvalidBlocks();
}
示例4: setBlockMSBArray
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public void setBlockMSBArray(NibbleArray p_76673_1_)
{
// CraftBukkit start - Don't hang on to an empty nibble array
boolean empty = true;
// Spigot start
if ((!p_76673_1_.isTrivialArray()) || (p_76673_1_.getTrivialArrayValue() != 0))
{
empty = false;
}
// Spigot end
if (empty)
{
return;
}
// CraftBukkit end
this.blockMSBArray = this.validateNibbleArray(p_76673_1_); // CraftBukkit - Validate data
}
示例5: ExtendedBlockStorage
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
this.yBase = y;
this.data = new char[4096];
this.blocklightArray = new NibbleArray();
if (storeSkylight)
{
this.skylightArray = new NibbleArray();
}
}
示例6: ExtendedBlockStorage
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
this.yBase = y;
this.data = new BlockStateContainer();
this.blocklightArray = new NibbleArray();
if (storeSkylight)
{
this.skylightArray = new NibbleArray();
}
}
示例7: removeSectionLighting
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
@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;
}
示例8: removeSectionLighting
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
@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;
}
示例9: removeSectionLighting
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
@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;
}
示例10: readChunkFromNBT
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
private Chunk readChunkFromNBT(final World world, final NBTTagCompound nbt) {
final int i = nbt.getInteger("xPos");
final int j = nbt.getInteger("zPos");
final Chunk chunk = new Chunk(world, i, j);
chunk.heightMap = nbt.getIntArray("HeightMap");
chunk.isTerrainPopulated = nbt.getBoolean("TerrainPopulated");
chunk.isLightPopulated = nbt.getBoolean("LightPopulated");
chunk.inhabitedTime = nbt.getLong("InhabitedTime");
final NBTTagList sections = nbt.getTagList("Sections", 10);
final ExtendedBlockStorage[] ebs = new ExtendedBlockStorage[16];
final boolean flag = !world.provider.hasNoSky;
for (int k = 0; k < sections.tagCount(); k++) {
final NBTTagCompound scratch = sections.getCompoundTagAt(k);
final byte b1 = scratch.getByte("Y");
final ExtendedBlockStorage tebs = new ExtendedBlockStorage(b1 << 4, flag);
tebs.setBlockLSBArray(scratch.getByteArray("Blocks"));
if (scratch.hasKey("Add", 7)) {
tebs.setBlockMSBArray(new NibbleArray(scratch.getByteArray("Add"), 4));
}
tebs.setBlockMetadataArray(new NibbleArray(scratch.getByteArray("Data"), 4));
tebs.setBlocklightArray(new NibbleArray(scratch.getByteArray("BlockLight"), 4));
if (flag) {
tebs.setSkylightArray(new NibbleArray(scratch.getByteArray("SkyLight"), 4));
}
tebs.removeInvalidBlocks();
ebs[b1] = tebs;
}
chunk.setStorageArrays(ebs);
if (nbt.hasKey("Biomes", 7)) {
chunk.setBiomeArray(nbt.getByteArray("Biomes"));
}
return chunk;
}
示例11: ExtendedBlockStorage
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public ExtendedBlockStorage(int par1, boolean par2)
{
this.yBase = par1;
this.blockLSBArray = new byte[4096];
this.blockMetadataArray = new NibbleArray(this.blockLSBArray.length, 4);
this.blocklightArray = new NibbleArray(this.blockLSBArray.length, 4);
if (par2)
{
this.skylightArray = new NibbleArray(this.blockLSBArray.length, 4);
}
}
示例12: sendChunkColorData
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public static void sendChunkColorData(Chunk chunk, EntityPlayerMP player) {
try {
ChunkColorDataPacket packet = new ChunkColorDataPacket(methodGetValueArray);
NibbleArray[] redColorArray = ChunkStorageRGB.getRedColorArrays(chunk);
NibbleArray[] greenColorArray = ChunkStorageRGB.getGreenColorArrays(chunk);
NibbleArray[] blueColorArray = ChunkStorageRGB.getBlueColorArrays(chunk);
if (redColorArray == null || greenColorArray == null || blueColorArray == null) {
return;
}
packet.chunkXPosition = chunk.xPosition;
packet.chunkZPosition = chunk.zPosition;
packet.arraySize = redColorArray.length;
packet.yLocation = ChunkStorageRGB.getYLocationArray(chunk);
packet.RedColorArray = redColorArray;
packet.GreenColorArray = greenColorArray;
packet.BlueColorArray = blueColorArray;
//this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
//this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
//this.channels.get(Side.SERVER).writeOutbound(packet);
//Think this is right
INSTANCE.sendTo(packet, player);
//FMLLog.info("SendChunkColorData() Sent for %s, %s", chunk.xPosition, chunk.zPosition);
} catch (Exception e) {
FMLLog.getLogger().warn("SendChunkColorData() ", e);
}
}
示例13: checkedGetNibbleArray
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
/**
* Constructs a NibbleArray from a raw stream of byte data. If the
* byte data is incomplete, returns an empty array.
*
* @param rawdata The raw bytestream to build an array from.
* @return Instance of a NibbleArray.
*/
private static NibbleArray checkedGetNibbleArray(byte[] rawdata) {
if (rawdata.length == 0) {
return new NibbleArray(4096, 4);
} else if (rawdata.length < 2048) {
FMLLog.warning("checkedGetNibbleArray: rawdata is too short: %s, expected 2048", rawdata.length);
return new NibbleArray(4096, 4);
} else
return new NibbleArray(rawdata, 4);
}
示例14: validateNibbleArray
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
private NibbleArray validateNibbleArray(NibbleArray nibbleArray)
{
// Spigot start - fix for more awesome nibble arrays
if (nibbleArray != null && nibbleArray.getByteLength() < 2048)
{
nibbleArray.resizeArray(2048);
}
// Spigot end
return nibbleArray;
}
示例15: ExtendedBlockStorage
import net.minecraft.world.chunk.NibbleArray; //导入依赖的package包/类
public ExtendedBlockStorage(int p_i1997_1_, boolean p_i1997_2_)
{
this.yBase = p_i1997_1_;
this.blockLSBArray = new byte[4096];
this.blockMetadataArray = new NibbleArray(this.blockLSBArray.length, 4);
this.blocklightArray = new NibbleArray(this.blockLSBArray.length, 4);
if (p_i1997_2_)
{
this.skylightArray = new NibbleArray(this.blockLSBArray.length, 4);
}
}