Beispiel #1
0
        byte HandleCpeDefineBlockCommonStart()
        {
            byte      block = reader.ReadUInt8();
            BlockInfo info  = game.BlockInfo;

            info.ResetBlockInfo(block);

            info.Name[block]        = reader.ReadAsciiString();
            info.CollideType[block] = (BlockCollideType)reader.ReadUInt8();
            if (info.CollideType[block] != BlockCollideType.Solid)
            {
                info.IsTransparent[block] = true;
                info.IsOpaque[block]      = false;
            }

            info.SpeedMultiplier[block] = (float)Math.Pow(2, (reader.ReadUInt8() - 128) / 64f);
            info.SetTop(reader.ReadUInt8(), (Block)block);
            info.SetSide(reader.ReadUInt8(), (Block)block);
            info.SetBottom(reader.ReadUInt8(), (Block)block);
            info.BlocksLight[block] = reader.ReadUInt8() == 0;
            byte sound = reader.ReadUInt8();

            if (sound < breakSnds.Length)
            {
                info.StepSounds[block] = stepSnds[sound];
                info.DigSounds[block]  = breakSnds[sound];
            }
            info.FullBright[block] = reader.ReadUInt8() != 0;
            return(block);
        }