Moving contraptions in 1.15

- Ported the contraption renderer
- Fixed sticky blockstates of the linear chassis
- SuperByteBuffers can now be given a separate matrixStack for vertex lighting
- Kinetic TERs now make use of the passed light parameter
This commit is contained in:
simibubi 2020-05-25 19:58:13 +02:00
parent 85a30afc2b
commit 4e8a72be8b
63 changed files with 614 additions and 463 deletions

View File

@ -14,7 +14,7 @@ a579c40c43dc2174afb66f42d00d0c4a0efaaeee assets\create\blockstates\andesite_bric
97adf53a7cb99d7652fb39adc957e9e34cbaca47 assets\create\blockstates\andesite_cobblestone_slab.json 97adf53a7cb99d7652fb39adc957e9e34cbaca47 assets\create\blockstates\andesite_cobblestone_slab.json
96b5284693da168ab8e0809d86515b5f1a7e763f assets\create\blockstates\andesite_cobblestone_stairs.json 96b5284693da168ab8e0809d86515b5f1a7e763f assets\create\blockstates\andesite_cobblestone_stairs.json
82bd82270aff7d51e9239680ef4dd7b5c899ceb0 assets\create\blockstates\andesite_cobblestone_wall.json 82bd82270aff7d51e9239680ef4dd7b5c899ceb0 assets\create\blockstates\andesite_cobblestone_wall.json
9210df936a886dc4727deec204f06359dd1f14e9 assets\create\blockstates\andesite_pillar.json 398922758a6219544e5b85c91c9cf8a543b437e5 assets\create\blockstates\andesite_pillar.json
f9fa6aa530eb0891a74eadfbebc663172a57147a assets\create\blockstates\basin.json f9fa6aa530eb0891a74eadfbebc663172a57147a assets\create\blockstates\basin.json
96a4fae5883eda130f8ec1a57d34534f6d0793c4 assets\create\blockstates\belt.json 96a4fae5883eda130f8ec1a57d34534f6d0793c4 assets\create\blockstates\belt.json
40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json 40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json
@ -31,15 +31,15 @@ b8dd6e505943e06706d0718ece620ab3cf943650 assets\create\blockstates\brass_casing.
cbcdab42d01f8085db9e5f8db884f8adf7f17625 assets\create\blockstates\chiseled_scoria.json cbcdab42d01f8085db9e5f8db884f8adf7f17625 assets\create\blockstates\chiseled_scoria.json
291952556c52fba2af5bbd793c71af81abd27e71 assets\create\blockstates\chiseled_weathered_limestone.json 291952556c52fba2af5bbd793c71af81abd27e71 assets\create\blockstates\chiseled_weathered_limestone.json
4947c261310445fa55b92038326ac82967d192dd assets\create\blockstates\clockwork_bearing.json 4947c261310445fa55b92038326ac82967d192dd assets\create\blockstates\clockwork_bearing.json
86101bf2f0a5cec159c8b0e4c45ff0a73759c8b6 assets\create\blockstates\clutch.json 1f33834c685e3243882acfe20183fe64dfa872be assets\create\blockstates\clutch.json
10e6e789e00253da08db14e885a2cd24b7306047 assets\create\blockstates\cogwheel.json e5e3757e99c139d67b2a70288466d8a74d818841 assets\create\blockstates\cogwheel.json
f8eff64c75fc599e9a44a003f54ae9931cd8ce7c assets\create\blockstates\copper_block.json f8eff64c75fc599e9a44a003f54ae9931cd8ce7c assets\create\blockstates\copper_block.json
cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets\create\blockstates\copper_casing.json cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets\create\blockstates\copper_casing.json
3355a852cdc717e257ca19b3db836068964733e3 assets\create\blockstates\copper_ore.json 3355a852cdc717e257ca19b3db836068964733e3 assets\create\blockstates\copper_ore.json
dc76bca1fdd41c8e6ada27fd59a2b73d7adc9596 assets\create\blockstates\copper_shingles.json dc76bca1fdd41c8e6ada27fd59a2b73d7adc9596 assets\create\blockstates\copper_shingles.json
3df0d5d5170a2f6cbab0f8a9bc8f2d64229589af assets\create\blockstates\creative_crate.json 3df0d5d5170a2f6cbab0f8a9bc8f2d64229589af assets\create\blockstates\creative_crate.json
f0031f5e970b3d5695472ed384950b8631b015ed assets\create\blockstates\creative_motor.json f0031f5e970b3d5695472ed384950b8631b015ed assets\create\blockstates\creative_motor.json
46af6c7d1e9041e44f5ea495b0b61dcf662b9b70 assets\create\blockstates\crushing_wheel.json fe2f78b94c20944399101e7369e2d43324297fb6 assets\create\blockstates\crushing_wheel.json
a1dd6cb3daa97ea871290ef7b178d28b564ee2a2 assets\create\blockstates\crushing_wheel_controller.json a1dd6cb3daa97ea871290ef7b178d28b564ee2a2 assets\create\blockstates\crushing_wheel_controller.json
b1126c191877cff86b4e2de83e1fcbd151451cb7 assets\create\blockstates\cuckoo_clock.json b1126c191877cff86b4e2de83e1fcbd151451cb7 assets\create\blockstates\cuckoo_clock.json
1726b1b9e04a0634e7e1fdcf1cf4cc898efc5c2f assets\create\blockstates\dark_oak_window.json 1726b1b9e04a0634e7e1fdcf1cf4cc898efc5c2f assets\create\blockstates\dark_oak_window.json
@ -53,7 +53,7 @@ bfab7d9b2e01183d47a828f2827125771efa97fc assets\create\blockstates\dark_scoria_b
1ca115df6d2b5a63a1c505bc94d62543f1c0e26a assets\create\blockstates\dark_scoria_cobblestone_slab.json 1ca115df6d2b5a63a1c505bc94d62543f1c0e26a assets\create\blockstates\dark_scoria_cobblestone_slab.json
f86eea3f7df0988fffbe90e29b74141a7203cd15 assets\create\blockstates\dark_scoria_cobblestone_stairs.json f86eea3f7df0988fffbe90e29b74141a7203cd15 assets\create\blockstates\dark_scoria_cobblestone_stairs.json
f1020a33fcb1a362b6c55b5aa8ce093e47ebde09 assets\create\blockstates\dark_scoria_cobblestone_wall.json f1020a33fcb1a362b6c55b5aa8ce093e47ebde09 assets\create\blockstates\dark_scoria_cobblestone_wall.json
1cbba7ea7b2456b617a8b6e71059beb037462a00 assets\create\blockstates\dark_scoria_pillar.json 902778a0f16b7ad009ee7b123bb583eaea32467a assets\create\blockstates\dark_scoria_pillar.json
ac85f55d82d96fc15750e6b954297cfd1e00d04d assets\create\blockstates\deployer.json ac85f55d82d96fc15750e6b954297cfd1e00d04d assets\create\blockstates\deployer.json
c890ec9b3778aebb16c6b2eb2ca79bfbe7bf7435 assets\create\blockstates\diorite_bricks.json c890ec9b3778aebb16c6b2eb2ca79bfbe7bf7435 assets\create\blockstates\diorite_bricks.json
894d5ca00c3765553deaac44b83257983acf502d assets\create\blockstates\diorite_bricks_slab.json 894d5ca00c3765553deaac44b83257983acf502d assets\create\blockstates\diorite_bricks_slab.json
@ -63,7 +63,7 @@ e42f2ebe5a2fdaeed62b9bc289252664a1e8705b assets\create\blockstates\diorite_brick
a886ed9f02e54d3cf0bc55710c61f52737953ede assets\create\blockstates\diorite_cobblestone_slab.json a886ed9f02e54d3cf0bc55710c61f52737953ede assets\create\blockstates\diorite_cobblestone_slab.json
328e6ffb0b0124f497b2e227c814fa2bcccfeb0e assets\create\blockstates\diorite_cobblestone_stairs.json 328e6ffb0b0124f497b2e227c814fa2bcccfeb0e assets\create\blockstates\diorite_cobblestone_stairs.json
110cddbea434aa650eac919908880a0296b38a2f assets\create\blockstates\diorite_cobblestone_wall.json 110cddbea434aa650eac919908880a0296b38a2f assets\create\blockstates\diorite_cobblestone_wall.json
51b44abc3d7e3dfe71423230b052c3b9d1dee93d assets\create\blockstates\diorite_pillar.json bd24921c0c66deaabbdbf557b7ff9a507402c1e5 assets\create\blockstates\diorite_pillar.json
610435897262bc9a1d98d85ce470a5030411a1d7 assets\create\blockstates\dolomite.json 610435897262bc9a1d98d85ce470a5030411a1d7 assets\create\blockstates\dolomite.json
710f354ec7b11b545bac9c5cb6f181229aa84be9 assets\create\blockstates\dolomite_bricks.json 710f354ec7b11b545bac9c5cb6f181229aa84be9 assets\create\blockstates\dolomite_bricks.json
c681864890ec8c8c9f5ab275957979337539f782 assets\create\blockstates\dolomite_bricks_slab.json c681864890ec8c8c9f5ab275957979337539f782 assets\create\blockstates\dolomite_bricks_slab.json
@ -73,11 +73,11 @@ a2b7259dacf7b582e3b819e12015b5e18a1768e5 assets\create\blockstates\dolomite_cobb
5cf01ea02b50229fce2296206b9f0ce1c1b2c9f6 assets\create\blockstates\dolomite_cobblestone_slab.json 5cf01ea02b50229fce2296206b9f0ce1c1b2c9f6 assets\create\blockstates\dolomite_cobblestone_slab.json
e7c1db7226df5858f1884f0cf328a733fec22c3d assets\create\blockstates\dolomite_cobblestone_stairs.json e7c1db7226df5858f1884f0cf328a733fec22c3d assets\create\blockstates\dolomite_cobblestone_stairs.json
f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets\create\blockstates\dolomite_cobblestone_wall.json f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets\create\blockstates\dolomite_cobblestone_wall.json
6d7f0c92ee978366d2b019e35cf2fc6a2e4de37d assets\create\blockstates\dolomite_pillar.json f179202e59e449157f89efc37229b03bbfd391d7 assets\create\blockstates\dolomite_pillar.json
5fca916e329ccf449f6e60eb5ac7dd7efd250a23 assets\create\blockstates\drill.json 5fca916e329ccf449f6e60eb5ac7dd7efd250a23 assets\create\blockstates\drill.json
7b1c40891b07c8f3238537625d9e25c8627e7333 assets\create\blockstates\encased_belt.json 7b1c40891b07c8f3238537625d9e25c8627e7333 assets\create\blockstates\encased_belt.json
7b2b836649e729feafa60972bf95e3afb2143131 assets\create\blockstates\encased_fan.json 7b2b836649e729feafa60972bf95e3afb2143131 assets\create\blockstates\encased_fan.json
373ac3c29b553322291599e93eac12000c4a87f8 assets\create\blockstates\encased_shaft.json db1777f0eff1eb6987b569aee513656ae889ae75 assets\create\blockstates\encased_shaft.json
1442ff1a0e404f99263ba99d734da1dfed03d4e3 assets\create\blockstates\extractor.json 1442ff1a0e404f99263ba99d734da1dfed03d4e3 assets\create\blockstates\extractor.json
a774e815376a67e2a2de44e39af0a1a0b4406932 assets\create\blockstates\fancy_andesite_bricks.json a774e815376a67e2a2de44e39af0a1a0b4406932 assets\create\blockstates\fancy_andesite_bricks.json
180be26a75834cf9cdb881f969f77906e91cc36a assets\create\blockstates\fancy_andesite_bricks_slab.json 180be26a75834cf9cdb881f969f77906e91cc36a assets\create\blockstates\fancy_andesite_bricks_slab.json
@ -129,9 +129,9 @@ afff479c0e5284771afa9e7ce513595fe65860ee assets\create\blockstates\gabbro_cobble
85151aa7583e4752424b2efc1b35d8c9cceb66a7 assets\create\blockstates\gabbro_cobblestone_slab.json 85151aa7583e4752424b2efc1b35d8c9cceb66a7 assets\create\blockstates\gabbro_cobblestone_slab.json
a1f31a194129cfb65e335b3b96490f9275f9c564 assets\create\blockstates\gabbro_cobblestone_stairs.json a1f31a194129cfb65e335b3b96490f9275f9c564 assets\create\blockstates\gabbro_cobblestone_stairs.json
a64d8d0924c0b5b192f355343dd9b3a440875f6a assets\create\blockstates\gabbro_cobblestone_wall.json a64d8d0924c0b5b192f355343dd9b3a440875f6a assets\create\blockstates\gabbro_cobblestone_wall.json
89faeaf1847c67a3200a31a9d9a6a68d551a807b assets\create\blockstates\gabbro_pillar.json a6b44e8a1c4ce0c7442b2384b41ad36dd133f19b assets\create\blockstates\gabbro_pillar.json
727cc5f4176cc02636d73b21b9490b632d77de8e assets\create\blockstates\gearbox.json 9c48e311be8b959bfb98e16ffaa358210ac8b9dd assets\create\blockstates\gearbox.json
738198cf5ddd090003b5e157cc449fd001c4673d assets\create\blockstates\gearshift.json f34814b17cde3231a1dfb271f3dabf8d6de4fbf6 assets\create\blockstates\gearshift.json
87661d61e1645ef5ad4ea34f1c0fa31f139ea431 assets\create\blockstates\granite_bricks.json 87661d61e1645ef5ad4ea34f1c0fa31f139ea431 assets\create\blockstates\granite_bricks.json
d7f4cf7be7e9a3895840d9288245c52cbe25f0bd assets\create\blockstates\granite_bricks_slab.json d7f4cf7be7e9a3895840d9288245c52cbe25f0bd assets\create\blockstates\granite_bricks_slab.json
ec51efc72eb6b16c5f99399b4cb6284665d5be99 assets\create\blockstates\granite_bricks_stairs.json ec51efc72eb6b16c5f99399b4cb6284665d5be99 assets\create\blockstates\granite_bricks_stairs.json
@ -140,14 +140,14 @@ ec51efc72eb6b16c5f99399b4cb6284665d5be99 assets\create\blockstates\granite_brick
a4b0337149cb0617cc60061477c7178d37dbb831 assets\create\blockstates\granite_cobblestone_slab.json a4b0337149cb0617cc60061477c7178d37dbb831 assets\create\blockstates\granite_cobblestone_slab.json
d97fdea02187e63f6b63913357c79a18660d676d assets\create\blockstates\granite_cobblestone_stairs.json d97fdea02187e63f6b63913357c79a18660d676d assets\create\blockstates\granite_cobblestone_stairs.json
9ce66b5a61c3aad398756d26e4efee2b9e12a275 assets\create\blockstates\granite_cobblestone_wall.json 9ce66b5a61c3aad398756d26e4efee2b9e12a275 assets\create\blockstates\granite_cobblestone_wall.json
b51450d748285d3b13951a46deef940da7ae18ad assets\create\blockstates\granite_pillar.json f8659e81cd2a623475a6a9aca59149e82de56b1c assets\create\blockstates\granite_pillar.json
6ab675fa06317e6d07c0c1a453e7bb43e3f46b3b assets\create\blockstates\hand_crank.json 6ab675fa06317e6d07c0c1a453e7bb43e3f46b3b assets\create\blockstates\hand_crank.json
d7aad9c1ec992c42576490f633c9a3317983945c assets\create\blockstates\harvester.json d7aad9c1ec992c42576490f633c9a3317983945c assets\create\blockstates\harvester.json
be3bef7e091d8b50bfc1c6b7275946d1f636aefd assets\create\blockstates\horizontal_framed_glass.json be3bef7e091d8b50bfc1c6b7275946d1f636aefd assets\create\blockstates\horizontal_framed_glass.json
18d9fdaa1352a7e2ec91135e46dae5c02ccd8f8f assets\create\blockstates\horizontal_framed_glass_pane.json 18d9fdaa1352a7e2ec91135e46dae5c02ccd8f8f assets\create\blockstates\horizontal_framed_glass_pane.json
5d851c90d23de5087ce546d4bbe509e112b84c49 assets\create\blockstates\jungle_window.json 5d851c90d23de5087ce546d4bbe509e112b84c49 assets\create\blockstates\jungle_window.json
b15bea757ef981e0ca60f740ca234ee2014eb7b7 assets\create\blockstates\jungle_window_pane.json b15bea757ef981e0ca60f740ca234ee2014eb7b7 assets\create\blockstates\jungle_window_pane.json
c85d9caf2b34cd8c74ca9beb1d907bcfedbacd06 assets\create\blockstates\large_cogwheel.json f651091db216b009b3379b2f48d56d03481c8675 assets\create\blockstates\large_cogwheel.json
a38184e035c2ebca7471e1714494fea213af259e assets\create\blockstates\layered_andesite.json a38184e035c2ebca7471e1714494fea213af259e assets\create\blockstates\layered_andesite.json
0fef29f4bfe8e1258427252ef0ff1a414c194969 assets\create\blockstates\layered_dark_scoria.json 0fef29f4bfe8e1258427252ef0ff1a414c194969 assets\create\blockstates\layered_dark_scoria.json
924a0291410406c86ded448f95c97ac3b9d2bd2e assets\create\blockstates\layered_diorite.json 924a0291410406c86ded448f95c97ac3b9d2bd2e assets\create\blockstates\layered_diorite.json
@ -167,7 +167,7 @@ e7c7b952137c4cb615988ea59b9f14303c9a4dfe assets\create\blockstates\limestone_bri
19b6a403a126196144d13eafb81e172b87061019 assets\create\blockstates\limestone_cobblestone_slab.json 19b6a403a126196144d13eafb81e172b87061019 assets\create\blockstates\limestone_cobblestone_slab.json
43532aec1893f7d2f37798d5dbb11ecde0a3bfab assets\create\blockstates\limestone_cobblestone_stairs.json 43532aec1893f7d2f37798d5dbb11ecde0a3bfab assets\create\blockstates\limestone_cobblestone_stairs.json
17c5a6c1dd094c9201ed90fdcebde620a8a39900 assets\create\blockstates\limestone_cobblestone_wall.json 17c5a6c1dd094c9201ed90fdcebde620a8a39900 assets\create\blockstates\limestone_cobblestone_wall.json
48e4d5bce99d9aa2f629c3413f59ce1469da7e07 assets\create\blockstates\limestone_pillar.json b7506b862d13b3f915c60d38bb7a20afc935f70a assets\create\blockstates\limestone_pillar.json
c793ab3aa6cf09d8d6d4136757629689f0365771 assets\create\blockstates\linked_extractor.json c793ab3aa6cf09d8d6d4136757629689f0365771 assets\create\blockstates\linked_extractor.json
c5422866667331f1d5cf6753c0889747ee02762b assets\create\blockstates\linked_transposer.json c5422866667331f1d5cf6753c0889747ee02762b assets\create\blockstates\linked_transposer.json
ddcf4bb281e046fbb1026b8f46a2cf12448598df assets\create\blockstates\mechanical_bearing.json ddcf4bb281e046fbb1026b8f46a2cf12448598df assets\create\blockstates\mechanical_bearing.json
@ -288,9 +288,9 @@ a5befc14551f043675e985027609aeb7e6bacc0d assets\create\blockstates\scoria.json
be96a5541f211a6929fa04ec3535cb62ce7d4a2d assets\create\blockstates\scoria_cobblestone_slab.json be96a5541f211a6929fa04ec3535cb62ce7d4a2d assets\create\blockstates\scoria_cobblestone_slab.json
41d1fbbdfb038e474254bee5284561342fea0fc9 assets\create\blockstates\scoria_cobblestone_stairs.json 41d1fbbdfb038e474254bee5284561342fea0fc9 assets\create\blockstates\scoria_cobblestone_stairs.json
b6e50f46a02f833f2f2bafa8585a909b6da5e229 assets\create\blockstates\scoria_cobblestone_wall.json b6e50f46a02f833f2f2bafa8585a909b6da5e229 assets\create\blockstates\scoria_cobblestone_wall.json
b3f0bf24585f495a7936bcaf5ecd36420378563a assets\create\blockstates\scoria_pillar.json 46641fdbc6bdc05829153bc28efb90cae26a51f8 assets\create\blockstates\scoria_pillar.json
81931eb1027dfb42ba4b2186185a4c0a36e0dbe4 assets\create\blockstates\sequenced_gearshift.json 81931eb1027dfb42ba4b2186185a4c0a36e0dbe4 assets\create\blockstates\sequenced_gearshift.json
1c77f8a4618ccd25e77fd6d2b9faafa3a9320ce7 assets\create\blockstates\shaft.json 79ae6d86a829b9ce82fce68a6377d3810fcfcb10 assets\create\blockstates\shaft.json
e815bfd854c2653f10828bb11950f7fb991d7efc assets\create\blockstates\speedometer.json e815bfd854c2653f10828bb11950f7fb991d7efc assets\create\blockstates\speedometer.json
d62b7908119fa4f51715a186d0882b388bb25cab assets\create\blockstates\spruce_window.json d62b7908119fa4f51715a186d0882b388bb25cab assets\create\blockstates\spruce_window.json
8d7dfa60630a8b4bae4e8eca5c66e1cfa34dda1f assets\create\blockstates\spruce_window_pane.json 8d7dfa60630a8b4bae4e8eca5c66e1cfa34dda1f assets\create\blockstates\spruce_window_pane.json
@ -299,8 +299,8 @@ f385988cb6fa9c48b5d59a6942ec50ed2b60c8bf assets\create\blockstates\stockpile_swi
e815bfd854c2653f10828bb11950f7fb991d7efc assets\create\blockstates\stressometer.json e815bfd854c2653f10828bb11950f7fb991d7efc assets\create\blockstates\stressometer.json
8b0c2c7ac72529565b3339aa8df7565858100afa assets\create\blockstates\tiled_glass.json 8b0c2c7ac72529565b3339aa8df7565858100afa assets\create\blockstates\tiled_glass.json
a2454400b1cf9889f70aebdc89c52a1be25f543c assets\create\blockstates\tiled_glass_pane.json a2454400b1cf9889f70aebdc89c52a1be25f543c assets\create\blockstates\tiled_glass_pane.json
eb3bb63c9ca4ac2dda80a4afbcf5c2f5dd4950da assets\create\blockstates\translation_chassis.json 5b56f9ab24474105d4944413056bf4989454e0f8 assets\create\blockstates\translation_chassis.json
53725e7de23cc0bb49b12705441c4b12e5d72dfb assets\create\blockstates\translation_chassis_secondary.json 67abb31b7675196f4e94889582b5a213f7ffa960 assets\create\blockstates\translation_chassis_secondary.json
e122bf687d991dd2d7a05670039da7937f96ca05 assets\create\blockstates\transposer.json e122bf687d991dd2d7a05670039da7937f96ca05 assets\create\blockstates\transposer.json
a8094531617e27a545c4815ab2062bf0ffca3633 assets\create\blockstates\turntable.json a8094531617e27a545c4815ab2062bf0ffca3633 assets\create\blockstates\turntable.json
d45450255fd7a64cfd2bd8856fd4cff01a49cc8d assets\create\blockstates\vertical_extractor.json d45450255fd7a64cfd2bd8856fd4cff01a49cc8d assets\create\blockstates\vertical_extractor.json
@ -320,11 +320,11 @@ f02e0d7738c3c3622d9051db7deca7a9de274868 assets\create\blockstates\weathered_lim
fd7a9c7095372485081436c91489cadb2b0c514e assets\create\blockstates\weathered_limestone_cobblestone_slab.json fd7a9c7095372485081436c91489cadb2b0c514e assets\create\blockstates\weathered_limestone_cobblestone_slab.json
47f8c91ff4c3f5cad782ab469a1fe5f4909dc7f1 assets\create\blockstates\weathered_limestone_cobblestone_stairs.json 47f8c91ff4c3f5cad782ab469a1fe5f4909dc7f1 assets\create\blockstates\weathered_limestone_cobblestone_stairs.json
c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets\create\blockstates\weathered_limestone_cobblestone_wall.json c60c3115fd6eeaa3a696428a87a74d184ab7d62d assets\create\blockstates\weathered_limestone_cobblestone_wall.json
7e2476ffff93d0eedee5314e5692fcbf5692bffc assets\create\blockstates\weathered_limestone_pillar.json c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets\create\blockstates\weathered_limestone_pillar.json
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
efa942851f247891194d2c6ecdd8724a23b05aa0 assets\create\lang\en_ud.json efa942851f247891194d2c6ecdd8724a23b05aa0 assets\create\lang\en_ud.json
adb6af4aa68bac360242e78b9f883d94059b1df8 assets\create\lang\en_us.json fe4c49a84016a3861a86e116df2c7603d6d4b91f assets\create\lang\en_us.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
@ -1329,7 +1329,7 @@ a99446c05e1896f3a280e17b47ec4d4b0e81987d data\create\loot_tables\blocks\drill.js
503a93787537b46f462d32b0382c3396f42bb1f6 data\create\loot_tables\blocks\encased_belt.json 503a93787537b46f462d32b0382c3396f42bb1f6 data\create\loot_tables\blocks\encased_belt.json
9055d82b983b673e1638d17b712b9fcd1f5a52e6 data\create\loot_tables\blocks\encased_fan.json 9055d82b983b673e1638d17b712b9fcd1f5a52e6 data\create\loot_tables\blocks\encased_fan.json
b3849bece65e13128fdeb033b156cf6615bc72f8 data\create\loot_tables\blocks\encased_shaft.json b3849bece65e13128fdeb033b156cf6615bc72f8 data\create\loot_tables\blocks\encased_shaft.json
205f5899101262f31f5c1a88bb7d954918d08d04 data\create\loot_tables\blocks\extractor.json 5a47c1535c866184b4ffca65763f5676f319e0aa data\create\loot_tables\blocks\extractor.json
ddfc4764a6039d771e03af815ac4493da80d2e6b data\create\loot_tables\blocks\fancy_andesite_bricks.json ddfc4764a6039d771e03af815ac4493da80d2e6b data\create\loot_tables\blocks\fancy_andesite_bricks.json
31f2e6932505c68b28e92221a37144f69161c376 data\create\loot_tables\blocks\fancy_andesite_bricks_slab.json 31f2e6932505c68b28e92221a37144f69161c376 data\create\loot_tables\blocks\fancy_andesite_bricks_slab.json
413c8bb80954679796cd9d18f808c28a7bdbe681 data\create\loot_tables\blocks\fancy_andesite_bricks_stairs.json 413c8bb80954679796cd9d18f808c28a7bdbe681 data\create\loot_tables\blocks\fancy_andesite_bricks_stairs.json
@ -1369,7 +1369,7 @@ e4d0fe35d3441a5815bd4e1357329b284e63ecd8 data\create\loot_tables\blocks\fancy_we
f37526c092c645045c22674dea6c7b1ec503c9c3 data\create\loot_tables\blocks\flywheel.json f37526c092c645045c22674dea6c7b1ec503c9c3 data\create\loot_tables\blocks\flywheel.json
8fbd865f350c615031ec3f56eb98b51ce3008de3 data\create\loot_tables\blocks\framed_glass.json 8fbd865f350c615031ec3f56eb98b51ce3008de3 data\create\loot_tables\blocks\framed_glass.json
44c8bc7271fa367ff052bef242e1ae26fb435175 data\create\loot_tables\blocks\framed_glass_pane.json 44c8bc7271fa367ff052bef242e1ae26fb435175 data\create\loot_tables\blocks\framed_glass_pane.json
ed895ef7dcb97ad9b00d80a4fa9c331229dd532e data\create\loot_tables\blocks\funnel.json 205f5899101262f31f5c1a88bb7d954918d08d04 data\create\loot_tables\blocks\funnel.json
4063880eda871fe63a4eb549a19daecabce849e5 data\create\loot_tables\blocks\furnace_engine.json 4063880eda871fe63a4eb549a19daecabce849e5 data\create\loot_tables\blocks\furnace_engine.json
1070cba1c0f46cf7ebe31089f35333f5eadda6e4 data\create\loot_tables\blocks\gabbro.json 1070cba1c0f46cf7ebe31089f35333f5eadda6e4 data\create\loot_tables\blocks\gabbro.json
0356e003d8890d31b89d0ad98e32aae892da71f9 data\create\loot_tables\blocks\gabbro_bricks.json 0356e003d8890d31b89d0ad98e32aae892da71f9 data\create\loot_tables\blocks\gabbro_bricks.json
@ -1419,8 +1419,8 @@ cb315814960850b5080598b89ee94c833b5048f7 data\create\loot_tables\blocks\limeston
8db1e3f0dac48b91a4839206a7d5a88cef415fdc data\create\loot_tables\blocks\limestone_cobblestone_stairs.json 8db1e3f0dac48b91a4839206a7d5a88cef415fdc data\create\loot_tables\blocks\limestone_cobblestone_stairs.json
92fb16606f289ad33860270d098fad2522b24e09 data\create\loot_tables\blocks\limestone_cobblestone_wall.json 92fb16606f289ad33860270d098fad2522b24e09 data\create\loot_tables\blocks\limestone_cobblestone_wall.json
371115e5ceb08c07a9ab2371509960c31e0baa8a data\create\loot_tables\blocks\limestone_pillar.json 371115e5ceb08c07a9ab2371509960c31e0baa8a data\create\loot_tables\blocks\limestone_pillar.json
205f5899101262f31f5c1a88bb7d954918d08d04 data\create\loot_tables\blocks\linked_extractor.json dac789cf53b00eed34308848b5e267b7ccec090c data\create\loot_tables\blocks\linked_extractor.json
205f5899101262f31f5c1a88bb7d954918d08d04 data\create\loot_tables\blocks\linked_transposer.json 7af5a13c9e10903b11732fbc01ae3299328216f0 data\create\loot_tables\blocks\linked_transposer.json
90ddf7b5c3b61758a4ad12a1e6ef16fe6ebf7794 data\create\loot_tables\blocks\mechanical_bearing.json 90ddf7b5c3b61758a4ad12a1e6ef16fe6ebf7794 data\create\loot_tables\blocks\mechanical_bearing.json
e93872a90e4f4642a003539e7db28fdacfdcd114 data\create\loot_tables\blocks\mechanical_crafter.json e93872a90e4f4642a003539e7db28fdacfdcd114 data\create\loot_tables\blocks\mechanical_crafter.json
b12efeeef5682966016ce6ea2d171eecd33d9667 data\create\loot_tables\blocks\mechanical_mixer.json b12efeeef5682966016ce6ea2d171eecd33d9667 data\create\loot_tables\blocks\mechanical_mixer.json
@ -1552,7 +1552,7 @@ ec2889e712702644092197a4b41a682fb953817d data\create\loot_tables\blocks\stockpil
2082f3fb39185cb65555ab93178081a2f53f6046 data\create\loot_tables\blocks\tiled_glass_pane.json 2082f3fb39185cb65555ab93178081a2f53f6046 data\create\loot_tables\blocks\tiled_glass_pane.json
d95e09420ef7580779c71888d043aa5b4c56c725 data\create\loot_tables\blocks\translation_chassis.json d95e09420ef7580779c71888d043aa5b4c56c725 data\create\loot_tables\blocks\translation_chassis.json
7c70f942b2ffb58a3fb894e57ce4e445b9007be2 data\create\loot_tables\blocks\translation_chassis_secondary.json 7c70f942b2ffb58a3fb894e57ce4e445b9007be2 data\create\loot_tables\blocks\translation_chassis_secondary.json
205f5899101262f31f5c1a88bb7d954918d08d04 data\create\loot_tables\blocks\transposer.json b201436ae6d2ad5a7d47dca0ee8c7016b4c28fa5 data\create\loot_tables\blocks\transposer.json
7b66ad2c48449bafd0cdbd086ac41218cb73a814 data\create\loot_tables\blocks\turntable.json 7b66ad2c48449bafd0cdbd086ac41218cb73a814 data\create\loot_tables\blocks\turntable.json
eb3086010565ff1e83e30aa3712f82819bcc0e99 data\create\loot_tables\blocks\vertical_framed_glass.json eb3086010565ff1e83e30aa3712f82819bcc0e99 data\create\loot_tables\blocks\vertical_framed_glass.json
15019b1b2b77e6be8a0f4ccd20f35ebb4a82a090 data\create\loot_tables\blocks\vertical_framed_glass_pane.json 15019b1b2b77e6be8a0f4ccd20f35ebb4a82a090 data\create\loot_tables\blocks\vertical_framed_glass_pane.json

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/andesite_pillar", "model": "create:block/andesite_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z,powered=false": { "axis=z,powered=false": {
"model": "create:block/clutch/block", "model": "create:block/clutch/block",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,powered=true": { "axis=x,powered=true": {
"model": "create:block/clutch/block_powered", "model": "create:block/clutch/block_powered",
@ -22,7 +23,8 @@
}, },
"axis=z,powered=true": { "axis=z,powered=true": {
"model": "create:block/clutch/block_powered", "model": "create:block/clutch/block_powered",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/cogwheel", "model": "create:block/cogwheel",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/crushing_wheel", "model": "create:block/crushing_wheel",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/dark_scoria_pillar", "model": "create:block/dark_scoria_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/diorite_pillar", "model": "create:block/diorite_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/dolomite_pillar", "model": "create:block/dolomite_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/encased_shaft/block", "model": "create:block/encased_shaft/block",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/gabbro_pillar", "model": "create:block/gabbro_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/gearbox/block", "model": "create:block/gearbox/block",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z,powered=false": { "axis=z,powered=false": {
"model": "create:block/gearshift/block", "model": "create:block/gearshift/block",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,powered=true": { "axis=x,powered=true": {
"model": "create:block/gearshift/block_powered", "model": "create:block/gearshift/block_powered",
@ -22,7 +23,8 @@
}, },
"axis=z,powered=true": { "axis=z,powered=true": {
"model": "create:block/gearshift/block_powered", "model": "create:block/gearshift/block_powered",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/granite_pillar", "model": "create:block/granite_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/large_cogwheel", "model": "create:block/large_cogwheel",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/limestone_pillar", "model": "create:block/limestone_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -89,8 +89,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_west": "true",
"sticky_west": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_x_sticky", "model": "create:block/rotation_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/rotation_chassis_side_y_sticky", "model": "create:block/rotation_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/rotation_chassis_side_z_sticky", "model": "create:block/rotation_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/rotation_chassis_side_x", "model": "create:block/rotation_chassis_side_x",
@ -129,8 +129,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_west": "false",
"sticky_west": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_y", "model": "create:block/rotation_chassis_side_y",
@ -139,8 +139,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_west": "false",
"sticky_west": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_z", "model": "create:block/rotation_chassis_side_z",
@ -149,8 +149,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_north": "true",
"sticky_north": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_x_sticky" "model": "create:block/rotation_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/rotation_chassis_side_y_sticky", "model": "create:block/rotation_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/rotation_chassis_side_x_sticky", "model": "create:block/rotation_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/rotation_chassis_side_x" "model": "create:block/rotation_chassis_side_x"
@ -187,8 +187,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_north": "false",
"sticky_north": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_y", "model": "create:block/rotation_chassis_side_y",
@ -197,8 +197,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_north": "false",
"sticky_north": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_x", "model": "create:block/rotation_chassis_side_x",
@ -207,8 +207,8 @@
}, },
{ {
"when": { "when": {
"axis": "x", "sticky_east": "true",
"sticky_east": "true" "axis": "x"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_x_sticky", "model": "create:block/rotation_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/rotation_chassis_side_y_sticky", "model": "create:block/rotation_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/rotation_chassis_side_z_sticky" "model": "create:block/rotation_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/rotation_chassis_side_x", "model": "create:block/rotation_chassis_side_x",
@ -246,8 +246,8 @@
}, },
{ {
"when": { "when": {
"axis": "y", "sticky_east": "false",
"sticky_east": "false" "axis": "y"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_y", "model": "create:block/rotation_chassis_side_y",
@ -256,8 +256,8 @@
}, },
{ {
"when": { "when": {
"axis": "z", "sticky_east": "false",
"sticky_east": "false" "axis": "z"
}, },
"apply": { "apply": {
"model": "create:block/rotation_chassis_side_z" "model": "create:block/rotation_chassis_side_z"

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/scoria_pillar", "model": "create:block/scoria_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/shaft", "model": "create:block/shaft",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z,sticky_bottom=false,sticky_top=false": { "axis=z,sticky_bottom=false,sticky_top=false": {
"model": "create:block/translation_chassis", "model": "create:block/translation_chassis",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=true,sticky_top=false": { "axis=x,sticky_bottom=true,sticky_top=false": {
"model": "create:block/translation_chassis_bottom", "model": "create:block/translation_chassis_bottom",
@ -22,7 +23,8 @@
}, },
"axis=z,sticky_bottom=true,sticky_top=false": { "axis=z,sticky_bottom=true,sticky_top=false": {
"model": "create:block/translation_chassis_bottom", "model": "create:block/translation_chassis_bottom",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=false,sticky_top=true": { "axis=x,sticky_bottom=false,sticky_top=true": {
"model": "create:block/translation_chassis_top", "model": "create:block/translation_chassis_top",
@ -34,7 +36,8 @@
}, },
"axis=z,sticky_bottom=false,sticky_top=true": { "axis=z,sticky_bottom=false,sticky_top=true": {
"model": "create:block/translation_chassis_top", "model": "create:block/translation_chassis_top",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=true,sticky_top=true": { "axis=x,sticky_bottom=true,sticky_top=true": {
"model": "create:block/translation_chassis_top_bottom", "model": "create:block/translation_chassis_top_bottom",
@ -46,7 +49,8 @@
}, },
"axis=z,sticky_bottom=true,sticky_top=true": { "axis=z,sticky_bottom=true,sticky_top=true": {
"model": "create:block/translation_chassis_top_bottom", "model": "create:block/translation_chassis_top_bottom",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z,sticky_bottom=false,sticky_top=false": { "axis=z,sticky_bottom=false,sticky_top=false": {
"model": "create:block/translation_chassis_secondary", "model": "create:block/translation_chassis_secondary",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=true,sticky_top=false": { "axis=x,sticky_bottom=true,sticky_top=false": {
"model": "create:block/translation_chassis_secondary_bottom", "model": "create:block/translation_chassis_secondary_bottom",
@ -22,7 +23,8 @@
}, },
"axis=z,sticky_bottom=true,sticky_top=false": { "axis=z,sticky_bottom=true,sticky_top=false": {
"model": "create:block/translation_chassis_secondary_bottom", "model": "create:block/translation_chassis_secondary_bottom",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=false,sticky_top=true": { "axis=x,sticky_bottom=false,sticky_top=true": {
"model": "create:block/translation_chassis_secondary_top", "model": "create:block/translation_chassis_secondary_top",
@ -34,7 +36,8 @@
}, },
"axis=z,sticky_bottom=false,sticky_top=true": { "axis=z,sticky_bottom=false,sticky_top=true": {
"model": "create:block/translation_chassis_secondary_top", "model": "create:block/translation_chassis_secondary_top",
"x": 90 "x": 90,
"y": 180
}, },
"axis=x,sticky_bottom=true,sticky_top=true": { "axis=x,sticky_bottom=true,sticky_top=true": {
"model": "create:block/translation_chassis_secondary_top_bottom", "model": "create:block/translation_chassis_secondary_top_bottom",
@ -46,7 +49,8 @@
}, },
"axis=z,sticky_bottom=true,sticky_top=true": { "axis=z,sticky_bottom=true,sticky_top=true": {
"model": "create:block/translation_chassis_secondary_top_bottom", "model": "create:block/translation_chassis_secondary_top_bottom",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -10,7 +10,8 @@
}, },
"axis=z": { "axis=z": {
"model": "create:block/weathered_limestone_pillar", "model": "create:block/weathered_limestone_pillar",
"x": 90 "x": 90,
"y": 180
} }
} }
} }

View File

@ -6,7 +6,7 @@
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:air" "name": "create:extractor"
} }
], ],
"conditions": [ "conditions": [

View File

@ -6,7 +6,7 @@
"entries": [ "entries": [
{ {
"type": "minecraft:item", "type": "minecraft:item",
"name": "minecraft:air" "name": "create:transposer"
} }
], ],
"conditions": [ "conditions": [

View File

@ -38,18 +38,18 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
int light, int overlay) { int light, int overlay) {
for (RenderType type : RenderType.getBlockLayers()) for (RenderType type : RenderType.getBlockLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type)) if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type)); renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light);
} }
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms,
IVertexBuilder buffer) { IVertexBuilder buffer, int light) {
SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState); SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState);
renderRotatingBuffer(te, superByteBuffer, ms, buffer); renderRotatingBuffer(te, superByteBuffer, ms, buffer, light);
} }
public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms,
IVertexBuilder buffer) { IVertexBuilder buffer, int light) {
standardKineticRotationTransform(superBuffer, te).renderInto(ms, buffer); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, buffer);
} }
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) { public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
@ -59,18 +59,17 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
return angle; return angle;
} }
public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te) { public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te,
int light) {
final BlockPos pos = te.getPos(); final BlockPos pos = te.getPos();
Axis axis = ((IRotate) te.getBlockState() Axis axis = ((IRotate) te.getBlockState()
.getBlock()).getRotationAxis(te.getBlockState()); .getBlock()).getRotationAxis(te.getBlockState());
return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis)); return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis), light);
} }
public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis, public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis,
float angle) { float angle, int light) {
int light = te.getBlockState() buffer.light(light);
.getLightValue(te.getWorld(), te.getPos());
buffer.light((0xF0 << 16) | (light << 4));
buffer.rotateCentered(axis, angle); buffer.rotateCentered(axis, angle);
int white = 0xFFFFFF; int white = 0xFFFFFF;

View File

@ -1,10 +1,11 @@
package com.simibubi.create.content.contraptions.components.actors; package com.simibubi.create.content.contraptions.components.actors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -16,19 +17,21 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean isActive(MovementContext context) { public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(DrillBlock.FACING)
context.state.get(DrillBlock.FACING).getOpposite()); .getOpposite());
} }
@Override @Override
public Vec3d getActiveAreaOffset(MovementContext context) { public Vec3d getActiveAreaOffset(MovementContext context) {
return new Vec3d(context.state.get(DrillBlock.FACING).getDirectionVec()).scale(.65f); return new Vec3d(context.state.get(DrillBlock.FACING)
.getDirectionVec()).scale(.65f);
} }
@Override @Override
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
public SuperByteBuffer renderInContraption(MovementContext context) { public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
return DrillTileEntityRenderer.renderInContraption(context); IRenderTypeBuffer buffer) {
DrillTileEntityRenderer.renderInContraption(context, ms, msLocal, buffer);
} }
@Override @Override
@ -38,7 +41,8 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) { public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
return super.canBreak(world, breakingPos, state) && !state.getCollisionShape(world, breakingPos).isEmpty(); return super.canBreak(world, breakingPos, state) && !state.getCollisionShape(world, breakingPos)
.isEmpty();
} }
} }

