BiomeTweaker

BiomeTweaker

13M Downloads

Add support for for loops

hohserg1 opened this issue ยท 3 comments

commented

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

commented

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

commented

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

commented

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...