More Instructions

This commit is contained in:
simibubi 2021-02-12 17:08:48 +01:00
parent fd3d7bd7fd
commit 8ab27904db
54 changed files with 1555 additions and 405 deletions

View file

@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.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 f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
@ -337,7 +337,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.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 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.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 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
e3f618c5b622d21880de858678d1802cbf65e615 assets/create/lang/en_ud.json e3f618c5b622d21880de858678d1802cbf65e615 assets/create/lang/en_ud.json
acc852d80378b426d7ee6cb59c169e06b6d63b25 assets/create/lang/en_us.json a3e1a1b7946534a5db2482cc6d43aadbdaf0938f assets/create/lang/en_us.json
30ce93c56557cea2f384a47b549fb893700523a5 assets/create/lang/unfinished/de_de.json 56c92fc5d2526d6ab9086d2edb03956234cad255 assets/create/lang/unfinished/de_de.json
77b8310f3cbed36fa0d2ee29e65ac6aee0c2adc2 assets/create/lang/unfinished/es_mx.json 4cab4140761c85fe6f2cb0a636ade5d63be422c4 assets/create/lang/unfinished/es_mx.json
8db9f9147dcef8c8182c548a524f96f578c116ec assets/create/lang/unfinished/fr_fr.json c1436ba5bd506cd531586a1ca87f7bcc1091a2d6 assets/create/lang/unfinished/fr_fr.json
89f7029d73733938ee9f900fc36d52ab7fc97563 assets/create/lang/unfinished/it_it.json 4747471601a24efbc6cb01b339bafb984b6903c6 assets/create/lang/unfinished/it_it.json
b1935e7f8d79d1112e1685adb42daedb976ac6d7 assets/create/lang/unfinished/ja_jp.json 5b87db032d1726cc10a225bf0c4740f50169517f assets/create/lang/unfinished/ja_jp.json
23aaf879d07a24775aeba3b98c355c992b24f28b assets/create/lang/unfinished/ko_kr.json acc6638d1ae47eab3c33431e3b794d85bf158f8f assets/create/lang/unfinished/ko_kr.json
7372533759001f094dbcad787f01f3de7422d8c0 assets/create/lang/unfinished/nl_nl.json 88a425173c828ce221435dfd9a29316cfe05204b assets/create/lang/unfinished/nl_nl.json
0d1e5d79ef196a06b273962d5ac8f2013f91209c assets/create/lang/unfinished/pt_br.json 4672e12982db0283e4826904c2538a5465c5c1e6 assets/create/lang/unfinished/pt_br.json
54da7badbd4fb043f73f6e9a4dfc52bd9e7f515c assets/create/lang/unfinished/ru_ru.json 85d5f3d8fd543c5f8d2d50e689b5ad25765c7cc2 assets/create/lang/unfinished/ru_ru.json
45ca54406acac857752c67a45729da953d11f94a assets/create/lang/unfinished/zh_cn.json ad1f7b8a42bc74dd416380faf2b66f2ca1302ec0 assets/create/lang/unfinished/zh_cn.json
4093ea8612465858aa57581b36f8f60aa23ac203 assets/create/lang/unfinished/zh_tw.json c561cc74bcfc00b664ec299fb8d6f9ee2c236d24 assets/create/lang/unfinished/zh_tw.json
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -60,9 +60,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "true",
"down": "false", "down": "false",
"up": "true",
"south": "false",
"north": "true" "north": "true"
}, },
"apply": { "apply": {
@ -71,9 +71,9 @@
}, },
{ {
"when": { "when": {
"south": "true",
"up": "true",
"down": "false", "down": "false",
"up": "true",
"south": "true",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -82,9 +82,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "false",
"down": "true", "down": "true",
"up": "false",
"south": "false",
"north": "true" "north": "true"
}, },
"apply": { "apply": {
@ -93,9 +93,9 @@
}, },
{ {
"when": { "when": {
"south": "true",
"up": "false",
"down": "true", "down": "true",
"up": "false",
"south": "true",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -104,9 +104,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "true",
"down": "true", "down": "true",
"up": "true",
"south": "false",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -115,20 +115,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "true",
"down": "false", "down": "false",
"north": "false" "up": "true",
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
}
},
{
"when": {
"south": "false", "south": "false",
"up": "false",
"down": "true",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -137,9 +126,20 @@
}, },
{ {
"when": { "when": {
"down": "true",
"up": "false",
"south": "false",
"north": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
}
},
{
"when": {
"down": "false",
"up": "false",
"south": "true", "south": "true",
"up": "false",
"down": "false",
"north": "true" "north": "true"
}, },
"apply": { "apply": {
@ -148,9 +148,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "false",
"down": "false", "down": "false",
"up": "false",
"south": "false",
"north": "true" "north": "true"
}, },
"apply": { "apply": {
@ -159,9 +159,9 @@
}, },
{ {
"when": { "when": {
"south": "true",
"up": "false",
"down": "false", "down": "false",
"up": "false",
"south": "true",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -170,9 +170,9 @@
}, },
{ {
"when": { "when": {
"south": "false",
"up": "false",
"down": "false", "down": "false",
"up": "false",
"south": "false",
"north": "false" "north": "false"
}, },
"apply": { "apply": {
@ -302,8 +302,8 @@
}, },
{ {
"when": { "when": {
"up": "true",
"down": "false", "down": "false",
"up": "true",
"west": "false", "west": "false",
"east": "true" "east": "true"
}, },
@ -313,8 +313,8 @@
}, },
{ {
"when": { "when": {
"up": "true",
"down": "false", "down": "false",
"up": "true",
"west": "true", "west": "true",
"east": "false" "east": "false"
}, },
@ -324,8 +324,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "true", "down": "true",
"up": "false",
"west": "false", "west": "false",
"east": "true" "east": "true"
}, },
@ -335,8 +335,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "true", "down": "true",
"up": "false",
"west": "true", "west": "true",
"east": "false" "east": "false"
}, },
@ -346,19 +346,8 @@
}, },
{ {
"when": { "when": {
"up": "true",
"down": "true", "down": "true",
"west": "false",
"east": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_z"
}
},
{
"when": {
"up": "true", "up": "true",
"down": "false",
"west": "false", "west": "false",
"east": "false" "east": "false"
}, },
@ -368,8 +357,19 @@
}, },
{ {
"when": { "when": {
"up": "false", "down": "false",
"up": "true",
"west": "false",
"east": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_z"
}
},
{
"when": {
"down": "true", "down": "true",
"up": "false",
"west": "false", "west": "false",
"east": "false" "east": "false"
}, },
@ -379,8 +379,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "false", "down": "false",
"up": "false",
"west": "true", "west": "true",
"east": "true" "east": "true"
}, },
@ -390,8 +390,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "false", "down": "false",
"up": "false",
"west": "false", "west": "false",
"east": "true" "east": "true"
}, },
@ -401,8 +401,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "false", "down": "false",
"up": "false",
"west": "true", "west": "true",
"east": "false" "east": "false"
}, },
@ -412,8 +412,8 @@
}, },
{ {
"when": { "when": {
"up": "false",
"down": "false", "down": "false",
"up": "false",
"west": "false", "west": "false",
"east": "false" "east": "false"
}, },

View file

@ -29,8 +29,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "x",
"axis": "x" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -39,8 +39,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "y",
"axis": "y" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky" "model": "create:block/radial_chassis_side_y_sticky"
@ -48,8 +48,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "z",
"axis": "z" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -59,8 +59,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "x",
"axis": "x" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -69,8 +69,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "y",
"axis": "y" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y" "model": "create:block/radial_chassis_side_y"
@ -78,8 +78,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "z",
"axis": "z" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -89,8 +89,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_west": "true",
"sticky_west": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -99,8 +99,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_west": "true",
"sticky_west": "true" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -109,8 +109,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_west": "true",
"sticky_west": "true" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z_sticky", "model": "create:block/radial_chassis_side_z_sticky",
@ -119,8 +119,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_west": "false",
"sticky_west": "false" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -129,8 +129,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_west": "false",
"sticky_west": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -139,8 +139,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_west": "false",
"sticky_west": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z", "model": "create:block/radial_chassis_side_z",
@ -149,8 +149,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_north": "true",
"sticky_north": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky" "model": "create:block/radial_chassis_side_x_sticky"
@ -158,8 +158,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_north": "true",
"sticky_north": "true" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -168,8 +168,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_north": "true",
"sticky_north": "true" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -178,8 +178,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_north": "false",
"sticky_north": "false" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x" "model": "create:block/radial_chassis_side_x"
@ -187,8 +187,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_north": "false",
"sticky_north": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -197,8 +197,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_north": "false",
"sticky_north": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -207,8 +207,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_east": "true",
"sticky_east": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -217,8 +217,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_east": "true",
"sticky_east": "true" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -227,8 +227,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_east": "true",
"sticky_east": "true" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z_sticky" "model": "create:block/radial_chassis_side_z_sticky"
@ -236,8 +236,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_east": "false",
"sticky_east": "false" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -246,8 +246,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_east": "false",
"sticky_east": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -256,8 +256,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_east": "false",
"sticky_east": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z" "model": "create:block/radial_chassis_side_z"

View file

@ -1786,6 +1786,22 @@
"create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?",
"create.tooltip.randomWipDescription8": "Use it and regret your decision immediately.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 1095", "_": "Missing Localizations: 1107",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "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.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 886", "_": "Missing Localizations: 898",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "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.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 666", "_": "Missing Localizations: 678",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] 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.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.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 3", "_": "Missing Localizations: 15",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "Questo forse non fa per te. Che ne dici di quello?", "create.tooltip.randomWipDescription7": "Questo forse non fa per te. Che ne dici di quello?",
"create.tooltip.randomWipDescription8": "Usalo e rimpiangi immediatamente la tua decisione.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 12", "_": "Missing Localizations: 24",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "これは君に向いていないかもしれない。 あれはどう??", "create.tooltip.randomWipDescription7": "これは君に向いていないかもしれない。 あれはどう??",
"create.tooltip.randomWipDescription8": "それを使ったことをすぐ後悔する。", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 55", "_": "Missing Localizations: 67",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?", "create.tooltip.randomWipDescription7": "This one maybe isn't for you. What about that one?",
"create.tooltip.randomWipDescription8": "Use it and regret your decision immediately.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 1155", "_": "Missing Localizations: 1167",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "Deze is misschien niet geschikt voor jou.", "create.tooltip.randomWipDescription7": "Deze is misschien niet geschikt voor jou.",
"create.tooltip.randomWipDescription8": "Gebruikt het en je zal meteen spijt hebben.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 1221", "_": "Missing Localizations: 1233",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "UNLOCALIZED: This one maybe isn't for you. What about that one?", "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.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 5", "_": "Missing Localizations: 17",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "Этот, возможно, но не для тебя. Как насчет этого?", "create.tooltip.randomWipDescription7": "Этот, возможно, но не для тебя. Как насчет этого?",
"create.tooltip.randomWipDescription8": "Используя его, вы немедленно пожалеете о своем решении.", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 3", "_": "Missing Localizations: 15",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "这玩意不是给你用的,换个吧", "create.tooltip.randomWipDescription7": "这玩意不是给你用的,换个吧",
"create.tooltip.randomWipDescription8": "试试就逝世。", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 8", "_": "Missing Localizations: 20",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -1787,6 +1787,22 @@
"create.tooltip.randomWipDescription7": "這東西不是給你用的,再找找吧!", "create.tooltip.randomWipDescription7": "這東西不是給你用的,再找找吧!",
"create.tooltip.randomWipDescription8": "用了就死定了。", "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!" "_": "Thank you for translating Create!"
} }