View File

@ -2,18 +2,20 @@ package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.state.properties.BlockStateProperties.FACING; import static net.minecraft.state.properties.BlockStateProperties.FACING;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.IRotate;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction.Axis;
public class DrillTileEntityRenderer extends KineticTileEntityRenderer { public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
@ -30,19 +32,26 @@ public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
return AllBlockPartials.DRILL_HEAD.renderOnDirectional(state); return AllBlockPartials.DRILL_HEAD.renderOnDirectional(state);
} }
public static SuperByteBuffer renderInContraption(MovementContext context) { public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
MatrixStack[] matrixStacks = new MatrixStack[] { ms, msLocal };
BlockState state = context.state; BlockState state = context.state;
SuperByteBuffer buffer = getRotatingModel(state); SuperByteBuffer superBuffer = getRotatingModel(state);
float speed = (float) (context.contraption.stalled float speed = (float) (context.contraption.stalled
|| !VecHelper.isVecPointingTowards(context.relativeMotion, state.get(FACING).getOpposite()) || !VecHelper.isVecPointingTowards(context.relativeMotion, state.get(FACING)
? context.getAnimationSpeed() .getOpposite()) ? context.getAnimationSpeed() : 0);
: 0);
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
float time = AnimationTickHolder.getRenderTick() / 20; float time = AnimationTickHolder.getRenderTick() / 20;
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI); float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI);
return buffer.rotateCentered(axis, angle); for (MatrixStack m : matrixStacks)
MatrixStacker.of(m)
.centre()
.rotateY(angle)
.unCentre();
superBuffer.light(msLocal.peek()
.getModel())
.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
} }
} }

