BiomeTweaker icon indicating copy to clipboard operation
BiomeTweaker copied to clipboard

Add support for for loops

Open hohserg1 opened this issue 3 years ago • 3 comments

I want to execute some commands which differ by some counter. How can I avoid copy-pasting?

hohserg1 avatar Aug 01 '20 16:08 hohserg1

There are no explicit loops, related to #188 . What are you trying to achieve exactly? There may be an alternative you haven't considered.

superckl avatar Aug 01 '20 21:08 superckl

As example, follow config added floating flowers generation to the end dimension. Flowers are uses different blockstates. Now it solved by copy-paste https://gist.github.com/hohserg1/f19f76bc38e9b36763b43aeb8fa4b340

hohserg1 avatar Aug 05 '20 10:08 hohserg1

This is a good example, but also could be shortened. You can define your decoration once, only specifying the color block each time before adding it to the biome

flowerDec = newOreDecoration() 
 flowerDec.set("count", 1) 
 flowerDec.set("mainBlock", white_flower) 
 flowerDec.set("size", 3) 
 flowerDec.set("minY", 70) 
 flowerDec.set("maxY", 100) 
 flowerDec.addBlockToReplace("minecraft:air") 
 
#White
white_flower = forBlock("botania:miniisland")
 white_flower.setProperty("color", "white")
 flowerDec.set("mainBlock", white_flower) 
 sky.addDecoration(flowerDec)

#Orange
orange_flower = forBlock("botania:miniisland")
 orange_flower.setProperty("color", "orange")
 flowerDec.set("mainBlock", orange_flower) 
 sky.addDecoration(flowerDec)

#Etc...

superckl avatar Aug 05 '20 18:08 superckl