View file

@ -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.block.render.SpriteShifter;
import com.simibubi.create.foundation.item.CustomItemModels; import com.simibubi.create.foundation.item.CustomItemModels;
import com.simibubi.create.foundation.item.CustomRenderedItems; import com.simibubi.create.foundation.item.CustomRenderedItems;
import com.simibubi.create.foundation.metadoc.MetaDocs; import com.simibubi.create.foundation.metadoc.content.MetaDocIndex;
import com.simibubi.create.foundation.metadoc.WorldSectionElement; import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement;
import com.simibubi.create.foundation.utility.SuperByteBufferCache; import com.simibubi.create.foundation.utility.SuperByteBufferCache;
import com.simibubi.create.foundation.utility.outliner.Outliner; import com.simibubi.create.foundation.utility.outliner.Outliner;
@ -76,7 +76,7 @@ public class CreateClient {
AllEntityTypes.registerRenderers(); AllEntityTypes.registerRenderers();
getColorHandler().init(); getColorHandler().init();
AllFluids.assignRenderLayers(); AllFluids.assignRenderLayers();
MetaDocs.register(); MetaDocIndex.register();
IResourceManager resourceManager = Minecraft.getInstance() IResourceManager resourceManager = Minecraft.getInstance()
.getResourceManager(); .getResourceManager();

View file

@ -66,7 +66,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override @Override
public void initialize() { public void initialize() {
if (hasNetwork()) { if (hasNetwork() && !world.isRemote) {
KineticNetwork network = getOrCreateNetwork(); KineticNetwork network = getOrCreateNetwork();
if (!network.initialized) if (!network.initialized)
network.initFromTE(capacity, stress, networkSize); network.initFromTE(capacity, stress, networkSize);

View file

@ -34,11 +34,12 @@ import net.minecraft.world.biome.Biomes;
public class SchematicWorld extends WrappedWorld { public class SchematicWorld extends WrappedWorld {
private Map<BlockPos, BlockState> blocks; protected Map<BlockPos, BlockState> blocks;
private Map<BlockPos, TileEntity> tileEntities; protected Map<BlockPos, TileEntity> tileEntities;
private List<TileEntity> renderedTileEntities; protected List<TileEntity> renderedTileEntities;
private List<Entity> entities; protected List<Entity> entities;
private MutableBoundingBox bounds; protected MutableBoundingBox bounds;
public BlockPos anchor; public BlockPos anchor;
public boolean renderMode; public boolean renderMode;
@ -179,6 +180,13 @@ public class SchematicWorld extends WrappedWorld {
pos = pos.subtract(anchor); pos = pos.subtract(anchor);
bounds.expandTo(new MutableBoundingBox(pos, pos)); bounds.expandTo(new MutableBoundingBox(pos, pos));
blocks.put(pos, arg1); 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; return true;
} }

View file

@ -1,21 +1,49 @@
package com.simibubi.create.foundation.data; 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 { public enum AllLangPartials {
ADVANCEMENTS("Advancements"), ADVANCEMENTS("Advancements"),
MESSAGES("UI & Messages"), MESSAGES("UI & Messages"),
TOOLTIPS("Item Descriptions"), TOOLTIPS("Item Descriptions"),
METADOC("MetaDoc Text", MetaDocs::provideLangEntries),
; ;
private String display; private String display;
private Supplier<JsonElement> provider;
private AllLangPartials(String display) { private AllLangPartials(String display) {
this.display = display; this.display = display;
this.provider = this::fromResource;
}
private AllLangPartials(String display, Supplier<JsonElement> customProvider) {
this.display = display;
this.provider = customProvider;
} }
public String getDisplay() { public String getDisplay() {
return display; 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;
}
} }

View file

@ -24,7 +24,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.FilesHelper; import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache; import net.minecraft.data.DirectoryCache;
@ -201,14 +200,9 @@ public class LangMerger implements IDataProvider {
} }
private void collectEntries() { private void collectEntries() {
for (AllLangPartials partial : AllLangPartials.values()) { for (AllLangPartials partial : AllLangPartials.values())
String fileName = Lang.asId(partial.name()); addAll(partial.getDisplay(), partial.provide()
String filepath = "assets/" + Create.ID + "/lang/default/" + fileName + ".json"; .getAsJsonObject());
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());
}
} }
private void save(DirectoryCache cache, List<Object> dataIn, int missingKeys, Path target, String message) private void save(DirectoryCache cache, List<Object> dataIn, int missingKeys, Path target, String message)

View file

@ -9,6 +9,7 @@ import javax.annotation.Nullable;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.Widget;
@ -41,6 +42,8 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void render(int mouseX, int mouseY, float partialTicks) {
partialTicks = Minecraft.getInstance()
.getRenderPartialTicks();
renderBackground(); renderBackground();
renderWindow(mouseX, mouseY, partialTicks); renderWindow(mouseX, mouseY, partialTicks);

View file

@ -5,6 +5,7 @@ import java.util.List;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; 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.screen.Screen;
import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.Widget;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
@ -32,6 +33,8 @@ public abstract class AbstractSimiScreen extends Screen {
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) { public void render(int mouseX, int mouseY, float partialTicks) {
partialTicks = Minecraft.getInstance()
.getRenderPartialTicks();
renderBackground(); renderBackground();
renderWindow(mouseX, mouseY, partialTicks); renderWindow(mouseX, mouseY, partialTicks);
for (Widget widget : widgets) for (Widget widget : widgets)
@ -107,7 +110,8 @@ public abstract class AbstractSimiScreen extends Screen {
if (!widget.isHovered()) if (!widget.isHovered())
continue; continue;
if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip()
.isEmpty()) {
renderTooltip(((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); renderTooltip(((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY);
} }
} }

View file

@ -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;
}
}

View file

@ -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<String, String> shared = new HashMap<>();
static Map<ResourceLocation, Map<Integer, Map<String, String>>> 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<String, String> 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;
}
}

View file

@ -2,37 +2,70 @@ package com.simibubi.create.foundation.metadoc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; 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.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.DelayInstruction;
import com.simibubi.create.foundation.metadoc.instructions.DisplayWorldSectionInstruction; import com.simibubi.create.foundation.metadoc.instructions.DisplayWorldSectionInstruction;
import com.simibubi.create.foundation.metadoc.instructions.HideAllInstruction; 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.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.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
public class MetaDocScene { public class MetaDocScene {
List<MetaDocInstruction> schedule, activeSchedule; List<MetaDocInstruction> schedule, activeSchedule;
Set<MetaDocSceneElement> elements; Set<MetaDocElement> elements;
Map<Object, Set<MetaDocSceneElement>> groups;
MetaDocWorld world; MetaDocWorld world;
ResourceLocation component;
int sceneIndex;
SceneTransform transform;
public MetaDocScene(MetaDocWorld world) { public MetaDocScene(MetaDocWorld world, ResourceLocation component, int sceneIndex) {
this.world = world; this.world = world;
this.component = component;
this.sceneIndex = sceneIndex;
elements = new HashSet<>(); elements = new HashSet<>();
groups = new IdentityHashMap<>();
schedule = new ArrayList<>(); schedule = new ArrayList<>();
activeSchedule = 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() { public void reset() {
@ -42,6 +75,9 @@ public class MetaDocScene {
public void begin() { public void begin() {
reset(); reset();
world.restore();
transform = new SceneTransform();
forEach(WorldSectionElement.class, wse -> wse.queueRedraw(world));
elements.clear(); elements.clear();
activeSchedule.addAll(schedule); activeSchedule.addAll(schedule);
} }
@ -51,18 +87,27 @@ public class MetaDocScene {
activeSchedule.add(new HideAllInstruction(10, null)); activeSchedule.add(new HideAllInstruction(10, null));
} }
public void render(IRenderTypeBuffer buffer, MatrixStack ms) { public void renderScene(IRenderTypeBuffer buffer, MatrixStack ms) {
ms.push(); ms.push();
MutableBoundingBox bounds = world.getBounds(); forEach(MetaDocSceneElement.class, e -> {
ms.translate(bounds.getXSize() / -2f, -.5f, bounds.getZSize() / -2f); if (e.isVisible())
elements.forEach(e -> {
if (e.visible)
e.render(world, buffer, ms); e.render(world, buffer, ms);
}); });
ms.pop(); 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() { public void tick() {
transform.tick();
forEach(MetaDocElement::tick);
for (Iterator<MetaDocInstruction> iterator = activeSchedule.iterator(); iterator.hasNext();) { for (Iterator<MetaDocInstruction> iterator = activeSchedule.iterator(); iterator.hasNext();) {
MetaDocInstruction metaDocInstruction = iterator.next(); MetaDocInstruction metaDocInstruction = iterator.next();
metaDocInstruction.tick(this); metaDocInstruction.tick(this);
@ -75,7 +120,7 @@ public class MetaDocScene {
} }
} }
public void addElement(MetaDocSceneElement e) { public void addElement(MetaDocElement e) {
elements.add(e); elements.add(e);
} }
@ -83,32 +128,133 @@ public class MetaDocScene {
return world; return world;
} }
public Set<MetaDocSceneElement> getElements() { public Set<MetaDocElement> getElements() {
return elements; return elements;
} }
public void forEach(Consumer<? super MetaDocElement> function) {
for (MetaDocElement metaDocElement : elements)
function.accept(metaDocElement);
}
public <T extends MetaDocElement> void forEach(Class<T> type, Consumer<T> function) {
for (MetaDocElement metaDocElement : elements)
if (type.isInstance(metaDocElement))
function.accept(type.cast(metaDocElement));
}
public MutableBoundingBox getBounds() { public MutableBoundingBox getBounds() {
return world.getBounds(); return world == null ? new MutableBoundingBox() : world.getBounds();
} }
public SceneBuilder builder() { public SceneBuilder builder() {
return new SceneBuilder(); return new SceneBuilder();
} }
private Supplier<String> 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 class SceneBuilder {
public SceneBuilder showBasePlate() { public SceneBuilder showBasePlate() {
Vec3i length = getBounds().getLength(); 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( return addInstruction(
new DisplayWorldSectionInstruction(15, fadeInDirection, new WorldSectionElement.Cuboid(origin, size))); new DisplayWorldSectionInstruction(15, fadeInDirection, new WorldSectionElement(selection)));
}
public SceneBuilder showSection(WorldSectionElement element, Direction fadeInDirection) {
return addInstruction(new DisplayWorldSectionInstruction(15, fadeInDirection, element));
} }
public SceneBuilder debugSchematic() { public SceneBuilder debugSchematic() {
@ -123,11 +269,62 @@ public class MetaDocScene {
return idle(seconds * 20); 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<Float> 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) { public SceneBuilder addInstruction(MetaDocInstruction instruction) {
schedule.add(instruction); schedule.add(instruction);
return this; return this;
} }
//
public Select everywhere() {
return Select.cuboid(BlockPos.ZERO, getBounds().getLength());
}
} }
} }

View file

@ -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;
}
}

View file

@ -6,26 +6,28 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.AllIcons; 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.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.LerpedFloat;
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser; import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.client.GameSettings; import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
public class MetaDocScreen extends AbstractSimiScreen { public class MetaDocScreen extends AbstractSimiScreen {
private List<MetaDocScene> stories; private List<MetaDocScene> scenes;
private LerpedFloat fadeIn; private LerpedFloat fadeIn;
private LerpedFloat lazyIndex; private LerpedFloat lazyIndex;
private int index = 0; private int index = 0;
public MetaDocScreen(List<MetaDocScene> stories) { public MetaDocScreen(List<MetaDocScene> scenes) {
this.stories = stories; this.scenes = scenes;
lazyIndex = LerpedFloat.linear() lazyIndex = LerpedFloat.linear()
.startWithValue(index); .startWithValue(index);
fadeIn = LerpedFloat.linear() fadeIn = LerpedFloat.linear()
@ -37,11 +39,11 @@ public class MetaDocScreen extends AbstractSimiScreen {
public void tick() { public void tick() {
lazyIndex.tickChaser(); lazyIndex.tickChaser();
fadeIn.tickChaser(); fadeIn.tickChaser();
stories.get(index) scenes.get(index)
.tick(); .tick();
float lazyIndexValue = lazyIndex.getValue(); float lazyIndexValue = lazyIndex.getValue();
if (Math.abs(lazyIndexValue - index) > 1 / 512f) if (Math.abs(lazyIndexValue - index) > 1 / 512f)
stories.get(lazyIndexValue < index ? index - 1 : index + 1) scenes.get(lazyIndexValue < index ? index - 1 : index + 1)
.tick(); .tick();
} }
@ -55,11 +57,11 @@ public class MetaDocScreen extends AbstractSimiScreen {
protected boolean scroll(boolean forward) { protected boolean scroll(boolean forward) {
int prevIndex = index; int prevIndex = index;
index = forward ? index + 1 : index - 1; 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) { if (prevIndex != index && Math.abs(index - lazyIndex.getValue()) < 1.5f) {
stories.get(prevIndex) scenes.get(prevIndex)
.fadeOut(); .fadeOut();
stories.get(index) scenes.get(index)
.begin(); .begin();
lazyIndex.chase(index, 1 / 4f, Chaser.EXP); lazyIndex.chase(index, 1 / 4f, Chaser.EXP);
return true; return true;
@ -70,9 +72,6 @@ public class MetaDocScreen extends AbstractSimiScreen {
@Override @Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) { protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
partialTicks = Minecraft.getInstance()
.getRenderPartialTicks();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
renderStories(partialTicks); renderStories(partialTicks);
renderWidgets(mouseX, mouseY, partialTicks); renderWidgets(mouseX, mouseY, partialTicks);
@ -86,49 +85,65 @@ public class MetaDocScreen extends AbstractSimiScreen {
} }
protected void renderStory(int i, float partialTicks) { 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(); 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 value = lazyIndex.getValue(partialTicks);
double diff = i - value; double diff = i - value;
double slide = MathHelper.lerp(diff * diff, 200, 600); double slide = MathHelper.lerp(diff * diff, 200, 600) * diff;
ms.translate(diff * slide, 0, 0);
ms.scale(30, -30, 30); ms.push();
story.transform.updateScreenParams(width, height, slide);
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); story.transform.apply(ms);
story.render(buffer, ms); story.renderScene(buffer, ms);
buffer.draw(); buffer.draw();
ms.pop(); ms.pop();
} }
protected void renderWidgets(int mouseX, int mouseY, float pt) { protected void renderWidgets(int mouseX, int mouseY, float partialTicks) {
float fade = fadeIn.getValue(pt); float fade = fadeIn.getValue(partialTicks);
float lazyIndexValue = lazyIndex.getValue(partialTicks);
float indexDiff = Math.abs(lazyIndexValue - index);
int textColor = 0xeeeeee; 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.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()) if (fade < fadeIn.getChaseTarget())
RenderSystem.translated(0, (1 - fade) * 5, 0); RenderSystem.translated(0, (1 - fade) * 5, 0);
int closeWidth = 24; int closeWidth = 24;
int closeHeight = 24; int closeHeight = 24;
int closeX = (width - closeWidth) / 2; int closeX = (width - closeWidth) / 2;
int closeY = height - closeHeight - 31; int closeY = height - closeHeight - 31;
boolean hovered = isMouseOver(mouseX, mouseY, closeX, closeY, closeWidth, closeHeight); boolean hovered = isMouseOver(mouseX, mouseY, closeX, closeY, closeWidth, closeHeight);
renderBox(closeX, closeY, closeWidth, closeHeight, hovered);
renderBox(closeX, closeY, closeWidth, closeHeight, 0xdd000000, hovered ? 0x70ffffff : 0x30eebb00,
hovered ? 0x30ffffff : 0x10eebb00);
AllIcons.I_CONFIRM.draw(closeX + 4, closeY + 4); 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(); RenderSystem.popMatrix();
} }
@ -174,33 +189,36 @@ public class MetaDocScreen extends AbstractSimiScreen {
return super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_); 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) { protected boolean isMouseOver(double mouseX, double mouseY, int x, int y, int w, int h) {
boolean hovered = !(mouseX < x || mouseX > x + w); boolean hovered = !(mouseX < x || mouseX > x + w);
hovered &= !(mouseY < y || mouseY > y + h); hovered &= !(mouseY < y || mouseY > y + h);
return hovered; return hovered;
} }
protected void renderBox(int tooltipX, int tooltipY, int tooltipTextWidth, int tooltipHeight, int backgroundColor, public void drawString(String s, int x, int y, int color) {
int borderColorStart, int borderColorEnd) { drawString(font, s, x, y, color);
int zLevel = 400; }
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3,
backgroundColor, backgroundColor); public void renderBox(int x, int y, int w, int h, boolean highlighted) {
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, renderBox(x, y, w, h, 0xdd000000, highlighted ? 0x70ffffff : 0x30eebb00, highlighted ? 0x30ffffff : 0x10eebb00);
tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); }
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3,
tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); public void renderBox(int x, int y, int w, int h, int backgroundColor, int borderColorStart, int borderColorEnd) {
GuiUtils.drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, int zLevel = 100;
backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, x - 3, y - 4, x + w + 3, y - 3, backgroundColor, backgroundColor);
GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, GuiUtils.drawGradientRect(zLevel, x - 3, y + h + 3, x + w + 3, y + h + 4, backgroundColor, backgroundColor);
tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(zLevel, x - 3, y - 3, x + w + 3, y + h + 3, backgroundColor, backgroundColor);
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, GuiUtils.drawGradientRect(zLevel, x - 4, y - 3, x - 3, y + h + 3, backgroundColor, backgroundColor);
tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); GuiUtils.drawGradientRect(zLevel, x + w + 3, y - 3, x + w + 4, y + h + 3, backgroundColor, backgroundColor);
GuiUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, GuiUtils.drawGradientRect(zLevel, x - 3, y - 3 + 1, x - 3 + 1, y + h + 3 - 1, borderColorStart, borderColorEnd);
tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); GuiUtils.drawGradientRect(zLevel, x + w + 2, y - 3 + 1, x + w + 3, y + h + 3 - 1, borderColorStart,
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorEnd);
borderColorStart, borderColorStart); GuiUtils.drawGradientRect(zLevel, x - 3, y - 3, x + w + 3, y - 3 + 1, borderColorStart, borderColorStart);
GuiUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, GuiUtils.drawGradientRect(zLevel, x - 3, y + h + 2, x + w + 3, y + h + 3, borderColorEnd, borderColorEnd);
tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd);
} }
} }

View file

@ -8,6 +8,8 @@ public abstract class MetaDocStoryBoard {
public abstract String getSchematicName(); public abstract String getSchematicName();
public abstract String getStoryTitle();
public abstract void program(SceneBuilder scene, Vec3i worldSize); public abstract void program(SceneBuilder scene, Vec3i worldSize);
} }

View file

@ -1,20 +1,50 @@
package com.simibubi.create.foundation.metadoc; package com.simibubi.create.foundation.metadoc;
import java.util.HashMap;
import java.util.Map;
import com.simibubi.create.content.schematics.SchematicWorld; import com.simibubi.create.content.schematics.SchematicWorld;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
import net.minecraft.world.World; import net.minecraft.world.World;
public class MetaDocWorld extends SchematicWorld { public class MetaDocWorld extends SchematicWorld {
protected Map<BlockPos, BlockState> originalBlocks;
protected Map<BlockPos, TileEntity> originalTileEntities;
int overrideLight; int overrideLight;
WorldSectionElement mask; Select mask;
public MetaDocWorld(BlockPos anchor, World original) { public MetaDocWorld(BlockPos anchor, World original) {
super(anchor, 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) { public void pushFakeLight(int light) {
@ -30,7 +60,7 @@ public class MetaDocWorld extends SchematicWorld {
return overrideLight == -1 ? 15 : overrideLight; return overrideLight == -1 ? 15 : overrideLight;
} }
public void setMask(WorldSectionElement mask) { public void setMask(Select mask) {
this.mask = mask; this.mask = mask;
} }

View file

@ -8,12 +8,12 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import com.simibubi.create.AllBlocks; import com.google.gson.JsonElement;
import com.simibubi.create.Create; 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 com.tterrag.registrate.util.entry.ItemProviderEntry;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -22,6 +22,7 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; 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.PlacementSettings;
import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.gen.feature.template.Template;
@ -29,33 +30,40 @@ public class MetaDocs {
static Map<ResourceLocation, List<MetaDocStoryBoard>> all = new HashMap<>(); static Map<ResourceLocation, List<MetaDocStoryBoard>> all = new HashMap<>();
public static void register() { public static void addStoryBoard(ItemProviderEntry<?> component, MetaDocStoryBoard storyBoard) {
for (int i = 1; i < 6; i++)
addStoryBoard(AllBlocks.COGWHEEL, new CogwheelStory(i));
}
private static void addStoryBoard(ItemProviderEntry<?> component, MetaDocStoryBoard storyBoard) {
ResourceLocation id = component.getId(); ResourceLocation id = component.getId();
all.computeIfAbsent(id, $ -> new ArrayList<>()) all.computeIfAbsent(id, $ -> new ArrayList<>())
.add(storyBoard); .add(storyBoard);
} }
public static List<MetaDocScene> compile(ResourceLocation id) { public static List<MetaDocScene> compile(ResourceLocation id) {
return all.get(id)
.stream() if (MetaDocIndex.EDITOR_MODE) {
.map(sb -> { MetaDocLocalization.shared.clear();
MetaDocLocalization.specific.clear();
SharedText.gatherText();
}
List<MetaDocStoryBoard> list = all.get(id);
List<MetaDocScene> scenes = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
MetaDocStoryBoard sb = list.get(i);
Template activeTemplate = loadSchematic(sb.getSchematicName()); Template activeTemplate = loadSchematic(sb.getSchematicName());
MetaDocWorld world = new MetaDocWorld(BlockPos.ZERO, Minecraft.getInstance().world); MetaDocWorld world = new MetaDocWorld(BlockPos.ZERO, Minecraft.getInstance().world);
activeTemplate.addBlocksToWorld(world, BlockPos.ZERO, new PlacementSettings()); activeTemplate.addBlocksToWorld(world, BlockPos.ZERO, new PlacementSettings());
MetaDocScene scene = new MetaDocScene(world); world.createBackup();
MetaDocScene scene = new MetaDocScene(world, id, i);
MetaDocLocalization.registerSpecific(id, i, "title", sb.getStoryTitle());
sb.program(scene.builder(), world.getBounds() sb.program(scene.builder(), world.getBounds()
.getLength()); .getLength());
scene.begin(); scene.begin();
return scene; scenes.add(scene);
})
.collect(Collectors.toList()); }
return scenes;
} }
public static Template loadSchematic(String path) { public static Template loadSchematic(String path) {
@ -75,4 +83,18 @@ public class MetaDocs {
return t; 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();
}
} }

View file

@ -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<BlockPos> {
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<BlockPos> 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<BlockPos> all() {
return BlockPos.func_229383_a_(bb);
}
@Override
public int hashCode() {
return origin.hashCode() ^ size.hashCode();
}
}
}

View file

@ -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);
}
}

View file

@ -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));
}
}

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.metadoc.MetaDocWorld;
import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.LerpedFloat;
import com.simibubi.create.foundation.utility.MatrixStacker; 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 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;
}
} }

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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();
}
}