View File

@ -4,10 +4,10 @@ import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING;
import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableBoolean;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -16,6 +16,7 @@ import net.minecraft.block.CocoaBlock;
import net.minecraft.block.CropsBlock; import net.minecraft.block.CropsBlock;
import net.minecraft.block.KelpBlock; import net.minecraft.block.KelpBlock;
import net.minecraft.block.SugarCaneBlock; import net.minecraft.block.SugarCaneBlock;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty; import net.minecraft.state.IProperty;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
@ -23,27 +24,26 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
public class HarvesterMovementBehaviour extends MovementBehaviour { public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override @Override
public boolean isActive(MovementContext context) { public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING)
context.state.get(HORIZONTAL_FACING).getOpposite()); .getOpposite());
} }
@Override @Override
@OnlyIn(value = Dist.CLIENT) public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
public SuperByteBuffer renderInContraption(MovementContext context) { IRenderTypeBuffer buffers) {
return HarvesterRenderer.renderInContraption(context); HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers);
} }
@Override @Override
public Vec3d getActiveAreaOffset(MovementContext context) { public Vec3d getActiveAreaOffset(MovementContext context) {
return new Vec3d(context.state.get(HORIZONTAL_FACING).getDirectionVec()).scale(.45); return new Vec3d(context.state.get(HORIZONTAL_FACING)
.getDirectionVec()).scale(.45);
} }
@Override @Override
@ -82,13 +82,16 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
return false; return false;
return true; return true;
} }
if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { if (state.getCollisionShape(world, pos)
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
for (IProperty<?> property : state.getProperties()) { for (IProperty<?> property : state.getProperties()) {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName().equals(BlockStateProperties.AGE_0_1.getName())) if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
continue; continue;
if (((IntegerProperty) property).getAllowedValues().size() - 1 != state.get((IntegerProperty) property) if (((IntegerProperty) property).getAllowedValues()
.size() - 1 != state.get((IntegerProperty) property)
.intValue()) .intValue())
continue; continue;
return true; return true;
@ -104,11 +107,13 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (state.getBlock() instanceof SugarCaneBlock) if (state.getBlock() instanceof SugarCaneBlock)
return true; return true;
if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { if (state.getCollisionShape(world, pos)
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
for (IProperty<?> property : state.getProperties()) { for (IProperty<?> property : state.getProperties()) {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName().equals(BlockStateProperties.AGE_0_1.getName())) if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
continue; continue;
return false; return false;
} }
@ -128,23 +133,29 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
return crop.withAge(0); return crop.withAge(0);
} }
if (state.getBlock() == Blocks.SUGAR_CANE) { if (state.getBlock() == Blocks.SUGAR_CANE) {
if (state.getFluidState().isEmpty()) if (state.getFluidState()
.isEmpty())
return Blocks.AIR.getDefaultState(); return Blocks.AIR.getDefaultState();
return state.getFluidState().getBlockState(); return state.getFluidState()
.getBlockState();
} }
if (state.getCollisionShape(world, pos).isEmpty() || state.getBlock() instanceof CocoaBlock) { if (state.getCollisionShape(world, pos)
.isEmpty() || state.getBlock() instanceof CocoaBlock) {
for (IProperty<?> property : state.getProperties()) { for (IProperty<?> property : state.getProperties()) {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName().equals(BlockStateProperties.AGE_0_1.getName())) if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName()))
continue; continue;
return state.with((IntegerProperty) property, Integer.valueOf(0)); return state.with((IntegerProperty) property, Integer.valueOf(0));
} }
} }
if (state.getFluidState().isEmpty()) if (state.getFluidState()
.isEmpty())
return Blocks.AIR.getDefaultState(); return Blocks.AIR.getDefaultState();
return state.getFluidState().getBlockState(); return state.getFluidState()
.getBlockState();
} }
} }

