Skip to content

These docs were made completely by AI, so they might be right, or wrong, you'll need to test them yourself. This was made for a easier understanding of everything. So use at your own risk. If anything is wrong, please don't hurt to make a PR on the page you have a problem with. ON GITHUB

Blocks (Tiles)

The block system in LCE is built around the Tile base class. Internally, all blocks are called “tiles.” There are about 176 tile types registered in a static array of 4,096 slots.

Files: Minecraft.World/Tile.h, Minecraft.World/Tile.cpp

ConstantValuePurpose
TILE_NUM_COUNT4096Maximum possible tiles
TILE_NUM_MASK0xFFFBit mask for tile IDs
TILE_NUM_SHIFT12Bit shift position
INDESTRUCTIBLE_DESTROY_TIME-1.0fMarks unbreakable blocks
VariableTypePurpose
idintUnique tile identifier (0-4095)
destroySpeedfloatTime to break in ticks
explosionResistancefloatResistance to explosions
isInventoryItemboolWhether tile can be held as item
collectStatisticsboolWhether to track in statistics
_isTickingboolHas regular tick() updates
_isEntityTileboolHas associated TileEntity
m_iMaterialintCreative inventory material category
m_iBaseItemTypeintCreative inventory tab category
materialMaterial*Physical material properties
soundTypeconst SoundType*Sound effects
frictionfloatSurface friction coefficient (default 0.6)
gravityfloatGravity effect on entities
iconIcon*Block texture icon
descriptionIdunsigned intLocalization string ID for the block name
useDescriptionIdunsigned intLocalization string ID for the “use” action (4J addition)
m_textureNamewstringTexture resource name
(via ThreadStorage TLS) xx0, yy0, zz0, xx1, yy1, zz1doubleBounding box coordinates (originally direct members, moved to per-thread ThreadStorage via TLS by 4J for thread safety)

4J moved the bounding box coordinates into thread-local storage so that different threads can set block shapes without stomping on each other. Each thread calls CreateNewThreadStorage() to get its own copy, and ReleaseThreadStorage() when done.

class ThreadStorage {
double xx0, yy0, zz0, xx1, yy1, zz1;
int tileId;
};
static DWORD tlsIdxShape; // TLS slot index
static Tile **tiles; // Global tile registry
static bool solid[4096]; // Is the block solid?
static int lightBlock[4096]; // Light blocking (0-15)
static bool transculent[4096]; // Is transparent?
static int lightEmission[4096]; // Light output (0-15)
static unsigned char _sendTileData[4096]; // Data bits to network sync
static bool mipmapEnable[4096]; // Enable mipmapping?
static bool propagate[4096]; // Propagate updates?

The _sendTileData array was originally a simple bool in Java. 4J changed it to an unsigned char acting as a bitfield so it can indicate which specific data bits matter for network sync.

Pre-defined sound types that tiles can use:

Sound TypeUsage
SOUND_NORMALStone/default blocks
SOUND_WOODWooden blocks
SOUND_GRAVELGravel and dirt
SOUND_GRASSGrass blocks
SOUND_STONEStone variants
SOUND_METALMetal blocks (higher pitch)
SOUND_GLASSGlass blocks
SOUND_CLOTHWool/cloth
SOUND_SANDSand
SOUND_SNOWSnow
SOUND_LADDERLadders
SOUND_ANVILAnvils

Each SoundType contains: eMaterialSound, break/step/place sound IDs, volume, and pitch. The constructor is:

SoundType(eMATERIALSOUND_TYPE eMaterialSound, float volume, float pitch,
int iBreakSound = -1, int iPlaceSound = -1);

Every tile has a render shape that controls how it gets drawn:

ConstantValueExample
SHAPE_INVISIBLE-1Air, invisible blocks
SHAPE_BLOCK0Full cube (stone, dirt)
SHAPE_CROSS_TEXTURE1X-shape (flowers, tall grass)
SHAPE_TORCH2Torch
SHAPE_FIRE3Fire
SHAPE_WATER4Water/lava
SHAPE_RED_DUST5Redstone dust
SHAPE_ROWS6Crop rows
SHAPE_DOOR7Doors
SHAPE_LADDER8Ladder
SHAPE_RAIL9Rails
SHAPE_STAIRS10Stairs
SHAPE_FENCE11Fences
SHAPE_LEVER12Lever
SHAPE_CACTUS13Cactus
SHAPE_BED14Bed
SHAPE_DIODE15Repeater
SHAPE_PISTON_BASE16Piston base
SHAPE_PISTON_EXTENSION17Piston arm
SHAPE_IRON_FENCE18Iron bars
SHAPE_STEM19Pumpkin/melon stem
SHAPE_VINE20Vines
SHAPE_FENCE_GATE21Fence gate
SHAPE_ENTITYTILE_ANIMATED22Animated tile entities
SHAPE_LILYPAD23Lily pad
SHAPE_CAULDRON24Cauldron
SHAPE_BREWING_STAND25Brewing stand
SHAPE_PORTAL_FRAME26End portal frame
SHAPE_EGG27Dragon egg
SHAPE_COCOA28Cocoa beans
SHAPE_TRIPWIRE_SOURCE29Tripwire hook
SHAPE_TRIPWIRE30Tripwire
SHAPE_TREE31Logs (with rotation)
SHAPE_WALL32Cobblestone wall
SHAPE_FLOWER_POT33Flower pot
SHAPE_BEACON34Beacon
SHAPE_ANVIL35Anvil
SHAPE_QUARTZ39Quartz block

