I am looking for a way to manipulate a JAVA minecraft world (1.16.x) with a python script (under MacOS). Is there a way to do that?
Ideally, I do not want to install some other server (like bukkit, forge etc.), as this the instructions are completely insufficient, the servers are really old, or it does not work anyway.
So is there a way to just use a python script to read world data (i.e. get_block(x,y,z)) and to set a block (set_block(x,y,z, block)).
Hint: These two functions is essentially all I need.
The only thing I have seen to do this was the old "pymclevel" software written in Python. It established a set of primitive commands that could be used to import/export schematic files, fill areas with a particular block, and replace one block with another within an area (those are the primitives I used, anyway -- there may have been more).
It may not be exactly usable for you, since it hasn't been updated in quite a long time, but its source code might give you an example of how Python could be used to manipulate Minecraft worlds directly.
The only thing I have seen to do this was the old "pymclevel" software written in Python. It established a set of primitive commands that could be used to import/export schematic files, fill areas with a particular block, and replace one block with another within an area (those are the primitives I used, anyway -- there may have been more).
It may not be exactly usable for you, since it hasn't been updated in quite a long time, but its source code might give you an example of how Python could be used to manipulate Minecraft worlds directly.
This is what MCEdit used, but it only supports worlds loaded in versions up to 1.12.2 due to the changes made to the save format in 1.13; it is no longer possible to simply read in chunk (section) data and directly manipulate it since "blocks" are no longer directly saved in an orderly format; previously you can simply compute an index using the xyz coordinates and read in the data as a byte whose value is a block ID (plus an optional "add" field to get a 12 bit ID, but only mods were able to use this), with some simple bit twiddling to read in data values and light levels (packed as two 4 bit values per byte). 1.13 eliminated saving block IDs directly in favor of a "palette" that maps in-game IDs to local IDs, which enables global IDs to be mapped to no more than 4096 local IDs, the maximum that a 16x16x16 chunk section will ever need (the game was previously limited to this many global IDs since they were saved directly). Complicating the issue is the fact that the number of bits per block ID (actually, a "block state", a unique ID representing what used to be a separate block ID and data value) depends on how many unique IDs are stored within a section (for example, if there are 17-32 palette entries then each entry will use 5 bits, which are packed into 64 bit longs, of which the last 4 bits will not be used so there will be 342 longs per section).
Either way, the changes were too much for the developers of MCEdit, which has been abandoned (the original version was last updated 4 years ago, a successor, MCEdit2, never got out of beta). However, there are various mapping tools for 1.13+ so the new save format isn't a complete barrier to accessing it; the Wiki also indicates that there is at least one editor available for newer versions, MCA Selector, but it only appears to work with whole chunks, not individual blocks, and is written in Java:
I am looking for a way to manipulate a JAVA minecraft world (1.16.x) with a python script (under MacOS). Is there a way to do that?
Ideally, I do not want to install some other server (like bukkit, forge etc.), as this the instructions are completely insufficient, the servers are really old, or it does not work anyway.
So is there a way to just use a python script to read world data (i.e. get_block(x,y,z)) and to set a block (set_block(x,y,z, block)).
Hint: These two functions is essentially all I need.
The only thing I have seen to do this was the old "pymclevel" software written in Python. It established a set of primitive commands that could be used to import/export schematic files, fill areas with a particular block, and replace one block with another within an area (those are the primitives I used, anyway -- there may have been more).
It may not be exactly usable for you, since it hasn't been updated in quite a long time, but its source code might give you an example of how Python could be used to manipulate Minecraft worlds directly.
- sunperp
This is what MCEdit used, but it only supports worlds loaded in versions up to 1.12.2 due to the changes made to the save format in 1.13; it is no longer possible to simply read in chunk (section) data and directly manipulate it since "blocks" are no longer directly saved in an orderly format; previously you can simply compute an index using the xyz coordinates and read in the data as a byte whose value is a block ID (plus an optional "add" field to get a 12 bit ID, but only mods were able to use this), with some simple bit twiddling to read in data values and light levels (packed as two 4 bit values per byte). 1.13 eliminated saving block IDs directly in favor of a "palette" that maps in-game IDs to local IDs, which enables global IDs to be mapped to no more than 4096 local IDs, the maximum that a 16x16x16 chunk section will ever need (the game was previously limited to this many global IDs since they were saved directly). Complicating the issue is the fact that the number of bits per block ID (actually, a "block state", a unique ID representing what used to be a separate block ID and data value) depends on how many unique IDs are stored within a section (for example, if there are 17-32 palette entries then each entry will use 5 bits, which are packed into 64 bit longs, of which the last 4 bits will not be used so there will be 342 longs per section).
Either way, the changes were too much for the developers of MCEdit, which has been abandoned (the original version was last updated 4 years ago, a successor, MCEdit2, never got out of beta). However, there are various mapping tools for 1.13+ so the new save format isn't a complete barrier to accessing it; the Wiki also indicates that there is at least one editor available for newer versions, MCA Selector, but it only appears to work with whole chunks, not individual blocks, and is written in Java:
https://minecraft.gamepedia.com/Programs_and_editors/Mapping#Map_Editors
https://github.com/Querz/mcaselector (the screenshots indicate that it is capable of reading individual block data and the source is freely available)
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?