View File

@ -7,18 +7,18 @@ import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.util.math.Vec3d;
public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> { public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> {
@ -29,41 +29,43 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
@Override @Override
protected void renderSafe(HarvesterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(HarvesterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
SuperByteBuffer superBuffer = renderHead(te.getWorld(), te.getPos(), te.getBlockState(), 0); BlockState blockState = te.getBlockState();
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
SuperByteBuffer superBuffer = AllBlockPartials.HARVESTER_BLADE.renderOnHorizontal(blockState);
transformHead(ms, 0);
superBuffer.light(light)
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
} }
public static SuperByteBuffer renderInContraption(MovementContext context) { public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
BlockState state = context.state; IRenderTypeBuffer buffers) {
Direction facing = state.get(HORIZONTAL_FACING); MatrixStack[] matrixStacks = new MatrixStack[] { ms, msLocal };
int offset = facing.getAxisDirection().getOffset() * (facing.getAxis() == Axis.X ? 1 : -1); BlockState blockState = context.state;
Direction facing = blockState.get(HORIZONTAL_FACING);
SuperByteBuffer superBuffer = AllBlockPartials.HARVESTER_BLADE.renderOnHorizontal(blockState);
int offset = facing.getAxisDirection()
.getOffset() * (facing.getAxis() == Axis.X ? 1 : -1);
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite()) float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite())
? context.getAnimationSpeed() * offset ? context.getAnimationSpeed() * offset
: 0); : 0);
if (context.contraption.stalled) if (context.contraption.stalled)
speed = 0; speed = 0;
float time = AnimationTickHolder.getRenderTick() / 20; float time = AnimationTickHolder.getRenderTick() / 20;
float angle = (float) (((time * speed) % 360) / 180 * (float) Math.PI); float angle = (time * speed) % 360;
return renderHead(context.world, BlockPos.ZERO, state, angle); for (MatrixStack m : matrixStacks)
transformHead(m, angle);
superBuffer.light(msLocal.peek().getModel())
.renderInto(ms, buffers.getBuffer(RenderType.getCutoutMipped()));
} }
public static SuperByteBuffer renderHead(World world, BlockPos pos, BlockState state, float angle) { public static void transformHead(MatrixStack ms, float angle) {
SuperByteBuffer buffer = AllBlockPartials.HARVESTER_BLADE.renderOnHorizontal(state);
int lightMapCoords = WorldRenderer.getLightmapCoordinates(world, state, pos);
Direction facing = state.get(HORIZONTAL_FACING);
Axis axis = facing.rotateYCCW().getAxis();
int axisDirection = -facing.getAxisDirection().getOffset();
float originOffset = 1 / 16f; float originOffset = 1 / 16f;
float xOffset = axis == Axis.X ? 0 : originOffset * axisDirection; Vec3d offset = new Vec3d(0, -2 * originOffset, -originOffset).add(VecHelper.getCenterOf(BlockPos.ZERO));
float zOffset = axis == Axis.Z ? 0 : originOffset * axisDirection; MatrixStacker.of(ms)
.translate(offset)
buffer.translate(xOffset, 2 * originOffset, zOffset); .rotateX(angle)
buffer.rotateCentered(axis, angle); .translateBack(offset);
buffer.translate(-xOffset, -2 * originOffset, -zOffset);
buffer.light(lightMapCoords);
return buffer;
} }
} }