All tiles are set up in Tile::staticCtor():

IDInternal NameClassDestroy TimeNotes
1rockStoneTile1.5sStone, drops cobblestone
2grassGrassTile0.6sBiome-colored, spreads to dirt
3dirtDirtTile0.5sBasic soil
4stoneBrickTile2.0sCobblestone
5woodWoodTile2.0sPlanks, 4 wood type variants
6saplingSapling0.0s4 tree types, grows into trees
7unbreakableTile-1.0Bedrock, indestructible
8waterLiquidTileDynamicFlowing water
9calmWaterLiquidTileStaticStill water
10lavaLiquidTileDynamicFlowing lava, emits light
11calmLavaLiquidTileStaticStill lava, emits light
12sandHeavyTile0.5sFalls with gravity
13gravelGravelTile0.6sFalls, chance to drop flint
14goldOreOreTile3.0sGold ore
15ironOreOreTile3.0sIron ore
16coalOreOreTile3.0sCoal ore
17treeTrunkTreeTile2.0sLogs, 4 wood types, rotatable
18leavesLeafTile0.2s4 types, decay system
19spongeSponge0.6sAbsorbs water (range=2)
20glassGlassTile0.3sTransparent, no drop
21lapisOreOreTile3.0sLapis lazuli ore
22lapisBlockTile3.0sLapis block
23dispenserDispenserTile3.5sTileEntity, 6 facing dirs
24sandStoneSandStoneTile0.8s3 variants
25musicBlockMusicTile0.8sNote block, TileEntity
26bedBedTile0.2s2-block, head/foot
27goldenRailRailTile0.7sPowered rail
28detectorRailDetectorRailTile0.7sEmits signal on entity
29pistonStickyBasePistonBaseTileSticky piston
30webWebTile4.0sSlows entities
31tallgrassTallGrass0.0s3 types: shrub/grass/fern
32deadBushDeadBushTile0.0sDrops sticks
33pistonBasePistonBaseTileNormal piston
34pistonExtensionPistonExtensionTilePiston arm
35clothClothTile0.8sWool, 16 colors
36pistonMovingPiecePistonMovingPieceDynamic piston head
37flowerBush0.0sDandelion
38roseBush0.0sPoppy
39mushroom1Mushroom0.0sBrown mushroom, light=1
40mushroom2Mushroom0.0sRed mushroom
41goldBlockMetalTile3.0sGold block
42ironBlockMetalTile5.0sIron block
43stoneSlabStoneSlabTileDouble stone slab
44stoneSlabHalfStoneSlabTileStone half slab
45redBrickTile2.0sBricks
46tntTntTile0.0sExplodes on redstone
47bookshelfBookshelfTile1.5sDrops books
48mossStoneTile2.0sMossy cobblestone
49obsidianObsidianTile50.0sVery hard, extends StoneTile
50torchTorchTileLight level 14
51fireFireTileSpreads, animates
52mobSpawnerMobSpawnerTile5.0sTileEntity, spawns mobs
53stairs_woodStairTileOak wood stairs
54chestChestTile2.5sTileEntity, can double
55redStoneDustRedStoneDustTileSignal wire, power 0-15
56diamondOreOreTile3.0sDiamond ore
57diamondBlockMetalTile5.0sDiamond block
58workBenchWorkbenchTile2.5sCrafting table
59cropsCropTile0.0sWheat, 8 growth stages
60farmlandFarmTile0.6sTilled dirt
61furnaceFurnaceTile3.5sTileEntity, unlit
62furnace_litFurnaceTile3.5sTileEntity, lit, light=13
63signSignTile1.0sStanding sign, TileEntity
64door_woodDoorTile3.0sWood door, 2-block
65ladderLadderTile0.4sClimbable
66railRailTile0.7sNormal rail
67stairs_stoneStairTileStone stairs
68wallSignSignTile1.0sWall sign, TileEntity
69leverLeverTile0.5s6 orientations, redstone
70pressurePlate_stonePressurePlateTile0.5sMobs only
71door_ironDoorTile5.0sIron door, needs redstone
72pressurePlate_woodPressurePlateTile0.5sAll entities
73redStoneOreRedStoneOreTile3.0sEmits particles
74redStoneOre_litRedStoneOreTile3.0sGlowing, light=9
75notGate_offNotGateTileRedstone torch off
76notGate_onNotGateTileRedstone torch on, light=7
77buttonButtonTile0.5sStone button
78topSnowTopSnowTile0.1sSnow layer
79iceIceTile0.5sSlippery, transparent
80snowSnowTile0.2sSnow block
81cactusCactusTile0.4sDamages entities, grows
82clayClayTile0.6sDrops clay balls
83reedsReedTile0.0sSugar cane, grows to 3
84recordPlayerRecordPlayerTile2.0sJukebox, TileEntity
85fenceFenceTile2.0sOak fence
86pumpkinPumpkinTile1.0sRotatable, extends DirectionalTile
87hellRockHellStoneTile0.4sNetherrack
88hellSandHellSandTile0.5sSoul sand, slows entities
89lightGemLightGemTile0.3sGlowstone, light=15
90portalTilePortalTile-1.0Nether portal, light=11
91litPumpkinPumpkinTile1.0sJack o’Lantern, light=15
92cakeCakeTile0.5s6 eating stages
93diode_offDiodeTileRepeater off, 4 delays
94diode_onDiodeTileRepeater on, 4 delays
95aprilFoolsJokeLockedChestTileLocked chest, light emitting
96trapdoorTrapDoorTile3.0sWood trapdoor
97monsterStoneEggStoneMonsterTile0.75sSilverfish stone
98stoneBrickSmoothSmoothStoneBrickTile1.5sStone bricks
99hugeMushroom1HugeMushroomTile0.2sHuge brown mushroom
100hugeMushroom2HugeMushroomTile0.2sHuge red mushroom
101ironFenceThinFenceTile5.0sIron bars
102thinGlassThinFenceTile0.3sGlass pane
103melonMelonTile1.0sMelon block
104pumpkinStemStemTile0.0sGrows pumpkins
105melonStemStemTile0.0sGrows melons
106vineVineTile0.2s4-directional, climbable
107fenceGateFenceGateTile2.0sRotatable, extends DirectionalTile
108stairs_bricksStairTileBrick stairs
109stairs_stoneBrickSmoothStairTileStone brick stairs
110mycelMycelTile0.6sMycelium
111waterLilyWaterlilyTile0.0sLily pad, extends Bush
112netherBrickTile2.0sNether brick block
113netherFenceFenceTile2.0sNether brick fence
114stairs_netherBricksStairTileNether brick stairs
115netherStalkNetherStalkTile0.0sNether wart, 4 stages, extends Bush
116enchantTableEnchantmentTableTile5.0sTileEntity
117brewingStandBrewingStandTile0.5sTileEntity, light=1
118cauldronCauldronTile2.0sWater storage
119endPortalTileTheEndPortal-1.0End portal
120endPortalFrameTileTheEndPortalFrameTile-1.0End portal frame, light=1
121whiteStoneTile3.0sEnd stone
122dragonEggEggTile3.0sTeleports when hit, light=1
123redstoneLightRedlightTile0.3sRedstone lamp off
124redstoneLight_litRedlightTile0.3sRedstone lamp on
125woodSlabWoodSlabTileDouble wood slab
126woodSlabHalfWoodSlabTileWood half slab
127cocoaCocoaTile0.2sCocoa beans, 3 stages, extends DirectionalTile
128stairs_sandstoneStairTileSandstone stairs
129emeraldOreOreTile3.0sEmerald ore
130enderChestEnderChestTile22.5sTileEntity, light=7
131tripWireSourceTripWireSourceTileTripwire hook
132tripWireTripWireTileTripwire line
133emeraldBlockMetalTile5.0sEmerald block
134woodStairsDarkStairTileSpruce stairs
135woodStairsBirchStairTileBirch stairs
136woodStairsJungleStairTileJungle stairs
139cobbleWallWallTileStone/cobble wall
140flowerPotFlowerPotTile0.0sHolds plants
141carrotsCarrotTile0.0s8 growth stages, extends CropTile
142potatoesPotatoTile0.0s8 growth stages, extends CropTile
143button_woodButtonTile0.5sWood button
144skullSkullTile1.0sMob heads, TileEntity, max 40 per world
145anvilAnvilTile5.0s3 damage states, falls, extends HeavyTile
153netherQuartzOreTile3.0sNether quartz ore
155quartzBlockQuartzBlockTile0.8sQuartz, variants
156stairs_quartzStairTileQuartz stairs
171woolCarpetWoolCarpetTile0.1s16 colors
Tile (abstract base)
├── TransparentTile (allowSame flag, blocksLight virtual)
│ ├── LeafTile (4 types, decay system, fancy/fast toggle)
│ └── (no other direct subclasses in LCEMP)
├── HalfTransparentTile (allowSame flag, overlay texture)
│ ├── GlassTile
│ ├── IceTile
│ ├── CoralTile
│ └── PortalTile
├── HeavyTile (falling blocks, instaFall flag, checkSlide logic)
│ ├── AnvilTile (3 damage states)
│ └── GravelTile (flint drops)
├── EntityTile (has TileEntity via newTileEntity() pure virtual)
│ ├── ChestTile
│ ├── FurnaceTile
│ ├── SignTile
│ ├── MobSpawnerTile
│ ├── EnchantmentTableTile
│ ├── BrewingStandTile
│ ├── DispenserTile
│ ├── EnderChestTile
│ ├── RecordPlayerTile (jukebox)
│ ├── MusicTile (note block)
│ └── SkullTile (mob heads, max 40)
├── DirectionalTile (DIRECTION_MASK=0x3, getDirection helper)
│ ├── BedTile
│ ├── PumpkinTile (pumpkin + jack o'lantern)
│ ├── FenceGateTile
│ ├── DiodeTile (repeater)
│ └── CocoaTile
├── LiquidTile (flow physics, getFlow, getDepth, fizz)
│ ├── LiquidTileDynamic (flowing, iterative tick system)
│ └── LiquidTileStatic (still, converts to dynamic on neighbor change)
├── Bush (plants, mayPlaceOn, canSurvive, checkAlive)
│ ├── CropTile (wheat, getGrowthSpeed, growCropsToMax)
│ │ ├── CarrotTile
│ │ └── PotatoTile
│ ├── StemTile (pumpkin/melon)
│ ├── NetherStalkTile (nether wart)
│ ├── DeadBushTile
│ ├── WaterlilyTile (lily pad)
│ └── Mushroom (brown/red)
├── TorchTile (wall-mounted, checkCanSurvive)
│ └── NotGateTile (redstone torch, toggle frequency tracking)
├── FireTile (flameOdds/burnOdds arrays, spread logic)
├── RedStoneDustTile (power 0-15, signal propagation)
├── RailTile (inner Rail class for connections, usesDataBit)
│ └── DetectorRailTile
├── FenceTile (connectsTo, isFence static)
├── StairTile (delegates to base tile, UPSIDEDOWN_BIT)
├── PistonBaseTile (MAX_PUSH_DEPTH=12, sticky flag, TLS ignoreUpdate)
├── PistonExtensionTile
├── PistonMovingPiece
├── DoorTile
├── TrapDoorTile
├── PressurePlateTile
├── LeverTile
├── ButtonTile
├── CactusTile
├── VineTile
├── HalfSlabTile (TYPE_MASK=7, TOP_SLOT_BIT=8, fullSize flag)
│ ├── StoneSlabTile
│ └── WoodSlabTile
├── ThinFenceTile (iron bars, glass pane)
├── WallTile
├── OreTile (drops different item, XP on break)
├── StoneTile
│ └── ObsidianTile
├── GrassTile (MIN_BRIGHTNESS=4, biome colors, spreads to dirt)
├── DirtTile
├── MycelTile
├── FarmTile (wet/dry, isNearWater, fallOn converts back to dirt)
├── SandStoneTile (3 variants)
├── ClothTile (wool, 16 colors)
├── WoolCarpetTile (16 colors)
├── QuartzBlockTile (pillar variants)
├── TreeTile (log, 4 wood types, rotatable)
├── HugeMushroomTile
├── Sponge (RANGE=2)
├── CakeTile (6 stages)
├── CauldronTile (water level 0-3)
├── WorkbenchTile
├── BookshelfTile
├── TntTile
├── WebTile
├── ReedTile (sugar cane)
├── RedlightTile (redstone lamp)
├── RedStoneOreTile (glow on interact)
├── StoneMonsterTile (silverfish)
├── TopSnowTile
├── SnowTile
├── FlowerPotTile
├── TripWireSourceTile (hook)
├── TripWireTile (wire)
├── EggTile (dragon egg)
├── LockedChestTile (april fools)
├── TheEndPortal
├── TheEndPortalFrameTile
├── MelonTile
├── MetalTile (gold/iron/diamond/emerald blocks)
├── LightGemTile (glowstone)
├── HellStoneTile (netherrack)
├── HellSandTile (soul sand)
├── LadderTile
├── ClayTile
└── AirTile

Materials define physical properties that multiple tiles share:

class Material {
MaterialColor *color;
bool _flammable;
bool _replaceable;
bool _neverBuildable;
bool _isAlwaysDestroyable;
int pushReaction; // 0=push, 1=destroy, 2=block
bool destroyedByHand;
};
MethodReturnsPurpose
isLiquid()boolIs this a liquid material?
letsWaterThrough()boolCan water flow through?
isSolid()boolIs physically solid?
blocksLight()boolBlocks light propagation?
blocksMotion()boolBlocks entity movement?
isFlammable()boolCan burn?
isReplaceable()boolCan be overwritten by placement?
isSolidBlocking()boolBlocks solid rendering?
isAlwaysDestroyable()boolBreakable by any tool?
getPushReaction()intPiston behavior (0/1/2)
isDestroyedByHand()boolDrops when broken by hand?
static const int PUSH_NORMAL = 0; // Can be pushed
static const int PUSH_DESTROY = 1; // Destroyed when pushed
static const int PUSH_BLOCK = 2; // Cannot be pushed at all
MaterialSolidLiquidFlammableReplaceablePush Reaction
airNoNoNoYes
stoneYesNoNoNoPush
dirtYesNoNoNoPush
grassYesNoNoNoPush
woodYesNoYesNoPush
metalYesNoNoNoPush
heavyMetalYesNoNoNoBlock
waterNoYesNoYes
lavaNoYesNoYes
leavesYesNoYesNoDestroy
plantNoNoNoNoDestroy
replaceable_plantNoNoNoYesDestroy
spongeYesNoNoNoPush
clothYesNoYesNoPush
fireNoNoNoYesDestroy
sandYesNoNoNoPush
glassYesNoNoNoPush
buildable_glassYesNoNoNoPush
explosiveYesNoYesNoPush
iceYesNoNoNoPush
snowYesNoNoNoPush
topSnowNoNoNoYesDestroy
cactusYesNoNoNoDestroy
clayYesNoNoNoPush
portalNoNoNoNoBlock
cakeYesNoNoNoDestroy
decorationNoNoNoNoDestroy
clothDecorationNoNoYesNoPush
coralYesNoNoNoDestroy
vegetableYesNoNoNoDestroy
eggYesNoNoNoDestroy
webYesNoNoNoDestroy
pistonYesNoNoNoBlock

Here is every virtual method on the Tile base class, grouped by what they do.

// Called after construction to finalize the tile's setup
virtual void init();
// Builder-pattern setters (return Tile* for chaining)
virtual Tile *setSoundType(const SoundType *soundType);
virtual Tile *setLightBlock(int i);
virtual Tile *setLightEmission(float f);
virtual Tile *setExplodeable(float explosionResistance);
virtual Tile *setDestroyTime(float destroySpeed);
virtual Tile *setIndestructible();
virtual Tile *setTicking(bool tick);
virtual Tile *disableMipmap();
virtual Tile *setNotCollectStatistics();
virtual Tile *sendTileData(unsigned char importantMask = 15);
virtual Tile *setDescriptionId(unsigned int id);
virtual Tile *setUseDescriptionId(unsigned int id); // 4J addition
virtual Icon *getTexture(int face, int data); // Texture per face and metadata
virtual Icon *getTexture(int face); // Texture per face only
virtual Icon *getTexture(LevelSource *level, int x, int y, int z, int face); // World-aware texture
virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); // Skip hidden faces
virtual bool isSolidFace(LevelSource *level, int x, int y, int z, int face); // Is this face solid?
virtual bool isSolidRender(bool isServerLevel = false); // Needs solid rendering?
virtual bool isCubeShaped(); // Is a full cube?
virtual int getRenderLayer(); // 0=solid, 1=cutout, 2=transparent
virtual int getRenderShape(); // Which shape to draw
virtual int getColor() const; // Base tint color
virtual int getColor(int auxData); // Color per metadata
virtual int getColor(LevelSource *level, int x, int y, int z); // Position-based color (biomes)
virtual int getColor(LevelSource *level, int x, int y, int z, int data); // 4J addition: color with data
virtual float getBrightness(LevelSource *level, int x, int y, int z); // Brightness override
virtual int getLightColor(LevelSource *level, int x, int y, int z, int tileId = -1); // Light color (4J)
virtual float getShadeBrightness(LevelSource *level, int x, int y, int z); // Shadow brightness (4J)
virtual void prepareRender(Level *level, int x, int y, int z); // Pre-render setup
virtual void animateTick(Level *level, int x, int y, int z, Random *random); // Client-side particles
virtual void registerIcons(IconRegister *iconRegister); // Register texture icons
virtual wstring getTileItemIconName(); // Item icon name
virtual void setShape(float x0, float y0, float z0, float x1, float y1, float z1); // Set bounding box
virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1,
shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>());
virtual void updateDefaultShape(); // Reset to default shape
virtual double getShapeX0(); // Read bounding box from TLS
virtual double getShapeX1();
virtual double getShapeY0();
virtual double getShapeY1();
virtual double getShapeZ0();
virtual double getShapeZ1();
virtual AABB *getTileAABB(Level *level, int x, int y, int z); // Selection box
virtual AABB *getAABB(Level *level, int x, int y, int z); // Collision box
virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes,
shared_ptr<Entity> source); // Multiple collision boxes
virtual HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); // Raytrace
virtual bool isPathfindable(LevelSource *level, int x, int y, int z); // Can mobs walk through?
virtual float getDestroySpeed(Level *level, int x, int y, int z);
virtual float getDestroyProgress(shared_ptr<Player> player, Level *level, int x, int y, int z);
virtual int getResource(int data, Random *random, int playerBonusLevel); // Item ID to drop
virtual int getResourceCount(Random *random); // How many
virtual int getResourceCountForLootBonus(int bonusLevel, Random *random); // Fortune bonus
virtual int getSpawnResourcesAuxValue(int data); // Aux value for dropped item
virtual void spawnResources(Level *level, int x, int y, int z, int data, int playerBonusLevel);
virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel);
virtual void destroy(Level *level, int x, int y, int z, int data); // Block broken
virtual void playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data);
virtual void playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr<Player> player);
virtual bool isSilkTouchable(); // Silk Touch works?
virtual shared_ptr<ItemInstance> getSilkTouchItemInstance(int data); // Silk Touch drop
virtual int cloneTileId(Level *level, int x, int y, int z); // Pick block ID
virtual int cloneTileData(Level *level, int x, int y, int z); // Pick block data
virtual void tick(Level *level, int x, int y, int z, Random *random); // Regular updates
virtual void neighborChanged(Level *level, int x, int y, int z, int type); // Adjacent block changed
virtual void addLights(Level *level, int x, int y, int z); // Light update
virtual int getTickDelay(); // Tick frequency
virtual bool shouldTileTick(Level *level, int x, int y, int z); // 4J: skip tick if nothing to do
virtual void levelTimeChanged(Level *level, __int64 delta, __int64 newTime); // 4J: time-based updates
virtual void handleRain(Level *level, int x, int y, int z); // Rain interaction
virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player,
int clickedFace, float clickX, float clickY, float clickZ,
bool soundOnly = false); // Right-click
virtual bool TestUse(); // Can use at all?
virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player); // Can use here?
virtual void attack(Level *level, int x, int y, int z, shared_ptr<Player> player); // Left-click
virtual void stepOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity); // Walked on
virtual void fallOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity, float dist); // Fell on
virtual void entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity); // Inside block
virtual bool mayPlace(Level *level, int x, int y, int z, int face); // Can place on face?
virtual bool mayPlace(Level *level, int x, int y, int z); // Can place here?
virtual bool mayPick(int data, bool liquid); // Can target for picking?
virtual bool mayPick(); // Can target at all?
virtual bool canSurvive(Level *level, int x, int y, int z); // Can exist here?
virtual void onPlace(Level *level, int x, int y, int z); // Just placed
virtual void onRemove(Level *level, int x, int y, int z, int id, int data); // Being removed
virtual void onRemoving(Level *level, int x, int y, int z, int data); // About to remove
virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face,
float clickX, float clickY, float clickZ, int itemValue);
virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr<Mob> by); // Who placed it
virtual void finalizePlacement(Level *level, int x, int y, int z, int data); // Post-placement setup
virtual bool isSignalSource(); // Emits redstone?
virtual bool getSignal(LevelSource *level, int x, int y, int z); // Has any signal?
virtual bool getSignal(LevelSource *level, int x, int y, int z, int dir); // Signal per direction
virtual bool getDirectSignal(Level *level, int x, int y, int z, int dir); // Direct power
virtual float getExplosionResistance(shared_ptr<Entity> source);
virtual void wasExploded(Level *level, int x, int y, int z);
virtual int getPistonPushReaction(); // 0=push, 1=destroy, 2=block
virtual void handleEntityInside(Level *level, int x, int y, int z,
shared_ptr<Entity> e, Vec3 *velocity);
virtual wstring getName(); // Display name
virtual unsigned int getDescriptionId(int iData = -1); // Localization ID
virtual unsigned int getUseDescriptionId(); // 4J: "use" localization ID
virtual void triggerEvent(Level *level, int x, int y, int z, int b0, int b1); // Block events
virtual bool isCollectStatistics(); // Track in stats?
virtual bool isTicking(); // Has tick updates?
virtual bool isEntityTile(); // Has TileEntity?
// Helper (not virtual):
int getFaceFlags(LevelSource *level, int x, int y, int z); // AP: fast face culling
static bool isSolidBlockingTile(int t);
static bool isFaceVisible(Level *level, int x, int y, int z, int f);