View file

@ -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<String> textGetter;
String bakedText;
Vec3d vec;
public TextWindowElement(Supplier<String> 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<String> 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();
}
}

View file

@ -1,17 +1,17 @@
package com.simibubi.create.foundation.metadoc; package com.simibubi.create.foundation.metadoc.elements;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.CreateClient; 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.SuperByteBuffer;
import com.simibubi.create.foundation.utility.SuperByteBufferCache; import com.simibubi.create.foundation.utility.SuperByteBufferCache;
import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment; 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.model.IBakedModel;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; 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.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
public abstract class WorldSectionElement extends AnimatedSceneElement implements Predicate<BlockPos> { public class WorldSectionElement extends AnimatedSceneElement {
public static final Compartment<Pair<Integer, Integer>> DOC_WORLD_SECTION = new Compartment<>(); public static final Compartment<Pair<Integer, Integer>> DOC_WORLD_SECTION = new Compartment<>();
List<TileEntity> renderedTileEntities; List<TileEntity> 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 @Override
public void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms, float fade) { public void render(MetaDocWorld world, IRenderTypeBuffer buffer, MatrixStack ms, float fade) {
int light = -1; int light = -1;
if (fade != 1) if (fade != 1)
light = (int) (MathHelper.lerp(fade, 5, 14)); light = (int) (MathHelper.lerp(fade, 5, 14));
if (redraw)
renderedTileEntities = null;
world.pushFakeLight(light); world.pushFakeLight(light);
renderTileEntities(world, ms, buffer); renderTileEntities(world, ms, buffer);
@ -56,40 +75,7 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement
if (buffer instanceof IRenderTypeBuffer.Impl) if (buffer instanceof IRenderTypeBuffer.Impl)
((IRenderTypeBuffer.Impl) buffer).draw(); ((IRenderTypeBuffer.Impl) buffer).draw();
renderStructure(world, ms, buffer, fade); renderStructure(world, ms, buffer, fade);
} redraw = false;
@Override
public abstract int hashCode();
public abstract Stream<BlockPos> 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<BlockPos> all() {
return BlockPos.func_229383_a_(bb);
}
@Override
public int hashCode() {
return origin.hashCode() ^ size.hashCode();
}
} }
protected void renderStructure(MetaDocWorld world, MatrixStack ms, IRenderTypeBuffer buffer, float fade) { 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++) { for (int i = 0; i < blockLayers.size(); i++) {
RenderType layer = blockLayers.get(i); RenderType layer = blockLayers.get(i);
Pair<Integer, Integer> key = Pair.of(code, i); Pair<Integer, Integer> key = Pair.of(code, i);
if (redraw)
bufferCache.invalidate(DOC_WORLD_SECTION, key);
SuperByteBuffer contraptionBuffer = SuperByteBuffer contraptionBuffer =
bufferCache.get(DOC_WORLD_SECTION, key, () -> buildStructureBuffer(world, layer)); bufferCache.get(DOC_WORLD_SECTION, key, () -> buildStructureBuffer(world, layer));
if (contraptionBuffer.isEmpty()) if (contraptionBuffer.isEmpty())
continue; continue;
int light = 0xF000F0; int light = lightCoordsFromFade(fade);
if (fade != 1) {
light = (int) (0xF * fade);
light = light << 4 | light << 20;
}
contraptionBuffer.light(light) contraptionBuffer.light(light)
.renderInto(ms, buffer.getBuffer(layer)); .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) { private void renderTileEntities(MetaDocWorld world, MatrixStack ms, IRenderTypeBuffer buffer) {
if (renderedTileEntities == null) { if (renderedTileEntities == null) {
renderedTileEntities = new ArrayList<>(); renderedTileEntities = new ArrayList<>();
all().map(world::getTileEntity) section.all()
.map(world::getTileEntity)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.forEach(renderedTileEntities::add); .forEach(renderedTileEntities::add);
} } else
renderedTileEntities.removeIf(te -> world.getTileEntity(te.getPos()) != te);
TileEntityRenderHelper.renderTileEntities(world, renderedTileEntities, ms, new MatrixStack(), buffer); TileEntityRenderHelper.renderTileEntities(world, renderedTileEntities, ms, new MatrixStack(), buffer);
} }
@ -137,9 +122,10 @@ public abstract class WorldSectionElement extends AnimatedSceneElement implement
Random random = new Random(); Random random = new Random();
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
world.setMask(this); world.setMask(this.section);
all().forEach(pos -> { section.all()
.forEach(pos -> {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
if (state.getRenderType() == BlockRenderType.ENTITYBLOCK_ANIMATED) if (state.getRenderType() == BlockRenderType.ENTITYBLOCK_ANIMATED)
return; return;

View file

@ -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<ParrotElement> {
public CreateParrotInstruction(int fadeInTicks, Direction fadeInFrom, ParrotElement element) {
super(fadeInTicks, fadeInFrom, element);
}
}

View file

@ -1,37 +1,13 @@
package com.simibubi.create.foundation.metadoc.instructions; package com.simibubi.create.foundation.metadoc.instructions;
import com.simibubi.create.foundation.metadoc.MetaDocScene; import com.simibubi.create.foundation.metadoc.elements.WorldSectionElement;
import com.simibubi.create.foundation.metadoc.WorldSectionElement;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.Vec3d;
public class DisplayWorldSectionInstruction extends TickingInstruction { public class DisplayWorldSectionInstruction extends FadeIntoSceneInstruction<WorldSectionElement> {
private Direction fadeInFrom;
private WorldSectionElement element;
public DisplayWorldSectionInstruction(int fadeInTicks, Direction fadeInFrom, WorldSectionElement element) { public DisplayWorldSectionInstruction(int fadeInTicks, Direction fadeInFrom, WorldSectionElement element) {
super(false, fadeInTicks); super(fadeInTicks, fadeInFrom, element);
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);
} }
} }

View file

@ -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<T extends AnimatedSceneElement> 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);
}
}

View file

@ -1,7 +1,8 @@
package com.simibubi.create.foundation.metadoc.instructions; 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.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.Direction;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -25,6 +26,9 @@ public class HideAllInstruction extends TickingInstruction {
animatedSceneElement.setFade(1); animatedSceneElement.setFade(1);
animatedSceneElement animatedSceneElement
.setFadeVec(fadeOutTo == null ? null : new Vec3d(fadeOutTo.getDirectionVec()).scale(.5f)); .setFadeVec(fadeOutTo == null ? null : new Vec3d(fadeOutTo.getDirectionVec()).scale(.5f));
} else if (element instanceof AnimatedOverlayElement) {
AnimatedOverlayElement animatedSceneElement = (AnimatedOverlayElement) element;
animatedSceneElement.setFade(1);
} else } else
element.setVisible(false); element.setVisible(false);
}); });
@ -34,14 +38,17 @@ public class HideAllInstruction extends TickingInstruction {
public void tick(MetaDocScene scene) { public void tick(MetaDocScene scene) {
super.tick(scene); super.tick(scene);
float fade = (remainingTicks / (float) totalTicks); float fade = (remainingTicks / (float) totalTicks);
scene.getElements()
.forEach(element -> { scene.forEach(AnimatedSceneElement.class, ase -> {
if (!(element instanceof AnimatedSceneElement)) ase.setFade(fade * fade);
return;
AnimatedSceneElement animatedSceneElement = (AnimatedSceneElement) element;
animatedSceneElement.setFade(fade * fade);
if (remainingTicks == 0) if (remainingTicks == 0)
animatedSceneElement.setFade(0); ase.setFade(0);
});
scene.forEach(AnimatedOverlayElement.class, aoe -> {
aoe.setFade(fade * fade);
if (remainingTicks == 0)
aoe.setFade(0);
}); });
} }

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -2,16 +2,14 @@ package com.simibubi.create.foundation.metadoc.instructions;
import com.simibubi.create.foundation.metadoc.MetaDocInstruction; import com.simibubi.create.foundation.metadoc.MetaDocInstruction;
import com.simibubi.create.foundation.metadoc.MetaDocScene; import com.simibubi.create.foundation.metadoc.MetaDocScene;
import com.simibubi.create.foundation.metadoc.WorldSectionElement; import com.simibubi.create.foundation.metadoc.Select;
import net.minecraft.util.math.BlockPos;
public class ShowCompleteSchematicInstruction extends MetaDocInstruction { public class ShowCompleteSchematicInstruction extends MetaDocInstruction {
@Override @Override
public void tick(MetaDocScene scene) { public void tick(MetaDocScene scene) {
scene.addElement(new WorldSectionElement.Cuboid(BlockPos.ZERO, scene.getBounds() scene.addElement(Select.everything(scene)
.getLength())); .asElement());
} }
@Override @Override

View file

@ -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<String> 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);
}
}
}

View file

@ -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<CompoundNBT> data;
private Class<? extends TileEntity> type;
public TileEntityDataInstruction(Select selection, Class<? extends TileEntity> type,
UnaryOperator<CompoundNBT> 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;
}
}

View file

@ -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();
}

View file

@ -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);
}
}

View file

@ -4,6 +4,7 @@ import java.util.UUID;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
public class ColorHelper { public class ColorHelper {
@ -30,6 +31,11 @@ public class ColorHelper {
return 255 - progress; 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) { public static int mixColors(int color1, int color2, float w) {
int r1 = (color1 >> 16); int r1 = (color1 >> 16);
int g1 = (color1 >> 8) & 0xFF; int g1 = (color1 >> 8) & 0xFF;

View file

@ -86,6 +86,11 @@ public class SuperByteBufferCache {
} }
} }
public <T> void invalidate(Compartment<T> compartment, T key) {
Cache<Object, SuperByteBuffer> compartmentCache = this.cache.get(compartment);
compartmentCache.invalidate(key);
}
public void registerCompartment(Compartment<?> instance) { public void registerCompartment(Compartment<?> instance) {
cache.put(instance, CacheBuilder.newBuilder() cache.put(instance, CacheBuilder.newBuilder()
.build()); .build());