View File

@ -58,7 +58,7 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
renderItems(te, partialTicks, ms, buffer, light, overlay); renderItems(te, partialTicks, ms, buffer, light, overlay);
ms.pop(); ms.pop();
renderFast(te, partialTicks, ms, buffer); renderFast(te, partialTicks, ms, buffer, light);
//TessellatorHelper.draw(); //TessellatorHelper.draw();
} }
@ -132,7 +132,7 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
} }
} }
public void renderFast(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer) { public void renderFast(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light) {
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
@ -141,7 +141,7 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2)); superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2));
superBuffer.rotateCentered(Axis.Y, superBuffer.rotateCentered(Axis.Y,
(float) (blockState.get(HORIZONTAL_FACING).getAxis() != Axis.X ? 0 : Math.PI / 2)); (float) (blockState.get(HORIZONTAL_FACING).getAxis() != Axis.X ? 0 : Math.PI / 2));
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(blockState); Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(blockState);
BlockPos pos = te.getPos(); BlockPos pos = te.getPos();

View File

@ -30,7 +30,7 @@ public class HandCrankTileEntityRenderer extends KineticTileEntityRenderer {
SuperByteBuffer handle = AllBlockPartials.HAND_CRANK_HANDLE.renderOnDirectional(state, facing.getOpposite()); SuperByteBuffer handle = AllBlockPartials.HAND_CRANK_HANDLE.renderOnDirectional(state, facing.getOpposite());
HandCrankTileEntity crank = (HandCrankTileEntity) te; HandCrankTileEntity crank = (HandCrankTileEntity) te;
kineticRotationTransform(handle, te, facing.getAxis(), kineticRotationTransform(handle, te, facing.getAxis(),
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360); (crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, light);
handle.renderInto(ms, buffer.getBuffer(RenderType.getSolid())); handle.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
} }

View File

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.deployer;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -28,10 +29,11 @@ public class DeployerFilterSlot extends ValueBoxTransform {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
Direction facing = state.get(DeployerBlock.FACING); Direction facing = state.get(DeployerBlock.FACING);
float xRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
float yRot = AngleHelper.horizontalAngle(facing) + 180; float yRot = AngleHelper.horizontalAngle(facing) + 180;
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0; MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateY(yRot)); .rotateY(yRot)
ms.multiply(VecHelper.rotateX(zRot)); .rotateX(xRot);
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode; import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
@ -12,9 +13,9 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import com.simibubi.create.content.logistics.item.filter.FilterItem; import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
@ -22,15 +23,14 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.Constants.NBT;
public class DeployerMovementBehaviour extends MovementBehaviour { public class DeployerMovementBehaviour extends MovementBehaviour {
@Override @Override
public Vec3d getActiveAreaOffset(MovementContext context) { public Vec3d getActiveAreaOffset(MovementContext context) {
return new Vec3d(context.state.get(DeployerBlock.FACING).getDirectionVec()).scale(2); return new Vec3d(context.state.get(DeployerBlock.FACING)
.getDirectionVec()).scale(2);
} }
@Override @Override
@ -50,7 +50,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
} }
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) { public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING).getDirectionVec()); Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING)
.getDirectionVec());
facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z); facingVec = VecHelper.rotate(facingVec, context.rotation.x, context.rotation.y, context.rotation.z);
Vec3d vec = context.position.subtract(facingVec.scale(2)); Vec3d vec = context.position.subtract(facingVec.scale(2));
player.rotationYaw = ContraptionEntity.yawFromVector(facingVec); player.rotationYaw = ContraptionEntity.yawFromVector(facingVec);
@ -103,7 +104,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
DeployerFakePlayer player = getPlayer(context); DeployerFakePlayer player = getPlayer(context);
if (player == null) if (player == null)
return; return;
if (player.getHeldItemMainhand().isEmpty()) { if (player.getHeldItemMainhand()
.isEmpty()) {
ItemStack filter = getFilter(context); ItemStack filter = getFilter(context);
ItemStack held = ItemHelper.extract(context.contraption.inventory, ItemStack held = ItemHelper.extract(context.contraption.inventory,
stack -> FilterItem.test(context.world, stack, filter), 1, false); stack -> FilterItem.test(context.world, stack, filter), 1, false);
@ -139,7 +141,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
DeployerFakePlayer player = getPlayer(context); DeployerFakePlayer player = getPlayer(context);
if (player == null) if (player == null)
return; return;
context.data.put("HeldItem", player.getHeldItemMainhand().serializeNBT()); context.data.put("HeldItem", player.getHeldItemMainhand()
.serializeNBT());
} }
private DeployerFakePlayer getPlayer(MovementContext context) { private DeployerFakePlayer getPlayer(MovementContext context) {
@ -163,9 +166,9 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
} }
@Override @Override
@OnlyIn(Dist.CLIENT) public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
public List<SuperByteBuffer> renderListInContraption(MovementContext context) { IRenderTypeBuffer buffers) {
return DeployerTileEntityRenderer.renderListInContraption(context); DeployerTileEntityRenderer.renderInContraption(context, ms, msLocal, buffers);
} }
} }

View File

@ -3,9 +3,6 @@ package com.simibubi.create.content.contraptions.components.deployer;
import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING;
import java.util.Arrays;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
@ -26,6 +23,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
@ -77,11 +75,13 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
if (punching) if (punching)
ms.translate(0, 1 / 8f, -1 / 16f); ms.translate(0, 1 / 8f, -1 / 16f);
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
TransformType transform = TransformType.NONE; TransformType transform = TransformType.NONE;
boolean isBlockItem = boolean isBlockItem = (te.heldItem.getItem() instanceof BlockItem)
(te.heldItem.getItem() instanceof BlockItem) && itemRenderer.getItemModelWithOverrides(te.heldItem, Minecraft.getInstance().world, null).isGui3d(); && itemRenderer.getItemModelWithOverrides(te.heldItem, Minecraft.getInstance().world, null)
.isGui3d();
if (displayMode) { if (displayMode) {
float scale = isBlockItem ? 1.25f : 1; float scale = isBlockItem ? 1.25f : 1;
@ -103,7 +103,7 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb); KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light);
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
BlockPos pos = te.getPos(); BlockPos pos = te.getPos();
@ -112,8 +112,10 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
SuperByteBuffer hand = renderAndTransform(te.getWorld(), te.getHandPose(), blockState, pos, false); SuperByteBuffer hand = renderAndTransform(te.getWorld(), te.getHandPose(), blockState, pos, false);
Vec3d offset = getHandOffset(te, partialTicks, blockState); Vec3d offset = getHandOffset(te, partialTicks, blockState);
pole.translate(offset.x, offset.y, offset.z).renderInto(ms, vb); pole.translate(offset.x, offset.y, offset.z)
hand.translate(offset.x, offset.y, offset.z).renderInto(ms, vb); .renderInto(ms, vb);
hand.translate(offset.x, offset.y, offset.z)
.renderInto(ms, vb);
} }
protected Vec3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) { protected Vec3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) {
@ -126,7 +128,8 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
float handLength = te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0 float handLength = te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
: te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f; : te.getHandPose() == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21 / 16f); float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21 / 16f);
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(distance); Vec3d offset = new Vec3d(blockState.get(FACING)
.getDirectionVec()).scale(distance);
return offset; return offset;
} }
@ -152,7 +155,10 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
return buffer; return buffer;
} }
public static List<SuperByteBuffer> renderListInContraption(MovementContext context) { public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
MatrixStack[] matrixStacks = new MatrixStack[] { ms, msLocal };
IVertexBuilder builder = buffer.getBuffer(RenderType.getSolid());
BlockState blockState = context.state; BlockState blockState = context.state;
BlockPos pos = BlockPos.ZERO; BlockPos pos = BlockPos.ZERO;
Mode mode = NBTHelper.readEnum(context.tileData.getString("Mode"), Mode.class); Mode mode = NBTHelper.readEnum(context.tileData.getString("Mode"), Mode.class);
@ -169,16 +175,23 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
} else { } else {
Vec3d center = VecHelper.getCenterOf(new BlockPos(context.position)); Vec3d center = VecHelper.getCenterOf(new BlockPos(context.position));
double distance = context.position.distanceTo(center); double distance = context.position.distanceTo(center);
double nextDistance = context.position.add(context.motion).distanceTo(center); double nextDistance = context.position.add(context.motion)
factor = .5f - MathHelper.clamp( .distanceTo(center);
MathHelper.lerp(Minecraft.getInstance().getRenderPartialTicks(), distance, nextDistance), 0, 1); factor = .5f - MathHelper.clamp(MathHelper.lerp(Minecraft.getInstance()
.getRenderPartialTicks(), distance, nextDistance), 0, 1);
} }
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(factor); Vec3d offset = new Vec3d(blockState.get(FACING)
pole.translate(offset.x, offset.y, offset.z); .getDirectionVec()).scale(factor);
hand.translate(offset.x, offset.y, offset.z);
return Arrays.asList(pole, hand); Matrix4f lighting = msLocal.peek()
.getModel();
for (MatrixStack m : matrixStacks)
m.translate(offset.x, offset.y, offset.z);
pole.light(lighting)
.renderInto(ms, builder);
hand.light(lighting)
.renderInto(ms, builder);
} }
} }

View File

@ -29,7 +29,7 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
SuperByteBuffer superBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), SuperByteBuffer superBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
direction.getOpposite()); direction.getOpposite());
IVertexBuilder vb = buffer.getBuffer(RenderType.getCutoutMipped()); IVertexBuilder vb = buffer.getBuffer(RenderType.getCutoutMipped());
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
float time = AnimationTickHolder.getRenderTick(); float time = AnimationTickHolder.getRenderTick();
float speed = te.getSpeed() * 5; float speed = te.getSpeed() * 5;
@ -42,7 +42,7 @@ public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
SuperByteBuffer superByteBuffer = AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectional(te.getBlockState(), SuperByteBuffer superByteBuffer = AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectional(te.getBlockState(),
direction.getOpposite()); direction.getOpposite());
kineticRotationTransform(superByteBuffer, te, direction.getAxis(), angle); kineticRotationTransform(superByteBuffer, te, direction.getAxis(), angle, light);
superByteBuffer.renderInto(ms, vb); superByteBuffer.renderInto(ms, vb);
} }

View File

@ -60,7 +60,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
false, rotation, flip), connection).light(light).renderInto(ms, vb); false, rotation, flip), connection).light(light).renderInto(ms, vb);
} }
kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING).getAxis(), AngleHelper.rad(angle)); kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING).getAxis(), AngleHelper.rad(angle), light);
wheel.renderInto(ms, vb); wheel.renderInto(ms, vb);
} }

View File

@ -32,7 +32,7 @@ public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState); SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos); int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos);
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks); float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);

View File

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.saw;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -21,8 +22,10 @@ public class SawFilterSlot extends ValueBoxTransform {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
ms.multiply(VecHelper.rotateY(state.get(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 270 : 180)); int yRot = state.get(SawBlock.AXIS_ALONG_FIRST_COORDINATE) ? 270 : 180;
ms.multiply(VecHelper.rotateX(90)); MatrixStacker.of(ms)
.rotateY(yRot)
.rotateX(90);
} }
} }

View File

