void HandleCpeDefineBlock() { byte block = HandleCpeDefineBlockCommonStart(); BlockInfo info = game.BlockInfo; byte shape = reader.ReadUInt8(); if (shape == 0) { info.IsSprite[block] = true; info.IsOpaque[block] = false; info.IsTransparent[block] = true; } else if (shape <= 16) { info.MaxBB[block].Y = shape / 16f; } HandleCpeDefineBlockCommonEnd(block); // Update sprite BoundingBox if necessary if (info.IsSprite[block]) { using (FastBitmap fastBmp = new FastBitmap(game.TerrainAtlas.AtlasBitmap, true)) { info.RecalculateBB(block, fastBmp); } } }
void HandleCpeDefineBlock() { if (!game.AllowCustomBlocks) { SkipPacketData(PacketId.CpeDefineBlock); return; } byte id = HandleCpeDefineBlockCommonStart(false); BlockInfo info = game.BlockInfo; byte shape = reader.ReadUInt8(); if (shape == 0) { info.IsSprite[id] = true; info.IsOpaque[id] = false; info.IsTransparent[id] = true; } else if (shape <= 16) { info.MaxBB[id].Y = shape / 16f; } HandleCpeDefineBlockCommonEnd(id); // Update sprite BoundingBox if necessary if (info.IsSprite[id]) { using (FastBitmap dst = new FastBitmap(game.TerrainAtlas.AtlasBitmap, true, true)) info.RecalculateBB(id, dst); } info.DefinedCustomBlocks[id >> 5] |= (1u << (id & 0x1F)); }