cbs228 / nbtschematic Goto Github PK
View Code? Open in Web Editor NEWA simple schematic file reader for nbtlib
License: MIT License
A simple schematic file reader for nbtlib
License: MIT License
Mojang changed the block ID so I can't use command like sf.blocks[2, 3, 0] = 'minecraft:chest'
to add a chest.
reference:Minecraft Wiki
Requirement already satisfied: nbtlib in c:\users\naudi\appdata\local\programs\python\python36\lib\site-packages (1.2.4)
Collecting numpy==1.15.4 (from nbtlib)
Using cached https://files.pythonhosted.org/packages/51/70/7096a735b27359dbc0c380b23b9c9bd05fea62233f95849c43a6b02c5f40/numpy-1.15.4-cp36-none-win_amd64.whl
nbtschematic 0.1.0 has requirement numpy~=1.14.5, but you'll have numpy 1.15.4 which is incompatible.
Installing collected packages: numpy
Found existing installation: numpy 1.14.6
Uninstalling numpy-1.14.6:
Successfully uninstalled numpy-1.14.6
Successfully installed numpy-1.15.4
You are using pip version 10.0.1, however version 21.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\naudi>from nbtschematic import SchematicFile
'from' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>sf = SchematicFile.load('tests/test_schematic/simple.schematic')
'sf' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>print("The block at Y=%d, Z=%d, X=%d has block ID %d" %
Unable to initialize device PRN
C:\Users\naudi>pip install nbtschematic==0.1.0
Requirement already satisfied: nbtschematic==0.1.0 in c:\users\naudi\appdata\local\programs\python\python36\lib\site-packages (0.1.0)
Requirement already satisfied: nbtlib~=1.2.1 in c:\users\naudi\appdata\local\programs\python\python36\lib\site-packages (from nbtschematic==0.1.0) (1.2.4)
Collecting numpy~=1.14.5 (from nbtschematic==0.1.0)
Using cached https://files.pythonhosted.org/packages/dc/99/f824a73251589d9fcef2384f9dd21bd1601597fda92ced5882940586ec37/numpy-1.14.6-cp36-none-win_amd64.whl
nbtlib 1.2.4 has requirement numpy==1.15.4, but you'll have numpy 1.14.6 which is incompatible.
Installing collected packages: numpy
Found existing installation: numpy 1.15.4
Uninstalling numpy-1.15.4:
Successfully uninstalled numpy-1.15.4
Successfully installed numpy-1.14.6
You are using pip version 10.0.1, however version 21.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\naudi>from nbtschematic import SchematicFile
'from' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>sf = SchematicFile(shape=(10, 8, 4))
'sf' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>assert sf.blocks.shape == (10, 8, 4)
'assert' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>sf.blocks[2, 3, 0] = 42
'sf.blocks[2' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\naudi>sf.save('example.schematic')
Thank you for helping me with the nbtschematic software! I have so much to learn! If you aren't aware I plan to remake make Nyc in Minecraft 1.12 1:3 scale to use the immersive vehicle mods and chisels and bits mod. It is basically a redo of BTE's NYC 1:1 scale with added mods. However I am a newbie and just starting with my python journey (You can tell from my previous questions). I have seen the post "Building 1:1 Scale Minecraft Replicas with Google Maps" by Nikhil Jha which was a year ago and used the editor tool as well as analyzing each part of the code he used for rotating each schematic file and implementing it into python by copying (newbie mistake). However from your previous reply and python errors, I have seen the extra things I can add to make the code more efficient, like the numpy.swapaxes(). I Honestly was a bit overwhelmed. My starting map is with a LGA Airport runway piece from the website https://minecraftart.netlify.app/ which I believe is all I need to start the project. Because of my determination, I wanted to speed up the process by asking you for a generic code for rotating the specific schematic map file so that I can use it for multiple maps which I plan to connect in the end with coordinates. I'm sure there is more that could have been shown in the post. This would be highly appreciated. Sorry for any misunderstandings.
Here are the Givens:
file name: 'LGA1.schematic'
dimensions: width(159) height(210) thickness(1).
Blocks: All
Entities: None
Block entities: None
It seems like it's not possible to install nbtschematic.
python 3.8
numpy 1.18.2
But when i execute pip3 install nbtschematic i get this error:
ERROR: nbtlib 1.2.4 has requirement numpy==1.15.4, but you'll have numpy 1.14.6 which is incompatible.
Some blocks' ids have ":" or have no ids
It's not an integer
How can I use these blocks?
from nbtschematic import SchematicFile
orig = SchematicFile.load('LGA1.schematic')
print(orig.shape) # x,z,y => 33390
(Short(210), Short(159), Short(1))
new = SchematicFile(
... shape=(int(orig.shape[2]),int(orig.shape[1]),int(orig.shape[0]))
... ) # switch x,y
for y in range(int(orig.shape[0])):
... for z in range(int(orig.shape[1])):
... for x in range(int(orig.shape[2])):
... new.blocks[x,z,y] = orig.blocks[y,z,x] # switch x,y
... new.data[x,z,y] = orig.data[y,z,x] # preserve metadata
... new.save('flat.schematic')
File "", line 6
new.save('flat.schematic')
^
SyntaxError: invalid syntax
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.