Java 类net.minecraft.world.chunk.NibbleArray 实例源码

项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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);
    }
}
项目:burlapcraft    文件:HelperActions.java   
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;
}
项目:Cauldron    文件:ExtendedBlockStorage.java   
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();
}
项目:Cauldron    文件:ExtendedBlockStorage.java   
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
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new char[4096];
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new char[4096];
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:BaseClient    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new char[4096];
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:BaseClient    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new char[4096];
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:Backmemed    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new BlockStateContainer();
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:CustomWorldGen    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int y, boolean storeSkylight)
{
    this.yBase = y;
    this.data = new BlockStateContainer();
    this.blocklightArray = new NibbleArray();

    if (storeSkylight)
    {
        this.skylightArray = new NibbleArray();
    }
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:FastAsyncWorldedit    文件:SpongeQueue_1_11.java   
@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;
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:FastAsyncWorldedit    文件:SpongeQueue_1_12.java   
@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;
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:FastAsyncWorldedit    文件:ForgeQueue_All.java   
@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;
}
项目:Jiffy    文件:AnvilChunkLoader.java   
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;
}
项目:Resilience-Client-Source    文件:ExtendedBlockStorage.java   
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);
    }
}
项目:PixelUtilities    文件:PacketHandler.java   
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);
    }

}
项目:PixelUtilities    文件:ChunkStorageRGB.java   
/**
 * 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);
}
项目:Cauldron    文件:ExtendedBlockStorage.java   
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);
    }
}
项目:Cauldron    文件:ExtendedBlockStorage.java   
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;
}
项目:Cauldron    文件:ExtendedBlockStorage.java   
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);
    }
}
项目:RuneCraftery    文件:ExtendedBlockStorage.java   
public ExtendedBlockStorage(int p_i1997_1_, boolean p_i1997_2_) {
   this.field_76684_a = p_i1997_1_;
   this.field_76680_d = new byte[4096];
   this.field_76678_f = new NibbleArray(this.field_76680_d.length, 4);
   this.field_76679_g = new NibbleArray(this.field_76680_d.length, 4);
   if(p_i1997_2_) {
      this.field_76685_h = new NibbleArray(this.field_76680_d.length, 4);
   }

}
项目:RuneCraftery    文件:ExtendedBlockStorage.java   
public void func_76655_a(int p_76655_1_, int p_76655_2_, int p_76655_3_, int p_76655_4_) {
   int var5 = this.field_76680_d[p_76655_2_ << 8 | p_76655_3_ << 4 | p_76655_1_] & 255;
   if(this.field_76681_e != null) {
      var5 |= this.field_76681_e.func_76582_a(p_76655_1_, p_76655_2_, p_76655_3_) << 8;
   }

   if(var5 == 0 && p_76655_4_ != 0) {
      ++this.field_76682_b;
      if(Block.field_71973_m[p_76655_4_] != null && Block.field_71973_m[p_76655_4_].func_71881_r()) {
         ++this.field_76683_c;
      }
   } else if(var5 != 0 && p_76655_4_ == 0) {
      --this.field_76682_b;
      if(Block.field_71973_m[var5] != null && Block.field_71973_m[var5].func_71881_r()) {
         --this.field_76683_c;
      }
   } else if(Block.field_71973_m[var5] != null && Block.field_71973_m[var5].func_71881_r() && (Block.field_71973_m[p_76655_4_] == null || !Block.field_71973_m[p_76655_4_].func_71881_r())) {
      --this.field_76683_c;
   } else if((Block.field_71973_m[var5] == null || !Block.field_71973_m[var5].func_71881_r()) && Block.field_71973_m[p_76655_4_] != null && Block.field_71973_m[p_76655_4_].func_71881_r()) {
      ++this.field_76683_c;
   }

   this.field_76680_d[p_76655_2_ << 8 | p_76655_3_ << 4 | p_76655_1_] = (byte)(p_76655_4_ & 255);
   if(p_76655_4_ > 255) {
      if(this.field_76681_e == null) {
         this.field_76681_e = new NibbleArray(this.field_76680_d.length, 4);
      }

      this.field_76681_e.func_76581_a(p_76655_1_, p_76655_2_, p_76655_3_, (p_76655_4_ & 3840) >> 8);
   } else if(this.field_76681_e != null) {
      this.field_76681_e.func_76581_a(p_76655_1_, p_76655_2_, p_76655_3_, 0);
   }

}
项目:RuneCraftery    文件:ExtendedBlockStorage.java   
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);
    }
}
项目:RuneCraftery    文件:ExtendedBlockStorage.java   
@SideOnly(Side.CLIENT)

    /**
     * Called by a Chunk to initialize the MSB array if getBlockMSBArray returns null. Returns the newly-created
     * NibbleArray instance.
     */
    public NibbleArray createBlockMSBArray()
    {
        this.blockMSBArray = new NibbleArray(this.blockLSBArray.length, 4);
        return this.blockMSBArray;
    }
项目:BetterNutritionMod    文件:ExtendedBlockStorage.java   
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);
    }
}
项目:BetterNutritionMod    文件:ExtendedBlockStorage.java   
@SideOnly(Side.CLIENT)

    /**
     * Called by a Chunk to initialize the MSB array if getBlockMSBArray returns null. Returns the newly-created
     * NibbleArray instance.
     */
    public NibbleArray createBlockMSBArray()
    {
        this.blockMSBArray = new NibbleArray(this.blockLSBArray.length, 4);
        return this.blockMSBArray;
    }
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Returns the NibbleArray instance containing Block-light data.
 */
public NibbleArray getBlocklightArray()
{
    return this.blocklightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Returns the NibbleArray instance containing Sky-light data.
 */
public NibbleArray getSkylightArray()
{
    return this.skylightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Sets the NibbleArray instance used for Block-light values in this particular storage block.
 */
public void setBlocklightArray(NibbleArray newBlocklightArray)
{
    this.blocklightArray = newBlocklightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Sets the NibbleArray instance used for Sky-light values in this particular storage block.
 */
public void setSkylightArray(NibbleArray newSkylightArray)
{
    this.skylightArray = newSkylightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Returns the NibbleArray instance containing Block-light data.
 */
public NibbleArray getBlocklightArray()
{
    return this.blocklightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Returns the NibbleArray instance containing Sky-light data.
 */
public NibbleArray getSkylightArray()
{
    return this.skylightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Sets the NibbleArray instance used for Block-light values in this particular storage block.
 */
public void setBlocklightArray(NibbleArray newBlocklightArray)
{
    this.blocklightArray = newBlocklightArray;
}
项目:DecompiledMinecraft    文件:ExtendedBlockStorage.java   
/**
 * Sets the NibbleArray instance used for Sky-light values in this particular storage block.
 */
public void setSkylightArray(NibbleArray newSkylightArray)
{
    this.skylightArray = newSkylightArray;
}
项目:BaseClient    文件:ExtendedBlockStorage.java   
/**
 * Returns the NibbleArray instance containing Block-light data.
 */
public NibbleArray getBlocklightArray()
{
    return this.blocklightArray;
}