@ -41,7 +41,7 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
protected void renderShaft(SawTileEntity te, MatrixStack ms, IRenderTypeBuffer buffer, int light, protected void renderShaft(SawTileEntity te, MatrixStack ms, IRenderTypeBuffer buffer, int light,
int overlay) { int overlay) {
KineticTileEntityRenderer.renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid())); KineticTileEntityRenderer.renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid()), light);
} }
protected void renderItems(SawTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, protected void renderItems(SawTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light,

View File

@ -1,22 +1,15 @@
package com.simibubi.create.content.contraptions.components.structureMovement; package com.simibubi.create.content.contraptions.components.structureMovement;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.foundation.utility.MatrixStacker;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -38,17 +31,13 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
return; return;
if (entity.getContraption() == null) if (entity.getContraption() == null)
return; return;
if (entity.getContraption().getType() == AllContraptionTypes.MOUNTED && entity.getRidingEntity() == null) if (entity.getContraption()
.getType() == AllContraptionTypes.MOUNTED && entity.getRidingEntity() == null)
return; return;
// TODO 1.15 buffered render // Keep a copy of the transforms in order to determine correct lighting
RenderSystem.pushMatrix(); MatrixStack msLocal = getLocalTransform(entity);
long randomBits = (long) entity.getEntityId() * 493286711L; MatrixStack[] matrixStacks = new MatrixStack[] { ms, msLocal };
randomBits = randomBits * randomBits * 4392167121L + randomBits * 98761L;
float xNudge = (((float) (randomBits >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float yNudge = (((float) (randomBits >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float zNudge = (((float) (randomBits >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
RenderSystem.translatef(xNudge, yNudge, zNudge);
float degYaw = entity.getYaw(partialTicks); float degYaw = entity.getYaw(partialTicks);
float degPitch = entity.getPitch(partialTicks); float degPitch = entity.getPitch(partialTicks);
@ -58,15 +47,18 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
float anglePitch = (float) (degPitch / 180 * Math.PI); float anglePitch = (float) (degPitch / 180 * Math.PI);
float angleRoll = (float) (degRoll / 180 * Math.PI); float angleRoll = (float) (degRoll / 180 * Math.PI);
ms.push();
Entity ridingEntity = entity.getRidingEntity(); Entity ridingEntity = entity.getRidingEntity();
if (ridingEntity != null && ridingEntity instanceof AbstractMinecartEntity) { if (ridingEntity != null && ridingEntity instanceof AbstractMinecartEntity) {
AbstractMinecartEntity cart = (AbstractMinecartEntity) ridingEntity; AbstractMinecartEntity cart = (AbstractMinecartEntity) ridingEntity;
double cartX = MathHelper.lerp(partialTicks, cart.lastTickPosX, cart.getX());
double cartX = MathHelper.lerp((double) partialTicks, cart.lastTickPosX, cart.getX()); double cartY = MathHelper.lerp(partialTicks, cart.lastTickPosY, cart.getY());
double cartY = MathHelper.lerp((double) partialTicks, cart.lastTickPosY, cart.getY()); double cartZ = MathHelper.lerp(partialTicks, cart.lastTickPosZ, cart.getZ());
double cartZ = MathHelper.lerp((double) partialTicks, cart.lastTickPosZ, cart.getZ());
Vec3d cartPos = cart.getPos(cartX, cartY, cartZ); Vec3d cartPos = cart.getPos(cartX, cartY, cartZ);
for (MatrixStack stack : matrixStacks)
stack.translate(-.5f, 0, -.5f);
if (cartPos != null) { if (cartPos != null) {
Vec3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F); Vec3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F);
Vec3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F); Vec3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F);
@ -79,44 +71,32 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
cartY = (cartPosFront.y + cartPosBack.y) / 2.0D - cartY; cartY = (cartPosFront.y + cartPosBack.y) / 2.0D - cartY;
cartZ = cartPos.z - cartZ; cartZ = cartPos.z - cartZ;
RenderSystem.translatef((float) cartX, (float) cartY, (float) cartZ); for (MatrixStack stack : matrixStacks)
stack.translate(cartX, cartY, cartZ);
} }
GlStateManager.translatef(-.5f, 0, -.5f);
} }
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO); for (MatrixStack stack : matrixStacks)
TessellatorHelper.prepareFastRender(); MatrixStacker.of(stack)
RenderSystem.enableCull(); .nudge(entity.getEntityId())
TessellatorHelper.begin(DefaultVertexFormats.BLOCK); .centre()
ContraptionRenderer.render(entity.world, entity.getContraption(), superByteBuffer -> { .rotateRadians(angleRoll, angleYaw, anglePitch)
superByteBuffer.translate(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z); .unCentre();
superByteBuffer.rotate(Axis.X, angleRoll); ContraptionRenderer.render(entity.world, entity.getContraption(), ms, msLocal, buffers);
superByteBuffer.rotate(Axis.Y, angleYaw); ms.pop();
superByteBuffer.rotate(Axis.Z, anglePitch);
superByteBuffer.translate(rotationOffset.x, rotationOffset.y, rotationOffset.z);
}, ms, Tessellator.getInstance().getBuffer());
TessellatorHelper.draw();
if (!entity.getContraption().customRenderTEs.isEmpty()) {
RenderSystem.pushMatrix();
RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
RenderSystem.rotatef(degPitch, 0, 0, 1);
RenderSystem.rotatef(degYaw, 0, 1, 0);
RenderSystem.rotatef(degRoll, 1, 0, 0);
RenderSystem.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
ContraptionRenderer.renderTEsWithGL(entity.world, entity.getContraption(), entity.getPositionVec(),
new Vec3d(degRoll, degYaw, degPitch), ms, buffers);
RenderSystem.popMatrix();
}
RenderSystem.disableCull();
RenderSystem.popMatrix();
RenderSystem.shadeModel(7424);
RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.matrixMode(5888);
RenderHelper.enable();
super.render(entity, yaw, partialTicks, ms, buffers, overlay); super.render(entity, yaw, partialTicks, ms, buffers, overlay);
} }
protected MatrixStack getLocalTransform(ContraptionEntity entity) {
double pt = Minecraft.getInstance()
.getRenderPartialTicks();
MatrixStack matrixStack = new MatrixStack();
double x = MathHelper.lerp(pt, entity.lastTickPosX, entity.getX());
double y = MathHelper.lerp(pt, entity.lastTickPosY, entity.getY());
double z = MathHelper.lerp(pt, entity.lastTickPosZ, entity.getZ());
matrixStack.translate(x, y, z);
return matrixStack;
}
} }

View File

@ -1,13 +1,14 @@
package com.simibubi.create.content.contraptions.components.structureMovement; package com.simibubi.create.content.contraptions.components.structureMovement;
import java.util.Random; import java.util.Random;
import java.util.function.Consumer;
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.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment; import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment;
import com.simibubi.create.foundation.utility.TileEntityRenderHelper; import com.simibubi.create.foundation.utility.TileEntityRenderHelper;
@ -20,11 +21,12 @@ import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderType;
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.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.LightType; import net.minecraft.world.LightType;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraft.world.gen.feature.template.Template.BlockInfo;
@ -35,25 +37,35 @@ public class ContraptionRenderer {
public static final Compartment<Contraption> CONTRAPTION = new Compartment<>(); public static final Compartment<Contraption> CONTRAPTION = new Compartment<>();
protected static PlacementSimulationWorld renderWorld; protected static PlacementSimulationWorld renderWorld;
public static void render(World world, Contraption c, Consumer<SuperByteBuffer> transform, MatrixStack ms, public static void render(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
BufferBuilder buffer) {
SuperByteBuffer contraptionBuffer =
CreateClient.bufferCache.get(CONTRAPTION, c, () -> renderContraption(c, ms));
transform.accept(contraptionBuffer);
contraptionBuffer.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(ms, buffer);
renderActors(world, c, transform, ms, buffer);
}
public static void renderTEsWithGL(World world, Contraption c, Vec3d position, Vec3d rotation, MatrixStack ms,
IRenderTypeBuffer buffer) { IRenderTypeBuffer buffer) {
TileEntityRenderHelper.renderTileEntities(world, position, rotation, c.customRenderTEs, ms, buffer); renderStructure(world, c, ms, msLocal, buffer);
renderTileEntities(world, c, ms, msLocal, buffer);
renderActors(world, c, ms, msLocal, buffer);
} }
private static SuperByteBuffer renderContraption(Contraption c, MatrixStack ms) { protected static void renderStructure(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
IVertexBuilder translucent = buffer.getBuffer(RenderType.getTranslucent());
SuperByteBuffer contraptionBuffer = CreateClient.bufferCache.get(CONTRAPTION, c, () -> buildStructureBuffer(c));
Matrix4f model = msLocal.peek()
.getModel();
contraptionBuffer.light(model)
.renderInto(ms, translucent);
}
private static void renderTileEntities(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
TileEntityRenderHelper.renderTileEntities(world, c.customRenderTEs, ms, msLocal, buffer);
}
private static SuperByteBuffer buildStructureBuffer(Contraption c) {
if (renderWorld == null || renderWorld.getWorld() != Minecraft.getInstance().world) if (renderWorld == null || renderWorld.getWorld() != Minecraft.getInstance().world)
renderWorld = new PlacementSimulationWorld(Minecraft.getInstance().world); renderWorld = new PlacementSimulationWorld(Minecraft.getInstance().world);
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); MatrixStack ms = new MatrixStack();
BlockRendererDispatcher dispatcher = Minecraft.getInstance()
.getBlockRendererDispatcher();
BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer(); BlockModelRenderer blockRenderer = dispatcher.getBlockModelRenderer();
Random random = new Random(); Random random = new Random();
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
@ -69,8 +81,11 @@ public class ContraptionRenderer {
continue; continue;
IBakedModel originalModel = dispatcher.getModelForState(state); IBakedModel originalModel = dispatcher.getModelForState(state);
ms.push();
ms.translate(info.pos.getX(), info.pos.getY(), info.pos.getZ());
blockRenderer.renderModel(renderWorld, originalModel, state, info.pos, ms, builder, true, random, 42, blockRenderer.renderModel(renderWorld, originalModel, state, info.pos, ms, builder, true, random, 42,
OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE);
ms.pop();
} }
builder.finishDrawing(); builder.finishDrawing();
@ -78,28 +93,27 @@ public class ContraptionRenderer {
return new SuperByteBuffer(builder); return new SuperByteBuffer(builder);
} }
private static void renderActors(World world, Contraption c, Consumer<SuperByteBuffer> transform, MatrixStack ms, private static void renderActors(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
BufferBuilder buffer) { IRenderTypeBuffer buffer) {
MatrixStack[] matrixStacks = new MatrixStack[] { ms, msLocal };
for (Pair<BlockInfo, MovementContext> actor : c.getActors()) { for (Pair<BlockInfo, MovementContext> actor : c.getActors()) {
MovementContext context = actor.getRight(); MovementContext context = actor.getRight();
if (context == null) if (context == null)
continue; continue;
if (context.world == null) if (context.world == null)
context.world = world; context.world = world;
BlockInfo blockInfo = actor.getLeft(); BlockInfo blockInfo = actor.getLeft();
for (SuperByteBuffer render : Contraption.getMovement(blockInfo.state).renderListInContraption(context)) { for (MatrixStack m : matrixStacks) {
if (render == null) m.push();
continue; MatrixStacker.of(m)
.translate(blockInfo.pos);
int posX = blockInfo.pos.getX();
int posY = blockInfo.pos.getY();
int posZ = blockInfo.pos.getZ();
render.translate(posX, posY, posZ);
transform.accept(render);
render.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(ms, buffer);
} }
Contraption.getMovement(blockInfo.state)
.renderInContraption(context, ms, msLocal, buffer);
for (MatrixStack m : matrixStacks)
m.pop();
} }
} }

View File

@ -5,7 +5,7 @@ import java.util.function.BiPredicate;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
@ -27,7 +27,7 @@ public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTra
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
if (!direction.getAxis().isHorizontal()) if (!direction.getAxis().isHorizontal())
ms.multiply(VecHelper.rotateY(AngleHelper.horizontalAngle(state.get(BlockStateProperties.FACING)) - 90)); MatrixStacker.of(ms).rotateY(AngleHelper.horizontalAngle(state.get(BlockStateProperties.FACING)) - 90);
super.rotate(state, ms); super.rotate(state, ms);
} }
} }

View File

@ -1,10 +1,8 @@
package com.simibubi.create.content.contraptions.components.structureMovement; package com.simibubi.create.content.contraptions.components.structureMovement;
import java.util.Arrays; import com.mojang.blaze3d.matrix.MatrixStack;
import java.util.List;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -19,14 +17,11 @@ public abstract class MovementBehaviour {
return true; return true;
} }
public void tick(MovementContext context) { public void tick(MovementContext context) {}
}
public void startMoving(MovementContext context) { public void startMoving(MovementContext context) {}
}
public void visitNewPosition(MovementContext context, BlockPos pos) { public void visitNewPosition(MovementContext context, BlockPos pos) {}
}
public Vec3d getActiveAreaOffset(MovementContext context) { public Vec3d getActiveAreaOffset(MovementContext context) {
return Vec3d.ZERO; return Vec3d.ZERO;
@ -39,20 +34,11 @@ public abstract class MovementBehaviour {
Vec3d vec = context.position; Vec3d vec = context.position;
ItemEntity itemEntity = new ItemEntity(context.world, vec.x, vec.y, vec.z, remainder); ItemEntity itemEntity = new ItemEntity(context.world, vec.x, vec.y, vec.z, remainder);
itemEntity.setMotion(context.motion.add(0, 0.5f, 0).scale(context.world.rand.nextFloat() * .3f)); itemEntity.setMotion(context.motion.add(0, 0.5f, 0)
.scale(context.world.rand.nextFloat() * .3f));
context.world.addEntity(itemEntity); context.world.addEntity(itemEntity);
} }
@OnlyIn(value = Dist.CLIENT)
public SuperByteBuffer renderInContraption(MovementContext context) {
return null;
}
@OnlyIn(value = Dist.CLIENT)
public List<SuperByteBuffer> renderListInContraption(MovementContext context) {
return Arrays.asList(renderInContraption(context));
}
public void stopMoving(MovementContext context) { public void stopMoving(MovementContext context) {
} }
@ -61,4 +47,8 @@ public abstract class MovementBehaviour {
} }
@OnlyIn(Dist.CLIENT)
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {}
} }