FireTile keeps two arrays indexed by tile ID:

ArrayPurpose
flameOdds[]How easily each block catches fire
burnOdds[]How fast each block burns away

Flame and burn constants:

ConstantValueMeaning
FLAME_INSTANT60Catches fire very easily
FLAME_EASY30Catches fire easily
FLAME_MEDIUM15Moderate flammability
FLAME_HARD5Hard to catch fire
BURN_INSTANT100Burns away instantly
BURN_EASY60Burns away quickly
BURN_MEDIUM20Burns at moderate speed
BURN_HARD5Burns slowly
BURN_NEVER0Never burns away

Key methods: setFlammable(id, flame, burn), isFlammable(tile), getFlammability(level, x, y, z, odds), canBurn(level, x, y, z), checkBurnOut(level, x, y, z, chance, random, age), and isValidFireLocation(level, x, y, z).

LeafTile uses bit flags in the metadata:

  • Bit 3 (UPDATE_LEAF_BIT = 8): Needs a decay check
  • Bit 2 (PERSISTENT_LEAF_BIT = 4): Player-placed, won’t decay
  • Bits 0-1 (LEAF_TYPE_MASK = 3): Leaf type (0=oak, 1=evergreen, 2=birch, 3=jungle)

Leaves decay if they’re more than 4 blocks (REQUIRED_WOOD_RANGE) away from any log block. The decay check uses a flood-fill buffer (checkBuffer) to search for nearby logs.

