diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 7546069c8..91688b763 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -4c3e0500f9382d2e426e823fe876f57f4d7ee3b4 assets/create/blockstates/fluid_pipe.json +48086bf71a824faf14841b698050cc8544b09a9b assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json @@ -337,7 +337,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json -bdd56f32ce0a148b6e466a55ab2777f69fc08cfc assets/create/blockstates/radial_chassis.json +6fa36883e76e9e403bb429c8f86b8c0d3bba0cff assets/create/blockstates/radial_chassis.json 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json 722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json @@ -401,18 +401,18 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json e3f618c5b622d21880de858678d1802cbf65e615 assets/create/lang/en_ud.json -acc852d80378b426d7ee6cb59c169e06b6d63b25 assets/create/lang/en_us.json -30ce93c56557cea2f384a47b549fb893700523a5 assets/create/lang/unfinished/de_de.json -77b8310f3cbed36fa0d2ee29e65ac6aee0c2adc2 assets/create/lang/unfinished/es_mx.json -8db9f9147dcef8c8182c548a524f96f578c116ec assets/create/lang/unfinished/fr_fr.json -89f7029d73733938ee9f900fc36d52ab7fc97563 assets/create/lang/unfinished/it_it.json -b1935e7f8d79d1112e1685adb42daedb976ac6d7 assets/create/lang/unfinished/ja_jp.json -23aaf879d07a24775aeba3b98c355c992b24f28b assets/create/lang/unfinished/ko_kr.json -7372533759001f094dbcad787f01f3de7422d8c0 assets/create/lang/unfinished/nl_nl.json -0d1e5d79ef196a06b273962d5ac8f2013f91209c assets/create/lang/unfinished/pt_br.json -54da7badbd4fb043f73f6e9a4dfc52bd9e7f515c assets/create/lang/unfinished/ru_ru.json -45ca54406acac857752c67a45729da953d11f94a assets/create/lang/unfinished/zh_cn.json -4093ea8612465858aa57581b36f8f60aa23ac203 assets/create/lang/unfinished/zh_tw.json +a3e1a1b7946534a5db2482cc6d43aadbdaf0938f assets/create/lang/en_us.json +56c92fc5d2526d6ab9086d2edb03956234cad255 assets/create/lang/unfinished/de_de.json +4cab4140761c85fe6f2cb0a636ade5d63be422c4 assets/create/lang/unfinished/es_mx.json +c1436ba5bd506cd531586a1ca87f7bcc1091a2d6 assets/create/lang/unfinished/fr_fr.json +4747471601a24efbc6cb01b339bafb984b6903c6 assets/create/lang/unfinished/it_it.json +5b87db032d1726cc10a225bf0c4740f50169517f assets/create/lang/unfinished/ja_jp.json +acc6638d1ae47eab3c33431e3b794d85bf158f8f assets/create/lang/unfinished/ko_kr.json +88a425173c828ce221435dfd9a29316cfe05204b assets/create/lang/unfinished/nl_nl.json +4672e12982db0283e4826904c2538a5465c5c1e6 assets/create/lang/unfinished/pt_br.json +85d5f3d8fd543c5f8d2d50e689b5ad25765c7cc2 assets/create/lang/unfinished/ru_ru.json +ad1f7b8a42bc74dd416380faf2b66f2ca1302ec0 assets/create/lang/unfinished/zh_cn.json +c561cc74bcfc00b664ec299fb8d6f9ee2c236d24 assets/create/lang/unfinished/zh_tw.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index 581373307..80a25280c 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -60,9 +60,9 @@ }, { "when": { - "south": "false", - "up": "true", "down": "false", + "up": "true", + "south": "false", "north": "true" }, "apply": { @@ -71,9 +71,9 @@ }, { "when": { - "south": "true", - "up": "true", "down": "false", + "up": "true", + "south": "true", "north": "false" }, "apply": { @@ -82,9 +82,9 @@ }, { "when": { - "south": "false", - "up": "false", "down": "true", + "up": "false", + "south": "false", "north": "true" }, "apply": { @@ -93,9 +93,9 @@ }, { "when": { - "south": "true", - "up": "false", "down": "true", + "up": "false", + "south": "true", "north": "false" }, "apply": { @@ -104,9 +104,9 @@ }, { "when": { - "south": "false", - "up": "true", "down": "true", + "up": "true", + "south": "false", "north": "false" }, "apply": { @@ -115,20 +115,9 @@ }, { "when": { - "south": "false", - "up": "true", "down": "false", - "north": "false" - }, - "apply": { - "model": "create:block/fluid_pipe/ud_x" - } - }, - { - "when": { + "up": "true", "south": "false", - "up": "false", - "down": "true", "north": "false" }, "apply": { @@ -137,9 +126,20 @@ }, { "when": { + "down": "true", + "up": "false", + "south": "false", + "north": "false" + }, + "apply": { + "model": "create:block/fluid_pipe/ud_x" + } + }, + { + "when": { + "down": "false", + "up": "false", "south": "true", - "up": "false", - "down": "false", "north": "true" }, "apply": { @@ -148,9 +148,9 @@ }, { "when": { - "south": "false", - "up": "false", "down": "false", + "up": "false", + "south": "false", "north": "true" }, "apply": { @@ -159,9 +159,9 @@ }, { "when": { - "south": "true", - "up": "false", "down": "false", + "up": "false", + "south": "true", "north": "false" }, "apply": { @@ -170,9 +170,9 @@ }, { "when": { - "south": "false", - "up": "false", "down": "false", + "up": "false", + "south": "false", "north": "false" }, "apply": { @@ -302,8 +302,8 @@ }, { "when": { - "up": "true", "down": "false", + "up": "true", "west": "false", "east": "true" }, @@ -313,8 +313,8 @@ }, { "when": { - "up": "true", "down": "false", + "up": "true", "west": "true", "east": "false" }, @@ -324,8 +324,8 @@ }, { "when": { - "up": "false", "down": "true", + "up": "false", "west": "false", "east": "true" }, @@ -335,8 +335,8 @@ }, { "when": { - "up": "false", "down": "true", + "up": "false", "west": "true", "east": "false" }, @@ -346,19 +346,8 @@ }, { "when": { - "up": "true", "down": "true", - "west": "false", - "east": "false" - }, - "apply": { - "model": "create:block/fluid_pipe/ud_z" - } - }, - { - "when": { "up": "true", - "down": "false", "west": "false", "east": "false" }, @@ -368,8 +357,19 @@ }, { "when": { - "up": "false", + "down": "false", + "up": "true", + "west": "false", + "east": "false" + }, + "apply": { + "model": "create:block/fluid_pipe/ud_z" + } + }, + { + "when": { "down": "true", + "up": "false", "west": "false", "east": "false" }, @@ -379,8 +379,8 @@ }, { "when": { - "up": "false", "down": "false", + "up": "false", "west": "true", "east": "true" }, @@ -390,8 +390,8 @@ }, { "when": { - "up": "false", "down": "false", + "up": "false", "west": "false", "east": "true" }, @@ -401,8 +401,8 @@ }, { "when": { - "up": "false", "down": "false", + "up": "false", "west": "true", "east": "false" }, @@ -412,8 +412,8 @@ }, { "when": { - "up": "false", "down": "false", + "up": "false", "west": "false", "east": "false" }, diff --git a/src/generated/resources/assets/create/blockstates/radial_chassis.json b/src/generated/resources/assets/create/blockstates/radial_chassis.json index 1aa3d3728..f97d8c8bc 100644 --- a/src/generated/resources/assets/create/blockstates/radial_chassis.json +++ b/src/generated/resources/assets/create/blockstates/radial_chassis.json @@ -29,8 +29,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "x" + "axis": "x", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -39,8 +39,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "y" + "axis": "y", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky" @@ -48,8 +48,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "z" + "axis": "z", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -59,8 +59,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "x" + "axis": "x", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -69,8 +69,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "y" + "axis": "y", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_y" @@ -78,8 +78,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "z" + "axis": "z", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -89,8 +89,8 @@ }, { "when": { - "axis": "x", - "sticky_west": "true" + "sticky_west": "true", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -99,8 +99,8 @@ }, { "when": { - "axis": "y", - "sticky_west": "true" + "sticky_west": "true", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -109,8 +109,8 @@ }, { "when": { - "axis": "z", - "sticky_west": "true" + "sticky_west": "true", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z_sticky", @@ -119,8 +119,8 @@ }, { "when": { - "axis": "x", - "sticky_west": "false" + "sticky_west": "false", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -129,8 +129,8 @@ }, { "when": { - "axis": "y", - "sticky_west": "false" + "sticky_west": "false", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -139,8 +139,8 @@ }, { "when": { - "axis": "z", - "sticky_west": "false" + "sticky_west": "false", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z", @@ -149,8 +149,8 @@ }, { "when": { - "axis": "x", - "sticky_north": "true" + "sticky_north": "true", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky" @@ -158,8 +158,8 @@ }, { "when": { - "axis": "y", - "sticky_north": "true" + "sticky_north": "true", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -168,8 +168,8 @@ }, { "when": { - "axis": "z", - "sticky_north": "true" + "sticky_north": "true", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -178,8 +178,8 @@ }, { "when": { - "axis": "x", - "sticky_north": "false" + "sticky_north": "false", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x" @@ -187,8 +187,8 @@ }, { "when": { - "axis": "y", - "sticky_north": "false" + "sticky_north": "false", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -197,8 +197,8 @@ }, { "when": { - "axis": "z", - "sticky_north": "false" + "sticky_north": "false", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -207,8 +207,8 @@ }, { "when": { - "axis": "x", - "sticky_east": "true" + "sticky_east": "true", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -217,8 +217,8 @@ }, { "when": { - "axis": "y", - "sticky_east": "true" + "sticky_east": "true", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -227,8 +227,8 @@ }, { "when": { - "axis": "z", - "sticky_east": "true" + "sticky_east": "true", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z_sticky" @@ -236,8 +236,8 @@ }, { "when": { - "axis": "x", - "sticky_east": "false" + "sticky_east": "false", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -246,8 +246,8 @@ }, { "when": { - "axis": "y", - "sticky_east": "false" + "sticky_east": "false", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -256,8 +256,8 @@ }, { "when": { - "axis": "z", - "sticky_east": "false" + "sticky_east": "false", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z" diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index fb30e864a..69da8b46a 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1786,6 +1786,22 @@ "create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription8": "Use it and regret your decision immediately.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "This is Shared stuff", + "create.metadoc.shared.when_wrenched": "When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 10f43ea40..7ffbf545b 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1095", + "_": "Missing Localizations: 1107", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription8": "UNLOCALIZED: Use it and regret your decision immediately.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index 5982b8d60..1e175818f 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 886", + "_": "Missing Localizations: 898", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription8": "UNLOCALIZED: Use it and regret your decision immediately.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index f9524d01b..0c4230e07 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 666", + "_": "Missing Localizations: 678", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "Celui-ci n'est peut-être pas pour vous. Que dire de celui-là?", "create.tooltip.randomWipDescription8": "Utilisez-le et regrettez immédiatement votre décision.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index d8b4ba2dd..50077225a 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 3", + "_": "Missing Localizations: 15", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "Questo forse non fa per te. Che ne dici di quello?", "create.tooltip.randomWipDescription8": "Usalo e rimpiangi immediatamente la tua decisione.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index 51e3ebb30..33203a9f6 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 12", + "_": "Missing Localizations: 24", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "これは君に向いていないかもしれない。 あれはどう??", "create.tooltip.randomWipDescription8": "それを使ったことをすぐ後悔する。", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index f9779a768..baf40797c 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 55", + "_": "Missing Localizations: 67", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription8": "Use it and regret your decision immediately.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index cbd42c8a8..7b9c03a39 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1155", + "_": "Missing Localizations: 1167", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "Deze is misschien niet geschikt voor jou.", "create.tooltip.randomWipDescription8": "Gebruikt het en je zal meteen spijt hebben.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index a967dbbe6..071a3425e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1221", + "_": "Missing Localizations: 1233", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription8": "UNLOCALIZED: Use it and regret your decision immediately.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 01743b81b..102977f20 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 5", + "_": "Missing Localizations: 17", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "Этот, возможно, но не для тебя. Как насчет этого?", "create.tooltip.randomWipDescription8": "Используя его, вы немедленно пожалеете о своем решении.", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 625bf7385..56c4a2cbe 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 3", + "_": "Missing Localizations: 15", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "这玩意不是给你用的,换个吧", "create.tooltip.randomWipDescription8": "试试就逝世。", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 8fa416308..f3a73370e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 8", + "_": "Missing Localizations: 20", "_": "->------------------------] Game Elements [------------------------<-", @@ -1787,6 +1787,22 @@ "create.tooltip.randomWipDescription7": "這東西不是給你用的,再找找吧!", "create.tooltip.randomWipDescription8": "用了就死定了。", + + "_": "->------------------------] MetaDoc Text [------------------------<-", + + "create.metadoc.shared.more_shared": "UNLOCALIZED: This is Shared stuff", + "create.metadoc.shared.when_wrenched": "UNLOCALIZED: When Wrenched", + "create.metadoc.cogwheel.scene_0.test_text": "UNLOCALIZED: Test text for scene 1", + "create.metadoc.cogwheel.scene_0.title": "UNLOCALIZED: My First Metadoc Story, Part 1", + "create.metadoc.cogwheel.scene_1.test_text": "UNLOCALIZED: Test text for scene 2", + "create.metadoc.cogwheel.scene_1.title": "UNLOCALIZED: My First Metadoc Story, Part 2", + "create.metadoc.cogwheel.scene_2.test_text": "UNLOCALIZED: Test text for scene 3", + "create.metadoc.cogwheel.scene_2.title": "UNLOCALIZED: My First Metadoc Story, Part 3", + "create.metadoc.cogwheel.scene_3.test_text": "UNLOCALIZED: Test text for scene 4", + "create.metadoc.cogwheel.scene_3.title": "UNLOCALIZED: My First Metadoc Story, Part 4", + "create.metadoc.cogwheel.scene_4.test_text": "UNLOCALIZED: Test text for scene 5", + "create.metadoc.cogwheel.scene_4.title": "UNLOCALIZED: My First Metadoc Story, Part 5", + "_": "Thank you for translating Create!" } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 07668a3b6..861006a1d 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -16,8 +16,8 @@ import com.simibubi.create.foundation.block.render.CustomBlockModels; import com.simibubi.create.foundation.block.render.SpriteShifter; import com.simibubi.create.foundation.item.CustomItemModels; import com.simibubi.create.foundation.item.CustomRenderedItems; -import com.simibubi.create.foundation.metadoc.MetaDocs; -import com.simibubi.create.foundation.metadoc.WorldSectionElement; +import com.simibubi.create.foundation.metadoc.content.MetaDocIndex; +import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement; import com.simibubi.create.foundation.utility.SuperByteBufferCache; import com.simibubi.create.foundation.utility.outliner.Outliner; @@ -76,7 +76,7 @@ public class CreateClient { AllEntityTypes.registerRenderers(); getColorHandler().init(); AllFluids.assignRenderLayers(); - MetaDocs.register(); + MetaDocIndex.register(); IResourceManager resourceManager = Minecraft.getInstance() .getResourceManager(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index a7d96c5be..944d6a0f9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -66,7 +66,7 @@ public abstract class KineticTileEntity extends SmartTileEntity @Override public void initialize() { - if (hasNetwork()) { + if (hasNetwork() && !world.isRemote) { KineticNetwork network = getOrCreateNetwork(); if (!network.initialized) network.initFromTE(capacity, stress, networkSize); diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index e414c36e6..7fabee37f 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -34,11 +34,12 @@ import net.minecraft.world.biome.Biomes; public class SchematicWorld extends WrappedWorld { - private Map blocks; - private Map tileEntities; - private List renderedTileEntities; - private List entities; - private MutableBoundingBox bounds; + protected Map blocks; + protected Map tileEntities; + protected List renderedTileEntities; + protected List entities; + protected MutableBoundingBox bounds; + public BlockPos anchor; public boolean renderMode; @@ -179,6 +180,13 @@ public class SchematicWorld extends WrappedWorld { pos = pos.subtract(anchor); bounds.expandTo(new MutableBoundingBox(pos, pos)); blocks.put(pos, arg1); + if (tileEntities.containsKey(pos)) { + TileEntity tileEntity = tileEntities.get(pos); + if (!tileEntity.getType().isValidBlock(arg1.getBlock())) { + tileEntities.remove(pos); + renderedTileEntities.remove(tileEntity); + } + } return true; } diff --git a/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java b/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java index 34dcfeb86..8a4aaef81 100644 --- a/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java +++ b/src/main/java/com/simibubi/create/foundation/data/AllLangPartials.java @@ -1,21 +1,49 @@ package com.simibubi.create.foundation.data; +import com.google.common.base.Supplier; +import com.google.gson.JsonElement; +import com.simibubi.create.Create; +import com.simibubi.create.foundation.metadoc.MetaDocs; +import com.simibubi.create.foundation.utility.FilesHelper; +import com.simibubi.create.foundation.utility.Lang; + public enum AllLangPartials { - + ADVANCEMENTS("Advancements"), MESSAGES("UI & Messages"), TOOLTIPS("Item Descriptions"), - + METADOC("MetaDoc Text", MetaDocs::provideLangEntries), + ; - + private String display; + private Supplier provider; private AllLangPartials(String display) { this.display = display; + this.provider = this::fromResource; + } + + private AllLangPartials(String display, Supplier customProvider) { + this.display = display; + this.provider = customProvider; } public String getDisplay() { return display; } + public JsonElement provide() { + return provider.get(); + } + + private JsonElement fromResource() { + String fileName = Lang.asId(name()); + String filepath = "assets/" + Create.ID + "/lang/default/" + fileName + ".json"; + JsonElement element = FilesHelper.loadJsonResource(filepath); + if (element == null) + throw new IllegalStateException(String.format("Could not find default lang file: %s", filepath)); + return element; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/data/LangMerger.java b/src/main/java/com/simibubi/create/foundation/data/LangMerger.java index d51631052..9c9b9f9d9 100644 --- a/src/main/java/com/simibubi/create/foundation/data/LangMerger.java +++ b/src/main/java/com/simibubi/create/foundation/data/LangMerger.java @@ -24,7 +24,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.FilesHelper; -import com.simibubi.create.foundation.utility.Lang; import net.minecraft.data.DataGenerator; import net.minecraft.data.DirectoryCache; @@ -201,14 +200,9 @@ public class LangMerger implements IDataProvider { } private void collectEntries() { - for (AllLangPartials partial : AllLangPartials.values()) { - String fileName = Lang.asId(partial.name()); - String filepath = "assets/" + Create.ID + "/lang/default/" + fileName + ".json"; - JsonElement element = FilesHelper.loadJsonResource(filepath); - if (element == null) - throw new IllegalStateException(String.format("Could not find default lang file: %s", filepath)); - addAll(partial.getDisplay(), element.getAsJsonObject()); - } + for (AllLangPartials partial : AllLangPartials.values()) + addAll(partial.getDisplay(), partial.provide() + .getAsJsonObject()); } private void save(DirectoryCache cache, List dataIn, int missingKeys, Path target, String message) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 5ed72ec0e..106379330 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.client.gui.widget.Widget; @@ -41,6 +42,8 @@ public abstract class AbstractSimiContainerScreen extends C @Override public void render(int mouseX, int mouseY, float partialTicks) { + partialTicks = Minecraft.getInstance() + .getRenderPartialTicks(); renderBackground(); renderWindow(mouseX, mouseY, partialTicks); diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 1ec2a4129..2b1902376 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -5,6 +5,7 @@ import java.util.List; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.Widget; import net.minecraft.util.text.StringTextComponent; @@ -32,6 +33,8 @@ public abstract class AbstractSimiScreen extends Screen { @Override public void render(int mouseX, int mouseY, float partialTicks) { + partialTicks = Minecraft.getInstance() + .getRenderPartialTicks(); renderBackground(); renderWindow(mouseX, mouseY, partialTicks); for (Widget widget : widgets) @@ -79,7 +82,7 @@ public abstract class AbstractSimiScreen extends Screen { } return super.mouseScrolled(mouseX, mouseY, delta); } - + @Override public boolean mouseReleased(double x, double y, int button) { boolean result = false; @@ -106,8 +109,9 @@ public abstract class AbstractSimiScreen extends Screen { for (Widget widget : widgets) { if (!widget.isHovered()) continue; - - if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { + + if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip() + .isEmpty()) { renderTooltip(((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); } } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocElement.java new file mode 100644 index 000000000..753d454c8 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocElement.java @@ -0,0 +1,17 @@ +package com.simibubi.create.foundation.metadoc; + +public class MetaDocElement { + + boolean visible = true; + + public void tick() {} + + public boolean isVisible() { + return visible; + } + + public void setVisible(boolean visible) { + this.visible = visible; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocLocalization.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocLocalization.java new file mode 100644 index 000000000..55b28c150 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocLocalization.java @@ -0,0 +1,74 @@ +package com.simibubi.create.foundation.metadoc; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.simibubi.create.Create; +import com.simibubi.create.foundation.metadoc.content.MetaDocIndex; +import com.simibubi.create.foundation.utility.Lang; + +import net.minecraft.util.ResourceLocation; + +public class MetaDocLocalization { + + static Map shared = new HashMap<>(); + static Map>> specific = new HashMap<>(); + + // + + public static void registerShared(String key, String enUS) { + shared.put(key, enUS); + } + + public static void registerSpecific(ResourceLocation component, int scene, String key, String enUS) { + specific.computeIfAbsent(component, $ -> new HashMap<>()) + .computeIfAbsent(scene, $ -> new HashMap<>()) + .put(key, enUS); + } + + // + + public static String getShared(String key) { + if (MetaDocIndex.EDITOR_MODE) + return shared.get(key); + return Lang.translate(langKeyForShared(key)); + } + + public static String getSpecific(ResourceLocation component, int scene, String k) { + if (MetaDocIndex.EDITOR_MODE) + return specific.get(component) + .get(scene) + .get(k); + return Lang.translate(langKeyForSpecific(component.getPath(), scene, k)); + } + + // + + static final String LANG_PREFIX = "metadoc."; + + public static JsonElement record() { + JsonObject object = new JsonObject(); + shared.forEach((k, v) -> object.addProperty(Create.ID + "." + langKeyForShared(k), v)); + specific.forEach((rl, map) -> { + String component = rl.getPath(); + for (int i = 0; i < map.size(); i++) { + final int scene = i; + Map sceneMap = map.get(i); + sceneMap.forEach( + (k, v) -> object.addProperty(Create.ID + "." + langKeyForSpecific(component, scene, k), v)); + } + }); + return object; + } + + protected static String langKeyForSpecific(String component, int scene, String k) { + return LANG_PREFIX + component + ".scene_" + scene + "." + k; + } + + protected static String langKeyForShared(String k) { + return LANG_PREFIX + "shared." + k; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScene.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScene.java index 7642c1927..eb92fb29d 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScene.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScene.java @@ -2,46 +2,82 @@ package com.simibubi.create.foundation.metadoc; import java.util.ArrayList; import java.util.HashSet; -import java.util.IdentityHashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Supplier; +import java.util.function.UnaryOperator; import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity; +import com.simibubi.create.foundation.metadoc.elements.MetaDocOverlayElement; +import com.simibubi.create.foundation.metadoc.elements.MetaDocSceneElement; +import com.simibubi.create.foundation.metadoc.elements.ParrotElement; +import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement; +import com.simibubi.create.foundation.metadoc.instructions.CreateParrotInstruction; import com.simibubi.create.foundation.metadoc.instructions.DelayInstruction; import com.simibubi.create.foundation.metadoc.instructions.DisplayWorldSectionInstruction; import com.simibubi.create.foundation.metadoc.instructions.HideAllInstruction; +import com.simibubi.create.foundation.metadoc.instructions.ReplaceBlocksInstruction; +import com.simibubi.create.foundation.metadoc.instructions.RotateSceneInstruction; import com.simibubi.create.foundation.metadoc.instructions.ShowCompleteSchematicInstruction; +import com.simibubi.create.foundation.metadoc.instructions.TextWindowInstruction; +import com.simibubi.create.foundation.metadoc.instructions.TileEntityDataInstruction; +import com.simibubi.create.foundation.utility.LerpedFloat; +import com.simibubi.create.foundation.utility.MatrixStacker; +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.Matrix4f; +import net.minecraft.client.renderer.Vector4f; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MutableBoundingBox; +import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; public class MetaDocScene { List schedule, activeSchedule; - Set elements; - Map> groups; + Set elements; MetaDocWorld world; + ResourceLocation component; + int sceneIndex; + SceneTransform transform; - public MetaDocScene(MetaDocWorld world) { + public MetaDocScene(MetaDocWorld world, ResourceLocation component, int sceneIndex) { this.world = world; + this.component = component; + this.sceneIndex = sceneIndex; elements = new HashSet<>(); - groups = new IdentityHashMap<>(); schedule = new ArrayList<>(); activeSchedule = new ArrayList<>(); + transform = new SceneTransform(); + } + + public String getTitle() { + return getString("title"); + } + + public String getString(String key) { + return MetaDocLocalization.getSpecific(component, sceneIndex, key); } public void reset() { activeSchedule.clear(); schedule.forEach(mdi -> mdi.reset(this)); } - + public void begin() { reset(); + world.restore(); + transform = new SceneTransform(); + forEach(WorldSectionElement.class, wse -> wse.queueRedraw(world)); elements.clear(); activeSchedule.addAll(schedule); } @@ -51,18 +87,27 @@ public class MetaDocScene { activeSchedule.add(new HideAllInstruction(10, null)); } - public void render(IRenderTypeBuffer buffer, MatrixStack ms) { + public void renderScene(IRenderTypeBuffer buffer, MatrixStack ms) { ms.push(); - MutableBoundingBox bounds = world.getBounds(); - ms.translate(bounds.getXSize() / -2f, -.5f, bounds.getZSize() / -2f); - elements.forEach(e -> { - if (e.visible) + forEach(MetaDocSceneElement.class, e -> { + if (e.isVisible()) e.render(world, buffer, ms); }); ms.pop(); } + public void renderOverlay(MetaDocScreen screen, MatrixStack ms, float partialTicks) { + ms.push(); + forEach(MetaDocOverlayElement.class, e -> { + if (e.isVisible()) + e.render(this, screen, ms, partialTicks); + }); + ms.pop(); + } + public void tick() { + transform.tick(); + forEach(MetaDocElement::tick); for (Iterator iterator = activeSchedule.iterator(); iterator.hasNext();) { MetaDocInstruction metaDocInstruction = iterator.next(); metaDocInstruction.tick(this); @@ -75,7 +120,7 @@ public class MetaDocScene { } } - public void addElement(MetaDocSceneElement e) { + public void addElement(MetaDocElement e) { elements.add(e); } @@ -83,32 +128,133 @@ public class MetaDocScene { return world; } - public Set getElements() { + public Set getElements() { return elements; } + public void forEach(Consumer function) { + for (MetaDocElement metaDocElement : elements) + function.accept(metaDocElement); + } + + public void forEach(Class type, Consumer function) { + for (MetaDocElement metaDocElement : elements) + if (type.isInstance(metaDocElement)) + function.accept(type.cast(metaDocElement)); + } + public MutableBoundingBox getBounds() { - return world.getBounds(); + return world == null ? new MutableBoundingBox() : world.getBounds(); } public SceneBuilder builder() { return new SceneBuilder(); } + private Supplier textGetter(String key) { + return () -> MetaDocLocalization.getSpecific(component, sceneIndex, key); + } + + public SceneTransform getTransform() { + return transform; + } + + public class SceneTransform { + + public LerpedFloat xRotation, yRotation; + + // Screen params + int width, height; + double offset; + Matrix4f cachedMat; + + public SceneTransform() { + xRotation = LerpedFloat.angular() + .startWithValue(-35); + yRotation = LerpedFloat.angular() + .startWithValue(55); + } + + public void tick() { + xRotation.tickChaser(); + yRotation.tickChaser(); + } + + public void updateScreenParams(int width, int height, double offset) { + this.width = width; + this.height = height; + this.offset = offset; + cachedMat = null; + } + + public MatrixStack apply(MatrixStack ms) { + float pt = Minecraft.getInstance() + .getRenderPartialTicks(); + ms.translate(width / 2, height / 2, 200); + + MatrixStacker.of(ms) + .rotateX(-35) + .rotateY(55); + ms.translate(offset, 0, 0); + MatrixStacker.of(ms) + .rotateY(-55) + .rotateX(35); + + MatrixStacker.of(ms) + .rotateX(xRotation.getValue(pt)) + .rotateY(yRotation.getValue(pt)); + ms.scale(30, -30, 30); + + MutableBoundingBox bounds = getBounds(); + ms.translate(bounds.getXSize() / -2f, -.5f, bounds.getZSize() / -2f); + + return ms; + } + + public Vec3d screenToScene(float x, float y) { + refreshMatrix(); + Vector4f vec = new Vector4f(x, y, 0, 1); + cachedMat.invert(); + vec.transform(cachedMat); + cachedMat.invert(); + MutableBoundingBox bounds = getBounds(); + return new Vec3d(vec.getX() + bounds.getXSize() / -2f, vec.getY(), vec.getZ() + bounds.getZSize() / -2f); + } + + public Vec2f sceneToScreen(Vec3d vec) { + refreshMatrix(); + Vector4f vec4 = new Vector4f((float) vec.x, (float) vec.y, (float) vec.z, 1); + vec4.transform(cachedMat); + return new Vec2f(vec4.getX(), vec4.getY()); + } + + protected void refreshMatrix() { + if (cachedMat != null) + return; + MatrixStack ms = apply(new MatrixStack()); +// MatrixStacker.of(ms) +// .rotateY(180); + cachedMat = ms.peek() + .getModel(); + } + + } + public class SceneBuilder { public SceneBuilder showBasePlate() { Vec3i length = getBounds().getLength(); - return showSection(BlockPos.ZERO, new Vec3i(length.getX(), 0, length.getZ()), Direction.UP); + return showSection(Select.cuboid(BlockPos.ZERO, new Vec3i(length.getX(), 0, length.getZ())), Direction.UP); } - public SceneBuilder showSection(BlockPos origin, Vec3i size, Direction fadeInDirection) { + public SceneBuilder showText(Vec3d position, String key, String defaultText, int fadeTime, int duration) { + MetaDocLocalization.registerSpecific(component, sceneIndex, key, defaultText); + return addInstruction(new TextWindowInstruction(textGetter(key), fadeTime, duration, position)); + } + + public SceneBuilder showSection(Select selection, Direction fadeInDirection) { return addInstruction( - new DisplayWorldSectionInstruction(15, fadeInDirection, new WorldSectionElement.Cuboid(origin, size))); - } - - public SceneBuilder showSection(WorldSectionElement element, Direction fadeInDirection) { - return addInstruction(new DisplayWorldSectionInstruction(15, fadeInDirection, element)); + new DisplayWorldSectionInstruction(15, fadeInDirection, new WorldSectionElement(selection))); } public SceneBuilder debugSchematic() { @@ -123,11 +269,62 @@ public class MetaDocScene { return idle(seconds * 20); } + public SceneBuilder rotateCameraY(float degrees) { + return addInstruction(new RotateSceneInstruction(0, degrees, true)); + } + + public SceneBuilder setBlocks(Select selection, BlockState state) { + return addInstruction(new ReplaceBlocksInstruction(selection, state, true)); + } + + public SceneBuilder replaceBlocks(Select selection, BlockState state) { + return addInstruction(new ReplaceBlocksInstruction(selection, state, false)); + } + + public SceneBuilder setKineticSpeed(Select selection, float speed) { + return modifyKineticSpeed(selection, f -> speed); + } + + public SceneBuilder multiplyKineticSpeed(Select selection, float modifier) { + return modifyKineticSpeed(selection, f -> f * modifier); + } + + public SceneBuilder modifyKineticSpeed(Select selection, UnaryOperator speedFunc) { + return addInstruction(new TileEntityDataInstruction(selection, KineticTileEntity.class, nbt -> { + if (!nbt.contains("Speed")) + return nbt; + nbt.putFloat("Speed", speedFunc.apply(nbt.getFloat("Speed"))); + return nbt; + }, false)); + } + + public SceneBuilder flapFunnels(Select selection, boolean outward) { + return addInstruction(new TileEntityDataInstruction(selection, FunnelTileEntity.class, nbt -> { + nbt.putInt("Flap", outward ? -1 : 1); + return nbt; + }, false)); + } + + public SceneBuilder createParrotOn(BlockPos pos, Direction fadeInDirection) { + return addInstruction( + new CreateParrotInstruction(15, fadeInDirection, new ParrotElement(new Vec3d(pos).add(.5, 0, .5)))); + } + + public SceneBuilder createParrot(Vec3d location, Direction fadeInDirection) { + return addInstruction(new CreateParrotInstruction(15, fadeInDirection, new ParrotElement(location))); + } + public SceneBuilder addInstruction(MetaDocInstruction instruction) { schedule.add(instruction); return this; } + // + + public Select everywhere() { + return Select.cuboid(BlockPos.ZERO, getBounds().getLength()); + } + } } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocSceneElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocSceneElement.java deleted file mode 100644 index 1b208c990..000000000 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocSceneElement.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.simibubi.create.foundation.metadoc; - -import com.mojang.blaze3d.matrix.MatrixStack; - -import net.minecraft.client.renderer.IRenderTypeBuffer; - -public abstract class MetaDocSceneElement { - - boolean visible = true; - - public abstract void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms); - - public void setVisible(boolean visible) { - this.visible = visible; - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScreen.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScreen.java index 3f0f7ae8b..e9188f03b 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScreen.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocScreen.java @@ -6,26 +6,28 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AllIcons; +import com.simibubi.create.foundation.metadoc.content.MetaDocIndex; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; +import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.LerpedFloat.Chaser; -import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.client.GameSettings; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.client.gui.GuiUtils; public class MetaDocScreen extends AbstractSimiScreen { - private List stories; + private List scenes; private LerpedFloat fadeIn; private LerpedFloat lazyIndex; private int index = 0; - public MetaDocScreen(List stories) { - this.stories = stories; + public MetaDocScreen(List scenes) { + this.scenes = scenes; lazyIndex = LerpedFloat.linear() .startWithValue(index); fadeIn = LerpedFloat.linear() @@ -37,11 +39,11 @@ public class MetaDocScreen extends AbstractSimiScreen { public void tick() { lazyIndex.tickChaser(); fadeIn.tickChaser(); - stories.get(index) + scenes.get(index) .tick(); float lazyIndexValue = lazyIndex.getValue(); if (Math.abs(lazyIndexValue - index) > 1 / 512f) - stories.get(lazyIndexValue < index ? index - 1 : index + 1) + scenes.get(lazyIndexValue < index ? index - 1 : index + 1) .tick(); } @@ -55,11 +57,11 @@ public class MetaDocScreen extends AbstractSimiScreen { protected boolean scroll(boolean forward) { int prevIndex = index; index = forward ? index + 1 : index - 1; - index = MathHelper.clamp(index, 0, stories.size() - 1); + index = MathHelper.clamp(index, 0, scenes.size() - 1); if (prevIndex != index && Math.abs(index - lazyIndex.getValue()) < 1.5f) { - stories.get(prevIndex) + scenes.get(prevIndex) .fadeOut(); - stories.get(index) + scenes.get(index) .begin(); lazyIndex.chase(index, 1 / 4f, Chaser.EXP); return true; @@ -70,9 +72,6 @@ public class MetaDocScreen extends AbstractSimiScreen { @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - partialTicks = Minecraft.getInstance() - .getRenderPartialTicks(); - RenderSystem.enableBlend(); renderStories(partialTicks); renderWidgets(mouseX, mouseY, partialTicks); @@ -86,49 +85,65 @@ public class MetaDocScreen extends AbstractSimiScreen { } protected void renderStory(int i, float partialTicks) { - MetaDocScene story = stories.get(i); + SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); + MetaDocScene story = scenes.get(i); MatrixStack ms = new MatrixStack(); - ms.push(); - - ms.translate(width / 2, height / 2, 200); - MatrixStacker.of(ms) - .rotateX(-45) - .rotateY(45); - double value = lazyIndex.getValue(partialTicks); double diff = i - value; - double slide = MathHelper.lerp(diff * diff, 200, 600); - ms.translate(diff * slide, 0, 0); + double slide = MathHelper.lerp(diff * diff, 200, 600) * diff; - ms.scale(30, -30, 30); - - SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); - story.render(buffer, ms); + ms.push(); + story.transform.updateScreenParams(width, height, slide); + story.transform.apply(ms); + story.renderScene(buffer, ms); buffer.draw(); ms.pop(); } - protected void renderWidgets(int mouseX, int mouseY, float pt) { - float fade = fadeIn.getValue(pt); + protected void renderWidgets(int mouseX, int mouseY, float partialTicks) { + float fade = fadeIn.getValue(partialTicks); + float lazyIndexValue = lazyIndex.getValue(partialTicks); + float indexDiff = Math.abs(lazyIndexValue - index); int textColor = 0xeeeeee; - drawString(font, "MetaDoc Experimental 0", 50, 50 - 16, textColor); + { + int y = 34; + drawString(font, "MetaDoc Experimental 0", 50, y, textColor); + y += 10; + drawString(font, "> " + scenes.get(index) + .getTitle(), 50, y, ColorHelper.applyAlpha(textColor, 1 - indexDiff)); + y += 10; + if (MetaDocIndex.EDITOR_MODE) + drawString(font, "Mouse: " + mouseX + ", " + mouseY, 50, y, 0x8d8d8d); + } + // Scene overlay RenderSystem.pushMatrix(); + RenderSystem.translated(0, 0, 100); + renderOverlay(index, partialTicks); + if (indexDiff > 1 / 512f) + renderOverlay(lazyIndexValue < index ? index - 1 : index + 1, partialTicks); + RenderSystem.popMatrix(); + // Close button + RenderSystem.pushMatrix(); if (fade < fadeIn.getChaseTarget()) RenderSystem.translated(0, (1 - fade) * 5, 0); - int closeWidth = 24; int closeHeight = 24; int closeX = (width - closeWidth) / 2; int closeY = height - closeHeight - 31; boolean hovered = isMouseOver(mouseX, mouseY, closeX, closeY, closeWidth, closeHeight); - - renderBox(closeX, closeY, closeWidth, closeHeight, 0xdd000000, hovered ? 0x70ffffff : 0x30eebb00, - hovered ? 0x30ffffff : 0x10eebb00); + renderBox(closeX, closeY, closeWidth, closeHeight, hovered); AllIcons.I_CONFIRM.draw(closeX + 4, closeY + 4); + RenderSystem.popMatrix(); + } + private void renderOverlay(int i, float partialTicks) { + RenderSystem.pushMatrix(); + MetaDocScene story = scenes.get(i); + MatrixStack ms = new MatrixStack(); + story.renderOverlay(this, ms, partialTicks); RenderSystem.popMatrix(); } @@ -155,17 +170,17 @@ public class MetaDocScreen extends AbstractSimiScreen { .getKeyCode(); int dCode = settings.keyBindRight.getKey() .getKeyCode(); - + if (code == sCode) { onClose(); return true; } - + if (code == aCode) { scroll(false); return true; } - + if (code == dCode) { scroll(true); return true; @@ -173,6 +188,10 @@ public class MetaDocScreen extends AbstractSimiScreen { return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_); } + + public FontRenderer getFontRenderer() { + return font; + } protected boolean isMouseOver(double mouseX, double mouseY, int x, int y, int w, int h) { boolean hovered = !(mouseX < x || mouseX > x + w); @@ -180,27 +199,26 @@ public class MetaDocScreen extends AbstractSimiScreen { return hovered; } - protected void renderBox(int tooltipX, int tooltipY, int tooltipTextWidth, int tooltipHeight, int backgroundColor, - int borderColorStart, int borderColorEnd) { - int zLevel = 400; - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, - backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, - backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, - tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, - tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, - tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, - borderColorStart, borderColorStart); - GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + public void drawString(String s, int x, int y, int color) { + drawString(font, s, x, y, color); + } + + public void renderBox(int x, int y, int w, int h, boolean highlighted) { + renderBox(x, y, w, h, 0xdd000000, highlighted ? 0x70ffffff : 0x30eebb00, highlighted ? 0x30ffffff : 0x10eebb00); + } + + public void renderBox(int x, int y, int w, int h, int backgroundColor, int borderColorStart, int borderColorEnd) { + int zLevel = 100; + GuiUtils.drawGradientRect(zLevel, x - 3, y - 4, x + w + 3, y - 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(zLevel, x - 3, y + h + 3, x + w + 3, y + h + 4, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(zLevel, x - 3, y - 3, x + w + 3, y + h + 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(zLevel, x - 4, y - 3, x - 3, y + h + 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(zLevel, x + w + 3, y - 3, x + w + 4, y + h + 3, backgroundColor, backgroundColor); + GuiUtils.drawGradientRect(zLevel, x - 3, y - 3 + 1, x - 3 + 1, y + h + 3 - 1, borderColorStart, borderColorEnd); + GuiUtils.drawGradientRect(zLevel, x + w + 2, y - 3 + 1, x + w + 3, y + h + 3 - 1, borderColorStart, + borderColorEnd); + GuiUtils.drawGradientRect(zLevel, x - 3, y - 3, x + w + 3, y - 3 + 1, borderColorStart, borderColorStart); + GuiUtils.drawGradientRect(zLevel, x - 3, y + h + 2, x + w + 3, y + h + 3, borderColorEnd, borderColorEnd); } } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocStoryBoard.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocStoryBoard.java index ecd1e78ca..5199eec25 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocStoryBoard.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocStoryBoard.java @@ -7,6 +7,8 @@ import net.minecraft.util.math.Vec3i; public abstract class MetaDocStoryBoard { public abstract String getSchematicName(); + + public abstract String getStoryTitle(); public abstract void program(SceneBuilder scene, Vec3i worldSize); diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocWorld.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocWorld.java index a4388670d..4673cee68 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocWorld.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocWorld.java @@ -1,20 +1,50 @@ package com.simibubi.create.foundation.metadoc; +import java.util.HashMap; +import java.util.Map; + import com.simibubi.create.content.schematics.SchematicWorld; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.LightType; import net.minecraft.world.World; public class MetaDocWorld extends SchematicWorld { + protected Map originalBlocks; + protected Map originalTileEntities; + int overrideLight; - WorldSectionElement mask; + Select mask; public MetaDocWorld(BlockPos anchor, World original) { super(anchor, original); + originalBlocks = new HashMap<>(); + originalTileEntities = new HashMap<>(); + } + + public void createBackup() { + originalBlocks.clear(); + originalTileEntities.clear(); + blocks.forEach((k, v) -> originalBlocks.put(k, v)); + tileEntities.forEach((k, v) -> originalTileEntities.put(k, TileEntity.create(v.write(new CompoundNBT())))); + } + + public void restore() { + blocks.clear(); + tileEntities.clear(); + renderedTileEntities.clear(); + originalBlocks.forEach((k, v) -> blocks.put(k, v)); + originalTileEntities.forEach((k, v) -> { + TileEntity te = TileEntity.create(v.write(new CompoundNBT())); + te.setLocation(this, te.getPos()); + tileEntities.put(k, te); + renderedTileEntities.add(te); + }); } public void pushFakeLight(int light) { @@ -30,7 +60,7 @@ public class MetaDocWorld extends SchematicWorld { return overrideLight == -1 ? 15 : overrideLight; } - public void setMask(WorldSectionElement mask) { + public void setMask(Select mask) { this.mask = mask; } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocs.java b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocs.java index 649b7fb71..7d94caf57 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocs.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/MetaDocs.java @@ -8,12 +8,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import java.util.zip.GZIPInputStream; -import com.simibubi.create.AllBlocks; +import com.google.gson.JsonElement; import com.simibubi.create.Create; -import com.simibubi.create.foundation.metadoc.stories.CogwheelStory; +import com.simibubi.create.foundation.metadoc.content.MetaDocIndex; +import com.simibubi.create.foundation.metadoc.content.SharedText; import com.tterrag.registrate.util.entry.ItemProviderEntry; import net.minecraft.client.Minecraft; @@ -22,6 +22,7 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; @@ -29,33 +30,40 @@ public class MetaDocs { static Map> all = new HashMap<>(); - public static void register() { - - for (int i = 1; i < 6; i++) - addStoryBoard(AllBlocks.COGWHEEL, new CogwheelStory(i)); - - } - - private static void addStoryBoard(ItemProviderEntry component, MetaDocStoryBoard storyBoard) { + public static void addStoryBoard(ItemProviderEntry component, MetaDocStoryBoard storyBoard) { ResourceLocation id = component.getId(); all.computeIfAbsent(id, $ -> new ArrayList<>()) .add(storyBoard); } public static List compile(ResourceLocation id) { - return all.get(id) - .stream() - .map(sb -> { - Template activeTemplate = loadSchematic(sb.getSchematicName()); - MetaDocWorld world = new MetaDocWorld(BlockPos.ZERO, Minecraft.getInstance().world); - activeTemplate.addBlocksToWorld(world, BlockPos.ZERO, new PlacementSettings()); - MetaDocScene scene = new MetaDocScene(world); - sb.program(scene.builder(), world.getBounds() - .getLength()); - scene.begin(); - return scene; - }) - .collect(Collectors.toList()); + + if (MetaDocIndex.EDITOR_MODE) { + MetaDocLocalization.shared.clear(); + MetaDocLocalization.specific.clear(); + SharedText.gatherText(); + } + + List list = all.get(id); + List scenes = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + + MetaDocStoryBoard sb = list.get(i); + Template activeTemplate = loadSchematic(sb.getSchematicName()); + MetaDocWorld world = new MetaDocWorld(BlockPos.ZERO, Minecraft.getInstance().world); + activeTemplate.addBlocksToWorld(world, BlockPos.ZERO, new PlacementSettings()); + world.createBackup(); + + MetaDocScene scene = new MetaDocScene(world, id, i); + MetaDocLocalization.registerSpecific(id, i, "title", sb.getStoryTitle()); + sb.program(scene.builder(), world.getBounds() + .getLength()); + scene.begin(); + scenes.add(scene); + + } + + return scenes; } public static Template loadSchematic(String path) { @@ -75,4 +83,18 @@ public class MetaDocs { return t; } + public static JsonElement provideLangEntries() { + MetaDocIndex.register(); + SharedText.gatherText(); + all.forEach((id, list) -> { + for (int i = 0; i < list.size(); i++) { + MetaDocStoryBoard sb = list.get(i); + MetaDocScene scene = new MetaDocScene(null, id, i); + MetaDocLocalization.registerSpecific(id, i, "title", sb.getStoryTitle()); + sb.program(scene.builder(), Vec3i.NULL_VECTOR); + } + }); + return MetaDocLocalization.record(); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/Select.java b/src/main/java/com/simibubi/create/foundation/metadoc/Select.java new file mode 100644 index 000000000..688b59ed3 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/Select.java @@ -0,0 +1,69 @@ +package com.simibubi.create.foundation.metadoc; + +import java.util.function.Predicate; +import java.util.stream.Stream; + +import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MutableBoundingBox; +import net.minecraft.util.math.Vec3i; + +public abstract class Select implements Predicate { + + public static Select cuboid(BlockPos origin, Vec3i size) { + return new Cuboid(origin, size); + } + + public static Select pos(int x, int y, int z) { + return new Cuboid(new BlockPos(x, y, z), BlockPos.ZERO); + } + + public static Select everything(MetaDocScene scene) { + MutableBoundingBox bounds = scene.getBounds(); + return cuboid(BlockPos.ZERO, bounds.getLength()); + } + + // + + public WorldSectionElement asElement() { + return new WorldSectionElement(this); + } + + // + + @Override + public abstract int hashCode(); + + public abstract Stream all(); + + private static class Cuboid extends Select { + + MutableBoundingBox bb; + Vec3i origin; + Vec3i size; + + public Cuboid(BlockPos origin, Vec3i size) { + bb = new MutableBoundingBox(origin, origin.add(size)); + this.origin = origin; + this.size = size; + } + + @Override + public boolean test(BlockPos t) { + return bb.isVecInside(t); + } + + @Override + public Stream all() { + return BlockPos.func_229383_a_(bb); + } + + @Override + public int hashCode() { + return origin.hashCode() ^ size.hashCode(); + } + + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/content/CogwheelStory.java b/src/main/java/com/simibubi/create/foundation/metadoc/content/CogwheelStory.java new file mode 100644 index 000000000..e332e4e15 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/content/CogwheelStory.java @@ -0,0 +1,51 @@ +package com.simibubi.create.foundation.metadoc.content; + +import com.simibubi.create.foundation.metadoc.MetaDocScene.SceneBuilder; +import com.simibubi.create.foundation.metadoc.MetaDocStoryBoard; +import com.simibubi.create.foundation.metadoc.Select; + +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; + +public class CogwheelStory extends MetaDocStoryBoard { + + private int index; + + public CogwheelStory(int index) { + this.index = index; + } + + @Override + public String getSchematicName() { + return "cogwheel/s" + index; + } + + @Override + public String getStoryTitle() { + return "My First Metadoc Story, Part " + index; + } + + @Override + public void program(SceneBuilder scene, Vec3i worldSize) { + scene.showBasePlate(); + scene.idle(10); + + scene.showSection(Select.cuboid(BlockPos.ZERO.up(), worldSize), Direction.DOWN); + scene.multiplyKineticSpeed(scene.everywhere(), 2); + scene.rotateCameraY(90); + scene.createParrotOn(new BlockPos(0.5, 2.5, 1.5), Direction.DOWN); +// scene.idle(10); +// scene.createParrotOn(new BlockPos(5, 1, 5), Direction.DOWN); +// scene.idle(10); +// scene.createParrotOn(new BlockPos(0, 1, 5), Direction.DOWN); + + scene.idle(40); + scene.showText(new Vec3d(0.5, 2, 1.5), "swinging_text", "there's a parrot", 10, 50); + scene.idle(10); + scene.rotateCameraY(180); + + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/content/MetaDocIndex.java b/src/main/java/com/simibubi/create/foundation/metadoc/content/MetaDocIndex.java new file mode 100644 index 000000000..db91c27a1 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/content/MetaDocIndex.java @@ -0,0 +1,22 @@ +package com.simibubi.create.foundation.metadoc.content; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.metadoc.MetaDocs; + +public class MetaDocIndex { + + /** + * When true, lang files are bypassed and any text in metadoc can be hot-swapped + * without the need of runData + */ + public static final boolean EDITOR_MODE = true; + + public static void register() { + // Register storyboards here (Requires re-launch) + + for (int i = 1; i < 6; i++) + MetaDocs.addStoryBoard(AllBlocks.COGWHEEL, new CogwheelStory(i)); + + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/content/SharedText.java b/src/main/java/com/simibubi/create/foundation/metadoc/content/SharedText.java new file mode 100644 index 000000000..b2d061111 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/content/SharedText.java @@ -0,0 +1,23 @@ +package com.simibubi.create.foundation.metadoc.content; + +import com.simibubi.create.foundation.metadoc.MetaDocLocalization; + +public class SharedText { + + public static void gatherText() { + // Add entries used across several metadoc stories (Safe for hotswap) + + add("when_wrenched", "When Wrenched"); + add("more_shared", "This is Shared stuff"); + + } + + public static String get(String key) { + return MetaDocLocalization.getShared(key); + } + + private static void add(String k, String v) { + MetaDocLocalization.registerShared(k, v); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedOverlayElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedOverlayElement.java new file mode 100644 index 000000000..1c8cf29a0 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedOverlayElement.java @@ -0,0 +1,29 @@ +package com.simibubi.create.foundation.metadoc.elements; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocScreen; +import com.simibubi.create.foundation.utility.LerpedFloat; + +public abstract class AnimatedOverlayElement extends MetaDocOverlayElement { + + protected LerpedFloat fade; + + public AnimatedOverlayElement() { + fade = LerpedFloat.linear() + .startWithValue(0); + } + + public void setFade(float fade) { + this.fade.setValue(fade); + } + + @Override + public final void render(MetaDocScene scene, MetaDocScreen screen, MatrixStack ms, float partialTicks) { + float currentFade = fade.getValue(partialTicks); + render(scene, screen, ms, partialTicks, currentFade); + } + + protected abstract void render(MetaDocScene scene, MetaDocScreen screen, MatrixStack ms, float partialTicks, float fade); + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/AnimatedSceneElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedSceneElement.java similarity index 78% rename from src/main/java/com/simibubi/create/foundation/metadoc/AnimatedSceneElement.java rename to src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedSceneElement.java index fc13b7bff..a3d2bfc82 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/AnimatedSceneElement.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/AnimatedSceneElement.java @@ -1,6 +1,7 @@ -package com.simibubi.create.foundation.metadoc; +package com.simibubi.create.foundation.metadoc.elements; import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.MatrixStacker; @@ -40,4 +41,13 @@ public abstract class AnimatedSceneElement extends MetaDocSceneElement { protected abstract void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms, float fade); + protected int lightCoordsFromFade(float fade) { + int light = 0xF000F0; + if (fade != 1) { + light = (int) (0xF * fade); + light = light << 4 | light << 20; + } + return light; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocOverlayElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocOverlayElement.java new file mode 100644 index 000000000..29566ef8c --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocOverlayElement.java @@ -0,0 +1,14 @@ +package com.simibubi.create.foundation.metadoc.elements; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.metadoc.MetaDocElement; +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocScreen; + +public abstract class MetaDocOverlayElement extends MetaDocElement { + + public void tick() {} + + public abstract void render(MetaDocScene scene, MetaDocScreen screen, MatrixStack ms, float partialTicks); + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocSceneElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocSceneElement.java new file mode 100644 index 000000000..a5507a70a --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/MetaDocSceneElement.java @@ -0,0 +1,13 @@ +package com.simibubi.create.foundation.metadoc.elements; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.metadoc.MetaDocElement; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; + +import net.minecraft.client.renderer.IRenderTypeBuffer; + +public abstract class MetaDocSceneElement extends MetaDocElement { + + public abstract void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms); + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/elements/ParrotElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/ParrotElement.java new file mode 100644 index 000000000..5df7d845b --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/ParrotElement.java @@ -0,0 +1,72 @@ +package com.simibubi.create.foundation.metadoc.elements; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.Create; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.MatrixStacker; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.passive.ParrotEntity; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; + +public class ParrotElement extends AnimatedSceneElement { + + private Vec3d location; + private ParrotEntity entity; + + public ParrotElement(Vec3d location) { + this.location = location; + } + + @Override + public void tick() { + super.tick(); + if (entity == null) + return; + entity.ticksExisted++; + +// entity.prevRotationYawHead = entity.rotationYawHead; + entity.oFlapSpeed = entity.flapSpeed; + entity.oFlap = entity.flap; + entity.onGround = true; + +// entity.rotationYawHead++; + entity.flapSpeed = .5f; + entity.flap = 1; +// entity.flap += entity.flapSpeed; +// entity.flap += .5f + Create.random.nextFloat(); + } + + @Override + protected void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms, float fade) { + EntityRendererManager entityrenderermanager = Minecraft.getInstance() + .getRenderManager(); + float pt = Minecraft.getInstance() + .getRenderPartialTicks(); + + if (entity == null) { + entity = new ParrotEntity(EntityType.PARROT, world); + entity.setVariant(Create.random.nextInt(5)); +// entity.setPartying(BlockPos.ZERO, true); + } + + ms.push(); + ms.translate(location.x, location.y, location.z); + + MatrixStacker.of(ms) + .rotateY(AnimationTickHolder.getRenderTick() * 15) + .rotateZ(30); + ms.translate(-.25f, 0, 0); + + entityrenderermanager.render(entity, 0, 0, 0, 0, pt, ms, buffer, lightCoordsFromFade(fade)); + ms.pop(); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/elements/TextWindowElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/TextWindowElement.java new file mode 100644 index 000000000..4cbb84268 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/TextWindowElement.java @@ -0,0 +1,69 @@ +package com.simibubi.create.foundation.metadoc.elements; + +import java.util.List; +import java.util.function.Supplier; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocScreen; +import com.simibubi.create.foundation.utility.ColorHelper; + +import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.fml.client.gui.GuiUtils; + +public class TextWindowElement extends AnimatedOverlayElement { + + Supplier textGetter; + String bakedText; + Vec3d vec; + + public TextWindowElement(Supplier textGetter) { + this.textGetter = textGetter; + } + + public TextWindowElement moveTo(Vec3d vec) { + this.vec = vec; + return this; + } + + @Override + protected void render(MetaDocScene scene, MetaDocScreen screen, MatrixStack ms, float partialTicks, float fade) { + if (bakedText == null) + bakedText = textGetter.get(); + if (fade < 1 / 16f) + return; + Vec2f sceneToScreen = scene.getTransform() + .sceneToScreen(vec); + int targetX = screen.width * 6 / 8; + int textWidth = screen.width - targetX; + + List list = screen.getFontRenderer() + .listFormattedStringToWidth(bakedText, textWidth); + int boxWidth = 0; + for (String string : list) + boxWidth = Math.max(boxWidth, screen.getFontRenderer() + .getStringWidth(string)); + int boxHeight = screen.getFontRenderer() + .getWordWrappedHeight(bakedText, textWidth); + + RenderSystem.pushMatrix(); + RenderSystem.translatef(0, sceneToScreen.y, 400); + + screen.renderBox(targetX - 10, 3, boxWidth, boxHeight -1 , 0x55000000, 0x30eebb00, 0x10eebb00); + + RenderSystem.pushMatrix(); + RenderSystem.translatef(sceneToScreen.x, 0, 0); + double lineTarget = (targetX - sceneToScreen.x) * fade; + RenderSystem.scaled(lineTarget, 1, 1); + GuiUtils.drawGradientRect(-100, 0, 0, 1, 1, 0xFFFFFFFF, 0xFFFFFFFF); + GuiUtils.drawGradientRect(-100, 0, 1, 1, 2, 0xFF494949, 0xFF393939); + RenderSystem.popMatrix(); + + screen.getFontRenderer() + .drawSplitString(bakedText, targetX - 10, 3, textWidth, ColorHelper.applyAlpha(0xeeeeee, fade)); + RenderSystem.popMatrix(); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/metadoc/elements/WorldSectionElement.java similarity index 69% rename from src/main/java/com/simibubi/create/foundation/metadoc/WorldSectionElement.java rename to src/main/java/com/simibubi/create/foundation/metadoc/elements/WorldSectionElement.java index d1260037f..c3f867a6b 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/elements/WorldSectionElement.java @@ -1,17 +1,17 @@ -package com.simibubi.create.foundation.metadoc; +package com.simibubi.create.foundation.metadoc.elements; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Random; -import java.util.function.Predicate; -import java.util.stream.Stream; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; +import com.simibubi.create.foundation.metadoc.Select; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBufferCache; import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment; @@ -29,25 +29,44 @@ import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.util.math.Vec3i; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.data.EmptyModelData; -public abstract class WorldSectionElement extends AnimatedSceneElement implements Predicate { +public class WorldSectionElement extends AnimatedSceneElement { public static final Compartment> DOC_WORLD_SECTION = new Compartment<>(); List renderedTileEntities; + Select section; + boolean redraw; + + public WorldSectionElement(Select section) { + this.section = section; + } + + public void queueRedraw(MetaDocWorld world) { + redraw = true; + } + + public void tick() { + if (renderedTileEntities == null) + return; + renderedTileEntities.forEach(te -> { + if (te instanceof ITickableTileEntity) + ((ITickableTileEntity) te).tick(); + }); + } @Override public void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms, float fade) { int light = -1; if (fade != 1) light = (int) (MathHelper.lerp(fade, 5, 14)); + if (redraw) + renderedTileEntities = null; world.pushFakeLight(light); renderTileEntities(world, ms, buffer); @@ -56,40 +75,7 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement if (buffer instanceof IRenderTypeBuffer.Impl) ((IRenderTypeBuffer.Impl) buffer).draw(); renderStructure(world, ms, buffer, fade); - } - - @Override - public abstract int hashCode(); - - public abstract Stream all(); - - public static class Cuboid extends WorldSectionElement { - - MutableBoundingBox bb; - Vec3i origin; - Vec3i size; - - public Cuboid(BlockPos origin, Vec3i size) { - bb = new MutableBoundingBox(origin, origin.add(size)); - this.origin = origin; - this.size = size; - } - - @Override - public boolean test(BlockPos t) { - return bb.isVecInside(t); - } - - @Override - public Stream all() { - return BlockPos.func_229383_a_(bb); - } - - @Override - public int hashCode() { - return origin.hashCode() ^ size.hashCode(); - } - + redraw = false; } protected void renderStructure(MetaDocWorld world, MatrixStack ms, IRenderTypeBuffer buffer, float fade) { @@ -101,17 +87,14 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement for (int i = 0; i < blockLayers.size(); i++) { RenderType layer = blockLayers.get(i); Pair key = Pair.of(code, i); + if (redraw) + bufferCache.invalidate(DOC_WORLD_SECTION, key); SuperByteBuffer contraptionBuffer = bufferCache.get(DOC_WORLD_SECTION, key, () -> buildStructureBuffer(world, layer)); if (contraptionBuffer.isEmpty()) continue; - int light = 0xF000F0; - if (fade != 1) { - light = (int) (0xF * fade); - light = light << 4 | light << 20; - } - + int light = lightCoordsFromFade(fade); contraptionBuffer.light(light) .renderInto(ms, buffer.getBuffer(layer)); } @@ -120,10 +103,12 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement private void renderTileEntities(MetaDocWorld world, MatrixStack ms, IRenderTypeBuffer buffer) { if (renderedTileEntities == null) { renderedTileEntities = new ArrayList<>(); - all().map(world::getTileEntity) + section.all() + .map(world::getTileEntity) .filter(Objects::nonNull) .forEach(renderedTileEntities::add); - } + } else + renderedTileEntities.removeIf(te -> world.getTileEntity(te.getPos()) != te); TileEntityRenderHelper.renderTileEntities(world, renderedTileEntities, ms, new MatrixStack(), buffer); } @@ -137,22 +122,23 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement Random random = new Random(); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - world.setMask(this); + world.setMask(this.section); - all().forEach(pos -> { - BlockState state = world.getBlockState(pos); - if (state.getRenderType() == BlockRenderType.ENTITYBLOCK_ANIMATED) - return; - if (!RenderTypeLookup.canRenderInLayer(state, layer)) - return; + section.all() + .forEach(pos -> { + BlockState state = world.getBlockState(pos); + if (state.getRenderType() == BlockRenderType.ENTITYBLOCK_ANIMATED) + return; + if (!RenderTypeLookup.canRenderInLayer(state, layer)) + return; - IBakedModel originalModel = dispatcher.getModelForState(state); - ms.push(); - ms.translate(pos.getX(), pos.getY(), pos.getZ()); - blockRenderer.renderModel(world, originalModel, state, pos, ms, builder, true, random, 42, - OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); - ms.pop(); - }); + IBakedModel originalModel = dispatcher.getModelForState(state); + ms.push(); + ms.translate(pos.getX(), pos.getY(), pos.getZ()); + blockRenderer.renderModel(world, originalModel, state, pos, ms, builder, true, random, 42, + OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); + ms.pop(); + }); world.clearMask(); builder.finishDrawing(); diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/CreateParrotInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/CreateParrotInstruction.java new file mode 100644 index 000000000..b279103a5 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/CreateParrotInstruction.java @@ -0,0 +1,13 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import com.simibubi.create.foundation.metadoc.elements.ParrotElement; + +import net.minecraft.util.Direction; + +public class CreateParrotInstruction extends FadeIntoSceneInstruction { + + public CreateParrotInstruction(int fadeInTicks, Direction fadeInFrom, ParrotElement element) { + super(fadeInTicks, fadeInFrom, element); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/DisplayWorldSectionInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/DisplayWorldSectionInstruction.java index ba07163c1..b1116ff0c 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/DisplayWorldSectionInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/DisplayWorldSectionInstruction.java @@ -1,37 +1,13 @@ package com.simibubi.create.foundation.metadoc.instructions; -import com.simibubi.create.foundation.metadoc.MetaDocScene; -import com.simibubi.create.foundation.metadoc.WorldSectionElement; +import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement; import net.minecraft.util.Direction; -import net.minecraft.util.math.Vec3d; -public class DisplayWorldSectionInstruction extends TickingInstruction { - - private Direction fadeInFrom; - private WorldSectionElement element; +public class DisplayWorldSectionInstruction extends FadeIntoSceneInstruction { public DisplayWorldSectionInstruction(int fadeInTicks, Direction fadeInFrom, WorldSectionElement element) { - super(false, fadeInTicks); - this.fadeInFrom = fadeInFrom; - this.element = element; - } - - @Override - protected void firstTick(MetaDocScene scene) { - super.firstTick(scene); - scene.addElement(element); - element.setFade(0); - element.setFadeVec(new Vec3d(fadeInFrom.getDirectionVec()).scale(.5f)); - } - - @Override - public void tick(MetaDocScene scene) { - super.tick(scene); - float fade = (remainingTicks / (float) totalTicks); - element.setFade(1 - fade * fade); - if (remainingTicks == 0) - element.setFade(1); + super(fadeInTicks, fadeInFrom, element); } } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/FadeIntoSceneInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/FadeIntoSceneInstruction.java new file mode 100644 index 000000000..d37ab5296 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/FadeIntoSceneInstruction.java @@ -0,0 +1,37 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.elements.AnimatedSceneElement; + +import net.minecraft.util.Direction; +import net.minecraft.util.math.Vec3d; + +public class FadeIntoSceneInstruction extends TickingInstruction { + + private Direction fadeInFrom; + private T element; + + public FadeIntoSceneInstruction(int fadeInTicks, Direction fadeInFrom, T element) { + super(false, fadeInTicks); + this.fadeInFrom = fadeInFrom; + this.element = element; + } + + @Override + protected void firstTick(MetaDocScene scene) { + super.firstTick(scene); + scene.addElement(element); + element.setFade(0); + element.setFadeVec(new Vec3d(fadeInFrom.getDirectionVec()).scale(.5f)); + } + + @Override + public void tick(MetaDocScene scene) { + super.tick(scene); + float fade = (remainingTicks / (float) totalTicks); + element.setFade(1 - fade * fade); + if (remainingTicks == 0) + element.setFade(1); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/HideAllInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/HideAllInstruction.java index 678f83772..ce2941c0d 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/HideAllInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/HideAllInstruction.java @@ -1,7 +1,8 @@ package com.simibubi.create.foundation.metadoc.instructions; -import com.simibubi.create.foundation.metadoc.AnimatedSceneElement; import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.elements.AnimatedOverlayElement; +import com.simibubi.create.foundation.metadoc.elements.AnimatedSceneElement; import net.minecraft.util.Direction; import net.minecraft.util.math.Vec3d; @@ -25,6 +26,9 @@ public class HideAllInstruction extends TickingInstruction { animatedSceneElement.setFade(1); animatedSceneElement .setFadeVec(fadeOutTo == null ? null : new Vec3d(fadeOutTo.getDirectionVec()).scale(.5f)); + } else if (element instanceof AnimatedOverlayElement) { + AnimatedOverlayElement animatedSceneElement = (AnimatedOverlayElement) element; + animatedSceneElement.setFade(1); } else element.setVisible(false); }); @@ -34,15 +38,18 @@ public class HideAllInstruction extends TickingInstruction { public void tick(MetaDocScene scene) { super.tick(scene); float fade = (remainingTicks / (float) totalTicks); - scene.getElements() - .forEach(element -> { - if (!(element instanceof AnimatedSceneElement)) - return; - AnimatedSceneElement animatedSceneElement = (AnimatedSceneElement) element; - animatedSceneElement.setFade(fade * fade); - if (remainingTicks == 0) - animatedSceneElement.setFade(0); - }); + + scene.forEach(AnimatedSceneElement.class, ase -> { + ase.setFade(fade * fade); + if (remainingTicks == 0) + ase.setFade(0); + }); + + scene.forEach(AnimatedOverlayElement.class, aoe -> { + aoe.setFade(fade * fade); + if (remainingTicks == 0) + aoe.setFade(0); + }); } } diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ReplaceBlocksInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ReplaceBlocksInstruction.java new file mode 100644 index 000000000..7812fff46 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ReplaceBlocksInstruction.java @@ -0,0 +1,40 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; +import com.simibubi.create.foundation.metadoc.Select; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; + +public class ReplaceBlocksInstruction extends WorldModifyInstruction { + + private BlockState stateToUse; + private boolean replaceAir; + + public ReplaceBlocksInstruction(Select selection, BlockState stateToUse, boolean replaceAir) { + super(selection); + this.stateToUse = stateToUse; + this.replaceAir = replaceAir; + } + + @Override + protected void runModification(Select selection, MetaDocScene scene) { + MetaDocWorld world = scene.getWorld(); + selection.all() + .forEach(pos -> { + if (!world.getBounds() + .isVecInside(pos)) + return; + if (!replaceAir && world.getBlockState(pos) == Blocks.AIR.getDefaultState()) + return; + world.setBlockState(pos, stateToUse); + }); + } + + @Override + protected boolean needsRedraw() { + return true; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/RotateSceneInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/RotateSceneInstruction.java new file mode 100644 index 000000000..57075f101 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/RotateSceneInstruction.java @@ -0,0 +1,34 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import com.simibubi.create.foundation.metadoc.MetaDocInstruction; +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocScene.SceneTransform; +import com.simibubi.create.foundation.utility.LerpedFloat.Chaser; + +public class RotateSceneInstruction extends MetaDocInstruction { + + private float xRot; + private float yRot; + private boolean relative; + + public RotateSceneInstruction(float xRot, float yRot, boolean relative) { + this.xRot = xRot; + this.yRot = yRot; + this.relative = relative; + } + + @Override + public boolean isComplete() { + return true; + } + + @Override + public void tick(MetaDocScene scene) { + SceneTransform transform = scene.getTransform(); + float targetX = relative ? transform.xRotation.getChaseTarget() + xRot : xRot; + float targetY = relative ? transform.yRotation.getChaseTarget() + yRot : yRot; + transform.xRotation.chase(targetX, .1f, Chaser.EXP); + transform.yRotation.chase(targetY, .1f, Chaser.EXP); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ShowCompleteSchematicInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ShowCompleteSchematicInstruction.java index dbfa9c776..1824e7187 100644 --- a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ShowCompleteSchematicInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/ShowCompleteSchematicInstruction.java @@ -2,16 +2,14 @@ package com.simibubi.create.foundation.metadoc.instructions; import com.simibubi.create.foundation.metadoc.MetaDocInstruction; import com.simibubi.create.foundation.metadoc.MetaDocScene; -import com.simibubi.create.foundation.metadoc.WorldSectionElement; - -import net.minecraft.util.math.BlockPos; +import com.simibubi.create.foundation.metadoc.Select; public class ShowCompleteSchematicInstruction extends MetaDocInstruction { @Override public void tick(MetaDocScene scene) { - scene.addElement(new WorldSectionElement.Cuboid(BlockPos.ZERO, scene.getBounds() - .getLength())); + scene.addElement(Select.everything(scene) + .asElement()); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TextWindowInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TextWindowInstruction.java new file mode 100644 index 000000000..f1d232d29 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TextWindowInstruction.java @@ -0,0 +1,52 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import java.util.function.Supplier; + +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.elements.TextWindowElement; + +import net.minecraft.util.math.Vec3d; + +public class TextWindowInstruction extends TickingInstruction { + + private TextWindowElement element; + private int fadeTime; + + public TextWindowInstruction(Supplier text, int fadeTime, int duration, Vec3d position) { + super(false, duration + 2 * fadeTime); + this.fadeTime = fadeTime; + element = new TextWindowElement(text).moveTo(position); + } + + @Override + protected void firstTick(MetaDocScene scene) { + super.firstTick(scene); + scene.addElement(element); + element.setVisible(true); + element.setFade(0); + } + + @Override + public void tick(MetaDocScene scene) { + super.tick(scene); + int elapsed = totalTicks - remainingTicks; + + if (elapsed < fadeTime) { + float fade = (elapsed / (float) fadeTime); + element.setFade(fade * fade); + + } else if (remainingTicks < fadeTime) { + float fade = (remainingTicks / (float) fadeTime); + element.setFade(fade * fade); + + } else + element.setFade(1); + + if (remainingTicks == 0) { + element.setFade(0); + element.setFade(0); + element.setVisible(false); + } + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TileEntityDataInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TileEntityDataInstruction.java new file mode 100644 index 000000000..070af58b6 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/TileEntityDataInstruction.java @@ -0,0 +1,50 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import java.util.function.UnaryOperator; + +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.MetaDocWorld; +import com.simibubi.create.foundation.metadoc.Select; +import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; + +public class TileEntityDataInstruction extends WorldModifyInstruction { + + private boolean redraw; + private UnaryOperator data; + private Class type; + + public TileEntityDataInstruction(Select selection, Class type, + UnaryOperator data, boolean redraw) { + super(selection); + this.type = type; + this.data = data; + this.redraw = redraw; + } + + @Override + protected void runModification(Select selection, MetaDocScene scene) { + MetaDocWorld world = scene.getWorld(); + selection.all() + .forEach(pos -> { + if (!world.getBounds() + .isVecInside(pos)) + return; + TileEntity tileEntity = world.getTileEntity(pos); + if (!type.isInstance(tileEntity)) + return; + CompoundNBT apply = data.apply(tileEntity.write(new CompoundNBT())); + tileEntity.read(apply); + if (tileEntity instanceof SyncedTileEntity) + ((SyncedTileEntity) tileEntity).readClientUpdate(apply); + }); + } + + @Override + protected boolean needsRedraw() { + return redraw; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/instructions/WorldModifyInstruction.java b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/WorldModifyInstruction.java new file mode 100644 index 000000000..0fc337b00 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/metadoc/instructions/WorldModifyInstruction.java @@ -0,0 +1,32 @@ +package com.simibubi.create.foundation.metadoc.instructions; + +import com.simibubi.create.foundation.metadoc.MetaDocInstruction; +import com.simibubi.create.foundation.metadoc.MetaDocScene; +import com.simibubi.create.foundation.metadoc.Select; +import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement; + +public abstract class WorldModifyInstruction extends MetaDocInstruction { + + private Select selection; + + public WorldModifyInstruction(Select selection) { + this.selection = selection; + } + + @Override + public boolean isComplete() { + return true; + } + + @Override + public void tick(MetaDocScene scene) { + runModification(selection, scene); + if (needsRedraw()) + scene.forEach(WorldSectionElement.class, wse -> wse.queueRedraw(scene.getWorld())); + } + + protected abstract void runModification(Select selection, MetaDocScene scene); + + protected abstract boolean needsRedraw(); + +} diff --git a/src/main/java/com/simibubi/create/foundation/metadoc/stories/CogwheelStory.java b/src/main/java/com/simibubi/create/foundation/metadoc/stories/CogwheelStory.java deleted file mode 100644 index b5bcdad87..000000000 --- a/src/main/java/com/simibubi/create/foundation/metadoc/stories/CogwheelStory.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.simibubi.create.foundation.metadoc.stories; - -import com.simibubi.create.foundation.metadoc.MetaDocScene.SceneBuilder; -import com.simibubi.create.foundation.metadoc.MetaDocStoryBoard; - -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; - -public class CogwheelStory extends MetaDocStoryBoard { - - private int index; - - public CogwheelStory(int index) { - this.index = index; - } - - @Override - public String getSchematicName() { - return "cogwheel/s" + index; - } - - @Override - public void program(SceneBuilder scene, Vec3i worldSize) { - scene.showBasePlate() - .idle(10) - .showSection(BlockPos.ZERO.up(), worldSize, Direction.DOWN); - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/ColorHelper.java b/src/main/java/com/simibubi/create/foundation/utility/ColorHelper.java index 7dfc7e24a..dbe8ffca1 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ColorHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ColorHelper.java @@ -4,6 +4,7 @@ import java.util.UUID; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; public class ColorHelper { @@ -29,6 +30,11 @@ public class ColorHelper { else return 255 - progress; } + + public static int applyAlpha(int color, float alpha) { + int alphaChannel = (int) (0xFF * MathHelper.clamp(alpha, 0, 1)); + return (color & 0xFFFFFF) | alphaChannel << 24; + } public static int mixColors(int color1, int color2, float w) { int r1 = (color1 >> 16); diff --git a/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java b/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java index f37b65912..d85e749fb 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java +++ b/src/main/java/com/simibubi/create/foundation/utility/SuperByteBufferCache.java @@ -85,6 +85,11 @@ public class SuperByteBufferCache { return null; } } + + public void invalidate(Compartment compartment, T key) { + Cache compartmentCache = this.cache.get(compartment); + compartmentCache.invalidate(key); + } public void registerCompartment(Compartment instance) { cache.put(instance, CacheBuilder.newBuilder()