1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-09-15 14:32:09 +02:00

1 Commits

Author SHA1 Message Date
f18f798afb Port to 1.16.5 2021-07-06 18:58:00 +02:00
1066 changed files with 13262 additions and 16872 deletions

3
.idea/gradle.xml generated
View File

@@ -12,8 +12,7 @@
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/data" />
<option value="$PROJECT_DIR$/modules/system" />
<option value="$PROJECT_DIR$/modules/util" />
<option value="$PROJECT_DIR$/src/system" />
</set>
</option>
</GradleProjectSettings>

View File

@@ -2,20 +2,12 @@ ext {
mc_version = "1.16.5"
forge_version = "36.1.32"
mixin_version = "0.8.2"
kotlin_mod_version = "1.13.0"
mapping_version = "20210309-1.16.5"
access_transformers = [
new File(rootProject.projectDir, "src/main/resources/META-INF/accesstransformer_main.cfg"),
new File(project(":system").projectDir, "src/main/resources/META-INF/accesstransformer_system.cfg"),
new File(project(":util").projectDir, "src/main/resources/META-INF/accesstransformer_util.cfg"),
]
kotlin_mod_version = "1.13.0"
}
buildscript {
ext {
forge_gradle_version = "4.1.+"
mixin_gradle_version = "0.7-SNAPSHOT"
kotlin_version = "1.5.20"
}
@@ -26,8 +18,8 @@ buildscript {
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: forge_gradle_version, changing: true
classpath group: "org.spongepowered", name: "mixingradle", version: mixin_gradle_version
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "4.1.+", changing: true
classpath group: "org.spongepowered", name: "mixingradle", version: "0.7-SNAPSHOT"
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version
}
}
@@ -37,7 +29,7 @@ apply plugin: "org.spongepowered.mixin"
apply plugin: "eclipse"
apply plugin: "idea"
if (file("run/mods_deobf.gradle").exists()) {
if (file("run/mods_deobf.gradle").exists()){
apply from: "run/mods_deobf.gradle"
}
@@ -54,14 +46,12 @@ archivesBaseName = metaName.replaceAll("\\s", "")
idea {
module {
[".idea", ".settings", ".gradle", "build", "gradle", "run"].each {
[".idea", ".settings", ".gradle", "build", "gradle", "out", "run", "src/main/kotlin", "src/test/kotlin"].each {
excludeDirs += file(it)
}
["out", "src/main/kotlin", "src/test/kotlin"].each {
excludeDirs += file(it)
excludeDirs += file("modules/system/" + it)
excludeDirs += file("modules/util/" + it)
excludeDirs += file("src/system/" + it)
}
["src/main/kotlin", "src/test/kotlin"].each {
@@ -97,9 +87,10 @@ allprojects {
}
repositories {
mavenCentral()
maven { url = "https://files.minecraftforge.net/maven" }
maven { url = "https://thedarkcolour.github.io/KotlinForForge" }
maven {
name = "kotlinforforge"
url = "https://thedarkcolour.github.io/KotlinForForge"
}
}
dependencies {
@@ -108,7 +99,7 @@ allprojects {
implementation "org.jetbrains.kotlin:kotlin-reflect"
}
if (file("$buildDir/classes").exists()) {
if (file("$buildDir/classes").exists()){
file("$buildDir/classes/java/main").mkdirs() // Forge complains when the java folder is missing
}
}
@@ -124,7 +115,8 @@ sourceSets {
minecraft {
mappings channel: "snapshot", version: rootProject.mapping_version
setAccessTransformers(rootProject.access_transformers)
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
@@ -139,7 +131,6 @@ minecraft {
hee {
source sourceSets.main
source project(":system").sourceSets.main
source project(":util").sourceSets.main
}
}
}
@@ -156,13 +147,11 @@ minecraft {
hee {
source sourceSets.main
source project(":system").sourceSets.main
source project(":util").sourceSets.main
}
}
}
data {
property "hee.debug", ""
args "--mod", "hee"
args "--all"
args "--output", file("data/gen")
@@ -175,7 +164,6 @@ minecraft {
hee {
source sourceSets.main
source project(":system").sourceSets.main
source project(":util").sourceSets.main
source project(":datagen").sourceSets.main
}
}
@@ -191,11 +179,9 @@ dependencies {
minecraft "net.minecraftforge:forge:" + mc_version + "-" + forge_version
implementation project(":system")
implementation project(":util")
implementation "thedarkcolour:kotlinforforge:" + kotlin_mod_version
testImplementation project(":system")
testImplementation project(":util")
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.0-RC1"
if (System.getProperty("idea.sync.active") != "true") {
@@ -211,11 +197,9 @@ test {
jar {
archiveName = archivesBaseName + "-" + mc_version + "-v" + version + ".jar"
["system", "util"].each {
from(project(":" + it).sourceSets.main.output) {
from(project(":system").sourceSets.main.output) {
exclude "META-INF"
exclude "pack.mcmeta"
exclude "META-INF/*.kotlin_module"
}
}
from("./data/gen") {

View File

@@ -5,23 +5,28 @@ buildscript {
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: forge_gradle_version, changing: true
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "4.1.+", changing: true
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version
}
}
repositories {
mavenCentral()
maven { url = "https://files.minecraftforge.net/maven" }
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "eclipse"
minecraft {
mappings channel: "snapshot", version: rootProject.mapping_version
setAccessTransformers(rootProject.access_transformers)
accessTransformer = file("../src/main/resources/META-INF/accesstransformer.cfg")
}
dependencies {
minecraft "net.minecraftforge:forge:" + mc_version + "-" + forge_version
implementation rootProject
implementation project(":system")
implementation project(":util")
}
jar {

View File

@@ -10,9 +10,6 @@ e53a79fa8e5222e4287e2e5d410890b1f8df78ba assets/hee/blockstates/autumn_leaves_ye
1ce8f488560f32fddbd2532961df123665625c75 assets/hee/blockstates/autumn_sapling_orange.json
303070f9945ee2e6716e0fcd67bfa3275b93fde6 assets/hee/blockstates/autumn_sapling_red.json
694318e51ca78111cd91a507a99ab852825cdf0c assets/hee/blockstates/autumn_sapling_yellowgreen.json
6af0fcab50e591ffad19be1909b4e2baba4bc084 assets/hee/blockstates/cauldron_dragons_breath.json
06141839f09e97f639771c67108b9b2e2f437403 assets/hee/blockstates/cauldron_ender_goo.json
802edf094f47f5ce129eec4b2be018ab8a9a62e6 assets/hee/blockstates/cauldron_purified_ender_goo.json
e926f62a373640c427ba9ac962d7b2dcbe0ae376 assets/hee/blockstates/corrupted_energy.json
7bce0e85ae6f21ceede602f140f40c7678480790 assets/hee/blockstates/dark_chest.json
97ac658307fc07611fe9328ab95d692ab16bb92d assets/hee/blockstates/dark_loam.json
@@ -75,7 +72,7 @@ c16b5933b9af8fb1033c6d6d11e19628d7c56f4f assets/hee/blockstates/miners_burial_bl
b58fb5ca5bdaf639f725135a2a6682adc4c712ff assets/hee/blockstates/miners_burial_block_plain.json
4c56ed06867c9ef95b287b57e31ddb123e56020e assets/hee/blockstates/obsidian_chiseled.json
4c56ed06867c9ef95b287b57e31ddb123e56020e assets/hee/blockstates/obsidian_chiseled_lit.json
27365e71c0a9f8cfab0340d70a65b7f341363e0d assets/hee/blockstates/obsidian_falling.json
58196b68181ce4554fe7accaa29d3f1f2596b3c2 assets/hee/blockstates/obsidian_falling.json
d4bc138bf24df55f5df0df391cced6c587e6fec3 assets/hee/blockstates/obsidian_pillar.json
d666add54a950dd814fc08a7e612ac5a57070c15 assets/hee/blockstates/obsidian_pillar_lit.json
3c6eb037eb8731410f06b17815e9b9d3705c6b7f assets/hee/blockstates/obsidian_smooth.json
@@ -92,7 +89,6 @@ b70f529af4a5d86e6313d278bed22000f5aa5239 assets/hee/blockstates/purified_ender_g
7b9473e5987ea2cf6fde1a7b530895bba6891a24 assets/hee/blockstates/puzzle_block_wall.json
ce9b1e3bb4760063c69b9c671c8a567520125dd2 assets/hee/blockstates/scaffolding.json
070df87fc3b7dd9029a0bf0d59745cb0e4430181 assets/hee/blockstates/spawner_obsidian_towers.json
eb08886b7e7241361d5c7ee280e024610990847e assets/hee/blockstates/stone_brick_wall.json
947fcca21b602927ed0ead585ea1d2213372f074 assets/hee/blockstates/table_base_tier_1.json
404f8c1b45214db75959f02706dc10c66b278970 assets/hee/blockstates/table_base_tier_2.json
805a8e554ff95cea28405e6de97da053986bd9df assets/hee/blockstates/table_base_tier_3.json
@@ -107,7 +103,6 @@ c53b83ef3e8152ed65147117c10122e4906ea61b assets/hee/blockstates/whitebark_log.js
281264d279f075947ee2f8afdb78190364782921 assets/hee/blockstates/whitebark_planks.json
976d2b47d52e04eb9944e3c4c8aee9a91f315ade assets/hee/blockstates/whitebark_slab.json
776dd79a096f999f2606047486af73aca71a6cf0 assets/hee/blockstates/whitebark_stairs.json
9c87b9db95b144daa448ab95b11338423a7b5394 assets/hee/lang/en_us.json
a3127926cde114f660a9748f9d2ff6c378778d6a assets/hee/models/block/accumulation_table_tier_1.json
c87320b92ede3bf18f7497cf59689d15ef18969b assets/hee/models/block/accumulation_table_tier_2.json
0adc1ddee430fc2aacd2b6a32fbc1fea048345c2 assets/hee/models/block/accumulation_table_tier_3.json
@@ -164,16 +159,6 @@ f2e86d976bcd985021fbe00d34b1e1b44a64a557 assets/hee/models/block/endersol_merge_
488e5dec7542396ca80e3bcb02b7313a412aa97f assets/hee/models/block/endium_block.json
aa8fcca7cb3898e5e7658bbdae0a555209b3f8e2 assets/hee/models/block/endium_ore.json
01c6bfe57748c7a87ce304024d905c7715f1fe3c assets/hee/models/block/enhanced_brewing_stand.json
1926175e552d2b810d01b8a89fc45a5bb4dd39ed assets/hee/models/block/eternal_fire_floor0.json
1eab166292d4a4fcb44a9f5d9a33ca0dcf535ba5 assets/hee/models/block/eternal_fire_floor1.json
82316da36e8f8f4ee6fd9ae5fd119e4692b99d2d assets/hee/models/block/eternal_fire_side0.json
61ef10a01e1377e36af67d5ae379218924626595 assets/hee/models/block/eternal_fire_side1.json
ad645653a99dc42535fdfb855b4dc8622c6f826d assets/hee/models/block/eternal_fire_side_alt0.json
e233d09cb8537c735b2af104c0637bab2ca85d59 assets/hee/models/block/eternal_fire_side_alt1.json
5726b3ca9700fbca7ac3ade22ad5cc0634cfe652 assets/hee/models/block/eternal_fire_up0.json
4f913fac7c9deac303f95251a82018e4e3fb0183 assets/hee/models/block/eternal_fire_up1.json
fa5d1de1603cdea3f8886c053a48c9ce145ec173 assets/hee/models/block/eternal_fire_up_alt0.json
9b39ca3af11554cc5f7b49fa6b7d495d4026395e assets/hee/models/block/eternal_fire_up_alt1.json
78688919cd3be6d8e511a9e72227c8c1ed3eaf07 assets/hee/models/block/ethereal_lantern.json
2978d091e8cbd221ee969bb3f2e078c06ef4e3e1 assets/hee/models/block/experience_gate.json
7f01aebf3576d63fb8f254aa0d6ffd28f11245a4 assets/hee/models/block/experience_gate_controller.json
@@ -220,13 +205,14 @@ e715a206318b020b1e3119db56f8e807ab4c11dd assets/hee/models/block/infused_tnt.jso
63f514ba3c4648bbe843ab4bc5ddf1df70025f0c assets/hee/models/block/infusion_table_tier_1.json
71efff4640a6fe83ac449de2204e2d2bd0e3f97e assets/hee/models/block/infusion_table_tier_2.json
18c56872e21de3d66f642f1d6a3c4bccafc461c8 assets/hee/models/block/infusion_table_tier_3.json
fd787c41eb1e5875ff3b22b7a5c5d989d097ad40 assets/hee/models/block/loot_chest.json
a5f3f2cbbe8628a426817953c087585f65fc2254 assets/hee/models/block/loot_chest.json
7b4ae46a1f8d7d285d31565ce7cba02a5784d93f assets/hee/models/block/miners_burial_block_chiseled.json
f86f536da296ac2e2081fe038757e565f7ac6952 assets/hee/models/block/miners_burial_block_jail.json
7b3afe0784c92fb8e0d8112427e7f2ee1799e5e5 assets/hee/models/block/miners_burial_block_pillar.json
7e60044fcb9a5806d815a94b49304ff6ca992496 assets/hee/models/block/miners_burial_block_pillar_horizontal.json
1af20bb8055eb36f6e0b0db1eac13ad7a63ff106 assets/hee/models/block/miners_burial_block_plain.json
0ed91de9858f63ae21ace09f60cf734bbd27daa6 assets/hee/models/block/obsidian_chiseled.json
b1c121d633d189b0cb6fbc8b675b5acf0b19a0d4 assets/hee/models/block/obsidian_falling.json
66637af0fb0dc1f048ce46c7291d6fe3e443e69f assets/hee/models/block/obsidian_pillar.json
f5677922b8a5a69b2fd2a34cf081fb4dcbd9bd23 assets/hee/models/block/obsidian_pillar_horizontal.json
66637af0fb0dc1f048ce46c7291d6fe3e443e69f assets/hee/models/block/obsidian_pillar_lit.json
@@ -309,6 +295,7 @@ ffbc19b2aeeb81c1acf03dfc6f4ab101b5602f7a assets/hee/models/item/autumn_sapling_b
2ef2d9dd8a04a7a2bb0d0a75570565ff4921cf67 assets/hee/models/item/blank_token.json
98167609bf3898587f7565736a6fc24a7966cacd assets/hee/models/item/blobby_spawn_egg.json
fda3face7f4a5bb8debff8958d1d4920860cd1c3 assets/hee/models/item/compost.json
bd805b17a4641f39e85e70aa5e10f45b0f0d32ce assets/hee/models/item/corrupted_energy.json
5305057f6e86d0fb549f22e6d49a2ca6e9723c54 assets/hee/models/item/dark_chest.json
45959256d2d1b4548f4f528d2d690816697955d2 assets/hee/models/item/dark_loam.json
d6669437273af857f67460b9ffc674f07cc07630 assets/hee/models/item/dark_loam_slab.json
@@ -410,7 +397,7 @@ b0ccc08c142525e3d82a6643d34dfb0d82385571 assets/hee/models/item/miners_burial_bl
8e0fc42a6a28596571ec0877ab3a9af7901adeaa assets/hee/models/item/miners_burial_block_plain.json
7a8592c4a45ccdea4ca36898b3371364f6aab2ca assets/hee/models/item/obsidian_chiseled.json
7a8592c4a45ccdea4ca36898b3371364f6aab2ca assets/hee/models/item/obsidian_chiseled_lit.json
561f15cf196c891a108a723c24894fa524b7d2e2 assets/hee/models/item/obsidian_falling.json
6ec06a3d2286e954a180a021f8e2fa0847bc62a9 assets/hee/models/item/obsidian_falling.json
3c4e981d4d1945965dfbdc0e4c5ce4c2325646ca assets/hee/models/item/obsidian_fragment.json
28e22c71e0b66c4f05a034efed3fdc1c53ed3446 assets/hee/models/item/obsidian_pillar.json
28e22c71e0b66c4f05a034efed3fdc1c53ed3446 assets/hee/models/item/obsidian_pillar_lit.json
@@ -482,7 +469,7 @@ aa8696fc83d73951a890f55cd7c2b9c9abb3f611 assets/hee/models/item/whitebark_log.js
2903a69c4cd7c37db3891af9c0736568ccc3acff data/forge/tags/blocks/chests.json
3260d80138f7c357d2efbda403e8d0e6a957d75b data/forge/tags/blocks/end_stones.json
424e2e03cf62f23f4496468a97b9f0df060df9fe data/forge/tags/blocks/glass.json
763fefed687a3383a23e481415837b08a931661f data/forge/tags/blocks/obsidian.json
f87bf8e15aea2ca3068935be41828e61a22e6ef8 data/forge/tags/blocks/obsidian.json
83ea3831e8edbb4cab7f4a997b6e78b74d273493 data/forge/tags/blocks/ores.json
9a1109a26cfd5f396d8e080f77d8277f130f299d data/forge/tags/blocks/storage_blocks.json
2903a69c4cd7c37db3891af9c0736568ccc3acff data/forge/tags/items/chests.json
@@ -493,7 +480,7 @@ d3fbc7a0a7d1a6cd5b4a2d6604a4625c57b57a9a data/forge/tags/items/ender_pearls.json
ff2ba2285b4163d5d08376c6d99477f96273310c data/forge/tags/items/heads.json
144c342bc93a719b95e99b4d9493ed29885bf71b data/forge/tags/items/ingots.json
b187118e591990e8c0397058318592c587c3dcff data/forge/tags/items/nuggets.json
763fefed687a3383a23e481415837b08a931661f data/forge/tags/items/obsidian.json
f87bf8e15aea2ca3068935be41828e61a22e6ef8 data/forge/tags/items/obsidian.json
83ea3831e8edbb4cab7f4a997b6e78b74d273493 data/forge/tags/items/ores.json
ebdc7d4617021fcc8582e3a17b42d4a815d9e021 data/forge/tags/items/rods.json
9a1109a26cfd5f396d8e080f77d8277f130f299d data/forge/tags/items/storage_blocks.json
@@ -516,7 +503,6 @@ d9abd1ed1cc52d7f8c1b48896da855b2e8bded23 data/hee/loot_tables/blocks/dusty_stone
ef63046d109846e09f43eaa0fbd322889d31d3c3 data/hee/loot_tables/blocks/dusty_stone_brick_stairs.json
fd7e4cb74c69e176813fd0cddef9c4c98847eacc data/hee/loot_tables/blocks/dusty_stone_bricks.json
e891c4099dec492133fc58662765c326b00f1e09 data/hee/loot_tables/blocks/dusty_stone_cracked_bricks.json
de6d8d0b775f590077634afc913165c831192070 data/hee/loot_tables/blocks/dusty_stone_decoration.json
5ca27ed38494044939def58dae0354d0cb09baad data/hee/loot_tables/blocks/end_stone_burned.json
c50fb5765d11b9f46dd81f2d9c33d4d0b6bb1402 data/hee/loot_tables/blocks/end_stone_enchanted.json
7d720082305ddef2d864263bf58c55a67549cbeb data/hee/loot_tables/blocks/end_stone_infested.json
@@ -581,26 +567,24 @@ e66091a13a6e7593eb5bd971978d24a5a0e375b3 data/hee/loot_tables/blocks/whitebark.j
7d84dc443a052e349593b71d2c0a523e75396cdf data/hee/loot_tables/blocks/whitebark_slab.json
83e0b81adb3f9dd488397e8459b95f7b0ce19927 data/hee/loot_tables/blocks/whitebark_stairs.json
f5996244831ab38fe1fae2f304bbd7825d6ad98b data/minecraft/tags/blocks/bamboo_plantable_on.json
479189f9b35a3c8f795539daf6a1809130242c5b data/minecraft/tags/blocks/flower_pots.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/flower_pots.json
424e2e03cf62f23f4496468a97b9f0df060df9fe data/minecraft/tags/blocks/impermeable.json
4557912145f8c53493f249ef3961d02e156891e4 data/minecraft/tags/blocks/leaves.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/leaves.json
4ea74ec750ba7360a7843a0d4a604ac7b35dfa96 data/minecraft/tags/blocks/logs.json
4ea74ec750ba7360a7843a0d4a604ac7b35dfa96 data/minecraft/tags/blocks/logs_that_burn.json
697395021049c8cccfac2486c52eb6664cc5bad6 data/minecraft/tags/blocks/planks.json
10fff7e5092ddc68cc1611ad4605dc4d6608e227 data/minecraft/tags/blocks/portals.json
6f73d4c0d7c0f2650b498f35a60e8fe9c280c765 data/minecraft/tags/blocks/saplings.json
eb69de8447077a713baaab7e10184ec283c25516 data/minecraft/tags/blocks/slabs.json
07e3d7d270309424e1ab60a1b89ab2da85f800c7 data/minecraft/tags/blocks/stairs.json
5318f9d9be9209139567f7f58d77d1b27d9d1327 data/minecraft/tags/blocks/walls.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/saplings.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/slabs.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/stairs.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/blocks/walls.json
8a04ae43dc7062677394df7bf7276dbc92a5f1ca data/minecraft/tags/blocks/wooden_slabs.json
3bf587d2f806c14a76a10db8f43386552382c381 data/minecraft/tags/blocks/wooden_stairs.json
4557912145f8c53493f249ef3961d02e156891e4 data/minecraft/tags/items/leaves.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/items/leaves.json
4ea74ec750ba7360a7843a0d4a604ac7b35dfa96 data/minecraft/tags/items/logs.json
4ea74ec750ba7360a7843a0d4a604ac7b35dfa96 data/minecraft/tags/items/logs_that_burn.json
697395021049c8cccfac2486c52eb6664cc5bad6 data/minecraft/tags/items/planks.json
6f73d4c0d7c0f2650b498f35a60e8fe9c280c765 data/minecraft/tags/items/saplings.json
eb69de8447077a713baaab7e10184ec283c25516 data/minecraft/tags/items/slabs.json
07e3d7d270309424e1ab60a1b89ab2da85f800c7 data/minecraft/tags/items/stairs.json
5318f9d9be9209139567f7f58d77d1b27d9d1327 data/minecraft/tags/items/walls.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/items/saplings.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/items/slabs.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/items/stairs.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/minecraft/tags/items/walls.json
8a04ae43dc7062677394df7bf7276dbc92a5f1ca data/minecraft/tags/items/wooden_slabs.json
3bf587d2f806c14a76a10db8f43386552382c381 data/minecraft/tags/items/wooden_stairs.json

View File

@@ -1,16 +0,0 @@
{
"variants": {
"level=0": {
"model": "minecraft:block/cauldron"
},
"level=1": {
"model": "hee:block/cauldron_dragons_breath_level1"
},
"level=2": {
"model": "hee:block/cauldron_dragons_breath_level2"
},
"level=3": {
"model": "hee:block/cauldron_dragons_breath_level3"
}
}
}

View File

@@ -1,16 +0,0 @@
{
"variants": {
"level=0": {
"model": "minecraft:block/cauldron"
},
"level=1": {
"model": "hee:block/cauldron_ender_goo_level1"
},
"level=2": {
"model": "hee:block/cauldron_ender_goo_level2"
},
"level=3": {
"model": "hee:block/cauldron_ender_goo_level3"
}
}
}

View File

@@ -1,16 +0,0 @@
{
"variants": {
"level=0": {
"model": "minecraft:block/cauldron"
},
"level=1": {
"model": "hee:block/cauldron_purified_ender_goo_level1"
},
"level=2": {
"model": "hee:block/cauldron_purified_ender_goo_level2"
},
"level=3": {
"model": "hee:block/cauldron_purified_ender_goo_level3"
}
}
}

View File

@@ -1,7 +1,7 @@
{
"variants": {
"": {
"model": "minecraft:block/obsidian"
"model": "hee:block/obsidian_falling"
}
}
}

View File

@@ -1,90 +0,0 @@
{
"multipart": [
{
"when": {
"up": "true"
},
"apply": {
"model": "hee:block/stone_brick_wall_post"
}
},
{
"when": {
"east": "low"
},
"apply": {
"model": "hee:block/stone_brick_wall_side",
"y": 90,
"uvlock": true
}
},
{
"when": {
"east": "tall"
},
"apply": {
"model": "hee:block/stone_brick_wall_side_tall",
"y": 90,
"uvlock": true
}
},
{
"when": {
"north": "low"
},
"apply": {
"model": "hee:block/stone_brick_wall_side",
"uvlock": true
}
},
{
"when": {
"north": "tall"
},
"apply": {
"model": "hee:block/stone_brick_wall_side_tall",
"uvlock": true
}
},
{
"when": {
"south": "low"
},
"apply": {
"model": "hee:block/stone_brick_wall_side",
"y": 180,
"uvlock": true
}
},
{
"when": {
"south": "tall"
},
"apply": {
"model": "hee:block/stone_brick_wall_side_tall",
"y": 180,
"uvlock": true
}
},
{
"when": {
"west": "low"
},
"apply": {
"model": "hee:block/stone_brick_wall_side",
"y": 270,
"uvlock": true
}
},
{
"when": {
"west": "tall"
},
"apply": {
"model": "hee:block/stone_brick_wall_side_tall",
"y": 270,
"uvlock": true
}
}
]
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_floor0",
"textures": {
"particle": "hee:block/eternal_fire_0",
"fire": "hee:block/eternal_fire_0"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_floor1",
"textures": {
"particle": "hee:block/eternal_fire_1",
"fire": "hee:block/eternal_fire_1"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_side0",
"textures": {
"particle": "hee:block/eternal_fire_0",
"fire": "hee:block/eternal_fire_0"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_side1",
"textures": {
"particle": "hee:block/eternal_fire_1",
"fire": "hee:block/eternal_fire_1"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_side_alt0",
"textures": {
"particle": "hee:block/eternal_fire_0",
"fire": "hee:block/eternal_fire_0"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_side_alt1",
"textures": {
"particle": "hee:block/eternal_fire_1",
"fire": "hee:block/eternal_fire_1"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_up0",
"textures": {
"particle": "hee:block/eternal_fire_0",
"fire": "hee:block/eternal_fire_0"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_up1",
"textures": {
"particle": "hee:block/eternal_fire_1",
"fire": "hee:block/eternal_fire_1"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_up_alt0",
"textures": {
"particle": "hee:block/eternal_fire_0",
"fire": "hee:block/eternal_fire_0"
}
}

View File

@@ -1,7 +0,0 @@
{
"parent": "minecraft:block/fire_up_alt1",
"textures": {
"particle": "hee:block/eternal_fire_1",
"fire": "hee:block/eternal_fire_1"
}
}

View File

@@ -1,4 +1,5 @@
{
"parent": "minecraft:block/block",
"textures": {
"particle": "hee:block/loot_chest_particle"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "minecraft:block/obsidian"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "hee:block/corrupted_energy"
}

View File

@@ -1,3 +1,3 @@
{
"parent": "minecraft:block/obsidian"
"parent": "hee:block/obsidian_falling"
}

View File

@@ -7,7 +7,6 @@
"hee:obsidian_pillar",
"hee:obsidian_smooth_lit",
"hee:obsidian_chiseled_lit",
"hee:obsidian_pillar_lit",
"hee:obsidian_tower_top"
"hee:obsidian_pillar_lit"
]
}

View File

@@ -7,7 +7,6 @@
"hee:obsidian_pillar",
"hee:obsidian_smooth_lit",
"hee:obsidian_chiseled_lit",
"hee:obsidian_pillar_lit",
"hee:obsidian_tower_top"
"hee:obsidian_pillar_lit"
]
}

View File

@@ -1,19 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "hee:dusty_stone_decoration"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@@ -1,12 +1,4 @@
{
"replace": false,
"values": [
"hee:potted_autumn_sapling_red",
"hee:potted_autumn_sapling_brown",
"hee:potted_autumn_sapling_orange",
"hee:potted_autumn_sapling_yellowgreen",
"hee:potted_death_flower",
"hee:potted_death_flower_healed",
"hee:potted_death_flower_withered"
]
"values": []
}

View File

@@ -1,9 +1,4 @@
{
"replace": false,
"values": [
"hee:autumn_leaves_red",
"hee:autumn_leaves_brown",
"hee:autumn_leaves_orange",
"hee:autumn_leaves_yellowgreen"
]
"values": []
}

View File

@@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"hee:whitebark_log",
"hee:whitebark"
]
}

View File

@@ -1,9 +1,4 @@
{
"replace": false,
"values": [
"hee:autumn_sapling_red",
"hee:autumn_sapling_brown",
"hee:autumn_sapling_orange",
"hee:autumn_sapling_yellowgreen"
]
"values": []
}

View File

@@ -1,10 +1,4 @@
{
"replace": false,
"values": [
"hee:gloomrock_brick_slab",
"hee:gloomrock_smooth_slab",
"hee:dusty_stone_brick_slab",
"hee:dark_loam_slab",
"hee:whitebark_slab"
]
"values": []
}

View File

@@ -1,10 +1,4 @@
{
"replace": false,
"values": [
"hee:gloomrock_brick_stairs",
"hee:gloomrock_smooth_stairs",
"hee:dusty_stone_brick_stairs",
"hee:obsidian_stairs",
"hee:whitebark_stairs"
]
"values": []
}

View File

@@ -1,6 +1,4 @@
{
"replace": false,
"values": [
"hee:stone_brick_wall"
]
"values": []
}

View File

@@ -1,9 +1,4 @@
{
"replace": false,
"values": [
"hee:autumn_leaves_red",
"hee:autumn_leaves_brown",
"hee:autumn_leaves_orange",
"hee:autumn_leaves_yellowgreen"
]
"values": []
}

View File

@@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"hee:whitebark_log",
"hee:whitebark"
]
}

View File

@@ -1,9 +1,4 @@
{
"replace": false,
"values": [
"hee:autumn_sapling_red",
"hee:autumn_sapling_brown",
"hee:autumn_sapling_orange",
"hee:autumn_sapling_yellowgreen"
]
"values": []
}

View File

@@ -1,10 +1,4 @@
{
"replace": false,
"values": [
"hee:gloomrock_brick_slab",
"hee:gloomrock_smooth_slab",
"hee:dusty_stone_brick_slab",
"hee:dark_loam_slab",
"hee:whitebark_slab"
]
"values": []
}

View File

@@ -1,10 +1,4 @@
{
"replace": false,
"values": [
"hee:gloomrock_brick_stairs",
"hee:gloomrock_smooth_stairs",
"hee:dusty_stone_brick_stairs",
"hee:obsidian_stairs",
"hee:whitebark_stairs"
]
"values": []
}

View File

@@ -1,6 +1,4 @@
{
"replace": false,
"values": [
"hee:stone_brick_wall"
]
"values": []
}

View File

@@ -1,15 +1,15 @@
package chylex.hee.datagen
import chylex.hee.HEE
import chylex.hee.datagen.client.BlockItemModels
import chylex.hee.datagen.client.BlockModels
import chylex.hee.datagen.client.BlockStates
import chylex.hee.datagen.client.ItemModels
import chylex.hee.datagen.client.LangEnglish
import chylex.hee.datagen.server.BlockLootTables
import chylex.hee.datagen.server.BlockTags
import chylex.hee.datagen.server.ItemTags
import chylex.hee.util.forge.SubscribeAllEvents
import net.minecraftforge.eventbus.api.SubscribeEvent
import chylex.hee.system.forge.SubscribeAllEvents
import chylex.hee.system.forge.SubscribeEvent
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent
@@ -22,10 +22,10 @@ object DataGen {
with(e.generator) {
if (e.includeClient()) {
addProvider(BlockModels(this, modid, helper))
addProvider(BlockStates(this, modid, helper))
addProvider(BlockModels(this, modid, helper))
addProvider(BlockItemModels(this, modid, helper))
addProvider(ItemModels(this, modid, helper))
addProvider(LangEnglish(this, modid))
}
if (e.includeServer()) {

View File

@@ -1,14 +1,53 @@
package chylex.hee.datagen
import chylex.hee.HEE
import chylex.hee.system.facades.Resource
import net.minecraft.block.Block
import net.minecraft.data.IDataProvider
import net.minecraft.item.Item
import net.minecraft.util.IItemProvider
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.generators.ModelBuilder
import net.minecraftforge.client.model.generators.ModelProvider
import net.minecraftforge.registries.IForgeRegistryEntry
val IForgeRegistryEntry<*>.path: String
get() = registryName!!.path
val IForgeRegistryEntry<*>.isVanilla
get() = Resource.isVanilla(registryName!!)
val IItemProvider.r
get() = when(this) {
is Block -> resource("block/" + this.path, this.isVanilla)
is Item -> resource("item/" + this.path, this.isVanilla)
else -> throw IllegalArgumentException()
}
fun IItemProvider.r(suffix: String): ResourceLocation {
return when(this) {
is Block -> resource("block/" + this.path + suffix, this.isVanilla)
is Item -> resource("item/" + this.path + suffix, this.isVanilla)
else -> throw IllegalArgumentException()
}
}
fun resource(path: String, vanilla: Boolean): ResourceLocation {
return if (vanilla) Resource.Vanilla(path) else Resource.Custom(path)
}
inline fun <T : IDataProvider> T?.safeUnit(callback: T.() -> Unit) {
try {
this?.callback()
} catch (e: Exception) {
} catch(e: Exception) {
HEE.log.error("[DataGen] " + e.message)
}
}
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safeUnit(callback: U.() -> Unit) {
try {
this?.callback()
} catch(e: Exception) {
HEE.log.error("[DataGen] " + e.message)
}
}
@@ -16,7 +55,7 @@ inline fun <T : IDataProvider> T?.safeUnit(callback: T.() -> Unit) {
inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safe(callback: U.() -> T): T? {
return try {
this?.callback()
} catch (e: Exception) {
} catch(e: Exception) {
HEE.log.error("[DataGen] " + e.message)
null
}
@@ -25,8 +64,12 @@ inline fun <T : ModelBuilder<T>, U : ModelProvider<T>> U?.safe(callback: U.() ->
inline fun <T : ModelBuilder<T>> T?.then(callback: T.() -> T): T? {
return try {
this?.callback()
} catch (e: Exception) {
} catch(e: Exception) {
HEE.log.error("[DataGen] " + e.message)
null
}
}
class Callback<T>(val item: T, val suffix: String, val path: String) {
override fun toString() = path
}

View File

@@ -0,0 +1,115 @@
package chylex.hee.datagen.client
import chylex.hee.datagen.client.util.block
import chylex.hee.datagen.client.util.multi
import chylex.hee.datagen.client.util.override
import chylex.hee.datagen.client.util.parent
import chylex.hee.datagen.client.util.simple
import chylex.hee.datagen.r
import chylex.hee.datagen.then
import chylex.hee.init.ModBlocks
import chylex.hee.system.facades.Resource
import net.minecraft.block.Blocks
import net.minecraft.data.DataGenerator
import net.minecraftforge.client.model.generators.ItemModelProvider
import net.minecraftforge.common.data.ExistingFileHelper
class BlockItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper) {
override fun registerModels() {
// Blocks: Building (Uncategorized)
parent(ModBlocks.STONE_BRICK_WALL, Resource.Custom("block/stone_brick_wall_inventory"), checkExistence = false)
parent(ModBlocks.INFUSED_GLASS, Resource.Custom("block/infused_glass_c0"))
block(ModBlocks.ENDERSOL)
block(ModBlocks.HUMUS)
// Blocks: Building (Gloomrock)
simple(ModBlocks.GLOOMTORCH.asItem())
// Blocks: Building (Grave Dirt)
parent(ModBlocks.GRAVE_DIRT_PLAIN, Resource.Custom("block/grave_dirt_low"))
parent(ModBlocks.GRAVE_DIRT_LOOT, Resource.Custom("block/grave_dirt_loot_4"), checkExistence = false)
parent(ModBlocks.GRAVE_DIRT_SPIDERLING, Resource.Custom("block/grave_dirt_low"))
// Blocks: Interactive (Storage)
parent(ModBlocks.DARK_CHEST, Blocks.CHEST.asItem().r)
parent(ModBlocks.LOOT_CHEST, Blocks.CHEST.asItem().r)
// Blocks: Interactive (Puzzle)
parent(ModBlocks.PUZZLE_PLAIN, Resource.Custom("block/puzzle_base_active"), checkExistence = false)
parent(ModBlocks.PUZZLE_BURST_3, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_burst_3"))
}
parent(ModBlocks.PUZZLE_BURST_5, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_burst_5"))
}
parent(ModBlocks.PUZZLE_REDIRECT_1, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_redirect_1n"))
}
parent(ModBlocks.PUZZLE_REDIRECT_2, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_redirect_2ns"))
}
parent(ModBlocks.PUZZLE_REDIRECT_4, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_redirect_4"))
}
parent(ModBlocks.PUZZLE_TELEPORT, Resource.Custom("block/puzzle_block_inventory")).then {
texture("top", Resource.Custom("block/puzzle_overlay_teleport"))
}
// Blocks: Interactive (Gates)
block(ModBlocks.EXPERIENCE_GATE)
// Blocks: Interactive (Uncategorized)
simple(ModBlocks.IGNEOUS_PLATE)
simple(ModBlocks.ENHANCED_BREWING_STAND.asItem())
// Blocks: Decorative (Trees)
simple(ModBlocks.WHITEBARK_SAPLING_AUTUMN_RED)
simple(ModBlocks.WHITEBARK_SAPLING_AUTUMN_BROWN)
simple(ModBlocks.WHITEBARK_SAPLING_AUTUMN_ORANGE)
simple(ModBlocks.WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
// Blocks: Decorative (Plants)
simple(ModBlocks.DEATH_FLOWER_DECAYING, ModBlocks.DEATH_FLOWER_DECAYING.r("_1")).then {
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_2")) { predicate(Resource.Custom("death_level"), 4F) }
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_3")) { predicate(Resource.Custom("death_level"), 8F) }
override(ModBlocks.DEATH_FLOWER_DECAYING.asItem().r("_4")) { predicate(Resource.Custom("death_level"), 12F) }
}
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("item/generated"), 1..4) {
texture("layer0", Resource.Custom("block/" + it.path))
}
simple(ModBlocks.DEATH_FLOWER_HEALED)
simple(ModBlocks.DEATH_FLOWER_WITHERED)
// Blocks: Decorative (Uncategorized)
simple(ModBlocks.ANCIENT_COBWEB)
simple(ModBlocks.DRY_VINES, Blocks.VINE.r)
block(ModBlocks.ENDERMAN_HEAD)
// Blocks: Energy
simple(ModBlocks.ENERGY_CLUSTER)
// Blocks: Tables
block(ModBlocks.TABLE_PEDESTAL)
}
}

View File

@@ -1,74 +1,220 @@
package chylex.hee.datagen.client
import chylex.hee.datagen.client.util.cauldron
import chylex.hee.datagen.client.util.cross
import chylex.hee.datagen.client.util.cube
import chylex.hee.datagen.client.util.cubeBottomTop
import chylex.hee.datagen.client.util.cubeColumn
import chylex.hee.datagen.client.util.flowerPot
import chylex.hee.datagen.client.util.leaves
import chylex.hee.datagen.client.util.multi
import chylex.hee.datagen.client.util.parent
import chylex.hee.datagen.client.util.particle
import chylex.hee.datagen.client.util.portalFrame
import chylex.hee.datagen.client.util.simple
import chylex.hee.datagen.client.util.suffixed
import chylex.hee.datagen.client.util.table
import chylex.hee.datagen.client.util.wall
import chylex.hee.datagen.r
import chylex.hee.datagen.then
import chylex.hee.game.Resource.location
import chylex.hee.game.block.BlockAbstractTable
import chylex.hee.game.block.IHeeBlock
import chylex.hee.game.block.properties.BlockModel
import chylex.hee.game.block.properties.BlockModel.CubeBottomTop
import chylex.hee.game.block.properties.BlockModel.CubeColumn
import chylex.hee.game.block.properties.BlockModel.Fluid
import chylex.hee.game.block.properties.BlockModel.FromParent
import chylex.hee.game.block.properties.BlockModel.Manual
import chylex.hee.game.block.properties.BlockModel.Multi
import chylex.hee.game.block.properties.BlockModel.NoAmbientOcclusion
import chylex.hee.game.block.properties.BlockModel.Parent
import chylex.hee.game.block.properties.BlockModel.ParticleOnly
import chylex.hee.game.block.properties.BlockModel.PortalFrame
import chylex.hee.game.block.properties.BlockModel.SimpleBlockModel
import chylex.hee.game.block.properties.BlockModel.Suffixed
import chylex.hee.game.block.properties.BlockModel.Table
import chylex.hee.game.block.properties.BlockModel.WithTextures
import chylex.hee.init.ModBlocks
import net.minecraft.block.Block
import chylex.hee.system.facades.Resource
import net.minecraft.block.Blocks
import net.minecraft.data.DataGenerator
import net.minecraftforge.client.model.generators.BlockModelBuilder
import net.minecraftforge.client.model.generators.BlockModelProvider
import net.minecraftforge.common.data.ExistingFileHelper
class BlockModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockModelProvider(generator, modid, existingFileHelper) {
override fun registerModels() {
for (block in ModBlocks.ALL) {
(block as? IHeeBlock)?.model?.let { registerModel(block, it.blockModel) { builder -> builder } }
// Blocks: Building (Uncategorized)
wall(ModBlocks.STONE_BRICK_WALL, Blocks.STONE_BRICKS.r)
simple(ModBlocks.STONE_BRICK_WALL.suffixed("_inventory"), Resource.Vanilla("block/wall_inventory"), "wall", Blocks.STONE_BRICKS.r)
cubeColumn(ModBlocks.ENDERSOL)
cubeBottomTop(ModBlocks.ENDERSOL.suffixed("_merge_1"), ModBlocks.ENDERSOL.r("_merge_1"), Blocks.END_STONE.r, ModBlocks.ENDERSOL.r("_top"))
cubeBottomTop(ModBlocks.ENDERSOL.suffixed("_merge_2"), ModBlocks.ENDERSOL.r("_merge_2"), Blocks.END_STONE.r, ModBlocks.ENDERSOL.r("_top"))
cube(ModBlocks.HUMUS)
cubeBottomTop(ModBlocks.HUMUS.suffixed("_merge"), ModBlocks.HUMUS.r("_merge"), ModBlocks.ENDERSOL.r("_top"), ModBlocks.HUMUS.r)
// Blocks: Building (Obsidian)
cube(ModBlocks.OBSIDIAN_FALLING, Blocks.OBSIDIAN.r)
// Blocks: Building (End Stone)
cubeBottomTop(ModBlocks.END_STONE_INFESTED, bottom = Blocks.END_STONE.r).then {
texture("particle", ModBlocks.END_STONE_INFESTED.r("_top"))
}
cubeBottomTop(ModBlocks.END_STONE_BURNED, bottom = Blocks.END_STONE.r).then {
texture("particle", ModBlocks.END_STONE_BURNED.r("_top"))
}
cubeBottomTop(ModBlocks.END_STONE_ENCHANTED, bottom = Blocks.END_STONE.r).then {
texture("particle", ModBlocks.END_STONE_ENCHANTED.r("_top"))
}
// Blocks: Building (Grave Dirt)
cube(ModBlocks.GRAVE_DIRT_PLAIN.suffixed("_full"), ModBlocks.GRAVE_DIRT_PLAIN.r).then {
texture("particle", ModBlocks.GRAVE_DIRT_PLAIN.r)
}
multi(ModBlocks.GRAVE_DIRT_LOOT, Resource.Custom("block/grave_dirt_low"), 1..6) {
texture("top", Resource.Custom("block/$it"))
}
// Blocks: Building (Wood)
cube(ModBlocks.WHITEBARK, ModBlocks.WHITEBARK_LOG.r)
// Blocks: Fluids
particle(ModBlocks.ENDER_GOO, ModBlocks.ENDER_GOO.r("_still"))
particle(ModBlocks.PURIFIED_ENDER_GOO, ModBlocks.PURIFIED_ENDER_GOO.r("_still"))
cauldron(ModBlocks.CAULDRON_ENDER_GOO, ModBlocks.ENDER_GOO.r("_still"))
cauldron(ModBlocks.CAULDRON_PURIFIED_ENDER_GOO, ModBlocks.PURIFIED_ENDER_GOO.r("_still"))
cauldron(ModBlocks.CAULDRON_DRAGONS_BREATH, Resource.Custom("block/dragons_breath_still"))
// Blocks: Interactive (Storage)
particle(ModBlocks.DARK_CHEST, ModBlocks.GLOOMROCK_SMOOTH.r)
parent(ModBlocks.LOOT_CHEST, Resource.Vanilla("block/block")).then {
texture("particle", ModBlocks.LOOT_CHEST.r("_particle"))
}
// Blocks: Interactive (Puzzle)
arrayOf("active", "disabled", "inactive").forEach {
parent("puzzle_base_$it", Resource.Vanilla("block/cube_all")).then {
texture("all", Resource.Custom("block/puzzle_base_$it"))
}
}
private fun registerModel(block: Block, model: BlockModel, callback: (BlockModelBuilder) -> BlockModelBuilder) {
when (model) {
is SimpleBlockModel -> simple(block, model.parent, model.textureName, model.textureLocation ?: block.location)?.then(callback)
is CubeBottomTop -> cubeBottomTop(block, model.side ?: block.location("_side"), model.bottom ?: block.location("_bottom"), model.top ?: block.location("_top"))?.then(callback)
is PortalFrame -> portalFrame(block, model.frameBlock.location("_side"), model.frameBlock.location("_top_" + model.topSuffix))?.then(callback)
is ParticleOnly -> particle(block, model.particle)?.then(callback)
is Parent -> parent(model.name, model.parent)?.then(callback)
is FromParent -> parent(block, model.parent)?.then(callback)
is Suffixed -> registerModel(block.suffixed(model.suffix), model.wrapped, callback)
is WithTextures -> registerModel(block, model.baseModel) {
model.textures.entries.fold(callback(it)) { builder, (name, location) -> builder.texture(name, location) }
}
is NoAmbientOcclusion -> registerModel(block, model.baseModel) {
callback(it).ao(false)
}
is Multi -> {
for (innerModel in model.models) {
registerModel(block, innerModel, callback)
arrayOf("burst_3", "burst_5", "redirect_1e", "redirect_1n", "redirect_1s", "redirect_1w", "redirect_2ew", "redirect_2ns", "redirect_4", "teleport").forEach {
parent("puzzle_overlay_$it", Resource.Custom("block/puzzle_overlay")).then {
texture("overlay", Resource.Custom("block/puzzle_overlay_$it"))
}
}
CubeColumn -> cubeColumn(block)?.then(callback)
Table -> table(block as BlockAbstractTable)?.then(callback)
Fluid -> particle(block, block.location("_still"))?.then(callback)
Manual -> return
// Blocks: Interactive (Gates)
cubeBottomTop(ModBlocks.EXPERIENCE_GATE, top = ModBlocks.EXPERIENCE_GATE.r("_bottom"))
multi(ModBlocks.EXPERIENCE_GATE, ModBlocks.EXPERIENCE_GATE.r, arrayOf("_rd1", "_rd2", "_ud")) {
texture("top", Resource.Custom("block/experience_gate_top" + it.suffix))
}
cubeBottomTop(ModBlocks.EXPERIENCE_GATE_CONTROLLER, ModBlocks.EXPERIENCE_GATE.r("_side"), ModBlocks.EXPERIENCE_GATE.r("_bottom"), ModBlocks.EXPERIENCE_GATE.r("_top_controller"))
// Blocks: Interactive (Uncategorized)
cubeBottomTop(ModBlocks.INFUSED_TNT, Blocks.TNT.r("_side"), Blocks.TNT.r("_bottom"), Blocks.TNT.r("_top"))
particle(ModBlocks.IGNEOUS_PLATE, ModBlocks.IGNEOUS_PLATE.r)
parent(ModBlocks.ENHANCED_BREWING_STAND, Blocks.BREWING_STAND.r).then {
texture("particle", Blocks.BREWING_STAND.r)
texture("base", Blocks.BREWING_STAND.r("_base"))
texture("stand", ModBlocks.ENHANCED_BREWING_STAND.r)
}
// Blocks: Ores
parent(ModBlocks.STARDUST_ORE, Resource.Custom("block/cube_overlay")).then {
texture("particle", ModBlocks.STARDUST_ORE.r("_particle"))
texture("base", Blocks.END_STONE.r)
}
// Blocks: Decorative (Trees)
cross(ModBlocks.WHITEBARK_SAPLING_AUTUMN_RED)
cross(ModBlocks.WHITEBARK_SAPLING_AUTUMN_BROWN)
cross(ModBlocks.WHITEBARK_SAPLING_AUTUMN_ORANGE)
cross(ModBlocks.WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
leaves(ModBlocks.WHITEBARK_LEAVES_AUTUMN_RED)
leaves(ModBlocks.WHITEBARK_LEAVES_AUTUMN_BROWN)
leaves(ModBlocks.WHITEBARK_LEAVES_AUTUMN_ORANGE)
leaves(ModBlocks.WHITEBARK_LEAVES_AUTUMN_YELLOWGREEN)
flowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_RED, ModBlocks.WHITEBARK_SAPLING_AUTUMN_RED)
flowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_BROWN, ModBlocks.WHITEBARK_SAPLING_AUTUMN_BROWN)
flowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_ORANGE, ModBlocks.WHITEBARK_SAPLING_AUTUMN_ORANGE)
flowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN, ModBlocks.WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
// Blocks: Decorative (Plants)
multi(ModBlocks.DEATH_FLOWER_DECAYING, Resource.Vanilla("block/cross"), 1..4) {
texture("cross", Resource.Custom("block/$it"))
}
cross(ModBlocks.DEATH_FLOWER_HEALED)
cross(ModBlocks.DEATH_FLOWER_WITHERED)
multi(ModBlocks.POTTED_DEATH_FLOWER_DECAYING, Resource.Vanilla("block/flower_pot_cross"), 1..4) {
texture("plant", Resource.Custom("block/death_flower" + it.suffix))
}
flowerPot(ModBlocks.POTTED_DEATH_FLOWER_HEALED, ModBlocks.DEATH_FLOWER_HEALED)
flowerPot(ModBlocks.POTTED_DEATH_FLOWER_WITHERED, ModBlocks.DEATH_FLOWER_WITHERED)
// Blocks: Decorative (Uncategorized)
cross(ModBlocks.ANCIENT_COBWEB)
// Blocks: Portals
portalFrame(ModBlocks.END_PORTAL_FRAME, ModBlocks.END_PORTAL_FRAME.r("_side"), ModBlocks.END_PORTAL_FRAME.r("_top_plain"))
portalFrame(ModBlocks.END_PORTAL_ACCEPTOR, ModBlocks.END_PORTAL_FRAME.r("_side"), ModBlocks.END_PORTAL_FRAME.r("_top_acceptor"))
portalFrame(ModBlocks.VOID_PORTAL_FRAME, ModBlocks.VOID_PORTAL_FRAME.r("_side"), ModBlocks.VOID_PORTAL_FRAME.r("_top_plain"))
portalFrame(ModBlocks.VOID_PORTAL_STORAGE, ModBlocks.VOID_PORTAL_FRAME.r("_side"), ModBlocks.VOID_PORTAL_FRAME.r("_top_storage"))
portalFrame(ModBlocks.VOID_PORTAL_FRAME_CRAFTED, ModBlocks.VOID_PORTAL_FRAME.r("_side"), ModBlocks.VOID_PORTAL_FRAME.r("_top_plain"))
portalFrame(ModBlocks.VOID_PORTAL_STORAGE_CRAFTED, ModBlocks.VOID_PORTAL_FRAME.r("_side"), ModBlocks.VOID_PORTAL_FRAME.r("_top_storage"))
// Blocks: Energy
cross(ModBlocks.CORRUPTED_ENERGY, Blocks.BARRIER.asItem().r).then { ao(false) }
// Blocks: Tables
for(tier in 1..3) {
parent("table_tier_$tier", Resource.Custom("block/table")).then {
texture("particle", "hee:block/table_base")
texture("bottom", "hee:block/table_base")
texture("top", "hee:block/table_base")
texture("side", "hee:block/table_base_side_$tier")
}
}
parent(ModBlocks.TABLE_BASE_TIER_1, Resource.Custom("block/table_tier_1")).then {
Resource.Custom("block/transparent").let {
texture("overlay_top", it)
texture("overlay_side", it)
}
}
parent(ModBlocks.TABLE_BASE_TIER_2, Resource.Custom("block/table_tier_2")).then {
Resource.Custom("block/transparent").let {
texture("overlay_top", it)
texture("overlay_side", it)
}
}
parent(ModBlocks.TABLE_BASE_TIER_3, Resource.Custom("block/table_tier_3")).then {
Resource.Custom("block/transparent").let {
texture("overlay_top", it)
texture("overlay_side", it)
}
}
table(ModBlocks.ACCUMULATION_TABLE_TIER_1)
table(ModBlocks.ACCUMULATION_TABLE_TIER_2)
table(ModBlocks.ACCUMULATION_TABLE_TIER_3)
table(ModBlocks.EXPERIENCE_TABLE_TIER_1)
table(ModBlocks.EXPERIENCE_TABLE_TIER_2)
table(ModBlocks.EXPERIENCE_TABLE_TIER_3)
table(ModBlocks.INFUSION_TABLE_TIER_1)
table(ModBlocks.INFUSION_TABLE_TIER_2)
table(ModBlocks.INFUSION_TABLE_TIER_3)
}
}

View File

@@ -1,53 +1,191 @@
package chylex.hee.datagen.client
import chylex.hee.datagen.client.util.cauldron
import chylex.hee.datagen.client.util.cube
import chylex.hee.datagen.client.util.log
import chylex.hee.datagen.client.util.pillar
import chylex.hee.datagen.client.util.simpleStateAndItem
import chylex.hee.datagen.client.util.simpleStateOnly
import chylex.hee.datagen.client.util.slab
import chylex.hee.datagen.client.util.stairs
import chylex.hee.datagen.client.util.wall
import chylex.hee.game.block.IHeeBlock
import chylex.hee.game.block.properties.BlockStatePreset
import chylex.hee.game.block.properties.BlockStatePreset.Cauldron
import chylex.hee.game.block.properties.BlockStatePreset.Log
import chylex.hee.game.block.properties.BlockStatePreset.None
import chylex.hee.game.block.properties.BlockStatePreset.Pillar
import chylex.hee.game.block.properties.BlockStatePreset.PillarFrom
import chylex.hee.game.block.properties.BlockStatePreset.Simple
import chylex.hee.game.block.properties.BlockStatePreset.SimpleFrom
import chylex.hee.game.block.properties.BlockStatePreset.Slab
import chylex.hee.game.block.properties.BlockStatePreset.Stairs
import chylex.hee.game.block.properties.BlockStatePreset.Wall
import chylex.hee.datagen.r
import chylex.hee.init.ModBlocks
import net.minecraft.block.Block
import net.minecraft.block.RotatedPillarBlock
import net.minecraft.block.SlabBlock
import net.minecraft.block.StairsBlock
import net.minecraft.block.WallBlock
import net.minecraft.block.Blocks
import net.minecraft.data.DataGenerator
import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.common.data.ExistingFileHelper
class BlockStates(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : BlockStateProvider(generator, modid, existingFileHelper) {
override fun registerStatesAndModels() {
for (block in ModBlocks.ALL) {
(block as? IHeeBlock)?.model?.let { registerState(block, it.blockState) }
}
}
private fun registerState(block: Block, model: BlockStatePreset) {
when (model) {
None -> return
Simple -> simpleStateOnly(block)
is SimpleFrom -> simpleStateOnly(block, model.modelBlock)
Pillar -> pillar(block as RotatedPillarBlock)
is PillarFrom -> pillar(block as RotatedPillarBlock, model.modelBlock)
is Stairs -> stairs(block as StairsBlock, model.fullBlock, model.side)
is Slab -> slab(block as SlabBlock, model.fullBlock, model.side)
is Wall -> wall(block as WallBlock, model.fullBlock)
is Cauldron -> cauldron(block, model.fluidTexture)
Log -> log(block as RotatedPillarBlock)
}
// Blocks: Building (Uncategorized)
cube(ModBlocks.ETHEREAL_LANTERN)
cube(ModBlocks.VANTABLOCK)
cube(ModBlocks.ENDIUM_BLOCK)
// Blocks: Building (Gloomrock)
cube(ModBlocks.GLOOMROCK)
cube(ModBlocks.GLOOMROCK_BRICKS)
stairs(ModBlocks.GLOOMROCK_BRICK_STAIRS, ModBlocks.GLOOMROCK_BRICKS)
slab(ModBlocks.GLOOMROCK_BRICK_SLAB, ModBlocks.GLOOMROCK_BRICKS)
cube(ModBlocks.GLOOMROCK_SMOOTH)
stairs(ModBlocks.GLOOMROCK_SMOOTH_STAIRS, ModBlocks.GLOOMROCK_SMOOTH, side = ModBlocks.GLOOMROCK_SMOOTH_SLAB.r("_side"))
slab(ModBlocks.GLOOMROCK_SMOOTH_SLAB, ModBlocks.GLOOMROCK_SMOOTH, side = ModBlocks.GLOOMROCK_SMOOTH_SLAB.r("_side"))
cube(ModBlocks.GLOOMROCK_SMOOTH_RED)
cube(ModBlocks.GLOOMROCK_SMOOTH_ORANGE)
cube(ModBlocks.GLOOMROCK_SMOOTH_YELLOW)
cube(ModBlocks.GLOOMROCK_SMOOTH_GREEN)
cube(ModBlocks.GLOOMROCK_SMOOTH_CYAN)
cube(ModBlocks.GLOOMROCK_SMOOTH_BLUE)
cube(ModBlocks.GLOOMROCK_SMOOTH_PURPLE)
cube(ModBlocks.GLOOMROCK_SMOOTH_MAGENTA)
cube(ModBlocks.GLOOMROCK_SMOOTH_WHITE)
// Blocks: Building (Dusty Stone)
cube(ModBlocks.DUSTY_STONE)
cube(ModBlocks.DUSTY_STONE_CRACKED)
cube(ModBlocks.DUSTY_STONE_DAMAGED)
cube(ModBlocks.DUSTY_STONE_BRICKS)
cube(ModBlocks.DUSTY_STONE_CRACKED_BRICKS)
cube(ModBlocks.DUSTY_STONE_DECORATION)
stairs(ModBlocks.DUSTY_STONE_BRICK_STAIRS, ModBlocks.DUSTY_STONE_BRICKS)
slab(ModBlocks.DUSTY_STONE_BRICK_SLAB, ModBlocks.DUSTY_STONE_BRICKS)
// Blocks: Building (Obsidian)
stairs(ModBlocks.OBSIDIAN_STAIRS, Blocks.OBSIDIAN)
simpleStateAndItem(ModBlocks.OBSIDIAN_FALLING)
cube(ModBlocks.OBSIDIAN_SMOOTH)
cube(ModBlocks.OBSIDIAN_CHISELED)
pillar(ModBlocks.OBSIDIAN_PILLAR)
cube(ModBlocks.OBSIDIAN_SMOOTH_LIT, ModBlocks.OBSIDIAN_SMOOTH)
cube(ModBlocks.OBSIDIAN_CHISELED_LIT, ModBlocks.OBSIDIAN_CHISELED)
pillar(ModBlocks.OBSIDIAN_PILLAR_LIT, ModBlocks.OBSIDIAN_PILLAR)
cube(ModBlocks.OBSIDIAN_TOWER_TOP, ModBlocks.OBSIDIAN_CHISELED)
// Blocks: Building (End Stone)
simpleStateAndItem(ModBlocks.END_STONE_INFESTED)
simpleStateAndItem(ModBlocks.END_STONE_BURNED)
simpleStateAndItem(ModBlocks.END_STONE_ENCHANTED)
// Blocks: Building (Dark Loam)
cube(ModBlocks.DARK_LOAM)
slab(ModBlocks.DARK_LOAM_SLAB, ModBlocks.DARK_LOAM)
// Blocks: Building (Wood)
log(ModBlocks.WHITEBARK_LOG)
simpleStateAndItem(ModBlocks.WHITEBARK)
cube(ModBlocks.WHITEBARK_PLANKS)
stairs(ModBlocks.WHITEBARK_STAIRS, ModBlocks.WHITEBARK_PLANKS)
slab(ModBlocks.WHITEBARK_SLAB, ModBlocks.WHITEBARK_PLANKS)
// Blocks: Building (Miner's Burial)
cube(ModBlocks.MINERS_BURIAL_BLOCK_PLAIN)
cube(ModBlocks.MINERS_BURIAL_BLOCK_CHISELED)
pillar(ModBlocks.MINERS_BURIAL_BLOCK_PILLAR)
cube(ModBlocks.MINERS_BURIAL_BLOCK_JAIL)
simpleStateAndItem(ModBlocks.MINERS_BURIAL_ALTAR)
// Blocks: Fluids
simpleStateOnly(ModBlocks.ENDER_GOO)
simpleStateOnly(ModBlocks.PURIFIED_ENDER_GOO)
// Blocks: Interactive (Storage)
simpleStateOnly(ModBlocks.JAR_O_DUST)
simpleStateOnly(ModBlocks.DARK_CHEST)
simpleStateOnly(ModBlocks.LOOT_CHEST)
// Blocks: Interactive (Puzzle)
cube(ModBlocks.PUZZLE_WALL)
// Blocks: Interactive (Gates)
simpleStateAndItem(ModBlocks.EXPERIENCE_GATE_CONTROLLER)
// Blocks: Interactive (Uncategorized)
simpleStateAndItem(ModBlocks.INFUSED_TNT)
simpleStateOnly(ModBlocks.IGNEOUS_PLATE)
// Blocks: Ores
cube(ModBlocks.END_POWDER_ORE)
cube(ModBlocks.ENDIUM_ORE)
cube(ModBlocks.IGNEOUS_ROCK_ORE)
// Blocks: Decorative (Trees)
simpleStateOnly(ModBlocks.WHITEBARK_SAPLING_AUTUMN_RED)
simpleStateOnly(ModBlocks.WHITEBARK_SAPLING_AUTUMN_BROWN)
simpleStateOnly(ModBlocks.WHITEBARK_SAPLING_AUTUMN_ORANGE)
simpleStateOnly(ModBlocks.WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
simpleStateAndItem(ModBlocks.WHITEBARK_LEAVES_AUTUMN_RED)
simpleStateAndItem(ModBlocks.WHITEBARK_LEAVES_AUTUMN_BROWN)
simpleStateAndItem(ModBlocks.WHITEBARK_LEAVES_AUTUMN_ORANGE)
simpleStateAndItem(ModBlocks.WHITEBARK_LEAVES_AUTUMN_YELLOWGREEN)
simpleStateOnly(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_RED)
simpleStateOnly(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_BROWN)
simpleStateOnly(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_ORANGE)
simpleStateOnly(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
// Blocks: Decorative (Plants)
simpleStateOnly(ModBlocks.DEATH_FLOWER_HEALED)
simpleStateOnly(ModBlocks.DEATH_FLOWER_WITHERED)
simpleStateOnly(ModBlocks.POTTED_DEATH_FLOWER_HEALED)
simpleStateOnly(ModBlocks.POTTED_DEATH_FLOWER_WITHERED)
// Blocks: Decorative (Uncategorized)
simpleStateOnly(ModBlocks.ANCIENT_COBWEB)
simpleStateOnly(ModBlocks.ENDERMAN_HEAD, Blocks.SOUL_SAND)
simpleStateOnly(ModBlocks.ENDERMAN_WALL_HEAD, Blocks.SOUL_SAND)
// Blocks: Spawners
simpleStateOnly(ModBlocks.SPAWNER_OBSIDIAN_TOWERS, Blocks.SPAWNER)
// Blocks: Portals
simpleStateOnly(ModBlocks.END_PORTAL_INNER, Blocks.END_PORTAL)
simpleStateAndItem(ModBlocks.END_PORTAL_FRAME)
simpleStateAndItem(ModBlocks.END_PORTAL_ACCEPTOR)
simpleStateOnly(ModBlocks.VOID_PORTAL_INNER, Blocks.END_PORTAL)
simpleStateAndItem(ModBlocks.VOID_PORTAL_FRAME)
simpleStateAndItem(ModBlocks.VOID_PORTAL_STORAGE)
simpleStateAndItem(ModBlocks.VOID_PORTAL_FRAME_CRAFTED)
simpleStateAndItem(ModBlocks.VOID_PORTAL_STORAGE_CRAFTED)
// Blocks: Energy
simpleStateAndItem(ModBlocks.CORRUPTED_ENERGY)
// Blocks: Tables
simpleStateAndItem(ModBlocks.TABLE_BASE_TIER_1)
simpleStateAndItem(ModBlocks.TABLE_BASE_TIER_2)
simpleStateAndItem(ModBlocks.TABLE_BASE_TIER_3)
simpleStateAndItem(ModBlocks.ACCUMULATION_TABLE_TIER_1)
simpleStateAndItem(ModBlocks.ACCUMULATION_TABLE_TIER_2)
simpleStateAndItem(ModBlocks.ACCUMULATION_TABLE_TIER_3)
simpleStateAndItem(ModBlocks.EXPERIENCE_TABLE_TIER_1)
simpleStateAndItem(ModBlocks.EXPERIENCE_TABLE_TIER_2)
simpleStateAndItem(ModBlocks.EXPERIENCE_TABLE_TIER_3)
simpleStateAndItem(ModBlocks.INFUSION_TABLE_TIER_1)
simpleStateAndItem(ModBlocks.INFUSION_TABLE_TIER_2)
simpleStateAndItem(ModBlocks.INFUSION_TABLE_TIER_3)
// Blocks: Utilities
simpleStateAndItem(ModBlocks.SCAFFOLDING)
}
}

View File

@@ -1,108 +1,166 @@
package chylex.hee.datagen.client
import chylex.hee.datagen.client.util.block
import chylex.hee.datagen.client.util.layers
import chylex.hee.datagen.client.util.multi
import chylex.hee.datagen.client.util.override
import chylex.hee.datagen.client.util.parent
import chylex.hee.datagen.client.util.simple
import chylex.hee.datagen.client.util.suffixed
import chylex.hee.datagen.r
import chylex.hee.datagen.then
import chylex.hee.game.Resource
import chylex.hee.game.Resource.location
import chylex.hee.game.block.IHeeBlock
import chylex.hee.game.item.IHeeItem
import chylex.hee.game.item.properties.ItemModel
import chylex.hee.game.item.properties.ItemModel.AsBlock
import chylex.hee.game.item.properties.ItemModel.Copy
import chylex.hee.game.item.properties.ItemModel.FromParent
import chylex.hee.game.item.properties.ItemModel.Layers
import chylex.hee.game.item.properties.ItemModel.Manual
import chylex.hee.game.item.properties.ItemModel.Multi
import chylex.hee.game.item.properties.ItemModel.Named
import chylex.hee.game.item.properties.ItemModel.Simple
import chylex.hee.game.item.properties.ItemModel.SingleItemModel
import chylex.hee.game.item.properties.ItemModel.Skull
import chylex.hee.game.item.properties.ItemModel.SpawnEgg
import chylex.hee.game.item.properties.ItemModel.Suffixed
import chylex.hee.game.item.properties.ItemModel.Wall
import chylex.hee.game.item.properties.ItemModel.WithOverrides
import chylex.hee.game.item.properties.ItemModel.WithTextures
import chylex.hee.init.ModBlocks
import chylex.hee.init.ModItems
import net.minecraft.block.Block
import chylex.hee.system.facades.Resource
import net.minecraft.data.DataGenerator
import net.minecraft.util.IItemProvider
import net.minecraftforge.client.model.generators.ItemModelBuilder
import net.minecraft.item.Items
import net.minecraftforge.client.model.generators.ItemModelProvider
import net.minecraftforge.common.data.ExistingFileHelper
class ItemModels(generator: DataGenerator, modid: String, existingFileHelper: ExistingFileHelper) : ItemModelProvider(generator, modid, existingFileHelper) {
override fun registerModels() {
for (item in ModItems.ALL) {
(item as? IHeeItem)?.model?.let {
registerModel(item, it)
}
// Items: Raw Resources
simple(ModItems.ETHEREUM)
simple(ModItems.ANCIENT_DUST)
simple(ModItems.END_POWDER)
simple(ModItems.STARDUST)
simple(ModItems.ENDIUM_INGOT)
simple(ModItems.ENDIUM_NUGGET)
simple(ModItems.OBSIDIAN_FRAGMENT)
simple(ModItems.IGNEOUS_ROCK)
simple(ModItems.PUZZLE_MEDALLION)
simple(ModItems.INFERNIUM)
simple(ModItems.INFERNIUM_INGOT)
simple(ModItems.AURICION)
simple(ModItems.DRAGON_SCALE)
simple(ModItems.INSTABILITY_ORB)
simple(ModItems.ECTOPLASM)
simple(ModItems.ENCHANTED_CLAW)
// Items: Manufactured Resources
simple(ModItems.ALTERATION_NEXUS)
simple(ModItems.VOID_ESSENCE)
simple(ModItems.OBSIDIAN_ROD)
simple(ModItems.PURITY_EXTRACT)
simple(ModItems.STATIC_CORE)
simple(ModItems.TICKING_CORE)
simple(ModItems.DIRTY_INFERNIUM_INGOT)
simple(ModItems.AMELIOR)
simple(ModItems.REVITALIZATION_SUBSTANCE)
layers(ModItems.BINDING_ESSENCE, arrayOf("binding_essence_primary", "binding_essence_secondary", "binding_essence_tertiary", "binding_essence_quaternary"))
// Items: Nature & Food
simple(ModItems.COMPOST)
simple(ModItems.VOID_SALAD).then {
override(Resource.Custom("item/void_void_salad")) { predicate(Resource.Custom("void_salad_type"), 1F) }
override(Resource.Custom("item/mega_void_salad")) { predicate(Resource.Custom("void_salad_type"), 2F) }
}
for (block in ModBlocks.ALL) {
(block as? IHeeBlock)?.model?.itemModel?.let {
registerModel(if (it.asItem) block.asItem() else block, it.model)
}
}
simple("void_void_salad")
simple("mega_void_salad")
// Items: Table Cores
simple(ModItems.ACCUMULATION_TABLE_CORE)
simple(ModItems.EXPERIENCE_TABLE_CORE)
simple(ModItems.INFUSION_TABLE_CORE)
// Items: Utilities
simple(ModItems.TABLE_LINK)
simple(ModItems.KNOWLEDGE_NOTE)
parent(ModItems.ENDERMAN_HEAD, Resource.Vanilla("item/template_skull"))
simple(ModItems.EXPERIENCE_BOTTLE, Items.EXPERIENCE_BOTTLE.r)
// Items: Tools
simple(ModItems.VOID_MINER)
simple(ModItems.VOID_BUCKET).then {
override(ModItems.VOID_BUCKET.r("_fluid_level_1")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.01F) }
override(ModItems.VOID_BUCKET.r("_fluid_level_2")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.3F) }
override(ModItems.VOID_BUCKET.r("_fluid_level_3")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.5F) }
override(ModItems.VOID_BUCKET.r("_fluid_level_4")) { predicate(Resource.Custom("void_bucket_cooldown"), 0.7F) }
}
private fun registerModel(item: IItemProvider, model: ItemModel) {
registerModel(item, model) { it }
multi(ModItems.VOID_BUCKET, Resource.Vanilla("item/generated"), Array(4) { "_fluid_level_${it + 1}" }) {
texture("layer0", Resource.Custom("item/void_bucket"))
texture("layer1", Resource.Custom("item/$it"))
}
private fun registerModel(item: IItemProvider, model: ItemModel, callback: (ItemModelBuilder) -> ItemModelBuilder) {
when (model) {
is SingleItemModel -> registerSingleModel(item, model, callback)
simple(ModItems.SCORCHING_PICKAXE)
simple(ModItems.SCORCHING_SHOVEL)
simple(ModItems.SCORCHING_AXE)
simple(ModItems.SCORCHING_SWORD)
simple(ModItems.FLINT_AND_INFERNIUM)
is WithTextures -> registerModel(item, model.baseModel) {
model.textures.entries.fold(callback(it)) { builder, (name, location) -> builder.texture(name, location) }
// Items: Fluids
simple(ModItems.ENDER_GOO_BUCKET)
simple(ModItems.PURIFIED_ENDER_GOO_BUCKET)
// Items: Energy
layers(ModItems.ENERGY_ORACLE, arrayOf("energy_oracle", "energy_oracle_indicator_inactive")).then {
override(ModItems.ENERGY_ORACLE.r("_active_mild")) { predicate(Resource.Custom("activity_intensity"), 0.5F) }
override(ModItems.ENERGY_ORACLE.r("_active_full")) { predicate(Resource.Custom("activity_intensity"), 1F) }
}
is WithOverrides -> registerModel(item, model.baseModel) {
var builder = callback(it)
for ((property, valueMap) in model.overrides) {
for ((value, overrideModel) in valueMap) {
registerSingleModel(item, overrideModel)
builder = builder.override(overrideModel.getLocation(item.asItem())) {
predicate(property.name, value)
}
}
multi(ModItems.ENERGY_ORACLE, Resource.Vanilla("item/generated"), arrayOf("_active_mild", "_active_full")) {
texture("layer0", Resource.Custom("item/energy_oracle"))
texture("layer1", Resource.Custom("item/energy_oracle_indicator" + it.suffix))
}
builder
simple(ModItems.ENERGY_RECEPTACLE).then {
override(ModItems.ENERGY_RECEPTACLE.r("_with_cluster")) { predicate(Resource.Custom("has_cluster"), 1F) }
}
is Multi -> {
for (innerModel in model.models) {
registerModel(item, innerModel, callback)
}
}
}
layers(ModItems.ENERGY_RECEPTACLE.suffixed("_with_cluster"), arrayOf("energy_receptacle", "energy_receptacle_cluster"))
// Items: Gems & Teleportation
simple(ModItems.INFUSED_ENDER_PEARL, Items.ENDER_PEARL.r)
simple(ModItems.SPATIAL_DASH_GEM)
simple(ModItems.LINKING_GEM)
layers(ModItems.PORTAL_TOKEN, arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom")).then {
override(ModItems.PORTAL_TOKEN.r("_rare")) { predicate(Resource.Custom("token_type"), 1F) }
override(ModItems.PORTAL_TOKEN.r("_rare_corrupted")) { predicate(Resource.Custom("token_type"), 1.5F) }
override(ModItems.PORTAL_TOKEN.r("_solitary")) { predicate(Resource.Custom("token_type"), 2F) }
}
private fun registerSingleModel(item: IItemProvider, model: SingleItemModel) {
registerSingleModel(item, model) { it }
layers(ModItems.PORTAL_TOKEN.suffixed("_rare"), arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom", "portal_token_border_rare"))
layers(ModItems.PORTAL_TOKEN.suffixed("_rare_corrupted"), arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom", "portal_token_border_rare", "portal_token_corruption"))
layers(ModItems.PORTAL_TOKEN.suffixed("_solitary"), arrayOf("portal_token_outline", "portal_token_color_top", "portal_token_color_bottom", "portal_token_border_solitary"))
simple(ModItems.BLANK_TOKEN)
// Items: Trinkets
simple(ModItems.TRINKET_POUCH)
simple(ModItems.TOTEM_OF_UNDYING).then {
override(ModItems.TOTEM_OF_UNDYING.r("_shaking")) { predicate(Resource.Custom("is_shaking"), 1F) }
}
private fun registerSingleModel(item: IItemProvider, model: SingleItemModel, callback: (ItemModelBuilder) -> ItemModelBuilder) {
when (model) {
Manual -> return
Simple -> simple(item)?.then(callback)
AsBlock -> block(item as Block)?.then(callback)
Skull -> parent(item, Resource.Vanilla("item/template_skull"))?.then(callback)
SpawnEgg -> parent(item, Resource.Vanilla("item/template_spawn_egg"))?.then(callback)
Wall -> parent(item, item.suffixed("_inventory").location)?.then(callback)
is Copy -> simple(item, model.item.location)?.then(callback)
is Layers -> layers(item, model.layers)?.then(callback)
is Named -> simple(model.name)?.then(callback)
is FromParent -> parent(item, model.parent)?.then(callback)
is Suffixed -> registerModel(item.suffixed(model.suffix), model.wrapped, callback)
}
simple(ModItems.TOTEM_OF_UNDYING.suffixed("_shaking"))
simple(ModItems.AMULET_OF_RECOVERY)
simple(ModItems.AMULET_OF_RECOVERY.suffixed("_held"))
simple(ModItems.RING_OF_HUNGER)
simple(ModItems.RING_OF_PRESERVATION)
simple(ModItems.TALISMAN_OF_GRIEFING)
simple(ModItems.SCALE_OF_FREEFALL)
// Items: Spawn Eggs
parent(ModItems.SPAWN_ENDER_EYE, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_ANGRY_ENDERMAN, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_BLOBBY, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_ENDERMITE_INSTABILITY, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_SPIDERLING, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_UNDREAD, Resource.Vanilla("item/template_spawn_egg"))
parent(ModItems.SPAWN_VAMPIRE_BAT, Resource.Vanilla("item/template_spawn_egg"))
}
}

View File

@@ -1,119 +0,0 @@
package chylex.hee.datagen.client
import chylex.hee.HEE
import chylex.hee.client.text.LocalizationStrategy
import chylex.hee.game.block.IHeeBlock
import chylex.hee.game.command.ClientCommandHandler
import chylex.hee.game.item.IHeeItem
import chylex.hee.game.item.infusion.Infusion
import chylex.hee.game.mechanics.energy.IClusterHealth.HealthOverride
import chylex.hee.game.mechanics.energy.IClusterHealth.HealthStatus
import chylex.hee.game.potion.IHeeEffect
import chylex.hee.game.territory.TerritoryType
import chylex.hee.init.ModBlocks
import chylex.hee.init.ModCommands
import chylex.hee.init.ModEffects
import chylex.hee.init.ModEntities
import chylex.hee.init.ModItems
import chylex.hee.init.ModLanguage
import chylex.hee.init.ModPotions
import chylex.hee.init.ModSounds
import chylex.hee.system.getRegistryEntries
import chylex.hee.system.path
import net.minecraft.data.DataGenerator
import net.minecraft.potion.Effect
import net.minecraft.potion.Potion
import net.minecraftforge.common.data.LanguageProvider
class LangEnglish(generator: DataGenerator, modid: String) : LanguageProvider(generator, modid, "en_us") {
private val addedKeys = mutableMapOf<String, String>()
override fun addTranslations() {
for (block in ModBlocks.ALL) {
if (block is IHeeBlock) {
block.localization.localize(block.translationKey.removePrefix("block.hee."))?.let { add(block, it) }
addAll(block.localizationExtra)
}
}
for (item in ModItems.ALL) {
if (item is IHeeItem) {
item.localization.localize(item.translationKey.removePrefix("item.hee.").removePrefix("block.hee."))?.let { add(item, it) }
addAll(item.localizationExtra)
}
}
for (fluid in ModBlocks.FLUIDS) {
add("fluid.hee." + fluid.registryName, fluid.localizedName)
}
for ((type, properties) in ModEntities.ALL) {
properties.localization.localize(type.translationKey.removePrefix("entity.hee."))?.let { add(type, it) }
}
for ((sound, localized) in ModSounds.SUBTITLES) {
add("subtitles.hee." + sound.name.path, localized)
}
for (effect in getRegistryEntries<Effect>(ModEffects)) {
if (effect is IHeeEffect) {
effect.localization.localize(effect.name.removePrefix("effect.hee."))?.let { add(effect, it) }
}
}
for (potion in getRegistryEntries<Potion>(ModPotions)) {
val name = potion.path
val localized = LocalizationStrategy.Default.localize(name)
add("item.minecraft.potion.effect.$name", "Potion of $localized")
add("item.minecraft.splash_potion.effect.$name", "Splash Potion of $localized")
add("item.minecraft.lingering_potion.effect.$name", "Lingering Potion of $localized")
add("item.minecraft.tipped_arrow.effect.$name", "Arrow of $localized")
}
for (territoryType in TerritoryType.ALL) {
add(territoryType.translationKey, LocalizationStrategy.Default.localize(territoryType.title))
}
for (infusion in Infusion.values()) {
add(infusion.translationKey, infusion.localizedName)
}
for (clusterHealth in listOf(*HealthStatus.values(), *HealthOverride.values())) {
add(clusterHealth.translationKey, clusterHealth.localizedName)
}
for (command in ModCommands.admin + ModCommands.debug) {
val name = command.name
add("commands.hee.$name.info", command.description)
for ((key, translation) in command.localization) {
add("commands.hee.$name.$key", translation)
}
}
for (command in ClientCommandHandler.nonHelpCommands.values) {
val name = command.name
add("commands.hee.$name.info", command.description)
}
for ((key, localizedText) in ModLanguage.GENERIC) {
add(key, localizedText)
}
}
private fun addAll(map: Map<String, String>) {
for ((key, value) in map) {
add(key, value)
}
}
override fun add(key: String, value: String) {
val previous = addedKeys.put(key, value)
if (previous == null) {
super.add(key, value)
}
else if (value != previous) {
HEE.log.warn("[LangEnglish] Duplicate translation: $key -> $previous -> $value")
}
}
}

View File

@@ -1,12 +1,15 @@
package chylex.hee.datagen.client.util
import chylex.hee.datagen.Callback
import chylex.hee.datagen.path
import chylex.hee.datagen.r
import chylex.hee.datagen.safe
import chylex.hee.datagen.safeUnit
import chylex.hee.datagen.then
import chylex.hee.game.Resource
import chylex.hee.game.Resource.location
import chylex.hee.game.block.BlockAbstractTable
import chylex.hee.system.named
import chylex.hee.system.path
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.named
import chylex.hee.system.migration.BlockWall
import net.minecraft.block.AbstractBlock
import net.minecraft.block.Block
import net.minecraft.block.Blocks
@@ -26,22 +29,66 @@ fun BlockModelProvider.parent(block: Block, parent: ResourceLocation) = safe {
this.getBuilder(block.path).parent(getExistingFile(parent))
}
fun BlockModelProvider.simple(block: Block, parent: ResourceLocation, textureName: String, textureLocation: ResourceLocation = block.location): BlockModelBuilder? {
fun BlockModelProvider.simple(block: Block, parent: ResourceLocation, textureName: String, textureLocation: ResourceLocation = block.r): BlockModelBuilder? {
return this.parent(block, parent).then { texture(textureName, textureLocation) }
}
fun BlockModelProvider.cubeColumn(block: Block, side: ResourceLocation = block.location, end: ResourceLocation = block.location("_top")) = safe {
fun BlockModelProvider.cube(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder? {
return this.simple(block, Resource.Vanilla("block/cube_all"), "all", texture)
}
fun BlockModelProvider.cross(block: Block, texture: ResourceLocation = block.r): BlockModelBuilder? {
return this.simple(block, Resource.Vanilla("block/cross"), "cross", texture)
}
fun BlockModelProvider.cubeColumn(block: Block, side: ResourceLocation = block.r, end: ResourceLocation = block.r("_top")) = safe {
return this.cubeColumn(block.path, side, end)
}
fun BlockModelProvider.cubeBottomTop(block: Block, side: ResourceLocation, bottom: ResourceLocation, top: ResourceLocation) = safe {
fun BlockModelProvider.cubeBottomTop(block: Block, side: ResourceLocation = block.r("_side"), bottom: ResourceLocation = block.r("_bottom"), top: ResourceLocation = block.r("_top")) = safe {
return this.cubeBottomTop(block.path, side, bottom, top)
}
fun BlockModelProvider.leaves(block: Block): BlockModelBuilder? {
return this.simple(block, Resource.Vanilla("block/leaves"), "all")
}
fun BlockModelProvider.particle(block: Block, particle: ResourceLocation) = safe {
this.getBuilder(block.path).texture("particle", particle)
}
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: Array<String>, callback: BlockModelBuilder.(Callback<Block>) -> Unit) {
for(suffix in suffixes) {
val path = block.path + suffix
this.safeUnit {
this.getBuilder(path).parent(getExistingFile(parent)).callback(Callback(block, suffix, path))
}
}
}
fun BlockModelProvider.multi(block: Block, parent: ResourceLocation, suffixes: IntRange, callback: BlockModelBuilder.(Callback<Block>) -> Unit) {
multi(block, parent, Array(1 + suffixes.last - suffixes.first) { "_${suffixes.first + it}" }, callback)
}
fun BlockModelProvider.wall(block: BlockWall, texture: ResourceLocation) = safeUnit {
wallPost(block.path + "_post", texture)
wallSide(block.path + "_side", texture)
wallSideTall(block.path + "_side_tall", texture)
}
fun BlockModelProvider.cauldron(block: Block, water: ResourceLocation) = safeUnit {
getBuilder(block.path + "_level1").parent(getExistingFile(Resource.Vanilla("block/cauldron_level1"))).texture("water", water)
getBuilder(block.path + "_level2").parent(getExistingFile(Resource.Vanilla("block/cauldron_level2"))).texture("water", water)
getBuilder(block.path + "_level3").parent(getExistingFile(Resource.Vanilla("block/cauldron_level3"))).texture("water", water)
}
fun BlockModelProvider.flowerPot(potBlock: Block, plantBlock: Block) = safe {
this.getBuilder(potBlock.path)
.parent(getExistingFile(Resource.Vanilla("block/flower_pot_cross")))
.texture("plant", plantBlock.r)
}
fun BlockModelProvider.portalFrame(block: Block, side: ResourceLocation, top: ResourceLocation) = safe {
this.getBuilder(block.path)
.parent(getExistingFile(Resource.Custom("block/portal_frame")))

View File

@@ -1,57 +1,63 @@
package chylex.hee.datagen.client.util
import chylex.hee.datagen.r
import chylex.hee.datagen.safeUnit
import chylex.hee.game.Resource
import chylex.hee.game.Resource.location
import chylex.hee.game.block.util.CAULDRON_LEVEL
import chylex.hee.system.path
import chylex.hee.system.migration.BlockRotatedPillar
import chylex.hee.system.migration.BlockSlab
import chylex.hee.system.migration.BlockStairs
import net.minecraft.block.Block
import net.minecraft.block.RotatedPillarBlock
import net.minecraft.block.SlabBlock
import net.minecraft.block.StairsBlock
import net.minecraft.block.WallBlock
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile
private fun BlockStateProvider.simpleBlockItem(block: Block) {
this.simpleBlockItem(block, UncheckedModelFile(block.r))
}
fun BlockStateProvider.simpleStateOnly(block: Block, model: Block = block) = safeUnit {
this.simpleBlock(block, UncheckedModelFile(model.location))
this.simpleBlock(block, UncheckedModelFile(model.r))
}
fun BlockStateProvider.pillar(block: RotatedPillarBlock, model: Block = block) = safeUnit {
this.axisBlock(block, model.location)
fun BlockStateProvider.simpleStateAndItem(block: Block) = safeUnit {
this.simpleBlock(block, UncheckedModelFile(block.r))
this.simpleBlockItem(block)
}
fun BlockStateProvider.stairs(stairsBlock: StairsBlock, fullBlock: Block, side: ResourceLocation? = null) = safeUnit {
val texture = fullBlock.location
this.stairsBlock(stairsBlock, side ?: texture, texture, texture)
fun BlockStateProvider.cube(block: Block) = safeUnit {
this.simpleBlock(block)
this.simpleBlockItem(block)
}
fun BlockStateProvider.slab(slabBlock: SlabBlock, fullBlock: Block, side: ResourceLocation? = null) = safeUnit {
val texture = fullBlock.location
fun BlockStateProvider.cube(block: Block, model: Block) = safeUnit {
val modelFile = UncheckedModelFile(model.r)
this.simpleBlock(block, modelFile)
this.simpleBlockItem(block, modelFile)
}
fun BlockStateProvider.stairs(stairBlock: BlockStairs, fullBlock: Block, side: ResourceLocation? = null) = safeUnit {
val texture = fullBlock.r
this.stairsBlock(stairBlock, side ?: texture, texture, texture)
this.simpleBlockItem(stairBlock)
}
fun BlockStateProvider.slab(slabBlock: BlockSlab, fullBlock: Block, side: ResourceLocation? = null) = safeUnit {
val texture = fullBlock.r
this.slabBlock(slabBlock, texture, side ?: texture, texture, texture)
this.simpleBlockItem(slabBlock)
}
fun BlockStateProvider.wall(block: WallBlock, fullBlock: Block) = safeUnit {
val texture = fullBlock.location
this.wallBlock(block, texture)
models().simple(block.suffixed("_inventory"), Resource.Vanilla("block/wall_inventory"), "wall", texture)
}
fun BlockStateProvider.cauldron(block: Block, water: ResourceLocation) = safeUnit {
val models = models()
val level1 = models.getBuilder(block.path + "_level1").parent(models.getExistingFile(Resource.Vanilla("block/cauldron_level1"))).texture("water", water)
val level2 = models.getBuilder(block.path + "_level2").parent(models.getExistingFile(Resource.Vanilla("block/cauldron_level2"))).texture("water", water)
val level3 = models.getBuilder(block.path + "_level3").parent(models.getExistingFile(Resource.Vanilla("block/cauldron_level3"))).texture("water", water)
getVariantBuilder(block)
.partialState().with(CAULDRON_LEVEL, 0).addModels(ConfiguredModel(models.getExistingFile(Resource.Vanilla("block/cauldron"))))
.partialState().with(CAULDRON_LEVEL, 1).addModels(ConfiguredModel(level1))
.partialState().with(CAULDRON_LEVEL, 2).addModels(ConfiguredModel(level2))
.partialState().with(CAULDRON_LEVEL, 3).addModels(ConfiguredModel(level3))
}
fun BlockStateProvider.log(block: RotatedPillarBlock) = safeUnit {
fun BlockStateProvider.log(block: BlockRotatedPillar) = safeUnit {
this.logBlock(block)
this.simpleBlockItem(block)
}
fun BlockStateProvider.pillar(block: BlockRotatedPillar) = safeUnit {
this.axisBlock(block)
this.simpleBlockItem(block)
}
fun BlockStateProvider.pillar(block: BlockRotatedPillar, model: Block) = safeUnit {
val modelFile = UncheckedModelFile(model.r)
this.axisBlock(block, model.r)
this.simpleBlockItem(block, modelFile)
}

View File

@@ -1,11 +1,12 @@
package chylex.hee.datagen.client.util
import chylex.hee.datagen.Callback
import chylex.hee.datagen.path
import chylex.hee.datagen.r
import chylex.hee.datagen.safe
import chylex.hee.game.Resource
import chylex.hee.game.Resource.location
import chylex.hee.game.Resource.locationPrefix
import chylex.hee.system.named
import chylex.hee.system.path
import chylex.hee.datagen.safeUnit
import chylex.hee.system.facades.Resource
import chylex.hee.system.forge.named
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.util.IItemProvider
@@ -19,49 +20,59 @@ fun Item.suffixed(suffix: String): Item {
return Item(Item.Properties()) named this.path + suffix
}
fun IItemProvider.suffixed(suffix: String): IItemProvider = when (this) {
is Block -> this.suffixed(suffix)
is Item -> this.suffixed(suffix)
else -> throw IllegalArgumentException()
}
private val ItemModelProvider.generated
get() = getExistingFile(Resource.Vanilla("item/generated"))
private fun ItemModelProvider.build(item: IItemProvider): ItemModelBuilder {
return this.getBuilder(when (item) {
is Block -> item.path
is Item -> item.path
private fun IItemProvider.path() = when(this) {
is Block -> this.path
is Item -> this.path
else -> throw IllegalArgumentException()
})
}
fun ItemModelProvider.parent(item: IItemProvider, parent: ResourceLocation) = safe {
this.build(item).parent(getExistingFile(parent))
private fun ItemModelProvider.build(item: IItemProvider): ItemModelBuilder {
return this.getBuilder(item.path())
}
fun ItemModelProvider.parent(item: IItemProvider, parent: ResourceLocation, checkExistence: Boolean = true) = safe {
this.build(item).parent(if (checkExistence) getExistingFile(parent) else UncheckedModelFile(parent))
}
fun ItemModelProvider.simple(path: String, texture: String = "item/$path") = safe {
this.getBuilder(path).parent(generated).texture("layer0", texture)
}
fun ItemModelProvider.simple(item: IItemProvider, texture: ResourceLocation = item.location) = safe {
fun ItemModelProvider.simple(item: IItemProvider, texture: ResourceLocation = item.r) = safe {
this.build(item).parent(generated).texture("layer0", texture)
}
fun ItemModelProvider.layers(item: IItemProvider, layers: Array<out String>) = safe {
var builder = this.build(item).parent(generated)
fun ItemModelProvider.layers(item: Item, layers: Array<String>) = safe {
var builder = this.getBuilder(item.path).parent(generated)
for ((index, layer) in layers.withIndex()) {
builder = builder.texture("layer$index", Resource.Custom(item.locationPrefix + layer))
for((index, layer) in layers.withIndex()) {
builder = builder.texture("layer$index", Resource.Custom("item/$layer"))
}
builder
}
fun ItemModelProvider.block(block: Block, parent: Block = block) = safe {
this.getBuilder(block.path).parent(UncheckedModelFile(parent.location))
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: Array<String>, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit) {
for(suffix in suffixes) {
val path = item.path() + suffix
this.safeUnit {
this.getBuilder(path).parent(getExistingFile(parent)).callback(Callback(item, suffix, path))
}
}
}
inline fun ItemModelBuilder.override(model: ResourceLocation, callback: OverrideBuilder.() -> OverrideBuilder): ItemModelBuilder {
fun ItemModelProvider.multi(item: IItemProvider, parent: ResourceLocation, suffixes: IntRange, callback: ItemModelBuilder.(Callback<IItemProvider>) -> Unit) {
multi(item, parent, Array(1 + suffixes.last - suffixes.first) { "_${suffixes.first + it}" }, callback)
}
fun ItemModelProvider.block(block: Block, parent: Block = block) = safe {
this.getBuilder(block.path).parent(UncheckedModelFile(parent.r))
}
fun ItemModelBuilder.override(model: ResourceLocation, callback: OverrideBuilder.() -> OverrideBuilder): ItemModelBuilder? {
return this.override().model(UncheckedModelFile(model)).let(callback).end()
}

View File

@@ -1,42 +1,99 @@
package chylex.hee.datagen.server
import chylex.hee.HEE
import chylex.hee.datagen.server.util.BlockLootTableProvider
import chylex.hee.game.block.IHeeBlock
import chylex.hee.game.block.properties.BlockDrop
import chylex.hee.game.block.properties.BlockDrop.FlowerPot
import chylex.hee.game.block.properties.BlockDrop.Manual
import chylex.hee.game.block.properties.BlockDrop.NamedTile
import chylex.hee.game.block.properties.BlockDrop.Nothing
import chylex.hee.game.block.properties.BlockDrop.OneOf
import chylex.hee.game.block.properties.BlockDrop.Self
import chylex.hee.init.ModBlocks
import net.minecraft.block.Block
import net.minecraft.block.FlowerPotBlock
import chylex.hee.init.ModItems
import net.minecraft.block.Blocks
import net.minecraft.data.DataGenerator
import net.minecraft.loot.LootTables
class BlockLootTables(generator: DataGenerator) : BlockLootTableProvider(generator) {
override val consumer = object : RegistrationConsumer() {
override fun addTables() {
for (block in ModBlocks.ALL) {
(block as? IHeeBlock)?.let { registerDrop(block, it.drop) }
}
}
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_1)
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_2)
dropSelf(ModBlocks.ACCUMULATION_TABLE_TIER_3)
dropSelf(ModBlocks.DARK_LOAM)
dropSelf(ModBlocks.DARK_LOAM_SLAB)
dropSelf(ModBlocks.DEATH_FLOWER_HEALED)
dropSelf(ModBlocks.DEATH_FLOWER_WITHERED)
dropSelf(ModBlocks.DUSTY_STONE_BRICKS)
dropSelf(ModBlocks.DUSTY_STONE_BRICK_SLAB)
dropSelf(ModBlocks.DUSTY_STONE_BRICK_STAIRS)
dropSelf(ModBlocks.DUSTY_STONE_CRACKED_BRICKS)
dropSelf(ModBlocks.ENDIUM_BLOCK)
dropSelf(ModBlocks.ENDIUM_ORE)
dropSelf(ModBlocks.END_STONE_BURNED)
dropSelf(ModBlocks.END_STONE_ENCHANTED)
dropSelf(ModBlocks.END_STONE_INFESTED)
dropSelf(ModBlocks.ETHEREAL_LANTERN)
dropSelf(ModBlocks.EXPERIENCE_TABLE_TIER_1)
dropSelf(ModBlocks.EXPERIENCE_TABLE_TIER_2)
dropSelf(ModBlocks.EXPERIENCE_TABLE_TIER_3)
dropSelf(ModBlocks.GLOOMROCK)
dropSelf(ModBlocks.GLOOMROCK_BRICKS)
dropSelf(ModBlocks.GLOOMROCK_BRICK_SLAB)
dropSelf(ModBlocks.GLOOMROCK_BRICK_STAIRS)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_BLUE)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_CYAN)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_GREEN)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_MAGENTA)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_ORANGE)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_PURPLE)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_RED)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_SLAB)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_STAIRS)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_WHITE)
dropSelf(ModBlocks.GLOOMROCK_SMOOTH_YELLOW)
dropSelf(ModBlocks.GLOOMTORCH)
dropSelf(ModBlocks.IGNEOUS_PLATE)
dropSelf(ModBlocks.INFUSION_TABLE_TIER_1)
dropSelf(ModBlocks.INFUSION_TABLE_TIER_2)
dropSelf(ModBlocks.INFUSION_TABLE_TIER_3)
dropSelf(ModBlocks.MINERS_BURIAL_BLOCK_CHISELED)
dropSelf(ModBlocks.MINERS_BURIAL_BLOCK_PILLAR)
dropSelf(ModBlocks.MINERS_BURIAL_BLOCK_PLAIN)
dropSelf(ModBlocks.OBSIDIAN_CHISELED)
dropSelf(ModBlocks.OBSIDIAN_CHISELED_LIT)
dropSelf(ModBlocks.OBSIDIAN_PILLAR)
dropSelf(ModBlocks.OBSIDIAN_PILLAR_LIT)
dropSelf(ModBlocks.OBSIDIAN_SMOOTH)
dropSelf(ModBlocks.OBSIDIAN_SMOOTH_LIT)
dropSelf(ModBlocks.OBSIDIAN_STAIRS)
dropSelf(ModBlocks.STONE_BRICK_WALL)
dropSelf(ModBlocks.TABLE_BASE_TIER_1)
dropSelf(ModBlocks.TABLE_BASE_TIER_2)
dropSelf(ModBlocks.TABLE_BASE_TIER_3)
dropSelf(ModBlocks.TABLE_PEDESTAL)
dropSelf(ModBlocks.VANTABLOCK)
dropSelf(ModBlocks.VOID_PORTAL_FRAME_CRAFTED)
dropSelf(ModBlocks.VOID_PORTAL_STORAGE_CRAFTED)
dropSelf(ModBlocks.WHITEBARK)
dropSelf(ModBlocks.WHITEBARK_LOG)
dropSelf(ModBlocks.WHITEBARK_PLANKS)
dropSelf(ModBlocks.WHITEBARK_SAPLING_AUTUMN_BROWN)
dropSelf(ModBlocks.WHITEBARK_SAPLING_AUTUMN_ORANGE)
dropSelf(ModBlocks.WHITEBARK_SAPLING_AUTUMN_RED)
dropSelf(ModBlocks.WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
dropSelf(ModBlocks.WHITEBARK_SLAB)
dropSelf(ModBlocks.WHITEBARK_STAIRS)
private fun registerDrop(block: Block, drop: BlockDrop) {
if (block.lootTable == LootTables.EMPTY && drop != Nothing) {
HEE.log.error("[BlockLootTables] block has empty loot table but declares drops: " + block.registryName)
return
}
dropFunc(ModBlocks.DARK_CHEST, withName)
dropFunc(ModBlocks.ENHANCED_BREWING_STAND, withName)
when (drop) {
Nothing, Manual -> return
Self -> registerDropSelfLootTable(block)
NamedTile -> registerLootTable(block, withName)
FlowerPot -> registerFlowerPot(block as FlowerPotBlock)
is OneOf -> registerDropping(block, drop.item)
}
dropOther(ModBlocks.CAULDRON_DRAGONS_BREATH, Blocks.CAULDRON)
dropOther(ModBlocks.CAULDRON_ENDER_GOO, Blocks.CAULDRON)
dropOther(ModBlocks.CAULDRON_PURIFIED_ENDER_GOO, Blocks.CAULDRON)
dropOther(ModBlocks.ENDERMAN_HEAD, ModItems.ENDERMAN_HEAD)
dropOther(ModBlocks.ENDERMAN_WALL_HEAD, ModItems.ENDERMAN_HEAD)
dropOther(ModBlocks.OBSIDIAN_FALLING, Blocks.OBSIDIAN)
dropFlowerPot(ModBlocks.POTTED_DEATH_FLOWER_HEALED)
dropFlowerPot(ModBlocks.POTTED_DEATH_FLOWER_WITHERED)
dropFlowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_BROWN)
dropFlowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_ORANGE)
dropFlowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_YELLOWGREEN)
dropFlowerPot(ModBlocks.POTTED_WHITEBARK_SAPLING_AUTUMN_RED)
}
}
}

View File

@@ -1,32 +1,46 @@
package chylex.hee.datagen.server
import chylex.hee.game.block.IHeeBlock
import chylex.hee.datagen.server.util.add
import chylex.hee.game.block.BlockWhitebarkSapling
import chylex.hee.init.ModBlocks
import chylex.hee.system.forge.getRegistryEntries
import chylex.hee.system.migration.BlockFlowerPot
import chylex.hee.system.migration.BlockLeaves
import chylex.hee.system.migration.BlockSlab
import chylex.hee.system.migration.BlockStairs
import chylex.hee.system.migration.BlockWall
import net.minecraft.block.Block
import net.minecraft.data.BlockTagsProvider
import net.minecraft.data.DataGenerator
import net.minecraft.tags.ITag.INamedTag
import net.minecraft.tags.BlockTags
import net.minecraftforge.common.Tags
import net.minecraftforge.common.data.ExistingFileHelper
class BlockTags(generator: DataGenerator, modId: String, existingFileHelper: ExistingFileHelper?) : BlockTagsProvider(generator, modId, existingFileHelper) {
private val registeredTags = mutableSetOf<INamedTag<Block>>()
val allRegisteredTags: Set<INamedTag<Block>>
get() = registeredTags
private val blocks = getRegistryEntries<Block>(ModBlocks)
override fun registerTags() {
for (block in ModBlocks.ALL) {
val tags = (block as? IHeeBlock)?.tags
if (!tags.isNullOrEmpty()) {
registerTags(block, tags)
}
}
}
getOrCreateBuilder(BlockTags.BAMBOO_PLANTABLE_ON).add(ModBlocks.HUMUS)
getOrCreateBuilder(BlockTags.FLOWER_POTS).add(blocks.filterIsInstance<BlockFlowerPot>())
getOrCreateBuilder(BlockTags.IMPERMEABLE).add(ModBlocks.INFUSED_GLASS)
getOrCreateBuilder(BlockTags.LEAVES).add(blocks.filterIsInstance<BlockLeaves>())
getOrCreateBuilder(BlockTags.LOGS).add(ModBlocks.WHITEBARK_LOG, ModBlocks.WHITEBARK)
getOrCreateBuilder(BlockTags.PORTALS).add(ModBlocks.END_PORTAL_INNER, ModBlocks.VOID_PORTAL_INNER)
getOrCreateBuilder(BlockTags.PLANKS).add(ModBlocks.WHITEBARK_PLANKS)
getOrCreateBuilder(BlockTags.SAPLINGS).add(blocks.filterIsInstance<BlockWhitebarkSapling>())
getOrCreateBuilder(BlockTags.SLABS).add(blocks.filterIsInstance<BlockSlab>())
getOrCreateBuilder(BlockTags.STAIRS).add(blocks.filterIsInstance<BlockStairs>())
getOrCreateBuilder(BlockTags.WALLS).add(blocks.filterIsInstance<BlockWall>())
getOrCreateBuilder(BlockTags.WOODEN_SLABS).add(ModBlocks.WHITEBARK_SLAB)
getOrCreateBuilder(BlockTags.WOODEN_STAIRS).add(ModBlocks.WHITEBARK_STAIRS)
private fun registerTags(block: Block, tags: List<INamedTag<Block>>) {
for (tag in tags) {
getOrCreateBuilder(tag).addItemEntry(block)
registeredTags.add(tag)
}
getOrCreateBuilder(Tags.Blocks.CHESTS).add(ModBlocks.DARK_CHEST)
getOrCreateBuilder(Tags.Blocks.END_STONES).add(ModBlocks.END_STONE_INFESTED, ModBlocks.END_STONE_BURNED, ModBlocks.END_STONE_ENCHANTED)
getOrCreateBuilder(Tags.Blocks.GLASS).add(ModBlocks.INFUSED_GLASS)
getOrCreateBuilder(Tags.Blocks.OBSIDIAN).add(ModBlocks.OBSIDIAN_FALLING)
getOrCreateBuilder(Tags.Blocks.OBSIDIAN).add(ModBlocks.OBSIDIAN_SMOOTH, ModBlocks.OBSIDIAN_CHISELED, ModBlocks.OBSIDIAN_PILLAR)
getOrCreateBuilder(Tags.Blocks.OBSIDIAN).add(ModBlocks.OBSIDIAN_SMOOTH_LIT, ModBlocks.OBSIDIAN_CHISELED_LIT, ModBlocks.OBSIDIAN_PILLAR_LIT)
getOrCreateBuilder(Tags.Blocks.ORES).add(ModBlocks.END_POWDER_ORE, ModBlocks.ENDIUM_ORE, ModBlocks.STARDUST_ORE, ModBlocks.IGNEOUS_ROCK_ORE)
getOrCreateBuilder(Tags.Blocks.STORAGE_BLOCKS).add(ModBlocks.ENDIUM_BLOCK)
}
}

View File

@@ -1,33 +1,38 @@
package chylex.hee.datagen.server
import chylex.hee.game.item.IHeeItem
import chylex.hee.init.ModItems
import net.minecraft.data.BlockTagsProvider
import net.minecraft.data.DataGenerator
import net.minecraft.data.ItemTagsProvider
import net.minecraft.item.Item
import net.minecraft.tags.ITag.INamedTag
import net.minecraft.tags.BlockTags
import net.minecraft.tags.ItemTags
import net.minecraftforge.common.Tags
import net.minecraftforge.common.data.ExistingFileHelper
class ItemTags(dataGenerator: DataGenerator, private val blockTags: chylex.hee.datagen.server.BlockTags, modId: String, existingFileHelper: ExistingFileHelper?) : ItemTagsProvider(dataGenerator, blockTags, modId, existingFileHelper) {
class ItemTags(dataGenerator: DataGenerator, blockTagProvider: BlockTagsProvider, modId: String, existingFileHelper: ExistingFileHelper?) : ItemTagsProvider(dataGenerator, blockTagProvider, modId, existingFileHelper) {
override fun registerTags() {
val itemTags = ItemTags.getAllTags().associateBy { it.name }
copy(BlockTags.LEAVES, ItemTags.LEAVES)
copy(BlockTags.LOGS, ItemTags.LOGS)
copy(BlockTags.PLANKS, ItemTags.PLANKS)
copy(BlockTags.SAPLINGS, ItemTags.SAPLINGS)
copy(BlockTags.SLABS, ItemTags.SLABS)
copy(BlockTags.STAIRS, ItemTags.STAIRS)
copy(BlockTags.WALLS, ItemTags.WALLS)
copy(BlockTags.WOODEN_SLABS, ItemTags.WOODEN_SLABS)
copy(BlockTags.WOODEN_STAIRS, ItemTags.WOODEN_STAIRS)
for (blockTag in blockTags.allRegisteredTags) {
itemTags[blockTag.name]?.let { copy(blockTag, it) }
}
copy(Tags.Blocks.CHESTS, Tags.Items.CHESTS)
copy(Tags.Blocks.END_STONES, Tags.Items.END_STONES)
copy(Tags.Blocks.GLASS, Tags.Items.GLASS)
copy(Tags.Blocks.OBSIDIAN, Tags.Items.OBSIDIAN)
copy(Tags.Blocks.ORES, Tags.Items.ORES)
copy(Tags.Blocks.STORAGE_BLOCKS, Tags.Items.STORAGE_BLOCKS)
for (item in ModItems.ALL) {
val tags = (item as? IHeeItem)?.tags
if (!tags.isNullOrEmpty()) {
registerTags(item, tags)
}
}
}
private fun registerTags(item: Item, tags: List<INamedTag<Item>>) {
for (tag in tags) {
getOrCreateBuilder(tag).addItemEntry(item)
}
getOrCreateBuilder(Tags.Items.DUSTS).add(ModItems.ANCIENT_DUST, ModItems.END_POWDER, ModItems.STARDUST)
getOrCreateBuilder(Tags.Items.ENDER_PEARLS).add(ModItems.INFUSED_ENDER_PEARL)
getOrCreateBuilder(Tags.Items.HEADS).add(ModItems.ENDERMAN_HEAD)
getOrCreateBuilder(Tags.Items.INGOTS).add(ModItems.ENDIUM_INGOT, ModItems.INFERNIUM_INGOT, ModItems.DIRTY_INFERNIUM_INGOT)
getOrCreateBuilder(Tags.Items.NUGGETS).add(ModItems.ENDIUM_NUGGET)
getOrCreateBuilder(Tags.Items.RODS).add(ModItems.OBSIDIAN_ROD)
}
}

View File

@@ -1,5 +1,6 @@
package chylex.hee.datagen.server.util
import chylex.hee.system.migration.BlockFlowerPot
import com.mojang.datafixers.util.Pair
import net.minecraft.block.Block
import net.minecraft.data.DataGenerator
@@ -10,6 +11,7 @@ import net.minecraft.loot.LootParameterSets
import net.minecraft.loot.LootTable
import net.minecraft.loot.LootTable.Builder
import net.minecraft.loot.ValidationTracker
import net.minecraft.util.IItemProvider
import net.minecraft.util.ResourceLocation
import java.util.function.BiConsumer
import java.util.function.Consumer
@@ -31,12 +33,12 @@ abstract class BlockLootTableProvider(generator: DataGenerator) : LootTableProvi
protected abstract class RegistrationConsumer : BlockLootTables() {
private val lootTables = mutableMapOf<ResourceLocation, Builder>()
abstract override fun addTables()
override fun addTables() {}
final override fun accept(consumer: BiConsumer<ResourceLocation?, Builder?>) {
addTables()
for ((location, table) in lootTables) {
for((location, table) in lootTables) {
consumer.accept(location, table)
}
@@ -47,6 +49,22 @@ abstract class BlockLootTableProvider(generator: DataGenerator) : LootTableProvi
check(lootTables.put(block.lootTable, table) == null)
}
protected fun dropSelf(block: Block) {
registerDropSelfLootTable(block)
}
protected fun dropOther(block: Block, drop: IItemProvider) {
registerDropping(block, drop)
}
protected fun dropFunc(block: Block, func: (Block) -> Builder) {
registerLootTable(block, func)
}
protected fun dropFlowerPot(block: BlockFlowerPot) {
registerFlowerPot(block)
}
protected companion object {
val withName = BlockLootTables::droppingWithName
}

View File

@@ -3,5 +3,5 @@ package chylex.hee.datagen.server.util
import net.minecraft.data.TagsProvider
fun <T> TagsProvider.Builder<T>.add(items: List<T>) {
items.forEach(this::addItemEntry)
items.forEach(this::add)
}

View File

@@ -1,88 +0,0 @@
package chylex.hee.client.text
sealed class LocalizationStrategy {
abstract fun localize(key: String): String?
object Default : LocalizationStrategy() {
private val nonCapitalizedWords = setOf("of", "and")
override fun localize(key: String): String {
return key.split('_').joinToString(" ") {
if (nonCapitalizedWords.contains(it)) it else it.replaceFirstChar(Char::titlecaseChar)
}
}
}
open class ReplaceWords(private val wrapped: LocalizationStrategy, private val toReplace: String, private val replacement: String?) : LocalizationStrategy() {
constructor(toReplace: String, replacement: String?) : this(Default, toReplace, replacement)
override fun localize(key: String): String? {
val localized = wrapped.localize(key) ?: return null
val words = localized.split(' ').toMutableList()
val toDelete = this.toReplace.split(' ')
for (index in words.indices) {
if (toDelete.withIndex().all { (offset, word) -> words[index + offset] == word }) {
words.subList(index, index + toDelete.size).clear()
replacement?.let { words.add(index, it) }
break
}
}
return words.joinToString(" ")
}
}
class DeleteWords(wrapped: LocalizationStrategy, toDelete: String) : ReplaceWords(wrapped, toDelete, null) {
constructor(toDelete: String) : this(Default, toDelete)
}
class Parenthesized(private val wrapped: LocalizationStrategy = Default, private val wordCount: Int, private val wordOffset: Int = 0, private val fromStart: Boolean = false) : LocalizationStrategy() {
override fun localize(key: String): String? {
val localized = wrapped.localize(key) ?: return null
val words = localized.split(' ').toMutableList()
val firstIndex = if (fromStart) wordOffset else words.size - wordOffset - wordCount
val lastIndex = firstIndex + wordCount - 1
if (firstIndex < 0 || lastIndex > words.lastIndex) {
return localized
}
words[firstIndex] = '(' + words[firstIndex]
words[lastIndex] = words[lastIndex] + ')'
return words.joinToString(" ")
}
}
class MoveToBeginning(private val wrapped: LocalizationStrategy = Default, private val wordCount: Int, private val wordOffset: Int = 0, private val fromStart: Boolean = false) : LocalizationStrategy() {
override fun localize(key: String): String? {
val localized = wrapped.localize(key) ?: return null
val words = localized.split(' ').toMutableList()
val firstIndex = if (fromStart) wordOffset else words.size - wordOffset - wordCount
if (firstIndex < 0 || firstIndex + wordCount > words.size) {
return localized
}
val subList = words.subList(firstIndex, firstIndex + wordCount)
val movedWords = subList.toList()
subList.clear()
words.addAll(0, movedWords)
return words.joinToString(" ")
}
}
class Custom(private val localized: String) : LocalizationStrategy() {
override fun localize(key: String): String {
return localized
}
}
object None : LocalizationStrategy() {
override fun localize(key: String): String? {
return null
}
}
}

View File

@@ -1,45 +0,0 @@
package chylex.hee.game
import chylex.hee.HEE
import chylex.hee.system.isVanilla
import chylex.hee.system.path
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.util.IItemProvider
import net.minecraft.util.ResourceLocation
object Resource {
const val NAMESPACE_VANILLA = "minecraft"
fun Vanilla(path: String) = ResourceLocation(NAMESPACE_VANILLA, path)
fun Custom(path: String) = ResourceLocation(HEE.ID, path)
fun isVanilla(location: ResourceLocation) = location.namespace == NAMESPACE_VANILLA
fun isCustom(location: ResourceLocation) = location.namespace == HEE.ID
operator fun invoke(path: String, isVanilla: Boolean): ResourceLocation {
return if (isVanilla) Vanilla(path) else Custom(path)
}
val IItemProvider.locationPrefix
get() = when (this) {
is Block -> "block/"
is Item -> "item/"
else -> throw IllegalArgumentException()
}
val IItemProvider.location
get() = when (this) {
is Block -> Resource(this.locationPrefix + this.path, this.isVanilla)
is Item -> Resource(this.locationPrefix + this.path, this.isVanilla)
else -> throw IllegalArgumentException()
}
fun IItemProvider.location(suffix: String): ResourceLocation {
return when (this) {
is Block -> Resource(this.locationPrefix + this.path + suffix, this.isVanilla)
is Item -> Resource(this.locationPrefix + this.path + suffix, this.isVanilla)
else -> throw IllegalArgumentException()
}
}
}

View File

@@ -1,11 +0,0 @@
package chylex.hee.game.block
import chylex.hee.game.block.properties.BlockBuilder
import chylex.hee.game.block.properties.BlockDrop
import net.minecraft.block.Block
import net.minecraft.loot.LootTables
open class HeeBlock(builder: BlockBuilder) : Block(builder.p), IHeeBlock {
override val drop
get() = if (lootTable == LootTables.EMPTY) BlockDrop.Nothing else BlockDrop.Self
}

View File

@@ -1,34 +0,0 @@
package chylex.hee.game.block
import chylex.hee.client.text.LocalizationStrategy
import chylex.hee.game.block.properties.BlockDrop
import chylex.hee.game.block.properties.BlockModel
import chylex.hee.game.block.properties.BlockRenderLayer
import chylex.hee.game.block.properties.BlockRenderLayer.SOLID
import chylex.hee.game.block.properties.BlockTint
import chylex.hee.game.block.properties.IBlockStateModel
import net.minecraft.block.Block
import net.minecraft.tags.ITag.INamedTag
interface IHeeBlock {
val localization: LocalizationStrategy
get() = LocalizationStrategy.Default
val localizationExtra: Map<String, String>
get() = emptyMap()
val model: IBlockStateModel
get() = BlockModel.Cube
val renderLayer: BlockRenderLayer
get() = SOLID
val tint: BlockTint?
get() = null
val drop: BlockDrop
get() = BlockDrop.Self
val tags: List<INamedTag<Block>>
get() = emptyList()
}

View File

@@ -1,8 +0,0 @@
package chylex.hee.game.block.entity
import net.minecraft.block.Block
import net.minecraft.tileentity.TileEntity
interface IHeeTileEntityType<T : TileEntity> {
val blocks: Array<out Block>
}

View File

@@ -1,12 +0,0 @@
package chylex.hee.game.block.properties
import net.minecraft.util.IItemProvider
sealed class BlockDrop {
object Nothing : BlockDrop()
object Self : BlockDrop()
object Manual : BlockDrop()
object NamedTile : BlockDrop()
object FlowerPot : BlockDrop()
class OneOf(val item: IItemProvider) : BlockDrop()
}

View File

@@ -1,5 +0,0 @@
package chylex.hee.game.block.properties
import chylex.hee.game.item.properties.ItemModel
class BlockItemModel(val model: ItemModel, val asItem: Boolean = false)

View File

@@ -1,53 +0,0 @@
package chylex.hee.game.block.properties
import chylex.hee.game.Resource
import chylex.hee.game.item.properties.ItemModel
import chylex.hee.system.isVanilla
import chylex.hee.system.path
import net.minecraft.block.Block
import net.minecraft.util.ResourceLocation
sealed class BlockModel : IBlockStateModel {
override val blockState
get() = BlockStatePreset.Simple
override val blockModel
get() = this
override val itemModel
get() = BlockItemModel(ItemModel.AsBlock)
class SimpleBlockModel internal constructor(val parent: ResourceLocation, val textureName: String, val textureLocation: ResourceLocation?) : BlockModel()
companion object {
val Cube = Cube()
val Cross = Cross()
val Leaves = SimpleBlockModel(Resource.Vanilla("block/leaves"), "all", null)
fun Cube(texture: ResourceLocation? = null) = SimpleBlockModel(Resource.Vanilla("block/cube_all"), "all", texture)
fun Cross(texture: ResourceLocation? = null) = SimpleBlockModel(Resource.Vanilla("block/cross"), "cross", texture)
fun PottedPlant(texture: ResourceLocation? = null) = SimpleBlockModel(Resource.Vanilla("block/flower_pot_cross"), "plant", texture)
}
class CubeBottomTop(val side: ResourceLocation? = null, val bottom: ResourceLocation? = null, val top: ResourceLocation? = null) : BlockModel()
class PortalFrame(val frameBlock: Block, val topSuffix: String) : BlockModel()
class ParticleOnly(val particle: ResourceLocation) : BlockModel()
class Parent(val name: String, val parent: ResourceLocation) : BlockModel()
class FromParent(val parent: ResourceLocation) : BlockModel() {
constructor(block: Block) : this(Resource("block/" + block.path, block.isVanilla))
}
class Suffixed(val suffix: String, val wrapped: BlockModel = Cube): BlockModel()
class WithTextures(val baseModel: BlockModel, val textures: Map<String, ResourceLocation>) : BlockModel()
class NoAmbientOcclusion(val baseModel: BlockModel) : BlockModel()
class Multi(vararg val models: BlockModel) : BlockModel() {
constructor(models: List<BlockModel>) : this(*models.toTypedArray())
}
object CubeColumn : BlockModel()
object Table : BlockModel()
object Fluid : BlockModel()
object Manual : BlockModel()
}

View File

@@ -1,8 +0,0 @@
package chylex.hee.game.block.properties
enum class BlockRenderLayer {
SOLID,
CUTOUT,
CUTOUT_MIPPED,
TRANSLUCENT
}

View File

@@ -1,12 +0,0 @@
package chylex.hee.game.block.properties
import chylex.hee.game.item.properties.ItemModel
class BlockStateModel(
override val blockState: BlockStatePreset,
override val blockModel: BlockModel,
override val itemModel: BlockItemModel?,
) : IBlockStateModel {
constructor(blockState: BlockStatePreset, blockModel: BlockModel, itemModel: ItemModel?) : this(blockState, blockModel, itemModel?.let(::BlockItemModel))
constructor(blockState: BlockStatePreset, blockModel: BlockModel) : this(blockState, blockModel, null as BlockItemModel?)
}

View File

@@ -1,89 +0,0 @@
package chylex.hee.game.block.properties
import chylex.hee.game.Resource.location
import chylex.hee.game.item.properties.ItemModel
import net.minecraft.block.Block
import net.minecraft.block.Blocks
import net.minecraft.util.ResourceLocation
object BlockStateModels {
val Manual = BlockStateModel(
BlockStatePreset.None,
BlockModel.Manual
)
fun Cube(modelBlock: Block) = BlockStateModel(
BlockStatePreset.SimpleFrom(modelBlock),
BlockModel.Manual,
ItemModel.FromParent(modelBlock)
)
val Pillar = BlockStateModel(
BlockStatePreset.Pillar,
BlockModel.Manual,
ItemModel.AsBlock
)
fun Pillar(modelBlock: Block) = BlockStateModel(
BlockStatePreset.PillarFrom(modelBlock),
BlockModel.Manual,
ItemModel.FromParent(modelBlock)
)
val Cross = BlockStateModel(
BlockStatePreset.Simple,
BlockModel.Cross,
ItemModel.Simple
)
val Log = BlockStateModel(
BlockStatePreset.Log,
BlockModel.Manual,
ItemModel.AsBlock
)
val Fluid = BlockStateModel(
BlockStatePreset.Simple,
BlockModel.Fluid
)
fun Stairs(fullBlock: Block, side: ResourceLocation? = null) = BlockStateModel(
BlockStatePreset.Stairs(fullBlock, side),
BlockModel.Manual,
ItemModel.AsBlock
)
fun Slab(fullBlock: Block, side: ResourceLocation? = null) = BlockStateModel(
BlockStatePreset.Slab(fullBlock, side),
BlockModel.Manual,
ItemModel.AsBlock
)
fun Wall(fullBlock: Block) = BlockStateModel(
BlockStatePreset.Wall(fullBlock),
BlockModel.Manual,
ItemModel.Wall
)
fun Chest(particleTexture: ResourceLocation) = BlockStateModel(
BlockStatePreset.Simple,
BlockModel.ParticleOnly(particleTexture),
ItemModel.FromParent(Blocks.CHEST.asItem().location)
)
fun Cauldron(fluidTexture: ResourceLocation) = BlockStateModel(
BlockStatePreset.Cauldron(fluidTexture),
BlockModel.Manual
)
fun PottedPlant(plantBlock: Block) = BlockStateModel(
BlockStatePreset.Simple,
BlockModel.PottedPlant(plantBlock.location)
)
fun ItemOnly(itemModel: ItemModel, asItem: Boolean = false) = BlockStateModel(
BlockStatePreset.None,
BlockModel.Manual,
BlockItemModel(itemModel, asItem)
)
}

View File

@@ -1,17 +0,0 @@
package chylex.hee.game.block.properties
import net.minecraft.block.Block
import net.minecraft.util.ResourceLocation
sealed class BlockStatePreset {
object None : BlockStatePreset()
object Simple : BlockStatePreset()
class SimpleFrom(val modelBlock: Block) : BlockStatePreset()
object Pillar : BlockStatePreset()
class PillarFrom(val modelBlock: Block) : BlockStatePreset()
class Stairs(val fullBlock: Block, val side: ResourceLocation? = null) : BlockStatePreset()
class Slab(val fullBlock: Block, val side: ResourceLocation? = null) : BlockStatePreset()
class Wall(val fullBlock: Block) : BlockStatePreset()
class Cauldron(val fluidTexture: ResourceLocation) : BlockStatePreset()
object Log : BlockStatePreset()
}

View File

@@ -1,30 +0,0 @@
package chylex.hee.game.block.properties
import chylex.hee.util.forge.Side
import chylex.hee.util.forge.Sided
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.client.renderer.color.IBlockColor
import net.minecraft.client.renderer.color.IItemColor
import net.minecraft.util.math.BlockPos
import net.minecraft.world.IBlockDisplayReader
@Sided(Side.CLIENT, _interface = IBlockColor::class)
abstract class BlockTint : IBlockColor {
protected companion object {
const val NO_TINT = -1
}
@Sided(Side.CLIENT)
open fun forItem(block: Block): IItemColor? {
return IItemColor { _, tintIndex -> this@BlockTint.tint(block.defaultState, null, null, tintIndex) }
}
@Sided(Side.CLIENT)
final override fun getColor(state: BlockState, world: IBlockDisplayReader?, pos: BlockPos?, tintIndex: Int): Int {
return tint(state, world, pos, tintIndex)
}
@Sided(Side.CLIENT)
abstract fun tint(state: BlockState, world: IBlockDisplayReader?, pos: BlockPos?, tintIndex: Int): Int
}

View File

@@ -1,7 +0,0 @@
package chylex.hee.game.block.properties
interface IBlockStateModel {
val blockState: BlockStatePreset
val blockModel: BlockModel
val itemModel: BlockItemModel?
}

View File

@@ -1,28 +0,0 @@
package chylex.hee.game.command
import com.mojang.brigadier.builder.ArgumentBuilder
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
import net.minecraft.command.CommandSource
import net.minecraft.util.text.ITextComponent
import net.minecraft.util.text.TranslationTextComponent
interface ICommand {
val name: String
val description: String
val permissionLevel: Int
get() = 2
val localization: Map<String, String>
get() = emptyMap()
fun register(builder: ArgumentBuilder<CommandSource, *>)
}
fun ICommand.message(name: String, vararg params: Any): ITextComponent {
return TranslationTextComponent("commands.hee.${this.name}.$name", *params)
}
fun ICommand.exception(name: String): SimpleCommandExceptionType {
return SimpleCommandExceptionType(TranslationTextComponent("commands.hee.${this.name}.$name"))
}

View File

@@ -1,14 +0,0 @@
package chylex.hee.game.command.argument;
final class EnumArgumentConstructor {
private EnumArgumentConstructor() {}
@SuppressWarnings({ "unchecked", "rawtypes" })
static EnumArgument<?> createEnumArgument(final Class<?> cls) {
if (!cls.isEnum()) {
throw new IllegalArgumentException("cannot create an EnumArgument for class: " + cls.getName());
}
return new EnumArgument(cls);
}
}

View File

@@ -1,25 +0,0 @@
package chylex.hee.game.entity
import chylex.hee.client.text.LocalizationStrategy
import chylex.hee.game.entity.properties.EntitySize
import chylex.hee.game.entity.properties.EntityTrackerInfo
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityClassification
import net.minecraft.entity.EntityClassification.MISC
interface IHeeEntityType<T : Entity> {
val localization: LocalizationStrategy
get() = LocalizationStrategy.None
val classification: EntityClassification
get() = MISC
val size: EntitySize
val tracker: EntityTrackerInfo
val isImmuneToFire: Boolean
get() = false
val disableSerialization: Boolean
get() = false
}

View File

@@ -1,26 +0,0 @@
package chylex.hee.game.entity
import chylex.hee.client.text.LocalizationStrategy
import chylex.hee.game.entity.properties.EntitySpawnPlacement
import chylex.hee.game.entity.properties.EntityTrackerInfo
import net.minecraft.entity.EntityClassification
import net.minecraft.entity.MobEntity
import net.minecraft.entity.ai.attributes.AttributeModifierMap.MutableAttribute
interface IHeeMobEntityType<T : MobEntity> : IHeeEntityType<T> {
override val localization: LocalizationStrategy
get() = LocalizationStrategy.Default
override val classification: EntityClassification
override val tracker
get() = EntityTrackerInfo.Defaults.MOB
val attributes: MutableAttribute
val placement: EntitySpawnPlacement<T>?
get() = null
val spawnEggName: String?
get() = null
}

View File

@@ -1,9 +0,0 @@
package chylex.hee.game.entity.living
import net.minecraft.entity.LivingEntity
object MobTypes {
fun isBoss(entity: LivingEntity): Boolean {
return !entity.canChangeDimension() // TODO better impl?
}
}

View File

@@ -1,5 +0,0 @@
package chylex.hee.game.entity.properties
data class EntitySize(val width: Float, val height: Float) {
constructor(size: Float) : this(size, size)
}

View File

@@ -1,14 +0,0 @@
package chylex.hee.game.entity.properties
import net.minecraft.entity.EntitySpawnPlacementRegistry.IPlacementPredicate
import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType
import net.minecraft.entity.MobEntity
import net.minecraft.entity.monster.MonsterEntity
import net.minecraft.world.gen.Heightmap
data class EntitySpawnPlacement<T : MobEntity>(val placementType: PlacementType, val heightmapType: Heightmap.Type, val predicate: IPlacementPredicate<T>) {
companion object {
fun <T : MobEntity> passive() = EntitySpawnPlacement<T>(PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, MobEntity::canSpawnOn)
fun <T : MonsterEntity> hostile() = EntitySpawnPlacement<T>(PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, MonsterEntity::canMonsterSpawnInLight)
}
}

View File

@@ -1,15 +0,0 @@
package chylex.hee.game.entity.properties
data class EntityTrackerInfo(
val trackingRange: Int,
val updateInterval: Int,
val receiveVelocityUpdates: Boolean,
) {
object Defaults {
val MOB = EntityTrackerInfo(trackingRange = 5, updateInterval = 3, receiveVelocityUpdates = true)
val ITEM = EntityTrackerInfo(trackingRange = 4, updateInterval = 3, receiveVelocityUpdates = true)
val PROJECTILE = EntityTrackerInfo(trackingRange = 4, updateInterval = 10, receiveVelocityUpdates = true)
val FALLING_BLOCK = EntityTrackerInfo(trackingRange = 10, updateInterval = 20, receiveVelocityUpdates = true)
val TECHNICAL = EntityTrackerInfo(trackingRange = 0, updateInterval = Int.MAX_VALUE, receiveVelocityUpdates = false)
}
}

View File

@@ -1,11 +0,0 @@
package chylex.hee.game.fx
import chylex.hee.util.buffer.writePos
import net.minecraft.network.PacketBuffer
import net.minecraft.util.math.BlockPos
class FxBlockData(private val pos: BlockPos) : IFxData {
override fun write(buffer: PacketBuffer) {
buffer.writePos(pos)
}
}

View File

@@ -1,10 +0,0 @@
package chylex.hee.game.fx
import net.minecraft.entity.Entity
import net.minecraft.network.PacketBuffer
class FxEntityData(private val entity: Entity) : IFxData {
override fun write(buffer: PacketBuffer) {
buffer.writeInt(entity.entityId)
}
}

View File

@@ -1,11 +0,0 @@
package chylex.hee.game.fx
import chylex.hee.util.buffer.writeVec
import net.minecraft.network.PacketBuffer
import net.minecraft.util.math.vector.Vector3d
class FxVecData(private val vec: Vector3d) : IFxData {
override fun write(buffer: PacketBuffer) {
buffer.writeVec(vec)
}
}

View File

@@ -1,5 +0,0 @@
package chylex.hee.game.item
import net.minecraft.item.Item
open class HeeItem(properties: Properties) : Item(properties), IHeeItem

View File

@@ -1,28 +0,0 @@
package chylex.hee.game.item
import chylex.hee.client.text.LocalizationStrategy
import chylex.hee.game.item.properties.ItemModel
import chylex.hee.game.item.properties.ItemTint
import chylex.hee.game.item.util.ItemProperty
import net.minecraft.item.Item
import net.minecraft.tags.ITag.INamedTag
interface IHeeItem {
val localization: LocalizationStrategy
get() = LocalizationStrategy.Default
val localizationExtra: Map<String, String>
get() = emptyMap()
val model: ItemModel
get() = ItemModel.Simple
val tint: ItemTint?
get() = null
val properties: List<ItemProperty>
get() = emptyList()
val tags: List<INamedTag<Item>>
get() = emptyList()
}

View File

@@ -1,52 +0,0 @@
package chylex.hee.game.item.properties
import chylex.hee.game.Resource
import chylex.hee.game.item.util.ItemProperty
import chylex.hee.system.isVanilla
import chylex.hee.system.path
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.util.IItemProvider
import net.minecraft.util.ResourceLocation
sealed class ItemModel {
sealed class SingleItemModel : ItemModel() {
open fun getLocation(item: Item): ResourceLocation {
return Resource("item/" + item.path, item.isVanilla)
}
}
object Manual : SingleItemModel()
object Simple : SingleItemModel()
object AsBlock : SingleItemModel()
object Skull : SingleItemModel()
object SpawnEgg : SingleItemModel()
object Wall : SingleItemModel()
class Layers(vararg val layers: String) : SingleItemModel()
class Copy(val item: IItemProvider) : SingleItemModel()
class Named(val name: String) : SingleItemModel() {
override fun getLocation(item: Item): ResourceLocation {
return Resource("item/$name", item.isVanilla)
}
}
class FromParent(val parent: ResourceLocation) : SingleItemModel() {
constructor(block: Block) : this(Resource("block/" + block.path, block.isVanilla))
override fun getLocation(item: Item): ResourceLocation {
return parent
}
}
class Suffixed(val suffix: String, val wrapped: ItemModel = Simple) : SingleItemModel() {
override fun getLocation(item: Item): ResourceLocation {
return Resource("item/" + item.path + suffix, item.isVanilla)
}
}
class WithTextures(val baseModel: ItemModel, val textures: Map<String, ResourceLocation>) : ItemModel()
class WithOverrides(val baseModel: ItemModel, vararg val overrides: Pair<ItemProperty, Map<Float, SingleItemModel>>) : ItemModel()
class Multi(vararg val models: ItemModel) : ItemModel()
}

View File

@@ -1,21 +0,0 @@
package chylex.hee.game.item.properties
import chylex.hee.util.forge.Side
import chylex.hee.util.forge.Sided
import net.minecraft.client.renderer.color.IItemColor
import net.minecraft.item.ItemStack
@Sided(Side.CLIENT, _interface = IItemColor::class)
abstract class ItemTint : IItemColor {
protected companion object {
const val NO_TINT = -1
}
@Sided(Side.CLIENT)
final override fun getColor(stack: ItemStack, tintIndex: Int): Int {
return tint(stack, tintIndex)
}
@Sided(Side.CLIENT)
abstract fun tint(stack: ItemStack, tintIndex: Int): Int
}

View File

@@ -1,7 +0,0 @@
package chylex.hee.game.potion
import chylex.hee.util.color.IntColor
import net.minecraft.potion.Effect
import net.minecraft.potion.EffectType
abstract class HeeEffect(type: EffectType, color: IntColor) : Effect(type, color.i), IHeeEffect

View File

@@ -1,8 +0,0 @@
package chylex.hee.game.potion
import chylex.hee.client.text.LocalizationStrategy
interface IHeeEffect {
val localization: LocalizationStrategy
get() = LocalizationStrategy.Default
}

View File

@@ -1,17 +0,0 @@
package chylex.hee.game.world
import chylex.hee.HEE
import net.minecraft.entity.Entity
import net.minecraft.world.World
val World.isOverworldDimension
get() = this.dimensionKey === World.OVERWORLD
val World.isEndDimension
get() = this.dimensionKey === HEE.dim
val Entity.isInOverworldDimension
get() = this.world.isOverworldDimension
val Entity.isInEndDimension
get() = this.world.isEndDimension

View File

@@ -1,10 +0,0 @@
package chylex.hee.game.world.generation.blob
import chylex.hee.game.world.generation.structure.world.ScaffoldedWorld
import chylex.hee.util.math.Size
import java.util.Random
interface IBlobLayout {
val size: Size
fun generate(world: ScaffoldedWorld, rand: Random, generator: BlobGenerator)
}

View File

@@ -1,19 +0,0 @@
package chylex.hee.game.world.generation.blob.layouts
import chylex.hee.game.world.generation.blob.BlobGenerator
import chylex.hee.game.world.generation.blob.IBlobLayout
import chylex.hee.game.world.generation.structure.world.ScaffoldedWorld
import chylex.hee.util.math.Size
import chylex.hee.util.math.ceilToInt
import chylex.hee.util.random.RandomDouble
import java.util.Random
class BlobLayoutSingle(
private val radius: RandomDouble,
) : IBlobLayout {
override val size = Size(1 + (radius.max.ceilToInt() * 2))
override fun generate(world: ScaffoldedWorld, rand: Random, generator: BlobGenerator) {
generator.place(world, world.worldSize.centerPos, radius(rand))
}
}

View File

@@ -1,23 +0,0 @@
package chylex.hee.game.world.generation.blob.populators
import chylex.hee.game.world.generation.blob.BlobGenerator
import chylex.hee.game.world.generation.blob.IBlobPopulator
import chylex.hee.game.world.generation.structure.world.ScaffoldedWorld
import chylex.hee.game.world.util.allInBoxMutable
import chylex.hee.util.math.Pos
import chylex.hee.util.math.floorToInt
import chylex.hee.util.random.RandomDouble
import java.util.Random
class BlobPopulatorShaveTop(
private val height: RandomDouble,
) : IBlobPopulator {
override fun generate(world: ScaffoldedWorld, rand: Random, generator: BlobGenerator) {
val size = world.worldSize
val shave = (size.maxY * height(rand)).floorToInt()
for (pos in Pos(0, size.maxY - shave, 0).allInBoxMutable(size.maxPos)) {
world.markUnused(pos)
}
}
}

View File

@@ -1,75 +0,0 @@
package chylex.hee.game.world.generation.noise
import chylex.hee.game.world.generation.noise.OpenSimplex2S.GenerateContext3D
import chylex.hee.game.world.generation.noise.OpenSimplex2S.LatticeOrientation3D
import chylex.hee.util.math.MutablePos
import net.minecraft.util.math.BlockPos
import java.util.Random
sealed class Noise3D {
// Generation
abstract fun getRawValue(x: Double, y: Double, z: Double): Double
// Implementations
sealed class SuperSimplex(rand: Random) : Noise3D() {
protected val generator = OpenSimplex2S(rand.nextLong())
protected abstract val orientation: LatticeOrientation3D
class AreaNoise(val buffer: Array<Array<DoubleArray>>) {
operator fun get(x: Int, y: Int, z: Int) = buffer[z][y][x]
inline fun forEach(callback: (BlockPos.Mutable, Double) -> Unit) {
val pos = MutablePos()
for ((z, yArray) in buffer.withIndex()) {
pos.z = z
for ((y, xArray) in yArray.withIndex()) {
pos.y = y
for ((x, value) in xArray.withIndex()) {
pos.x = x
callback(pos, value)
}
}
}
}
}
class AreaGenerator(private val generator: OpenSimplex2S, private val context: GenerateContext3D) {
fun generate(x: Int, y: Int, z: Int, xSize: Int, ySize: Int, zSize: Int): AreaNoise {
val buffer = Array(zSize) { Array(ySize) { DoubleArray(xSize) { 0.0 } } }
return buffer.apply { generator.generate3(context, this, x, y, z) }.let(::AreaNoise)
}
}
fun getAreaGenerator(xFreq: Double, yFreq: Double, zFreq: Double, amplitude: Double): AreaGenerator {
return AreaGenerator(generator, GenerateContext3D(orientation, xFreq, yFreq, zFreq, amplitude))
}
fun getAreaGenerator(xzFreq: Double, yFreq: Double, amplitude: Double): AreaGenerator {
return getAreaGenerator(xzFreq, yFreq, xzFreq, amplitude)
}
class Classic(rand: Random) : SuperSimplex(rand) {
override val orientation
get() = LatticeOrientation3D.Classic
override fun getRawValue(x: Double, y: Double, z: Double): Double {
return generator.noise3_Classic(x, y, z)
}
}
class Terrain(rand: Random) : SuperSimplex(rand) {
override val orientation
get() = LatticeOrientation3D.XZBeforeY
override fun getRawValue(x: Double, y: Double, z: Double): Double {
return generator.noise3_XZBeforeY(x, y, z)
}
}
}
}

View File

@@ -1,42 +0,0 @@
package chylex.hee.game.world.generation.noise
import chylex.hee.util.math.remapRange
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.roundToInt
class NoiseValue(var value: Double) {
inline fun then(process: (Double) -> Double) {
value = process(value)
}
fun multiply(mp: Double) = then {
it * mp
}
fun redistribute(power: Double) = then {
it.pow(power)
}
fun terrace(steps: Int) = then {
(it * steps).roundToInt().toDouble() / steps
}
fun coerce(minimum: Double = 0.0, maximum: Double = 1.0) = then {
it.coerceIn(minimum, maximum)
}
fun remap(oldRange: ClosedFloatingPointRange<Double>, newRange: ClosedFloatingPointRange<Double>) = then {
remapRange(it, oldRange, newRange)
}
fun remap(newRange: ClosedFloatingPointRange<Double>) = then {
remapRange(it, (0.0)..(1.0), newRange)
}
inline fun ifNonZero(block: NoiseValue.() -> Unit) {
if (abs(value) > 0.001) {
block()
}
}
}

View File

@@ -1,7 +0,0 @@
package chylex.hee.game.world.generation.structure
import chylex.hee.util.math.Size
interface IStructurePiece {
val size: Size
}

View File

@@ -1,8 +0,0 @@
package chylex.hee.game.world.generation.structure.piece
import chylex.hee.game.world.generation.structure.IStructureGenerator
import chylex.hee.util.math.BoundingBox
interface IStructureBuild : IStructureGenerator {
val boundingBoxes: Iterable<BoundingBox>
}

View File

@@ -1,34 +0,0 @@
package chylex.hee.game.world.generation.structure.world.segments
import chylex.hee.game.world.generation.structure.world.segments.ISegment.Companion.index
import chylex.hee.util.math.MutablePos
import chylex.hee.util.math.Size
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap
import net.minecraft.block.BlockState
import net.minecraft.util.math.BlockPos
/**
* A segment that supports arbitrary block states in arbitrary positions.
*/
class SegmentFull(private val size: Size, fillState: BlockState) : ISegment {
constructor(size: Size, fillState: BlockState, posToStateMap: Long2ObjectOpenHashMap<BlockState>) : this(size, fillState) {
val pos = MutablePos()
val iter = posToStateMap.long2ObjectEntrySet().fastIterator()
while (iter.hasNext()) {
val entry = iter.next()
pos.setPos(entry.longKey)
data[index(pos, size)] = entry.value
}
}
private val data = Array(size.x * size.y * size.z) { fillState }
override fun getState(pos: BlockPos): BlockState {
return data[index(pos, size)]
}
override fun withState(pos: BlockPos, state: BlockState): ISegment {
data[index(pos, size)] = state
return this
}
}

View File

@@ -1,43 +0,0 @@
package chylex.hee.game.world.generation.structure.world.segments
import chylex.hee.util.math.Size
import chylex.hee.util.math.floorToInt
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.util.math.BlockPos
import kotlin.math.pow
/**
* A segment mostly filled with one type of block state, but allowing for a few [exceptions].
* When the amount of exceptions reaches a [threshold] based on the segment size, it gets converted to [SegmentFull].
*/
class SegmentMultiState(private val size: Size, private val fillState: BlockState) : ISegment {
constructor(size: Size, block: Block) : this(size, block.defaultState)
/**
* The threshold power was determined using the WorldSegmentProfiling test.
* The segment gets converted when the amount of memory used by the [exceptions] map reaches roughly half of the memory used by the [SegmentFull] array.
*/
private val threshold = (size.x * size.y * size.z).toDouble().pow(0.825).floorToInt()
private val exceptions = Long2ObjectOpenHashMap<BlockState>(threshold, 0.75F).apply { defaultReturnValue(fillState) }
override fun getState(pos: BlockPos): BlockState {
return exceptions.get(pos.toLong())
}
override fun withState(pos: BlockPos, state: BlockState): ISegment {
if (state == fillState) {
exceptions.remove(pos.toLong())
return this
}
@Suppress("ReplacePutWithAssignment")
exceptions.put(pos.toLong(), state) // kotlin indexer boxes the values
return if (exceptions.size < threshold)
this
else
SegmentFull(size, fillState, exceptions)
}
}

View File

@@ -1,41 +0,0 @@
package chylex.hee.system
import chylex.hee.HEE
import chylex.hee.game.item.util.nbt
import chylex.hee.game.item.util.nbtOrNull
import chylex.hee.util.nbt.TagCompound
import chylex.hee.util.nbt.getCompoundOrNull
import chylex.hee.util.nbt.getOrCreateCompound
import net.minecraft.entity.Entity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.ItemStack
// NBT
val TagCompound.heeTag
get() = this.getOrCreateCompound(HEE.ID)
val TagCompound.heeTagOrNull
get() = this.getCompoundOrNull(HEE.ID)
// ItemStack
val ItemStack.heeTag: TagCompound
get() = this.nbt.heeTag
val ItemStack.heeTagOrNull: TagCompound?
get() = this.nbtOrNull?.heeTagOrNull
// Entity
val Entity.heeTag
get() = this.persistentData.heeTag
val Entity.heeTagOrNull
get() = this.persistentData.heeTagOrNull
val Entity.heeTagPersistent
get() = this.persistentData.getOrCreateCompound(PlayerEntity.PERSISTED_NBT_TAG).heeTag
val Entity.heeTagPersistentOrNull
get() = this.persistentData.getCompoundOrNull(PlayerEntity.PERSISTED_NBT_TAG)?.heeTagOrNull

View File

@@ -1,3 +0,0 @@
public net.minecraft.entity.LivingEntity field_110153_bc # lastDamage
public net.minecraft.loot.LootTable <init>(Lnet/minecraft/loot/LootParameterSet;[Lnet/minecraft/loot/LootPool;[Lnet/minecraft/loot/functions/ILootFunction;)V
public net.minecraft.loot.LootTable func_186463_a(Ljava/util/List;ILjava/util/Random;)V # shuffleItems

View File

@@ -1,7 +0,0 @@
{
"pack": {
"description": "Hardcore Ender Expansion 2 (System Library)",
"pack_format": 6,
"_comment": ""
}
}

View File

@@ -1,30 +0,0 @@
buildscript {
repositories {
mavenCentral()
maven { url = "https://files.minecraftforge.net/maven" }
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: forge_gradle_version, changing: true
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version
}
}
apply plugin: "net.minecraftforge.gradle"
minecraft {
mappings channel: "snapshot", version: rootProject.mapping_version
setAccessTransformers(rootProject.access_transformers)
}
dependencies {
minecraft "net.minecraftforge:forge:" + mc_version + "-" + forge_version
}
jar {
manifest {
attributes([
"FMLModType": "LIBRARY"
])
}
}

Some files were not shown because too many files have changed in this diff Show More