Skip to main content
Lumps are the fundamental data containers in BSP files, organizing different types of map data into discrete sections.

Lump

Default lump type for lumps inside a BSP file.

Constructor

Lump(int index, LumpType type)
Lump(LumpType type)
Creates a new lump with the specified index and type. The second constructor uses the type’s default index. Parameters:
  • index - Position in the lump table
  • type - The lump type enum value

Methods

LumpType

Enumeration of all lump types used in BSP files across different versions.

Common Lump Types

Static Methods

get (by name)

static LumpType get(String name, int bspVersion)
static LumpType get(String name)
Returns the lump type for a given name in a specific BSP version. The version-less variant defaults to BSP v19. Parameters:
  • name - Lump name (e.g., “LUMP_ENTITIES”)
  • bspVersion - BSP version to consider for version-specific lumps
Returns:
  • The matching LumpType, or LUMP_UNKNOWN if not found

get (by index)

static LumpType get(int index, int bspVersion)
static LumpType get(int index)
Returns the lump type for a given index in a specific BSP version. Parameters:
  • index - Lump table index (0-63)
  • bspVersion - BSP version to consider
Returns:
  • The matching LumpType, or LUMP_UNKNOWN if not found

Instance Methods

getIndex

int getIndex()
Returns the position of this lump type in the lump table.

getBspVersion

int getBspVersion()
Returns the first BSP version where this lump type was introduced, or -1 if unknown.

Example Usage

// Get lump type by index
LumpType type = LumpType.get(0); // LUMP_ENTITIES

// Get lump type by name for specific version
LumpType hdrType = LumpType.get("LUMP_LIGHTING_HDR", 20);

// Check version
if (type.getBspVersion() <= bspFile.getVersion()) {
    // This lump type is supported
}

GameLump

Special lump type for game-specific lumps stored inside LUMP_GAME_LUMP.

Methods

getName

String getName()
Returns the name decoded from the FourCC identifier (e.g., “sprp” for static props).

getFlags

int getFlags()
Returns the game lump flags.

setFlags

void setFlags(int flags)
Sets the game lump flags.

setCompressed

void setCompressed(boolean compressed)
Marks the game lump as compressed and sets flags to 1 if compressed, 0 otherwise.

Common Game Lumps

FourCCNameDescription
sprpStatic PropsStatic prop placement
prpsProp NamesStatic prop model names
prplProp LeavesStatic prop leaf associations

LumpFile

Utility for loading and saving individual lumps from .lmp files.

Constructor

LumpFile(BspFile bsp)
LumpFile(int bspVersion)
Parameters:
  • bsp - Parent BSP file
  • bspVersion - BSP version for standalone usage

Methods

load

void load(Path file, ByteOrder bo) throws IOException
void load(Path file) throws IOException
Loads a lump from an external .lmp file. The version-less variant uses little-endian byte order. Parameters:
  • file - Path to the .lmp file
  • bo - Byte order for reading

save

void save(Path file) throws IOException
Saves the lump to an external .lmp file. Parameters:
  • file - Path to save the .lmp file

getLump / setLump

Lump getLump()
void setLump(Lump lump)
Gets or sets the lump object.

LMP File Format

The LMP file header (20 bytes):
static final int HEADER_SIZE = 20;
OffsetTypeFieldDescription
0intlumpOffsetOffset to lump data (usually 20)
4intlumpIndexLump table index
8intlumpVersionLump version
12intlumpSizeSize of lump data
16intmapRevisionMap revision number

Example Usage

// Load an external lump file
LumpFile lumpFile = new LumpFile(20); // BSP version 20
lumpFile.load(Paths.get("maps/mymap_l_0.lmp"));

Lump entitiesLump = lumpFile.getLump();
System.out.println("Loaded lump: " + entitiesLump.getName());
System.out.println("Size: " + entitiesLump.getLength() + " bytes");

Entities

Entity classes and key-value handling

Structs

BSP file structures and data types

Build docs developers (and LLMs) love