Skip to content
/ mc4ktex Public

View & save the textures from the JavaScript version of Minecraft 4k

License

Notifications You must be signed in to change notification settings

lnrw/mc4ktex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mc4ktex

In 2012, Notch developed a JavaScript version of Minecraft 4k. This version generates textures slightly differently to the original Java version, so this project aims to provide a means to view & save these textures.

The comments for the texture generation algorithm were taken from this version of Minecraft 4k.

The main difference is the Java version uses a set seed to always generate the same textures, but the PRNG in JavaScript cannot be seeded so the textures are randomly generated.

Why are there three transparent textures at the top of the page?

The algorithm doesn't assign a value to the first 768 elements (3 16px × 16px textures) of the texmap array so when they are accessed, their value is undefined. The rendering code in Minecraft 4k uses bitwise operators on the values from the texmap array. Bitwise operators convert operands to 32-bit integers so undefined is converted to 0. This means the first three textures are entirely black (0x000000). Black is considered transparent in the rendering code, so these textures are rendered as air blocks.

Pseudocode to illustrate this (ray casting):

if (color > 0) then
  draw pixel
  next ray
else
  step ray
endif

Therefore, for completeness, these textures are included and rendered as transparent.

Further reading

Wiki page for Minecraft 4k

Final version of Minecraft 4k (JavaScript)

HackerNews page discussing Minecraft 4k

Releases

No releases published

Packages

No packages published

Languages