4J added a shouldTileTick() override so the game can skip adding leaves to the tick list when no decay check is actually needed.

CropTile growth speed depends on:

  • Light level (must be >= MAX_BRIGHTNESS - 6)
  • Adjacent farmland blocks
  • Water hydration of farmland
  • Random tick probability

The getGrowthSpeed() private method calculates the growth rate based on these factors. growCropsToMax() instantly sets the crop to full growth (used by bone meal).

CropTile also has getBaseSeedId() and getBasePlantId() virtual methods that subclasses like CarrotTile and PotatoTile override to return their specific seed and plant item IDs.

FarmTile has special behaviors:

  • Wet/dry state: stored in metadata, controlled by isNearWater() which checks for water within 4 blocks horizontally
  • Crop check: isUnderCrops() detects if a crop is growing on top
  • Entity damage: fallOn() reverts farmland to dirt when entities land on it
  • Dehydration: tick() gradually dries out farmland that isn’t near water and doesn’t have crops

LiquidTile (water/lava) handles flow physics. The base class provides:

virtual Vec3 *getFlow(LevelSource *level, int x, int y, int z); // Flow direction
virtual int getDepth(Level *level, int x, int y, int z); // Flow level
virtual int getRenderedDepth(LevelSource *level, int x, int y, int z);
virtual void fizz(Level *level, int x, int y, int z); // Lava + water = obsidian