View File

@ -32,7 +32,7 @@ public class BearingTileEntityRenderer extends KineticTileEntityRenderer {
if (facing.getAxis().isHorizontal()) if (facing.getAxis().isHorizontal())
superBuffer.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing.getOpposite()))); superBuffer.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing.getOpposite())));
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks - 1); float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks - 1);
kineticRotationTransform(superBuffer, te, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI)); kineticRotationTransform(superBuffer, te, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI), light);
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid())); superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
} }

View File

@ -79,7 +79,7 @@ public class LinearChassisBlock extends AbstractChassisBlock {
@Override @Override
public boolean reverseUVs(BlockState state, Direction face) { public boolean reverseUVs(BlockState state, Direction face) {
Axis axis = state.get(AXIS); Axis axis = state.get(AXIS);
if (axis.isHorizontal() && (axis == Axis.Z ^ face.getAxisDirection() == AxisDirection.POSITIVE)) if (axis.isHorizontal() && (face.getAxisDirection() == AxisDirection.POSITIVE))
return true; return true;
return super.reverseUVs(state, face); return super.reverseUVs(state, face);
} }

View File

@ -22,7 +22,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay); super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms,
buffer.getBuffer(RenderType.getSolid())); buffer.getBuffer(RenderType.getSolid()), light);
} }
private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) { private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) {

View File

@ -87,7 +87,7 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
modelTransform.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float) (Math.PI / 2))); modelTransform.multiply(Vector3f.POSITIVE_X.getRadialQuaternion((float) (Math.PI / 2)));
modelTransform.translate(-0.5, -0.5, -0.5); modelTransform.translate(-0.5, -0.5, -0.5);
SuperByteBuffer superBuffer = CreateClient.bufferCache.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, modelTransform); SuperByteBuffer superBuffer = CreateClient.bufferCache.renderDirectionalPartial(AllBlockPartials.BELT_PULLEY, blockState, dir, modelTransform);
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te) KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, light)
.renderInto(ms, vb); .renderInto(ms, vb);
} }

View File

@ -48,7 +48,7 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
SuperByteBuffer superByteBuffer = SuperByteBuffer superByteBuffer =
AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), direction); AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), direction);
kineticRotationTransform(superByteBuffer, te, axis, angle); kineticRotationTransform(superByteBuffer, te, axis, angle, light);
superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid())); superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
} }
} }

View File

@ -49,7 +49,7 @@ public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
angle += offset; angle += offset;
angle = angle / 180f * (float) Math.PI; angle = angle / 180f * (float) Math.PI;
kineticRotationTransform(shaft, te, axis, angle); kineticRotationTransform(shaft, te, axis, angle, light);
shaft.renderInto(ms, buffer.getBuffer(RenderType.getSolid())); shaft.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
} }
} }

View File

@ -8,7 +8,7 @@ import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -92,9 +92,10 @@ public class CrossPlaneMirror extends SymmetryMirror {
@Override @Override
public void applyModelTransform(MatrixStack ms) { public void applyModelTransform(MatrixStack ms) {
super.applyModelTransform(ms); super.applyModelTransform(ms);
ms.translate(.5, .5, .5); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateY(((Align) orientation) == Align.Y ? 0 : 45)); .centre()
ms.translate(-.5, -.5, -.5); .rotateY(((Align) orientation) == Align.Y ? 0 : 45)
.unCentre();
} }
@Override @Override

View File

@ -8,7 +8,7 @@ import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -88,9 +88,10 @@ public class PlaneMirror extends SymmetryMirror {
@Override @Override
public void applyModelTransform(MatrixStack ms) { public void applyModelTransform(MatrixStack ms) {
super.applyModelTransform(ms); super.applyModelTransform(ms);
ms.translate(.5, .5, .5); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateY(((Align) orientation) == Align.XY ? 0 : 90)); .centre()
ms.translate(-.5, -.5, -.5); .rotateY(((Align) orientation) == Align.XY ? 0 : 90)
.unCentre();
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.belts.observer;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -20,8 +21,10 @@ public class BeltObserverFilterSlot extends ValueBoxTransform {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
ms.multiply(VecHelper.rotateY(AngleHelper.horizontalAngle(state.get(HorizontalBlock.HORIZONTAL_FACING)) + 180)); float yRot = AngleHelper.horizontalAngle(state.get(HorizontalBlock.HORIZONTAL_FACING)) + 180;
ms.multiply(VecHelper.rotateX(90)); MatrixStacker.of(ms)
.rotateY(yRot)
.rotateX(90);
} }
} }

View File

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.diodes;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -18,9 +19,10 @@ public class AdjustableRepeaterScrollSlot extends ValueBoxTransform {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
float y = AngleHelper.horizontalAngle(state.get(BlockStateProperties.HORIZONTAL_FACING)) + 180; float yRot = AngleHelper.horizontalAngle(state.get(BlockStateProperties.HORIZONTAL_FACING)) + 180;
ms.multiply(VecHelper.rotateY(y)); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateX(90)); .rotateY(yRot)
.rotateX(90);
} }
} }

View File

@ -7,6 +7,7 @@ import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
import com.simibubi.create.content.logistics.block.transposer.TransposerBlock; import com.simibubi.create.content.logistics.block.transposer.TransposerBlock;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -35,8 +36,9 @@ public class ExtractorSlots {
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
float yRot = AngleHelper.horizontalAngle(state.get(HORIZONTAL_FACING)); float yRot = AngleHelper.horizontalAngle(state.get(HORIZONTAL_FACING));
float xRot = (AttachedLogisticalBlock.isVertical(state)) ? 0 : 90; float xRot = (AttachedLogisticalBlock.isVertical(state)) ? 0 : 90;
ms.multiply(VecHelper.rotateY(yRot)); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateX(xRot)); .rotateY(yRot)
.rotateX(xRot);
} }
} }
@ -74,10 +76,11 @@ public class ExtractorSlots {
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
float horizontalAngle = AngleHelper.horizontalAngle(state.get(HORIZONTAL_FACING)); float horizontalAngle = AngleHelper.horizontalAngle(state.get(HORIZONTAL_FACING));
boolean vertical = AttachedLogisticalBlock.isVertical(state); boolean vertical = AttachedLogisticalBlock.isVertical(state);
float xRot = vertical ? (state.get(AttachedLogisticalBlock.UPWARD) ? 90 : 270) : 0;
float yRot = vertical ? horizontalAngle + 180 : horizontalAngle + 270; float yRot = vertical ? horizontalAngle + 180 : horizontalAngle + 270;
ms.multiply(VecHelper.rotateY(yRot)); float zRot = vertical ? (state.get(AttachedLogisticalBlock.UPWARD) ? 90 : 270) : 0;
ms.multiply(VecHelper.rotateZ(xRot)); MatrixStacker.of(ms)
.rotateY(yRot)
.rotateZ(zRot);
} }
} }

View File

@ -5,6 +5,7 @@ import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
import com.simibubi.create.content.logistics.block.extractor.ExtractorBlock; import com.simibubi.create.content.logistics.block.extractor.ExtractorBlock;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -43,8 +44,9 @@ public class FunnelFilterSlot extends ValueBoxTransform {
if (blockFacing == Direction.UP) if (blockFacing == Direction.UP)
xRot += 180; xRot += 180;
ms.multiply(VecHelper.rotateY(yRot)); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateX(xRot)); .rotateY(yRot)
.rotateX(xRot);
} }
} }

View File

@ -8,7 +8,7 @@ import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -90,7 +90,7 @@ public class CreativeCrateTileEntity extends CrateTileEntity {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
ms.multiply(VecHelper.rotateX(90)); MatrixStacker.of(ms).rotateX(90);
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.redstone;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -24,7 +25,8 @@ public class RedstoneLinkFrequencySlot extends ValueBoxTransform.Dual {
Direction facing = state.get(RedstoneLinkBlock.FACING); Direction facing = state.get(RedstoneLinkBlock.FACING);
Vec3d location = vertical; Vec3d location = vertical;
if (facing.getAxis().isHorizontal()) { if (facing.getAxis()
.isHorizontal()) {
location = horizontal; location = horizontal;
if (!isFirst()) if (!isFirst())
location = location.add(0, 5 / 16f, 0); location = location.add(0, 5 / 16f, 0);
@ -40,10 +42,12 @@ public class RedstoneLinkFrequencySlot extends ValueBoxTransform.Dual {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
Direction facing = state.get(RedstoneLinkBlock.FACING); Direction facing = state.get(RedstoneLinkBlock.FACING);
float yRot = facing.getAxis().isVertical() ? 0 : AngleHelper.horizontalAngle(facing) + 180; float yRot = facing.getAxis()
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0; .isVertical() ? 0 : AngleHelper.horizontalAngle(facing) + 180;
ms.multiply(VecHelper.rotateY(yRot)); float xRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
ms.multiply(VecHelper.rotateX(zRot)); MatrixStacker.of(ms)
.rotateY(yRot)
.rotateX(xRot);
} }
@Override @Override

View File

@ -95,7 +95,7 @@ public class BlockStateGen {
return ConfiguredModel.builder() return ConfiguredModel.builder()
.modelFile(modelFunc.apply(state)) .modelFile(modelFunc.apply(state))
.rotationX(axis == Axis.Y ? 0 : 90) .rotationX(axis == Axis.Y ? 0 : 90)
.rotationY(axis == Axis.X ? 90 : 0) .rotationY(axis == Axis.X ? 90 : axis == Axis.Z ? 180 : 0)
.build(); .build();
}); });
} }

View File

@ -6,6 +6,7 @@ import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -108,8 +109,9 @@ public abstract class ValueBoxTransform {
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
float yRot = AngleHelper.horizontalAngle(direction) + 180; float yRot = AngleHelper.horizontalAngle(direction) + 180;
float xRot = direction == Direction.UP ? 90 : direction == Direction.DOWN ? 270 : 0; float xRot = direction == Direction.UP ? 90 : direction == Direction.DOWN ? 270 : 0;
ms.multiply(VecHelper.rotateY(yRot)); MatrixStacker.of(ms)
ms.multiply(VecHelper.rotateX(xRot)); .rotateY(yRot)
.rotateX(xRot);
} }
@Override @Override

View File

@ -27,11 +27,11 @@ public class AngleHelper {
return facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0; return facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0;
} }
public static float rad(float angle) { public static float rad(double angle) {
return (float) (angle / 180 * Math.PI); return (float) (angle / 180 * Math.PI);
} }
public static float deg(float angle) { public static float deg(double angle) {
return (float) (angle * 180 / Math.PI); return (float) (angle * 180 / Math.PI);
} }

View File

