Comments (4)
This will be implemented as its own function, dynamicBlock
, that way we can more easily cover the documentation in warnings.
from terra.
alternative to that: what if we just implemented kotlin style switch cases?
when(randomInt(8)) {
0 -> block(1, 2, 3, "minecraft:stone");
1 -> block(1, 2, 3, "minecraft:coal_ore");
2 -> block(1, 2, 3, "minecraft:iron_ore");
3 -> block(1, 2, 3, "minecraft:gold_ore");
4 -> block(1, 2, 3, "minecraft:redstone_ore");
5 -> block(1, 2, 3, "minecraft:diamond_ore");
6 -> block(1, 2, 3, "minecraft:emerald_ore");
7 -> block(1, 2, 3, "minecraft:netherrite_block");
else -> print("h o w");
}
it could also be really useful for the check function.
when(check(1, 2, 3)) {
"AIR" -> print("is air");
"OCEAN" -> print("is ocean");
"LAND" -> {
print("is land");
block(1, 2, 3, "minecraft:stone");
}
else -> print("error");
}
they can also remove large if chains. For example, from the stronghold.tesf
structure:
when {
check( 13, y + 0, -8) != "LAND" -> fail;
check(-12, y + 5, -8) != "LAND" -> fail;
check(-12, y + 0, 8) != "LAND" -> fail;
check( 13, y + 0, 8) != "LAND" -> fail;
check( 13, y + 5, -8) != "LAND" -> fail;
check( 13, y + 5, 8) != "LAND" -> fail;
check(-11, y + 0, -8) != "LAND" -> fail;
check(-12, y + 5, 8) != "LAND" -> fail;
}
I would like to note though: I'd much prefer the word with
over when
, but then again, when
makes more sense for the last example. So maybe both? idk.
from terra.
Also, wouldn't you be able to do this?
str blockType = "";
num block = randomInt(3);
if (block == 0)
blockType = "minecraft:one";
else if (block == 1)
blockType = "minecraft:two";
else if (block == 2)
blockType = "minecraft:three";
block(1, 2, 3, blockType); // use as many of these as you want.
from terra.
Implemented as dynamicBlock
in cda2d46
from terra.
Related Issues (20)
- [Bug] Sponge schematics don't use offset field during placement HOT 2
- [Feature] Distance transform sampler HOT 2
- [Feature] Folia port
- [Feature] Configurable pipeline v2 cache size
- Profile pipeline v2 caching & optimize accordingly
- [Feature] 1.20 compatibility HOT 2
- [Feature] <Put your title here>When will update 1.20.1, please HOT 2
- [Bug] Bumping addon version requires gradle clean to apply correct version
- [Feature] Bukkit 1.20.2 NMS HOT 2
- Don't log old addon deprecations by default HOT 4
- Implement image cache strategies to reduce excessive memory consumption HOT 9
- [Feature] Add PlaceholderAPI support for common info sharing (without api usage) HOT 1
- [Bug] Flying Villages HOT 3
- [Feature] Alexs caves compatibility HOT 1
- [Feature] Use the "Customize" button for packs. HOT 1
- [Bug/F.Req?] Ticker text is too long.
- [Feature] grow custom trees from saplings
- [Feature] Config Loader API
- [Bug] StackOverflowError when generating terrain HOT 4
- Generate the world 100 times, 100 times it is the sea, and there is very little land HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terra.