LiquidTileDynamic (flowing) adds:

  • trySpreadTo(): Attempts to spread to a neighbor
  • getSlopeDistance(): Pathfinds to find the nearest drop for water flow direction
  • getSpread(): Determines which of 4 horizontal directions to flow
  • isWaterBlocking(): Checks if a block stops water
  • canSpreadTo(): Whether flow can enter a position
  • setStatic(): Converts to LiquidTileStatic when flow stops
  • 4J iterative tick: iterativeTick() uses a deque (m_tilesToTick) to process liquid spread iteratively instead of recursively, avoiding stack overflows

LiquidTileStatic (still) converts back to LiquidTileDynamic via setDynamic() when a neighbor changes. It also checks isFlammable() on neighbors to potentially start fires near still lava.

PistonBaseTile can push up to 12 blocks (MAX_PUSH_DEPTH) in a line:

bool createPush(Level *level, int sx, int sy, int sz, int facing);
static bool canPush(Level *level, int sx, int sy, int sz, int facing);
static bool isPushable(int block, Level *level, int cx, int cy, int cz, bool allowDestroyable);

Key constants and flags:

  • EXTENDED_BIT = 8: Metadata flag for extended state
  • UNDEFINED_FACING = 7: No direction set yet
  • TRIGGER_EXTEND = 0 / TRIGGER_CONTRACT = 1: Event parameters
  • PLATFORM_THICKNESS: The thickness of the piston platform