@ -0,0 +1,81 @@
package com.simibubi.create.foundation.utility;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
public class MatrixStacker {
static Vec3d center = VecHelper.getCenterOf(BlockPos.ZERO);
static MatrixStacker instance;
MatrixStack ms;
public static MatrixStacker of(MatrixStack ms) {
if (instance == null)
instance = new MatrixStacker();
instance.ms = ms;
return instance;
}
public MatrixStacker rotateX(double angle) {
return multiply(Vector3f.POSITIVE_X, angle);
}
public MatrixStacker rotateY(double angle) {
return multiply(Vector3f.POSITIVE_Y, angle);
}
public MatrixStacker rotateZ(double angle) {
return multiply(Vector3f.POSITIVE_Z, angle);
}
public MatrixStacker rotateRadians(double angleRoll, double angleYaw, double anglePitch) {
rotateX(AngleHelper.deg(angleRoll));
rotateY(AngleHelper.deg(angleYaw));
rotateZ(AngleHelper.deg(anglePitch));
return this;
}
public MatrixStacker centre() {
return translate(center);
}
public MatrixStacker unCentre() {
return translateBack(center);
}
public MatrixStacker translate(Vec3i vec) {
ms.translate(vec.getX(), vec.getY(), vec.getZ());
return this;
}
public MatrixStacker translate(Vec3d vec) {
ms.translate(vec.x, vec.y, vec.z);
return this;
}
public MatrixStacker translateBack(Vec3d vec) {
ms.translate(-vec.x, -vec.y, -vec.z);
return this;
}
public MatrixStacker nudge(int id) {
long randomBits = (long) id * 493286711L;
randomBits = randomBits * randomBits * 4392167121L + randomBits * 98761L;
float xNudge = (((float) (randomBits >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float yNudge = (((float) (randomBits >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float zNudge = (((float) (randomBits >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
ms.translate(xNudge, yNudge, zNudge);
return this;
}
private MatrixStacker multiply(Vector3f axis, double angle) {
ms.multiply(axis.getDegreesQuaternion((float) angle));
return this;
}
}

View File

@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.BufferBuilder.DrawState; import net.minecraft.client.renderer.BufferBuilder.DrawState;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
@ -18,6 +19,9 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
public class SuperByteBuffer { public class SuperByteBuffer {
@ -40,9 +44,8 @@ public class SuperByteBuffer {
// Vertex Lighting // Vertex Lighting
private boolean shouldLight; private boolean shouldLight;
private IVertexLighter vertexLighter;
private float lightOffsetX, lightOffsetY, lightOffsetZ;
private int packedLightCoords; private int packedLightCoords;
private Matrix4f lightTransform;
// Vertex Coloring // Vertex Coloring
private boolean shouldColor; private boolean shouldColor;
@ -54,8 +57,10 @@ public class SuperByteBuffer {
ByteBuffer original = state.getSecond(); ByteBuffer original = state.getSecond();
original.order(ByteOrder.nativeOrder()); // Vanilla bug, endianness does not carry over into sliced buffers original.order(ByteOrder.nativeOrder()); // Vanilla bug, endianness does not carry over into sliced buffers
this.original = original; this.original = original;
this.mutable = GLAllocation.createDirectByteBuffer(state.getFirst()
this.mutable = GLAllocation.createDirectByteBuffer(state.getFirst().getCount() * buf.getVertexFormat().getSize()); .getCount()
* buf.getVertexFormat()
.getSize());
this.mutable.order(original.order()); this.mutable.order(original.order());
this.mutable.limit(original.limit()); this.mutable.limit(original.limit());
mutable.put(this.original); mutable.put(this.original);
@ -64,16 +69,24 @@ public class SuperByteBuffer {
transforms = new MatrixStack(); transforms = new MatrixStack();
} }
public ByteBuffer build(MatrixStack input) { public ByteBuffer build(MatrixStack view) {
original.rewind(); original.rewind();
mutable.rewind(); mutable.rewind();
Matrix4f t = input.peek().getModel().copy(); Matrix4f t = view.peek()
t.multiply(transforms.peek().getModel()); .getModel()
.copy();
Matrix4f localTransforms = transforms.peek()
.getModel();
t.multiply(localTransforms);
for (int vertex = 0; vertex < vertexCount(original); vertex++) { for (int vertex = 0; vertex < vertexCount(original); vertex++) {
Vector4f pos = new Vector4f(getX(original, vertex), getY(original, vertex), getZ(original, vertex), 1F); Vector4f pos = new Vector4f(getX(original, vertex), getY(original, vertex), getZ(original, vertex), 1F);
Vector4f lightPos = new Vector4f(pos.getX(), pos.getY(), pos.getZ(), pos.getW());
pos.transform(t); pos.transform(t);
lightPos.transform(localTransforms);
putPos(mutable, vertex, pos.getX(), pos.getY(), pos.getZ()); putPos(mutable, vertex, pos.getX(), pos.getY(), pos.getZ());
if (shouldColor) { if (shouldColor) {
@ -99,11 +112,12 @@ public class SuperByteBuffer {
putUV(mutable, vertex, getU(original, vertex), getV(original, vertex)); putUV(mutable, vertex, getU(original, vertex), getV(original, vertex));
if (shouldLight) { if (shouldLight) {
if (vertexLighter != null) int light = packedLightCoords;
putLight(mutable, vertex, if (lightTransform != null) {
vertexLighter.getPackedLight(pos.getX() + lightOffsetX, pos.getY() + lightOffsetY, pos.getZ() + lightOffsetZ)); lightPos.transform(lightTransform);
else light = getLight(Minecraft.getInstance().world, lightPos);
putLight(mutable, vertex, packedLightCoords); }
putLight(mutable, vertex, light);
} }
} }
@ -152,7 +166,8 @@ public class SuperByteBuffer {
public SuperByteBuffer rotate(Direction axis, float radians) { public SuperByteBuffer rotate(Direction axis, float radians) {
if (radians == 0) if (radians == 0)
return this; return this;
transforms.multiply(axis.getUnitVector().getRadialQuaternion(radians)); transforms.multiply(axis.getUnitVector()
.getRadialQuaternion(radians));
return this; return this;
} }
@ -162,7 +177,8 @@ public class SuperByteBuffer {
} }
public SuperByteBuffer rotateCentered(Direction axis, float radians) { public SuperByteBuffer rotateCentered(Direction axis, float radians) {
return translate(.5f, .5f, .5f).rotate(axis, radians).translate(-.5f, -.5f, -.5f); return translate(.5f, .5f, .5f).rotate(axis, radians)
.translate(-.5f, -.5f, -.5f);
} }
public SuperByteBuffer shiftUV(SpriteShiftEntry entry) { public SuperByteBuffer shiftUV(SpriteShiftEntry entry) {
@ -193,21 +209,14 @@ public class SuperByteBuffer {
public SuperByteBuffer light(int packedLightCoords) { public SuperByteBuffer light(int packedLightCoords) {
shouldLight = true; shouldLight = true;
vertexLighter = null; lightTransform = null;
this.packedLightCoords = packedLightCoords; this.packedLightCoords = packedLightCoords;
return this; return this;
} }
public SuperByteBuffer light(IVertexLighter lighter) { public SuperByteBuffer light(Matrix4f lightTransform) {
shouldLight = true; shouldLight = true;
vertexLighter = lighter; this.lightTransform = lightTransform;
return this;
}
public SuperByteBuffer offsetLighting(double x, double y, double z) {
lightOffsetX = (float) x;
lightOffsetY = (float) y;
lightOffsetZ = (float) z;
return this; return this;
} }
@ -290,4 +299,19 @@ public class SuperByteBuffer {
buffer.put(bufferPosition + 15, a); buffer.put(bufferPosition + 15, a);
} }
private static int getLight(World world, Vector4f lightPos) {
BlockPos.Mutable pos = new BlockPos.Mutable();
float sky = 0, block = 0;
float offset = 1 / 8f;
for (float zOffset = offset; zOffset >= -offset; zOffset -= 2 * offset)
for (float yOffset = offset; yOffset >= -offset; yOffset -= 2 * offset)
for (float xOffset = offset; xOffset >= -offset; xOffset -= 2 * offset) {
pos.setPos(lightPos.getX() + xOffset, lightPos.getY() + yOffset, lightPos.getZ() + zOffset);
sky += world.getLightLevel(LightType.SKY, pos) / 8f;
block += world.getLightLevel(LightType.BLOCK, pos) / 8f;
}
return ((int) sky) << 20 | ((int) block) << 4;
}
} }

View File

@ -2,38 +2,36 @@ package com.simibubi.create.foundation.utility;
import java.util.Iterator; import java.util.Iterator;
import org.lwjgl.opengl.GL13;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.crash.ReportedException; import net.minecraft.crash.ReportedException;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.world.LightType;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TileEntityRenderHelper { public class TileEntityRenderHelper {
protected static LightingWorld lightingWorld; protected static LightingWorld lightingWorld;
public static void renderTileEntities(World world, Vec3d position, Vec3d rotation, public static void renderTileEntities(World world, Iterable<TileEntity> customRenderTEs, MatrixStack ms,
Iterable<TileEntity> customRenderTEs, MatrixStack ms, IRenderTypeBuffer buffer) { MatrixStack localTransform, IRenderTypeBuffer buffer) {
float pt = Minecraft.getInstance().getRenderPartialTicks(); float pt = Minecraft.getInstance()
.getRenderPartialTicks();
if (lightingWorld == null) if (lightingWorld == null)
lightingWorld = new LightingWorld(world); lightingWorld = new LightingWorld(world);
lightingWorld.setWorld(world); lightingWorld.setWorld(world);
lightingWorld.setTransform(position, rotation); lightingWorld.setTransform(localTransform.peek()
.getModel());
for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) { for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) {
TileEntity tileEntity = iterator.next(); TileEntity tileEntity = iterator.next();
@ -45,29 +43,24 @@ public class TileEntityRenderHelper {
try { try {
BlockPos pos = tileEntity.getPos(); BlockPos pos = tileEntity.getPos();
if (!tileEntity.hasFastRenderer()) {
RenderHelper.enable();
int i = WorldRenderer.getLightmapCoordinates(lightingWorld, pos);
int j = LightTexture.getBlockLightCoordinates(i);
int k = LightTexture.getSkyLightCoordinates(i);
RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float) j, (float) k);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
}
RenderSystem.disableCull();
World prevTileWorld = tileEntity.getWorld(); World prevTileWorld = tileEntity.getWorld();
ms.push();
MatrixStacker.of(ms)
.translate(pos);
tileEntity.setLocation(lightingWorld, pos); tileEntity.setLocation(lightingWorld, pos);
TileEntityRendererDispatcher.instance.render(tileEntity, pt, ms, buffer); TileEntityRendererDispatcher.instance.render(tileEntity, pt, ms, buffer);
tileEntity.setLocation(prevTileWorld, pos); tileEntity.setLocation(prevTileWorld, pos);
RenderSystem.enableCull(); ms.pop();
} catch (ReportedException e) { } catch (ReportedException e) {
if (AllConfigs.CLIENT.explainRenderErrors.get()) { if (AllConfigs.CLIENT.explainRenderErrors.get()) {
Create.logger.error("TileEntity " + tileEntity.getType().getRegistryName().toString() Create.logger.error("TileEntity " + tileEntity.getType()
+ " didn't want to render while moved.\n", e); .getRegistryName()
.toString() + " didn't want to render while moved.\n", e);
} else { } else {
Create.logger.error("TileEntity " + tileEntity.getType().getRegistryName().toString() Create.logger.error("TileEntity " + tileEntity.getType()
+ " didn't want to render while moved.\n"); .getRegistryName()
.toString() + " didn't want to render while moved.\n");
} }
iterator.remove(); iterator.remove();
continue; continue;
@ -77,8 +70,7 @@ public class TileEntityRenderHelper {
private static class LightingWorld extends WrappedWorld { private static class LightingWorld extends WrappedWorld {
private Vec3d offset; private Matrix4f matrix;
private Vec3d rotation;
public LightingWorld(World world) { public LightingWorld(World world) {
super(world); super(world);
@ -88,21 +80,19 @@ public class TileEntityRenderHelper {
this.world = world; this.world = world;
} }
void setTransform(Vec3d offset, Vec3d rotation) { void setTransform(Matrix4f matrix) {
this.offset = offset; this.matrix = matrix;
this.rotation = rotation;
} }
@Override @Override
public int getBaseLightLevel(BlockPos pos, int minLight) { public int getLightLevel(LightType p_226658_1_, BlockPos p_226658_2_) {
return super.getBaseLightLevel(transformPos(pos), minLight); return super.getLightLevel(p_226658_1_, transformPos(p_226658_2_));
} }
private BlockPos transformPos(BlockPos pos) { private BlockPos transformPos(BlockPos pos) {
Vec3d vec = VecHelper.getCenterOf(pos); Vector4f vec = new Vector4f(pos.getX(), pos.getY(), pos.getZ(), 1);
vec = VecHelper.rotate(vec, rotation.x, rotation.y, rotation.z); vec.transform(matrix);
vec = vec.add(offset).subtract(VecHelper.getCenterOf(BlockPos.ZERO)); return new BlockPos(vec.getX(), vec.getY(), vec.getZ());
return new BlockPos(vec);
} }
} }

View File

@ -2,8 +2,6 @@ package com.simibubi.create.foundation.utility;
import java.util.Random; import java.util.Random;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.nbt.DoubleNBT; import net.minecraft.nbt.DoubleNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -12,8 +10,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class VecHelper { public class VecHelper {
@ -99,19 +95,4 @@ public class VecHelper {
return true; return true;
} }
@OnlyIn(Dist.CLIENT)
public static Quaternion rotateX(double angle) {
return Vector3f.POSITIVE_X.getDegreesQuaternion((float) angle);
}
@OnlyIn(Dist.CLIENT)
public static Quaternion rotateY(double angle) {
return Vector3f.POSITIVE_Y.getDegreesQuaternion((float) angle);
}
@OnlyIn(Dist.CLIENT)
public static Quaternion rotateZ(double angle) {
return Vector3f.POSITIVE_Z.getDegreesQuaternion((float) angle);
}
} }