-
Notifications
You must be signed in to change notification settings - Fork 0
Generating your own block
Timaaos edited this page Feb 11, 2021
·
5 revisions
In this tutorial you will add generation for your own block! Craftpy has generation module so its will be easy! We need import generation module:
import gen_noise
We need to generate noise:
noise = gen_noise.noise(model.WORLDSIZE)
Now we checking all pixels:
for noisearr in noise:
for noisenum in noisearr:
if(noisenum>0.2):
pos = (noise.index(noisearr)-model.WORLDSIZE/2, math.floor(noisenum*15), noisearr.index(noisenum)-model.WORLDSIZE/2)
if (not model.world.__contains__(pos)):
model.add_block(pos,WILBER_BLOCK)
if(noisenum>0.2)
checking is noisenum bigger than threshold(0.2
)
noisenum*15
calculates y position of block
WILBER_BLOCK
is block