It can’t push obsidian, bedrock, or tile entities (chests, furnaces, etc.). The isSticky flag controls whether the piston pulls blocks back. 4J added TLS for the ignoreUpdate flag to make piston updates thread-safe.

The facing direction is determined by getNewFacing() which checks the player’s look direction when placing.

Max tripwire length is 42 blocks (WIRE_DIST_MAX = 2 + 40, which is 2 hooks plus 40 wire blocks). TripWireSourceTile scans for the paired hook and activates when an entity crosses the wire.

Data bits:

  • MASK_DIR = 0x3: Direction (2 bits)
  • MASK_ATTACHED = 0x4: Is attached to matching hook
  • MASK_POWERED = 0x8: Is powered/triggered

Key methods: calculateState() does the main wire scanning and state update, notifyNeighbors() sends updates along the wire axis, and checkCanSurvive() verifies the hook has a solid wall behind it.

RedStoneDustTile stores the power level (0-15) in the data value. Power drops by 1 for each block it travels. Signal propagation uses:

void updatePowerStrength(Level *level, int x, int y, int z);
void updatePowerStrength(Level *level, int x, int y, int z, int xFrom, int yFrom, int zFrom);
int checkTarget(Level *level, int x, int y, int z, int target);
void checkCornerChangeAt(Level *level, int x, int y, int z);

The shouldSignal flag prevents infinite loops during signal propagation. The toUpdate set (using TilePos with custom hash) tracks positions that need neighbor notifications after a power change.

Static helpers shouldConnectTo() and shouldReceivePowerFrom() check if a neighboring block at a given direction should have a wire connection or receive power.

NotGateTile extends TorchTile and tracks recent toggles to prevent burnout oscillation:

  • RECENT_TOGGLE_TIMER = 60 ticks (3 seconds)
  • MAX_RECENT_TOGGLES = 8

A static map recentToggles (keyed by Level*) stores a deque of Toggle records with position and timestamp. If a torch toggles more than 8 times in 60 ticks, it stops responding. 4J added removeLevelReferences() to clean up when a level is destroyed.

RailTile has an inner Rail class that manages track connections:

  • connections: vector of connected rail positions
  • updateConnections(): figures out rail direction from neighbors
  • connectsTo() / canConnectTo(): checks if two rails can link
  • countPotentialConnections(): counts nearby rails
  • place(): finalizes the rail’s direction and powered state

Constants:

  • DIR_FLAT_Z = 0, DIR_FLAT_X = 1: Flat rail directions
  • RAIL_DATA_BIT = 8: Used by powered/detector rails
  • RAIL_DIRECTION_MASK = 7: Direction bits

DetectorRailTile extends RailTile and emits a redstone signal when a minecart rolls over it.

StairTile is interesting because it delegates most of its behavior to a base tile. When you create stairs from cobblestone, the stair tile wraps the cobblestone tile and forwards calls like getTexture(), getExplosionResistance(), and tick() to it.

Constants:

  • UPSIDEDOWN_BIT = 4: Metadata flag for upside-down stairs
  • DIR_EAST = 0, DIR_WEST = 1, DIR_SOUTH = 2, DIR_NORTH = 3

The stair shape is built from multiple AABBs using setBaseShape(), setStepShape(), and setInnerPieceShape(). Dead space columns (DEAD_SPACES[8][2]) define which parts of the cube to remove.

HalfSlabTile manages both single and double slabs:

  • TYPE_MASK = 7: Lower 3 bits store slab type
  • TOP_SLOT_BIT = 8: Whether placed on top half
  • fullSize: Whether this is the double-slab variant

getPlacedOnFaceDataValue() determines whether to place on top or bottom based on where the player clicked. StoneSlabTile and WoodSlabTile extend it with type-specific textures and names.

SkullTile has a hard limit: MAX_SKULL_TILES = 40 per world. Data bits:

  • PLACEMENT_MASK = 0x7: Placement direction
  • NO_DROP_BIT = 0x8: Suppress drops (used when wither spawns)

The checkMobSpawn() method checks if placing a wither skull completes a wither pattern and spawns the Wither boss.

TileEntity is the base class for blocks that need persistent data beyond the 4-bit metadata. It’s stored separately from the block grid and can hold complex state.

class TileEntity : public enable_shared_from_this<TileEntity> {
Level *level;
int x, y, z;
int data;
Tile *tile;
bool remove;
unsigned char renderRemoveStage; // 4J added
virtual void load(CompoundTag *tag);
virtual void save(CompoundTag *tag);
virtual void tick();
virtual shared_ptr<Packet> getUpdatePacket();
virtual void triggerEvent(int b0, int b1);
virtual void clearCache();
virtual shared_ptr<TileEntity> clone() = 0; // 4J addition
};

4J added the clone() pure virtual method so tile entities can be deep-copied (needed for their chunk caching system). They also added RenderRemoveStage for managing tile entity removal during rendering.

The EntityTile base class connects tiles to tile entities:

class EntityTile : public Tile {
virtual void onPlace(Level *level, int x, int y, int z); // Creates the TileEntity
virtual void onRemove(Level *level, int x, int y, int z, ...); // Removes it
virtual shared_ptr<TileEntity> newTileEntity(Level *level) = 0; // Factory method
virtual void triggerEvent(Level *level, int x, int y, int z, int b0, int b1);
};
TileEntity ClassUsed ByStores
ChestTileEntityChest, Ender ChestInventory items (implements Container)
FurnaceTileEntityFurnaceSmelting items, fuel, cook time (implements Container)
DispenserTileEntityDispenserInventory items (implements Container)
BrewingStandTileEntityBrewing StandPotions, ingredient, brew time (implements Container)
MobSpawnerTileEntityMob SpawnerMob type, spawn delay, range
SignTileEntitySign (standing + wall)4 lines of text
MusicTileEntityNote BlockNote pitch
SkullTileEntitySkull/HeadSkull type, rotation
EnderChestTileEntityEnder ChestShared inventory
TheEndPortalTileEntityEnd Portal(minimal state)
RecordPlayerTile::EntityJukeboxRecord item ID

When tiles become items in inventory, they use TileItem:

class TileItem : public Item {
int tileId;
virtual bool useOn(...); // Place tile in world
};

Specialized TileItem variants:

ClassUsed For
ClothTileItemWool (16 colors)
TreeTileItemLogs (4 wood types)
MultiTextureTileItemSandstone, quartz variants
StoneSlabTileItemSlabs that combine
SaplingTileItem4 sapling types
LeafTileItem4 leaf types
PistonTileItemSticky vs normal
ColoredTileItemTall grass variants, lily pads
AuxDataTileItemGeneric metadata-based variants
SmoothStoneBrickTileItemStone brick variants
StoneMonsterTileItemSilverfish stone variants
AnvilTileItemAnvil damage states (extends MultiTextureTileItem)
WaterLilyTileItemLily pad placement (extends ColoredTileItem)

Most tiles store 4 bits of metadata (0-15). Here are the common uses:

UsageExample Tiles
Rotation (0-3)Stairs, repeaters, logs, pistons
Growth stage (0-7)Wheat, carrots, potatoes
Color (0-15)Wool, carpet
Open/closed flagDoors, trapdoors, fence gates
Powered flagRepeaters, lamps, rails
Facing directionDispensers, furnaces, chests
Damage stateAnvils (0-2)
Water levelCauldrons (0-3)
Leaf type + flagsLeaves (bits 0-1=type, bit 2=persistent, bit 3=update)
Slab positionHalf slabs (bits 0-2=type, bit 3=top)
Power level (0-15)Redstone dust
Wire stateTripwire (bits 0-1=dir, bit 2=attached, bit 3=powered)

MC fills in many of the unassigned tile IDs that are empty in LCEMP. Here’s what gets added:

IDNameClassNotes
95stained_glassStainedGlassBlockReplaces the locked chest (April Fools joke). 16 colors.
137command_blockCommandBlockIndestructible, 6M explosion resistance
138beaconBeaconTileFull light emission, tile entity
146trapped_chestTrapped chest (emits redstone)
147weightedPlate_lightWeightedPressurePlateTileGold pressure plate, analog signal
148weightedPlate_heavyWeightedPressurePlateTileIron pressure plate, analog signal
149comparator_offComparatorTileRedstone comparator (off state)
150comparator_onComparatorTileRedstone comparator (on state), light=10
151daylightDetectorDaylightDetectorTileOutputs signal based on sunlight
152redstoneBlockBlock of redstone
154hopperHopperTileItem transport, tile entity
155quartzBlockQuartzBlockTileAlready in LCEMP at this ID
157activatorRailPoweredRailTileActivator rail
158dropperDropperTileLike a dispenser but just drops items
159stained_clayColoredTileStained hardened clay, 16 colors
160stained_glass_paneStainedGlassPaneBlockStained glass pane, 16 colors
170hayBlockHayBlockTileHay bale, rotatable pillar
172hardened_clayTilePlain hardened clay block

MC also adds a ColoredTile base class that handles blocks with 16 color variants (wool, stained clay, stained glass). In LCEMP, wool uses ClothTile instead.

The BasePressurePlateTile and BaseRailTile classes are new in MC, providing shared base functionality that LCEMP handles directly in PressurePlateTile and RailTile.

The BaseEntityTile class is another MC addition that provides a shared base for tile entity blocks. LCEMP uses EntityTile in its hierarchy instead.

MC also adds RepeaterTile and ComparatorTile as separate source files. In LCEMP, the repeater logic lives entirely in DiodeTile.