Encased and Windowed Pipes

- Added encased and non-opaque versions of the fluid pipe.
- Added new generic te behaviour across pipe blocks for their rims/attachment models
- Pipes and pumps now render a little drain cap when connected to a fluid inventory
This commit is contained in:
simibubi 2020-08-25 20:12:33 +02:00
parent a4b4c770be
commit e52765cce0
59 changed files with 1358 additions and 218 deletions

View file

@ -91,6 +91,7 @@ f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets/create/blockstates/dolomite_cobb
f179202e59e449157f89efc37229b03bbfd391d7 assets/create/blockstates/dolomite_pillar.json f179202e59e449157f89efc37229b03bbfd391d7 assets/create/blockstates/dolomite_pillar.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
656813b75dd3b901bf34f24df785e4b0fbe11aa6 assets/create/blockstates/encased_fluid_pipe.json
e157d7f67b08493b71d7ffea8d622f4a64dbc155 assets/create/blockstates/encased_shaft.json e157d7f67b08493b71d7ffea8d622f4a64dbc155 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
@ -147,6 +148,7 @@ a64d8d0924c0b5b192f355343dd9b3a440875f6a assets/create/blockstates/gabbro_cobble
a6b44e8a1c4ce0c7442b2384b41ad36dd133f19b assets/create/blockstates/gabbro_pillar.json a6b44e8a1c4ce0c7442b2384b41ad36dd133f19b assets/create/blockstates/gabbro_pillar.json
9c48e311be8b959bfb98e16ffaa358210ac8b9dd assets/create/blockstates/gearbox.json 9c48e311be8b959bfb98e16ffaa358210ac8b9dd assets/create/blockstates/gearbox.json
f34814b17cde3231a1dfb271f3dabf8d6de4fbf6 assets/create/blockstates/gearshift.json f34814b17cde3231a1dfb271f3dabf8d6de4fbf6 assets/create/blockstates/gearshift.json
93f8bdc22d9a5e04268964e35e4285c8cbf2b89d assets/create/blockstates/glass_fluid_pipe.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
@ -357,17 +359,17 @@ c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets/create/blockstates/weathered_lim
a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.json a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.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
a9bcfd546e95865633a97e4b29e39c4aec940338 assets/create/lang/en_ud.json 15f8e8f779c6ce41a9e42d87796df14d1415ab5a assets/create/lang/en_ud.json
8e6187bfc654637c05fd80adaec3c60e6739705a assets/create/lang/en_us.json 3c6d8906ded9a78050003f8b029407ef2078da87 assets/create/lang/en_us.json
2426fd815d49680600f1b69e936915413020d117 assets/create/lang/unfinished/de_de.json 1abcbe5404e82eb9b944c9075eb39ff3b20512e5 assets/create/lang/unfinished/de_de.json
a287218c649de21c20e43db160ad862dec493103 assets/create/lang/unfinished/fr_fr.json e9f885ab2cee12075ec10a85e95e2f0a7fc49d9b assets/create/lang/unfinished/fr_fr.json
4bfe784a61dac2afb024c4030162c6b1b62ac80d assets/create/lang/unfinished/it_it.json 44331773068529facc64870b0762609567fec8b6 assets/create/lang/unfinished/it_it.json
e2b77bb3274597ce3752fae2e93f207f8837e191 assets/create/lang/unfinished/ja_jp.json e3c2ef988da795fc84ea8a9bff8b8557ac6c370a assets/create/lang/unfinished/ja_jp.json
bebccb9ae6b0d00bf651fa73ac4945f06b57fac2 assets/create/lang/unfinished/ko_kr.json a5c17249f0b2575c372c658bfd958fe4244fb5d6 assets/create/lang/unfinished/ko_kr.json
1c158b2b894f9092a4da2d12a8379da7cfcfe3bc assets/create/lang/unfinished/nl_nl.json abcfc0ab1bf1b077f0aeaf54e00c2aceef78d253 assets/create/lang/unfinished/nl_nl.json
3610f9f37483efe94c591b96e946f93091f56773 assets/create/lang/unfinished/pt_br.json 899ebaa95bf6d3140bf6bbcf6f8a5fab2ab5111e assets/create/lang/unfinished/pt_br.json
1d0b24b5dc447e1306a779e1a510411b9ce3c44d assets/create/lang/unfinished/ru_ru.json bba218b9d488faf4406d975eba81996f621b2200 assets/create/lang/unfinished/ru_ru.json
76928b7d9f7f41f4fa622824a872bec8e5635cea assets/create/lang/unfinished/zh_cn.json b87385232b0be35079736a3a32ff88f252721cf3 assets/create/lang/unfinished/zh_cn.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
@ -544,6 +546,7 @@ cc6d9300cd26f2323c653dbcc61b7a885be8fa3b assets/create/models/block/dolomite_cob
a101974d906487326dc38916f828d12a278a49ae assets/create/models/block/dolomite_cobblestone_wall_post.json a101974d906487326dc38916f828d12a278a49ae assets/create/models/block/dolomite_cobblestone_wall_post.json
9c497140dfe73abe1964479eaf1af8f1892de290 assets/create/models/block/dolomite_cobblestone_wall_side.json 9c497140dfe73abe1964479eaf1af8f1892de290 assets/create/models/block/dolomite_cobblestone_wall_side.json
999a7cd79a9dc80c47fd6103b65f006b55187402 assets/create/models/block/dolomite_pillar.json 999a7cd79a9dc80c47fd6103b65f006b55187402 assets/create/models/block/dolomite_pillar.json
1a8bac1e97a2a6c3cc362081568d2a7fce815ad5 assets/create/models/block/encased_fluid_pipe.json
17dae5fdc1a551d8ab1ab8a68cabf7a8c3848d86 assets/create/models/block/fancy_andesite_bricks.json 17dae5fdc1a551d8ab1ab8a68cabf7a8c3848d86 assets/create/models/block/fancy_andesite_bricks.json
cfb2cd84a1cbd9226a77ebc1f6c29e8eaa9c577f assets/create/models/block/fancy_andesite_bricks_slab.json cfb2cd84a1cbd9226a77ebc1f6c29e8eaa9c577f assets/create/models/block/fancy_andesite_bricks_slab.json
8ee27601996ab577991b6a0f7e9df27db0282cad assets/create/models/block/fancy_andesite_bricks_slab_top.json 8ee27601996ab577991b6a0f7e9df27db0282cad assets/create/models/block/fancy_andesite_bricks_slab_top.json
@ -1920,6 +1923,7 @@ d5fc5b3dc612cd748117e9d8b0ecda76e73f4514 data/create/loot_tables/blocks/dolomite
6121c99e6e037dda9022af3a414aee444467ac1b data/create/loot_tables/blocks/dolomite_pillar.json 6121c99e6e037dda9022af3a414aee444467ac1b data/create/loot_tables/blocks/dolomite_pillar.json
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
205f5899101262f31f5c1a88bb7d954918d08d04 data/create/loot_tables/blocks/encased_fluid_pipe.json
b127cb6920e6d7d9c8b2402cb186402a9a8dd3fc data/create/loot_tables/blocks/encased_shaft.json b127cb6920e6d7d9c8b2402cb186402a9a8dd3fc data/create/loot_tables/blocks/encased_shaft.json
5a47c1535c866184b4ffca65763f5676f319e0aa 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
@ -1976,6 +1980,7 @@ ae19749df10663efc51b8b27af310164f250ed38 data/create/loot_tables/blocks/gabbro_c
e8d09c919e3b8125d7da0f38383c01bcfc61c7a8 data/create/loot_tables/blocks/gabbro_pillar.json e8d09c919e3b8125d7da0f38383c01bcfc61c7a8 data/create/loot_tables/blocks/gabbro_pillar.json
b0109b4a4f0f738cbbe6b5911e8c3c0310b76f99 data/create/loot_tables/blocks/gearbox.json b0109b4a4f0f738cbbe6b5911e8c3c0310b76f99 data/create/loot_tables/blocks/gearbox.json
5f39461c5c9d3ad8d84195b06b9468fe2b0fb269 data/create/loot_tables/blocks/gearshift.json 5f39461c5c9d3ad8d84195b06b9468fe2b0fb269 data/create/loot_tables/blocks/gearshift.json
205f5899101262f31f5c1a88bb7d954918d08d04 data/create/loot_tables/blocks/glass_fluid_pipe.json
74371bc2b516ad9742ca081d82dc1b7f642e25b4 data/create/loot_tables/blocks/granite_bricks.json 74371bc2b516ad9742ca081d82dc1b7f642e25b4 data/create/loot_tables/blocks/granite_bricks.json
29f2cbc04f898bb8ff48055a7e43ded85e635bf9 data/create/loot_tables/blocks/granite_bricks_slab.json 29f2cbc04f898bb8ff48055a7e43ded85e635bf9 data/create/loot_tables/blocks/granite_bricks_slab.json
6b2c74992f261df4f539ff65919e2f4a58b146ec data/create/loot_tables/blocks/granite_bricks_stairs.json 6b2c74992f261df4f539ff65919e2f4a58b146ec data/create/loot_tables/blocks/granite_bricks_stairs.json

View file

@ -0,0 +1,17 @@
{
"variants": {
"axis=x": {
"model": "create:block/encased_fluid_pipe",
"x": 90,
"y": 90
},
"axis=y": {
"model": "create:block/encased_fluid_pipe"
},
"axis=z": {
"model": "create:block/encased_fluid_pipe",
"x": 90,
"y": 180
}
}
}

View file

@ -0,0 +1,30 @@
{
"variants": {
"alt=false,axis=x": {
"model": "create:block/fluid_pipe/window",
"x": 90,
"y": 90
},
"alt=true,axis=x": {
"model": "create:block/fluid_pipe/window_alt",
"x": 90,
"y": 90
},
"alt=false,axis=y": {
"model": "create:block/fluid_pipe/window"
},
"alt=true,axis=y": {
"model": "create:block/fluid_pipe/window_alt"
},
"alt=false,axis=z": {
"model": "create:block/fluid_pipe/window",
"x": 90,
"y": 180
},
"alt=true,axis=z": {
"model": "create:block/fluid_pipe/window_alt",
"x": 90,
"y": 180
}
}
}

View file

@ -92,6 +92,7 @@
"block.create.dolomite_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u01DD\u0287\u0131\u026Fo\u05DFo\u15E1", "block.create.dolomite_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u01DD\u0287\u0131\u026Fo\u05DFo\u15E1",
"block.create.encased_belt": "\u0287\u05DF\u01DD\u15FA p\u01DDs\u0250\u0254u\u018E", "block.create.encased_belt": "\u0287\u05DF\u01DD\u15FA p\u01DDs\u0250\u0254u\u018E",
"block.create.encased_fan": "u\u0250\u2132 p\u01DDs\u0250\u0254u\u018E", "block.create.encased_fan": "u\u0250\u2132 p\u01DDs\u0250\u0254u\u018E",
"block.create.encased_fluid_pipe": "\u01DDd\u0131\u0500 p\u0131n\u05DF\u2132 p\u01DDs\u0250\u0254u\u018E",
"block.create.encased_shaft": "\u0287\u025F\u0250\u0265S p\u01DDs\u0250\u0254u\u018E", "block.create.encased_shaft": "\u0287\u025F\u0250\u0265S p\u01DDs\u0250\u0254u\u018E",
"block.create.extractor": "\u0279o\u0287\u0254\u0250\u0279\u0287x\u018E", "block.create.extractor": "\u0279o\u0287\u0254\u0250\u0279\u0287x\u018E",
"block.create.fancy_andesite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131s\u01DDpu\u2C6F \u028E\u0254u\u0250\u2132", "block.create.fancy_andesite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131s\u01DDpu\u2C6F \u028E\u0254u\u0250\u2132",
@ -148,6 +149,7 @@
"block.create.gabbro_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 o\u0279qq\u0250\u2141", "block.create.gabbro_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 o\u0279qq\u0250\u2141",
"block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141", "block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141",
"block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141", "block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141",
"block.create.glass_fluid_pipe": "\u01DDd\u0131\u0500 p\u0131n\u05DF\u2132 ss\u0250\u05DF\u2141",
"block.create.granite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141", "block.create.granite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141",
"block.create.granite_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141", "block.create.granite_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141",
"block.create.granite_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141", "block.create.granite_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131u\u0250\u0279\u2141",

View file

@ -95,6 +95,7 @@
"block.create.dolomite_pillar": "Dolomite Pillar", "block.create.dolomite_pillar": "Dolomite Pillar",
"block.create.encased_belt": "Encased Belt", "block.create.encased_belt": "Encased Belt",
"block.create.encased_fan": "Encased Fan", "block.create.encased_fan": "Encased Fan",
"block.create.encased_fluid_pipe": "Encased Fluid Pipe",
"block.create.encased_shaft": "Encased Shaft", "block.create.encased_shaft": "Encased Shaft",
"block.create.extractor": "Extractor", "block.create.extractor": "Extractor",
"block.create.fancy_andesite_bricks": "Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "Fancy Andesite Bricks",
@ -151,6 +152,7 @@
"block.create.gabbro_pillar": "Gabbro Pillar", "block.create.gabbro_pillar": "Gabbro Pillar",
"block.create.gearbox": "Gearbox", "block.create.gearbox": "Gearbox",
"block.create.gearshift": "Gearshift", "block.create.gearshift": "Gearshift",
"block.create.glass_fluid_pipe": "Glass Fluid Pipe",
"block.create.granite_bricks": "Granite Bricks", "block.create.granite_bricks": "Granite Bricks",
"block.create.granite_bricks_slab": "Granite Bricks Slab", "block.create.granite_bricks_slab": "Granite Bricks Slab",
"block.create.granite_bricks_stairs": "Granite Bricks Stairs", "block.create.granite_bricks_stairs": "Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 814", "_": "Missing Localizations: 816",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Dolomitsäule", "block.create.dolomite_pillar": "Dolomitsäule",
"block.create.encased_belt": "Eingeschlossener Riemen", "block.create.encased_belt": "Eingeschlossener Riemen",
"block.create.encased_fan": "Eingeschlossener Propeller", "block.create.encased_fan": "Eingeschlossener Propeller",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Eingeschlossene Welle", "block.create.encased_shaft": "Eingeschlossene Welle",
"block.create.extractor": "Auswerfer", "block.create.extractor": "Auswerfer",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Getriebe", "block.create.gearbox": "Getriebe",
"block.create.gearshift": "Gangschaltung", "block.create.gearshift": "Gangschaltung",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Granitziegel", "block.create.granite_bricks": "Granitziegel",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 417", "_": "Missing Localizations: 419",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Pillier de dolomie", "block.create.dolomite_pillar": "Pillier de dolomie",
"block.create.encased_belt": "Tapis roulant enfermé", "block.create.encased_belt": "Tapis roulant enfermé",
"block.create.encased_fan": "Ventilateur enfermé", "block.create.encased_fan": "Ventilateur enfermé",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Arbre mécanique enfermé", "block.create.encased_shaft": "Arbre mécanique enfermé",
"block.create.extractor": "Extracteur", "block.create.extractor": "Extracteur",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Boîte à roue dentée", "block.create.gearbox": "Boîte à roue dentée",
"block.create.gearshift": "Décaleur de rotation", "block.create.gearshift": "Décaleur de rotation",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Briques de granite", "block.create.granite_bricks": "Briques de granite",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 401", "_": "Missing Localizations: 403",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Pilastro di Dolomite", "block.create.dolomite_pillar": "Pilastro di Dolomite",
"block.create.encased_belt": "Nastro Incassato", "block.create.encased_belt": "Nastro Incassato",
"block.create.encased_fan": "Ventilatore incassato", "block.create.encased_fan": "Ventilatore incassato",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Albero Incassato", "block.create.encased_shaft": "Albero Incassato",
"block.create.extractor": "Estrattore", "block.create.extractor": "Estrattore",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Riduttore", "block.create.gearbox": "Riduttore",
"block.create.gearshift": "Cambio", "block.create.gearshift": "Cambio",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Mattoni di Granito", "block.create.granite_bricks": "Mattoni di Granito",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 396", "_": "Missing Localizations: 398",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "苦灰石の柱", "block.create.dolomite_pillar": "苦灰石の柱",
"block.create.encased_belt": "ケース入りベルト", "block.create.encased_belt": "ケース入りベルト",
"block.create.encased_fan": "ケース入りファン", "block.create.encased_fan": "ケース入りファン",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "ケース入りシャフト", "block.create.encased_shaft": "ケース入りシャフト",
"block.create.extractor": "エクストラクター", "block.create.extractor": "エクストラクター",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "ギアボックス", "block.create.gearbox": "ギアボックス",
"block.create.gearshift": "ギアシフト", "block.create.gearshift": "ギアシフト",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "花崗岩レンガ", "block.create.granite_bricks": "花崗岩レンガ",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 401", "_": "Missing Localizations: 403",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "백운암 기둥", "block.create.dolomite_pillar": "백운암 기둥",
"block.create.encased_belt": "덮힌 벨트", "block.create.encased_belt": "덮힌 벨트",
"block.create.encased_fan": "덮힌 환풍기", "block.create.encased_fan": "덮힌 환풍기",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "덮힌 축", "block.create.encased_shaft": "덮힌 축",
"block.create.extractor": "추출기", "block.create.extractor": "추출기",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "기어박스", "block.create.gearbox": "기어박스",
"block.create.gearshift": "기어쉬프트", "block.create.gearshift": "기어쉬프트",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "화강암 벽돌", "block.create.granite_bricks": "화강암 벽돌",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 751", "_": "Missing Localizations: 753",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Dolomiet Pilaar", "block.create.dolomite_pillar": "Dolomiet Pilaar",
"block.create.encased_belt": "Omhulsde Transportband", "block.create.encased_belt": "Omhulsde Transportband",
"block.create.encased_fan": "Omhulsde Ventilator", "block.create.encased_fan": "Omhulsde Ventilator",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Omhulsde Drijfas", "block.create.encased_shaft": "Omhulsde Drijfas",
"block.create.extractor": "Extractor", "block.create.extractor": "Extractor",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Versnellingsbak", "block.create.gearbox": "Versnellingsbak",
"block.create.gearshift": "Versnellingspook", "block.create.gearshift": "Versnellingspook",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Granietstenen", "block.create.granite_bricks": "Granietstenen",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 821", "_": "Missing Localizations: 823",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Pilar de Dolomite", "block.create.dolomite_pillar": "Pilar de Dolomite",
"block.create.encased_belt": "Esteira Revestida", "block.create.encased_belt": "Esteira Revestida",
"block.create.encased_fan": "Ventilador Revestida", "block.create.encased_fan": "Ventilador Revestida",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Eixo Revestido", "block.create.encased_shaft": "Eixo Revestido",
"block.create.extractor": "Extrator", "block.create.extractor": "Extrator",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Caixa de Transmissão", "block.create.gearbox": "Caixa de Transmissão",
"block.create.gearshift": "Câmbio", "block.create.gearshift": "Câmbio",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Tijolos de Granito", "block.create.granite_bricks": "Tijolos de Granito",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 815", "_": "Missing Localizations: 817",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "Доломитовая колонна", "block.create.dolomite_pillar": "Доломитовая колонна",
"block.create.encased_belt": "Ленточный привод", "block.create.encased_belt": "Ленточный привод",
"block.create.encased_fan": "Вентилятор", "block.create.encased_fan": "Вентилятор",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "Вальный привод", "block.create.encased_shaft": "Вальный привод",
"block.create.extractor": "Экстрактор", "block.create.extractor": "Экстрактор",
"block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks", "block.create.fancy_andesite_bricks": "UNLOCALIZED: Fancy Andesite Bricks",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar", "block.create.gabbro_pillar": "UNLOCALIZED: Gabbro Pillar",
"block.create.gearbox": "Муфта", "block.create.gearbox": "Муфта",
"block.create.gearshift": "Реверсивная муфта", "block.create.gearshift": "Реверсивная муфта",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "Гранитные кирпичи", "block.create.granite_bricks": "Гранитные кирпичи",
"block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab", "block.create.granite_bricks_slab": "UNLOCALIZED: Granite Bricks Slab",
"block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs", "block.create.granite_bricks_stairs": "UNLOCALIZED: Granite Bricks Stairs",

View file

@ -1,5 +1,5 @@
{ {
"_": "Missing Localizations: 77", "_": "Missing Localizations: 79",
"_": "->------------------------] Game Elements [------------------------<-", "_": "->------------------------] Game Elements [------------------------<-",
@ -96,6 +96,7 @@
"block.create.dolomite_pillar": "竖纹白云岩", "block.create.dolomite_pillar": "竖纹白云岩",
"block.create.encased_belt": "连携齿轮箱", "block.create.encased_belt": "连携齿轮箱",
"block.create.encased_fan": "鼓风机", "block.create.encased_fan": "鼓风机",
"block.create.encased_fluid_pipe": "UNLOCALIZED: Encased Fluid Pipe",
"block.create.encased_shaft": "齿轮箱", "block.create.encased_shaft": "齿轮箱",
"block.create.extractor": "提取器", "block.create.extractor": "提取器",
"block.create.fancy_andesite_bricks": "方纹安山岩砖", "block.create.fancy_andesite_bricks": "方纹安山岩砖",
@ -152,6 +153,7 @@
"block.create.gabbro_pillar": "竖纹辉长岩", "block.create.gabbro_pillar": "竖纹辉长岩",
"block.create.gearbox": "十字齿轮箱", "block.create.gearbox": "十字齿轮箱",
"block.create.gearshift": "红石齿轮箱", "block.create.gearshift": "红石齿轮箱",
"block.create.glass_fluid_pipe": "UNLOCALIZED: Glass Fluid Pipe",
"block.create.granite_bricks": "花岗岩砖", "block.create.granite_bricks": "花岗岩砖",
"block.create.granite_bricks_slab": "花岗岩砖台阶", "block.create.granite_bricks_slab": "花岗岩砖台阶",
"block.create.granite_bricks_stairs": "花岗岩砖楼梯", "block.create.granite_bricks_stairs": "花岗岩砖楼梯",

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/copper_casing",
"end": "create:block/encased_pipe"
}
}

View file

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

View file

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

View file

@ -9,9 +9,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.fluids.FluidPipeAttachmentBehaviour.AttachmentTypes;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
@ -30,46 +32,28 @@ public class AllBlockPartials {
public static final AllBlockPartials SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"), public static final AllBlockPartials SCHEMATICANNON_CONNECTOR = get("schematicannon/connector"),
SCHEMATICANNON_PIPE = get("schematicannon/pipe"), SCHEMATICANNON_PIPE = get("schematicannon/pipe"),
SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFTLESS_COGWHEEL = get("cogwheel_shaftless"), SHAFT_HALF = get("shaft_half"),
SHAFT_HALF = get("shaft_half"),
BELT_PULLEY = get("belt_pulley"), BELT_START = get("belt/start"), BELT_MIDDLE = get("belt/middle"),
BELT_PULLEY = get("belt_pulley"), BELT_END = get("belt/end"), BELT_START_BOTTOM = get("belt/start_bottom"),
BELT_START = get("belt/start"), BELT_MIDDLE_BOTTOM = get("belt/middle_bottom"), BELT_END_BOTTOM = get("belt/end_bottom"),
BELT_MIDDLE = get("belt/middle"), BELT_DIAGONAL_START = get("belt/diagonal_start"), BELT_DIAGONAL_MIDDLE = get("belt/diagonal_middle"),
BELT_END = get("belt/end"),
BELT_START_BOTTOM = get("belt/start_bottom"),
BELT_MIDDLE_BOTTOM = get("belt/middle_bottom"),
BELT_END_BOTTOM = get("belt/end_bottom"),
BELT_DIAGONAL_START = get("belt/diagonal_start"),
BELT_DIAGONAL_MIDDLE = get("belt/diagonal_middle"),
BELT_DIAGONAL_END = get("belt/diagonal_end"), BELT_DIAGONAL_END = get("belt/diagonal_end"),
ENCASED_FAN_INNER = get("encased_fan/propeller"), ENCASED_FAN_INNER = get("encased_fan/propeller"), HAND_CRANK_HANDLE = get("hand_crank/handle"),
HAND_CRANK_HANDLE = get("hand_crank/handle"), MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"),
MECHANICAL_PRESS_HEAD = get("mechanical_press/head"), MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"), MECHANICAL_CRAFTER_LID = get("mechanical_crafter/lid"),
MECHANICAL_MIXER_POLE = get("mechanical_mixer/pole"),
MECHANICAL_MIXER_HEAD = get("mechanical_mixer/head"),
MECHANICAL_CRAFTER_LID = get("mechanical_crafter/lid"),
MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"), MECHANICAL_CRAFTER_ARROW = get("mechanical_crafter/arrow"),
MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"), MECHANICAL_CRAFTER_BELT_FRAME = get("mechanical_crafter/belt"),
MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), MECHANICAL_CRAFTER_BELT = get("mechanical_crafter/belt_animated"), GAUGE_DIAL = get("gauge/dial"),
GAUGE_DIAL = get("gauge/dial"), GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_SPEED = get("gauge/speedometer/head"),
GAUGE_INDICATOR = get("gauge/indicator"), GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), BEARING_TOP = get("bearing/top"),
GAUGE_HEAD_SPEED = get("gauge/speedometer/head"), DRILL_HEAD = get("mechanical_drill/head"), HARVESTER_BLADE = get("mechanical_harvester/blade"),
GAUGE_HEAD_STRESS = get("gauge/stressometer/head"), DEPLOYER_POLE = get("deployer/pole"), DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"),
BEARING_TOP = get("bearing/top"), DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"), DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"),
DRILL_HEAD = get("mechanical_drill/head"), ANALOG_LEVER_HANDLE = get("analog_lever/handle"), ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"),
HARVESTER_BLADE = get("mechanical_harvester/blade"), BELT_FUNNEL_FLAP = get("belt_funnel/flap"), BELT_TUNNEL_FLAP = get("belt_tunnel/flap"),
DEPLOYER_POLE = get("deployer/pole"), FLEXPEATER_INDICATOR = get("diodes/indicator"), FLYWHEEL = get("flywheel/wheel"),
DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"),
DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"),
DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"),
ANALOG_LEVER_HANDLE = get("analog_lever/handle"),
ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"),
BELT_FUNNEL_FLAP = get("belt_funnel/flap"),
BELT_TUNNEL_FLAP = get("belt_tunnel/flap"),
FLEXPEATER_INDICATOR = get("diodes/indicator"),
FLYWHEEL = get("flywheel/wheel"),
FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"), FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"),
FLYWHEEL_LOWER_ROTATING = get("flywheel/lower_rotating_connector"), FLYWHEEL_LOWER_ROTATING = get("flywheel/lower_rotating_connector"),
@ -95,14 +79,14 @@ public class AllBlockPartials {
MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"), MECHANICAL_PUMP_ARROW = get("mechanical_pump/arrow"), MECHANICAL_PUMP_COG = get("mechanical_pump/cog"),
FLUID_PIPE_CASING = get("fluid_pipe/casing"), FLUID_PIPE_CASING = get("fluid_pipe/casing"),
COUPLING_ATTACHMENT = getEntity("minecart_coupling/attachment"), COUPLING_ATTACHMENT = getEntity("minecart_coupling/attachment"),
COUPLING_RING = getEntity("minecart_coupling/ring"), COUPLING_RING = getEntity("minecart_coupling/ring"),
COUPLING_CONNECTOR = getEntity("minecart_coupling/connector") COUPLING_CONNECTOR = getEntity("minecart_coupling/connector")
;
public static final Map<Direction, AllBlockPartials> PIPE_RIMS = map(); ;
public static final Map<AttachmentTypes, Map<Direction, AllBlockPartials>> PIPE_ATTACHMENTS = map();
public static final Map<HeatLevel, AllBlockPartials> BLAZES = map(); public static final Map<HeatLevel, AllBlockPartials> BLAZES = map();
static { static {
@ -117,8 +101,16 @@ public class AllBlockPartials {
private AllBlockPartials() {} private AllBlockPartials() {}
private static void populateMaps() { private static void populateMaps() {
for (Direction d : Iterate.directions) for (AttachmentTypes type : AttachmentTypes.values()) {
PIPE_RIMS.put(d, get("fluid_pipe/rim/" + d.getName())); if (!type.hasModel())
continue;
Map<Direction, AllBlockPartials> map = map();
for (Direction d : Iterate.directions) {
String asId = Lang.asId(type.name());
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getName())));
}
PIPE_ATTACHMENTS.put(type, map);
}
for (HeatLevel heat : HeatLevel.values()) { for (HeatLevel heat : HeatLevel.values()) {
if (heat == HeatLevel.NONE) if (heat == HeatLevel.NONE)
continue; continue;
@ -136,7 +128,7 @@ public class AllBlockPartials {
all.add(partials); all.add(partials);
return partials; return partials;
} }
private static AllBlockPartials get(String path) { private static AllBlockPartials get(String path) {
AllBlockPartials partials = new AllBlockPartials(); AllBlockPartials partials = new AllBlockPartials();
partials.modelLocation = new ResourceLocation(Create.ID, "block/" + path); partials.modelLocation = new ResourceLocation(Create.ID, "block/" + path);

View file

@ -59,13 +59,15 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul
import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock;
import com.simibubi.create.content.contraptions.components.turntable.TurntableBlock; import com.simibubi.create.content.contraptions.components.turntable.TurntableBlock;
import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock; import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.content.contraptions.fluids.FluidPipeBlock; import com.simibubi.create.content.contraptions.fluids.PipeAttachmentModel;
import com.simibubi.create.content.contraptions.fluids.FluidPipeModel;
import com.simibubi.create.content.contraptions.fluids.FluidTankBlock;
import com.simibubi.create.content.contraptions.fluids.FluidTankGenerator;
import com.simibubi.create.content.contraptions.fluids.FluidTankItem;
import com.simibubi.create.content.contraptions.fluids.FluidTankModel;
import com.simibubi.create.content.contraptions.fluids.PumpBlock; import com.simibubi.create.content.contraptions.fluids.PumpBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.GlassFluidPipeBlock;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankGenerator;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankItem;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankModel;
import com.simibubi.create.content.contraptions.processing.BasinBlock; import com.simibubi.create.content.contraptions.processing.BasinBlock;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlockItem; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlockItem;
@ -219,12 +221,14 @@ public class AllBlocks {
.build() .build()
.register(); .register();
public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT = REGISTRATE.block("encased_shaft", EncasedShaftBlock::new) public static final BlockEntry<EncasedShaftBlock> ENCASED_SHAFT =
REGISTRATE.block("encased_shaft", EncasedShaftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque) .properties(Block.Properties::nonOpaque)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
//.blockstate(BlockStateGen.axisBlockProvider(true)) .blockstate((c, p) -> axisBlock(c, p, blockState -> p.models()
.blockstate((c, p) -> axisBlock(c, p, blockState -> p.models().getExistingFile(p.modLoc("block/encased_shaft/" + blockState.get(EncasedShaftBlock.CASING).getName())))) .getExistingFile(p.modLoc("block/encased_shaft/" + blockState.get(EncasedShaftBlock.CASING)
.getName()))))
.loot((p, b) -> p.registerDropping(b, SHAFT.get())) .loot((p, b) -> p.registerDropping(b, SHAFT.get()))
.register(); .register();
@ -461,14 +465,34 @@ public class AllBlocks {
public static final BlockEntry<FluidPipeBlock> FLUID_PIPE = REGISTRATE.block("fluid_pipe", FluidPipeBlock::new) public static final BlockEntry<FluidPipeBlock> FLUID_PIPE = REGISTRATE.block("fluid_pipe", FluidPipeBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.blockstate(BlockStateGen.pipe()) .blockstate(BlockStateGen.pipe())
.onRegister(CreateRegistrate.blockModel(() -> FluidPipeModel::new)) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE =
REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new)
.initialProperties(SharedProperties::softMetal)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, state -> p.models()
.cubeColumn(c.getName(), p.modLoc("block/copper_casing"), p.modLoc("block/encased_pipe"))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get()))
.register();
public static final BlockEntry<GlassFluidPipeBlock> GLASS_FLUID_PIPE =
REGISTRATE.block("glass_fluid_pipe", GlassFluidPipeBlock::new)
.initialProperties(SharedProperties::softMetal)
.addLayer(() -> RenderType::getCutoutMipped)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, s -> p.models()
.getExistingFile(p.modLoc("block/fluid_pipe/window" + (s.get(GlassFluidPipeBlock.ALT) ? "_alt" : "")))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get()))
.register();
public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new) public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(true)) .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(true))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.transform(StressConfigDefaults.setImpact(4.0)) .transform(StressConfigDefaults.setImpact(4.0))
.item() .item()
.transform(customItemModel()) .transform(customItemModel())

View file

@ -29,6 +29,7 @@ public class AllShapes {
CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(), CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(),
MOTOR_BLOCK = shape(3, 0, 3, 13, 14, 13).forDirectional(), MOTOR_BLOCK = shape(3, 0, 3, 13, 14, 13).forDirectional(),
FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(), SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(), FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(), SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
EIGHT_VOXEL_POLE = shape(4, 0, 4, 12, 16, 12).forAxis(),
EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH) EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH)
.withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)), .withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16) TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16)

View file

@ -43,11 +43,13 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul
import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity;
import com.simibubi.create.content.contraptions.components.turntable.TurntableTileEntity; import com.simibubi.create.content.contraptions.components.turntable.TurntableTileEntity;
import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelTileEntity; import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelTileEntity;
import com.simibubi.create.content.contraptions.fluids.FluidPipeTileEntity;
import com.simibubi.create.content.contraptions.fluids.FluidTankRenderer;
import com.simibubi.create.content.contraptions.fluids.FluidTankTileEntity;
import com.simibubi.create.content.contraptions.fluids.PumpRenderer; import com.simibubi.create.content.contraptions.fluids.PumpRenderer;
import com.simibubi.create.content.contraptions.fluids.PumpTileEntity; import com.simibubi.create.content.contraptions.fluids.PumpTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity;
import com.simibubi.create.content.contraptions.fluids.pipes.TransparentStraightPipeRenderer;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankRenderer;
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity;
import com.simibubi.create.content.contraptions.processing.BasinRenderer; import com.simibubi.create.content.contraptions.processing.BasinRenderer;
import com.simibubi.create.content.contraptions.processing.BasinTileEntity; import com.simibubi.create.content.contraptions.processing.BasinTileEntity;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerRenderer; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerRenderer;
@ -203,10 +205,21 @@ public class AllTileEntities {
.register(); .register();
public static final TileEntityEntry<FluidPipeTileEntity> FLUID_PIPE = Create.registrate() public static final TileEntityEntry<FluidPipeTileEntity> FLUID_PIPE = Create.registrate()
.tileEntity("fluid_pipe", (NonNullFunction<TileEntityType<FluidPipeTileEntity>, ? extends FluidPipeTileEntity>) FluidPipeTileEntity::new) .tileEntity("fluid_pipe", FluidPipeTileEntity::new)
.validBlocks(AllBlocks.FLUID_PIPE) .validBlocks(AllBlocks.FLUID_PIPE)
.register(); .register();
public static final TileEntityEntry<StraightPipeTileEntity> ENCASED_FLUID_PIPE = Create.registrate()
.tileEntity("encased_fluid_pipe", StraightPipeTileEntity::new)
.validBlocks(AllBlocks.ENCASED_FLUID_PIPE)
.register();
public static final TileEntityEntry<StraightPipeTileEntity> GLASS_FLUID_PIPE = Create.registrate()
.tileEntity("glass_fluid_pipe", StraightPipeTileEntity::new)
.validBlocks(AllBlocks.GLASS_FLUID_PIPE)
.renderer(() -> TransparentStraightPipeRenderer::new)
.register();
public static final TileEntityEntry<FluidTankTileEntity> FLUID_TANK = Create.registrate() public static final TileEntityEntry<FluidTankTileEntity> FLUID_TANK = Create.registrate()
.tileEntity("fluid_tank", (NonNullFunction<TileEntityType<FluidTankTileEntity>, ? extends FluidTankTileEntity>) FluidTankTileEntity::new) .tileEntity("fluid_tank", (NonNullFunction<TileEntityType<FluidTankTileEntity>, ? extends FluidTankTileEntity>) FluidTankTileEntity::new)
.validBlocks(AllBlocks.FLUID_TANK) .validBlocks(AllBlocks.FLUID_TANK)

View file

@ -61,10 +61,10 @@ class FluidNetworkFlow {
void addToSkippedConnections(IWorld world) { void addToSkippedConnections(IWorld world) {
forEachPipeFlow(world, (pipe, face, inbound) -> { forEachPipeFlow(world, (pipe, face, inbound) -> {
if (!pipe.fluid.isFluidEqual(fluidStack)) if (!pipe.getFluid().isFluidEqual(fluidStack))
return; return;
BlockFace blockFace = new BlockFace(pipe.getPos(), face); BlockFace blockFace = new BlockFace(pipe.getPos(), face);
this.activePipeNetwork.previousFlow.put(blockFace, pipe.fluid); this.activePipeNetwork.previousFlow.put(blockFace, pipe.getFluid());
}); });
} }
@ -186,7 +186,7 @@ class FluidNetworkFlow {
BlockFace blockface = new BlockFace(currentPos, direction); BlockFace blockface = new BlockFace(currentPos, direction);
if (!pipe.hasStartedFlow(this, direction, inbound)) if (!pipe.hasStartedFlow(this, direction, inbound))
pipe.addFlow(this, direction, inbound); pipe.addFlow(this, direction, inbound, false);
if (skipping && canSkip(previousFlow, blockface)) { if (skipping && canSkip(previousFlow, blockface)) {
pipe.skipFlow(direction, inbound); pipe.skipFlow(direction, inbound);
FluidPropagator.showBlockFace(blockface) FluidPropagator.showBlockFace(blockface)

View file

@ -0,0 +1,57 @@
package com.simibubi.create.content.contraptions.fluids;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import net.minecraft.block.BlockState;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
public class FluidPipeAttachmentBehaviour extends TileEntityBehaviour {
public static BehaviourType<FluidPipeAttachmentBehaviour> TYPE = new BehaviourType<>();
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
if (!isPipeConnectedTowards(state, direction))
return AttachmentTypes.NONE;
BlockPos offsetPos = pos.offset(direction);
BlockState facingState = world.getBlockState(offsetPos);
if (facingState.getBlock() instanceof PumpBlock && facingState.get(PumpBlock.FACING)
.getAxis() == direction.getAxis())
return AttachmentTypes.NONE;
if (FluidPropagator.hasFluidCapability(facingState, world, offsetPos, direction))
return AttachmentTypes.DRAIN;
return AttachmentTypes.RIM;
}
public boolean isPipeConnectedTowards(BlockState state, Direction direction) {
FluidPipeBehaviour fluidPipeBehaviour = TileEntityBehaviour.get(tileEntity, FluidPipeBehaviour.TYPE);
if (fluidPipeBehaviour == null)
return false;
return fluidPipeBehaviour.isConnectedTo(state, direction);
}
public static enum AttachmentTypes {
NONE, RIM, DRAIN;
public boolean hasModel() {
return this != NONE;
}
}
public FluidPipeAttachmentBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public BehaviourType<?> getType() {
return TYPE;
}
}

View file

@ -103,7 +103,15 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
CompoundNBT nbt = new CompoundNBT(); CompoundNBT nbt = new CompoundNBT();
NBTHelper.writeEnum(nbt, "Face", face); NBTHelper.writeEnum(nbt, "Face", face);
nbt.putBoolean("In", inbound); nbt.putBoolean("In", inbound);
PipeFlows pipeFlows = allFlows.get(face)
.get(inbound);
Set<FluidNetworkFlow> participants = pipeFlows.participants;
nbt.putBoolean("Silent", participants == null || participants.isEmpty());
nbt.put("Progress", flowProgress.writeNBT()); nbt.put("Progress", flowProgress.writeNBT());
if (client)
nbt.putFloat("Strength", pipeFlows.bestFlowStrength);
flows.add(nbt); flows.add(nbt);
} }
compound.put("Flows", flows); compound.put("Flows", flows);
@ -125,8 +133,10 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
boolean inbound = nbt.getBoolean("In"); boolean inbound = nbt.getBoolean("In");
LerpedFloat progress = createFlowProgress(0); LerpedFloat progress = createFlowProgress(0);
progress.readNBT(nbt.getCompound("Progress"), false); progress.readNBT(nbt.getCompound("Progress"), false);
addFlow(null, face, inbound); addFlow(null, face, inbound, nbt.getBoolean("Silent"));
setFlowProgress(face, inbound, progress); setFlowProgress(face, inbound, progress);
if (client)
setVisualFlowStrength(face, inbound, nbt.getFloat("Strength"));
}); });
if (!client) if (!client)
@ -143,7 +153,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
} }
} }
public void addFlow(@Nullable FluidNetworkFlow flow, Direction face, boolean inbound) { public void addFlow(@Nullable FluidNetworkFlow flow, Direction face, boolean inbound, boolean silent) {
if (flow != null) { if (flow != null) {
FluidStack fluid = flow.getFluidStack(); FluidStack fluid = flow.getFluidStack();
if (!this.fluid.isEmpty() && !fluid.isFluidEqual(this.fluid)) { if (!this.fluid.isEmpty() && !fluid.isFluidEqual(this.fluid)) {
@ -155,7 +165,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
if (!allFlows.containsKey(face)) { if (!allFlows.containsKey(face)) {
allFlows.put(face, Couple.create(PipeFlows::new)); allFlows.put(face, Couple.create(PipeFlows::new));
if (inbound) if (inbound && !silent)
spawnSplashOnRim(face); spawnSplashOnRim(face);
} }
@ -173,6 +183,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
Couple<PipeFlows> couple = allFlows.get(face); Couple<PipeFlows> couple = allFlows.get(face);
couple.get(inbound) couple.get(inbound)
.removeFlow(flow); .removeFlow(flow);
contentsChanged();
if (!couple.get(true) if (!couple.get(true)
.isActive() .isActive()
&& !couple.get(false) && !couple.get(false)
@ -182,6 +193,13 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
clear(); clear();
} }
public void setVisualFlowStrength(Direction face, boolean inbound, float strength) {
if (!allFlows.containsKey(face))
return;
allFlows.get(face)
.get(inbound).bestFlowStrength = strength;
}
public void setFlowProgress(Direction face, boolean inbound, LerpedFloat progress) { public void setFlowProgress(Direction face, boolean inbound, LerpedFloat progress) {
if (!allFlows.containsKey(face)) if (!allFlows.containsKey(face))
return; return;
@ -219,7 +237,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
} }
public static final int MAX_PARTICLE_RENDER_DISTANCE = 20; public static final int MAX_PARTICLE_RENDER_DISTANCE = 20;
public static final int SPLASH_PARTICLE_AMOUNT = 10; public static final int SPLASH_PARTICLE_AMOUNT = 3;
public static final float IDLE_PARTICLE_SPAWN_CHANCE = 1 / 100f; public static final float IDLE_PARTICLE_SPAWN_CHANCE = 1 / 100f;
public static final Random r = new Random(); public static final Random r = new Random();
@ -256,7 +274,7 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
World world = Minecraft.getInstance().world; World world = Minecraft.getInstance().world;
BlockPos pos = tileEntity.getPos(); BlockPos pos = tileEntity.getPos();
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
spawnRimParticles(world, state, fluid, face, 20); spawnRimParticles(world, state, fluid, face, SPLASH_PARTICLE_AMOUNT);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -316,12 +334,14 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
vec = vec.add(centerOf); vec = vec.add(centerOf);
if (inbound) { if (inbound) {
vec = vec.add(m); vec = vec.add(m);
m = centerOf.add(directionVec.scale(.5)).subtract(vec).scale(3); m = centerOf.add(directionVec.scale(.5))
.subtract(vec)
.scale(3);
} }
world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z); world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z);
} }
}); });
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -360,6 +380,28 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
} }
} }
public Pair<Boolean, LerpedFloat> getStrogestFlow(Direction side) {
Couple<PipeFlows> couple = allFlows.get(side);
if (couple == null)
return null;
PipeFlows in = couple.get(true);
PipeFlows out = couple.get(false);
Couple<LerpedFloat> progress = couple.map(pf -> pf.progress);
boolean inboundStronger = false;
if (in.isCompleted() != out.isCompleted()) {
inboundStronger = in.isCompleted();
} else if ((progress.get(true) == null) != (progress.get(false) == null)) {
inboundStronger = progress.get(true) != null;
} else {
if (progress.get(true) != null)
inboundStronger = in.bestFlowStrength > out.bestFlowStrength;
}
return Pair.of(inboundStronger, progress.get(inboundStronger));
}
private void clientTick() { private void clientTick() {
spawnParticles(); spawnParticles();
@ -418,6 +460,10 @@ public abstract class FluidPipeBehaviour extends TileEntityBehaviour {
.chase(1, speed, Chaser.LINEAR); .chase(1, speed, Chaser.LINEAR);
} }
public FluidStack getFluid() {
return fluid;
}
class PipeFlows { class PipeFlows {
LerpedFloat progress; LerpedFloat progress;
Set<FluidNetworkFlow> participants; Set<FluidNetworkFlow> participants;

View file

@ -1,39 +0,0 @@
package com.simibubi.create.content.contraptions.fluids;
import java.util.List;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
public class FluidPipeTileEntity extends SmartTileEntity {
FluidPipeBehaviour behaviour;
public FluidPipeTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviour = new StandardPipeBehaviour(this);
behaviours.add(behaviour);
}
class StandardPipeBehaviour extends FluidPipeBehaviour {
public StandardPipeBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public boolean isConnectedTo(BlockState state, Direction direction) {
return FluidPipeBlock.isPipe(state) && state.get(FluidPipeBlock.FACING_TO_PROPERTY_MAP.get(direction));
}
}
}

View file

@ -9,6 +9,8 @@ import org.apache.commons.lang3.mutable.MutableObject;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.fluids.pipes.AxisPipeBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.BlockFace;
@ -17,19 +19,47 @@ import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
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.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
public class FluidPropagator { public class FluidPropagator {
public static Direction validateNeighbourChange(BlockState state, World world, BlockPos pos, Block otherBlock,
BlockPos neighborPos, boolean isMoving) {
if (world.isRemote)
return null;
if (otherBlock instanceof FluidPipeBlock)
return null;
if (otherBlock instanceof AxisPipeBlock)
return null;
if (otherBlock instanceof PumpBlock)
return null;
if (otherBlock instanceof FlowingFluidBlock)
return null;
if (!isStraightPipe(state))
return null;
for (Direction d : Iterate.directions) {
if (!pos.offset(d)
.equals(neighborPos))
continue;
return d;
}
return null;
}
public static FluidPipeBehaviour getPipe(IBlockReader reader, BlockPos pos) { public static FluidPipeBehaviour getPipe(IBlockReader reader, BlockPos pos) {
return TileEntityBehaviour.get(reader, pos, FluidPipeBehaviour.TYPE); return TileEntityBehaviour.get(reader, pos, FluidPipeBehaviour.TYPE);
} }
@ -125,4 +155,35 @@ public class FluidPropagator {
static AxisAlignedBB smallCenter = new AxisAlignedBB(BlockPos.ZERO).shrink(.25); static AxisAlignedBB smallCenter = new AxisAlignedBB(BlockPos.ZERO).shrink(.25);
public static boolean hasFluidCapability(BlockState state, IBlockReader world, BlockPos pos, Direction blockFace) {
return state.hasTileEntity() && world.getTileEntity(pos)
.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, blockFace.getOpposite())
.isPresent();
}
public static boolean isStraightPipe(BlockState state) {
if (state.getBlock() instanceof AxisPipeBlock)
return true;
if (!FluidPipeBlock.isPipe(state))
return false;
boolean axisFound = false;
int connections = 0;
for (Axis axis : Iterate.axes) {
Direction d1 = Direction.getFacingFromAxis(AxisDirection.NEGATIVE, axis);
Direction d2 = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
boolean openAt1 = FluidPipeBlock.isOpenAt(state, d1);
boolean openAt2 = FluidPipeBlock.isOpenAt(state, d2);
if (openAt1)
connections++;
if (openAt2)
connections++;
if (openAt1 && openAt2)
if (axisFound)
return false;
else
axisFound = true;
}
return axisFound && connections == 2;
}
} }

View file

@ -125,6 +125,8 @@ public class OpenEndedPipe {
return 0; return 0;
if (!world.isAreaLoaded(outputPos, 0)) if (!world.isAreaLoaded(outputPos, 0))
return 0; return 0;
if (resource.isEmpty())
return 0;
BlockState state = world.getBlockState(outputPos); BlockState state = world.getBlockState(outputPos);
IFluidState fluidState = state.getFluidState(); IFluidState fluidState = state.getFluidState();
if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) { if (!fluidState.isEmpty() && fluidState.getFluid() != resource.getFluid()) {

View file

@ -1,11 +1,15 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.fluids.FluidPipeAttachmentBehaviour.AttachmentTypes;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.foundation.block.render.WrappedBakedModel; import com.simibubi.create.foundation.block.render.WrappedBakedModel;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -18,19 +22,22 @@ import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap; import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
public class FluidPipeModel extends WrappedBakedModel { public class PipeAttachmentModel extends WrappedBakedModel {
private static ModelProperty<PipeModelData> PIPE_PROPERTY = new ModelProperty<>(); private static ModelProperty<PipeModelData> PIPE_PROPERTY = new ModelProperty<>();
public FluidPipeModel(IBakedModel template) { public PipeAttachmentModel(IBakedModel template) {
super(template); super(template);
} }
@Override @Override
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) { public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
PipeModelData data = new PipeModelData(); PipeModelData data = new PipeModelData();
for (Direction d : Iterate.directions) FluidPipeAttachmentBehaviour attachmentBehaviour =
data.putRim(d, FluidPipeBlock.shouldDrawRim(world, pos, state, d)); TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE);
if (attachmentBehaviour != null)
for (Direction d : Iterate.directions)
data.putRim(d, attachmentBehaviour.getAttachment(world, pos, state, d));
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state)); data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
return new ModelDataMap.Builder().withInitial(PIPE_PROPERTY, data) return new ModelDataMap.Builder().withInitial(PIPE_PROPERTY, data)
.build(); .build();
@ -41,8 +48,10 @@ public class FluidPipeModel extends WrappedBakedModel {
List<BakedQuad> quads = super.getQuads(state, side, rand, data); List<BakedQuad> quads = super.getQuads(state, side, rand, data);
if (data instanceof ModelDataMap) { if (data instanceof ModelDataMap) {
ModelDataMap modelDataMap = (ModelDataMap) data; ModelDataMap modelDataMap = (ModelDataMap) data;
if (modelDataMap.hasProperty(PIPE_PROPERTY)) if (modelDataMap.hasProperty(PIPE_PROPERTY)) {
quads = new ArrayList<>(quads);
addQuads(quads, state, side, rand, modelDataMap, modelDataMap.getData(PIPE_PROPERTY)); addQuads(quads, state, side, rand, modelDataMap, modelDataMap.getData(PIPE_PROPERTY));
}
} }
return quads; return quads;
} }
@ -50,8 +59,9 @@ public class FluidPipeModel extends WrappedBakedModel {
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data, private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
PipeModelData pipeData) { PipeModelData pipeData) {
for (Direction d : Iterate.directions) for (Direction d : Iterate.directions)
if (pipeData.getRim(d)) if (pipeData.hasRim(d))
quads.addAll(AllBlockPartials.PIPE_RIMS.get(d) quads.addAll(AllBlockPartials.PIPE_ATTACHMENTS.get(pipeData.getRim(d))
.get(d)
.get() .get()
.getQuads(state, side, rand, data)); .getQuads(state, side, rand, data));
if (pipeData.isEncased()) if (pipeData.isEncased())
@ -60,15 +70,15 @@ public class FluidPipeModel extends WrappedBakedModel {
} }
private class PipeModelData { private class PipeModelData {
boolean[] rims; AttachmentTypes[] rims;
boolean encased; boolean encased;
public PipeModelData() { public PipeModelData() {
rims = new boolean[6]; rims = new AttachmentTypes[6];
Arrays.fill(rims, false); Arrays.fill(rims, AttachmentTypes.NONE);
} }
public void putRim(Direction face, boolean rim) { public void putRim(Direction face, AttachmentTypes rim) {
rims[face.getIndex()] = rim; rims[face.getIndex()] = rim;
} }
@ -76,7 +86,11 @@ public class FluidPipeModel extends WrappedBakedModel {
this.encased = encased; this.encased = encased;
} }
public boolean getRim(Direction face) { public boolean hasRim(Direction face) {
return rims[face.getIndex()] != AttachmentTypes.NONE;
}
public AttachmentTypes getRim(Direction face) {
return rims[face.getIndex()]; return rims[face.getIndex()];
} }

View file

@ -7,6 +7,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.BlockFace;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;

View file

@ -10,6 +10,8 @@ import java.util.Map;
import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableBoolean;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.BlockFace;
import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
@ -22,6 +24,8 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
@ -45,6 +49,12 @@ public class PumpTileEntity extends KineticTileEntity {
openEnds = Couple.create(HashMap::new); openEnds = Couple.create(HashMap::new);
setProvidedFluid(FluidStack.EMPTY); setProvidedFluid(FluidStack.EMPTY);
} }
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours);
behaviours.add(new PumpAttachmentBehaviour(this));
}
@Override @Override
public void initialize() { public void initialize() {
@ -346,4 +356,25 @@ public class PumpTileEntity extends KineticTileEntity {
this.providedFluid = providedFluid; this.providedFluid = providedFluid;
} }
class PumpAttachmentBehaviour extends FluidPipeAttachmentBehaviour {
public PumpAttachmentBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public boolean isPipeConnectedTowards(BlockState state, Direction direction) {
return isSideAccessible(direction);
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
if (attachment == AttachmentTypes.RIM)
return AttachmentTypes.NONE;
return attachment;
}
}
} }

View file

@ -0,0 +1,97 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Map;
import java.util.Random;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.DebugPacketSender;
import net.minecraft.state.BooleanProperty;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.TickPriority;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class AxisPipeBlock extends RotatedPillarBlock implements IWrenchable {
public AxisPipeBlock(Properties p_i48339_1_) {
super(p_i48339_1_);
}
@Override
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
boolean blockTypeChanged = state.getBlock() != newState.getBlock();
if (blockTypeChanged && !world.isRemote)
FluidPropagator.propagateChangedPipe(world, pos, state);
if (state.hasTileEntity() && (blockTypeChanged || !newState.hasTileEntity()))
world.removeTileEntity(pos);
}
@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) {
if (world.isRemote)
return;
if (state != oldState)
world.getPendingBlockTicks()
.scheduleTick(pos, this, 1, TickPriority.HIGH);
}
@Override
public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos,
PlayerEntity player) {
return AllBlocks.FLUID_PIPE.asStack();
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block otherBlock, BlockPos neighborPos,
boolean isMoving) {
DebugPacketSender.func_218806_a(world, pos);
Direction d = FluidPropagator.validateNeighbourChange(state, world, pos, otherBlock, neighborPos, isMoving);
if (d == null)
return;
if (!isOpenAt(state, d))
return;
world.getPendingBlockTicks()
.scheduleTick(pos, this, 1, TickPriority.HIGH);
}
public static boolean isOpenAt(BlockState state, Direction d) {
return d.getAxis() == state.get(AXIS);
}
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random r) {
FluidPropagator.propagateChangedPipe(world, pos, state);
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_,
ISelectionContext p_220053_4_) {
return AllShapes.EIGHT_VOXEL_POLE.get(state.get(AXIS));
}
public BlockState toRegularPipe(IWorld world, BlockPos pos, BlockState state) {
Direction side = Direction.getFacingFromAxis(AxisDirection.POSITIVE, state.get(AXIS));
Map<Direction, BooleanProperty> facingToPropertyMap = FluidPipeBlock.FACING_TO_PROPERTY_MAP;
return AllBlocks.FLUID_PIPE.get()
.updateBlockState(AllBlocks.FLUID_PIPE.getDefaultState()
.with(facingToPropertyMap.get(side), true)
.with(facingToPropertyMap.get(side.getOpposite()), true), side, null, world, pos);
}
}

View file

@ -0,0 +1,46 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import com.simibubi.create.AllTileEntities;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public class EncasedPipeBlock extends AxisPipeBlock {
public EncasedPipeBlock(Properties p_i48339_1_) {
super(p_i48339_1_);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.ENCASED_FLUID_PIPE.create();
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_,
ISelectionContext p_220053_4_) {
return VoxelShapes.fullCube();
}
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
World world = context.getWorld();
BlockPos pos = context.getPos();
world.setBlockState(pos, toRegularPipe(world, pos, state), 3);
return ActionResultType.SUCCESS;
}
}

View file

@ -1,43 +1,95 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.Random; import java.util.Random;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.fluids.FluidPipeAttachmentBehaviour;
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.block.IWaterLoggable; import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.SixWayBlock; import net.minecraft.block.SixWayBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemUseContext;
import net.minecraft.network.DebugPacketSender; import net.minecraft.network.DebugPacketSender;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
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.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader; import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.TickPriority; import net.minecraft.world.TickPriority;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable { public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable, IWrenchable {
public FluidPipeBlock(Properties properties) { public FluidPipeBlock(Properties properties) {
super(4 / 16f, properties); super(4 / 16f, properties);
this.setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false)); this.setDefaultState(super.getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
} }
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
World world = context.getWorld();
BlockPos pos = context.getPos();
Axis axis = getAxis(world, pos, state);
if (axis == null)
return ActionResultType.PASS;
if (context.getFace()
.getAxis() == axis)
return ActionResultType.PASS;
if (!world.isRemote)
world.setBlockState(pos, AllBlocks.GLASS_FLUID_PIPE.getDefaultState()
.with(GlassFluidPipeBlock.AXIS, axis));
return ActionResultType.SUCCESS;
}
@Override
public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
BlockRayTraceResult hit) {
if (!AllBlocks.COPPER_CASING.isIn(player.getHeldItem(hand)))
return ActionResultType.PASS;
Axis axis = getAxis(world, pos, state);
if (axis == null)
return ActionResultType.PASS;
if (!world.isRemote)
world.setBlockState(pos, AllBlocks.ENCASED_FLUID_PIPE.getDefaultState()
.with(EncasedPipeBlock.AXIS, axis));
return ActionResultType.SUCCESS;
}
@Nullable
private Axis getAxis(IBlockReader world, BlockPos pos, BlockState state) {
if (!FluidPropagator.isStraightPipe(state))
return null;
Axis axis = null;
for (Direction d : Iterate.directions) {
if (isOpenAt(state, d)) {
axis = d.getAxis();
break;
}
}
return axis;
}
@Override @Override
public boolean hasTileEntity(BlockState state) { public boolean hasTileEntity(BlockState state) {
return true; return true;
@ -70,25 +122,13 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block otherBlock, BlockPos neighborPos, public void neighborChanged(BlockState state, World world, BlockPos pos, Block otherBlock, BlockPos neighborPos,
boolean isMoving) { boolean isMoving) {
DebugPacketSender.func_218806_a(world, pos); DebugPacketSender.func_218806_a(world, pos);
if (world.isRemote) Direction d = FluidPropagator.validateNeighbourChange(state, world, pos, otherBlock, neighborPos, isMoving);
if (d == null)
return; return;
if (otherBlock instanceof FluidPipeBlock) if (!isOpenAt(state, d))
return; return;
if (otherBlock instanceof PumpBlock) world.getPendingBlockTicks()
return; .scheduleTick(pos, this, 1, TickPriority.HIGH);
if (otherBlock instanceof FlowingFluidBlock)
return;
if (!isStraightPipe(state))
return;
for (Direction d : Iterate.directions) {
if (!pos.offset(d)
.equals(neighborPos))
continue;
if (!isOpenAt(state, d))
return;
world.getPendingBlockTicks()
.scheduleTick(pos, this, 1, TickPriority.HIGH);
}
} }
@Override @Override
@ -100,65 +140,38 @@ public class FluidPipeBlock extends SixWayBlock implements IWaterLoggable {
return state.getBlock() instanceof FluidPipeBlock; return state.getBlock() instanceof FluidPipeBlock;
} }
public static boolean hasFluidCapability(BlockState state, IBlockReader world, BlockPos pos, Direction blockFace) {
return state.hasTileEntity() && world.getTileEntity(pos)
.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, blockFace.getOpposite())
.isPresent();
}
public static boolean canConnectTo(ILightReader world, BlockPos pos, BlockState neighbour, Direction blockFace) { public static boolean canConnectTo(ILightReader world, BlockPos pos, BlockState neighbour, Direction blockFace) {
if (isPipe(neighbour) || hasFluidCapability(neighbour, world, pos, blockFace)) if (isPipe(neighbour) || FluidPropagator.hasFluidCapability(neighbour, world, pos, blockFace))
return true; return true;
// TODO: more generic pipe connection handling. FluidPipeAttachmentBehaviour attachmentBehaviour =
return neighbour.getBlock() instanceof PumpBlock && blockFace.getAxis() == neighbour.get(PumpBlock.FACING) TileEntityBehaviour.get(world, pos, FluidPipeAttachmentBehaviour.TYPE);
.getAxis(); if (attachmentBehaviour == null)
return false;
return attachmentBehaviour.isPipeConnectedTowards(neighbour, blockFace.getOpposite());
} }
public static boolean shouldDrawRim(ILightReader world, BlockPos pos, BlockState state, Direction direction) { public static boolean shouldDrawRim(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
if (!isPipe(state))
return false;
if (!isOpenAt(state, direction))
return false;
BlockPos offsetPos = pos.offset(direction); BlockPos offsetPos = pos.offset(direction);
BlockState facingState = world.getBlockState(offsetPos); BlockState facingState = world.getBlockState(offsetPos);
if (facingState.getBlock() instanceof PumpBlock && facingState.get(PumpBlock.FACING)
.getAxis() == direction.getAxis())
return false;
if (!isPipe(facingState)) if (!isPipe(facingState))
return true; return true;
if (!isCornerOrEndPipe(world, pos, state)) if (!isCornerOrEndPipe(world, pos, state))
return false; return false;
if (isStraightPipe(facingState)) if (FluidPropagator.isStraightPipe(facingState))
return true; return true;
if (!shouldDrawCasing(world, pos, state) && shouldDrawCasing(world, offsetPos, facingState)) if (!shouldDrawCasing(world, pos, state) && shouldDrawCasing(world, offsetPos, facingState))
return true; return true;
if (isCornerOrEndPipe(world, offsetPos, facingState)) if (isCornerOrEndPipe(world, offsetPos, facingState))
return direction.getAxisDirection() == AxisDirection.POSITIVE; return direction.getAxisDirection() == AxisDirection.POSITIVE;
return false; return true;
} }
private static boolean isOpenAt(BlockState state, Direction direction) { public static boolean isOpenAt(BlockState state, Direction direction) {
return state.get(FACING_TO_PROPERTY_MAP.get(direction)); return state.get(FACING_TO_PROPERTY_MAP.get(direction));
} }
public static boolean isCornerOrEndPipe(ILightReader world, BlockPos pos, BlockState state) { public static boolean isCornerOrEndPipe(ILightReader world, BlockPos pos, BlockState state) {
return isPipe(state) && !isStraightPipe(state) && !shouldDrawCasing(world, pos, state); return isPipe(state) && !FluidPropagator.isStraightPipe(state) && !shouldDrawCasing(world, pos, state);
}
public static boolean isStraightPipe(BlockState state) {
if (!isPipe(state))
return false;
boolean axisFound = false;
for (Axis axis : Iterate.axes) {
Direction d1 = Direction.getFacingFromAxis(AxisDirection.NEGATIVE, axis);
Direction d2 = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
if (isOpenAt(state, d1) && isOpenAt(state, d2))
if (axisFound)
return false;
else
axisFound = true;
}
return axisFound;
} }
public static boolean shouldDrawCasing(ILightReader world, BlockPos pos, BlockState state) { public static boolean shouldDrawCasing(ILightReader world, BlockPos pos, BlockState state) {

View file

@ -0,0 +1,67 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.List;
import com.simibubi.create.content.contraptions.fluids.FluidPipeAttachmentBehaviour;
import com.simibubi.create.content.contraptions.fluids.FluidPipeBehaviour;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
public class FluidPipeTileEntity extends SmartTileEntity {
public FluidPipeTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new StandardPipeBehaviour(this));
behaviours.add(new StandardPipeAttachmentBehaviour(this));
}
class StandardPipeBehaviour extends FluidPipeBehaviour {
public StandardPipeBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public boolean isConnectedTo(BlockState state, Direction direction) {
return FluidPipeBlock.isPipe(state) && state.get(FluidPipeBlock.FACING_TO_PROPERTY_MAP.get(direction));
}
}
class StandardPipeAttachmentBehaviour extends FluidPipeAttachmentBehaviour {
public StandardPipeAttachmentBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
BlockPos offsetPos = pos.offset(direction);
if (!FluidPipeBlock.isPipe(world.getBlockState(offsetPos))) {
FluidPipeAttachmentBehaviour attachmentBehaviour =
TileEntityBehaviour.get(world, offsetPos, FluidPipeAttachmentBehaviour.TYPE);
if (attachmentBehaviour != null && attachmentBehaviour
.isPipeConnectedTowards(world.getBlockState(offsetPos), direction.getOpposite()))
return AttachmentTypes.NONE;
}
if (attachment == AttachmentTypes.RIM && !FluidPipeBlock.shouldDrawRim(world, pos, state, direction))
return AttachmentTypes.NONE;
return attachment;
}
}
}

View file

@ -0,0 +1,54 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import com.simibubi.create.AllTileEntities;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public class GlassFluidPipeBlock extends AxisPipeBlock {
public static final BooleanProperty ALT = BooleanProperty.create("alt");
public GlassFluidPipeBlock(Properties p_i48339_1_) {
super(p_i48339_1_);
setDefaultState(getDefaultState().with(ALT, false));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> p_206840_1_) {
super.fillStateContainer(p_206840_1_.add(ALT));
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.GLASS_FLUID_PIPE.create();
}
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
BlockState newState = state;
World world = context.getWorld();
BlockPos pos = context.getPos();
if (!state.get(ALT))
newState = state.with(ALT, true);
else
newState = toRegularPipe(world, pos, state);
world.setBlockState(pos, newState, 3);
return ActionResultType.SUCCESS;
}
}

View file

@ -0,0 +1,64 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import java.util.List;
import com.simibubi.create.content.contraptions.fluids.FluidPipeAttachmentBehaviour;
import com.simibubi.create.content.contraptions.fluids.FluidPipeBehaviour;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
public class StraightPipeTileEntity extends SmartTileEntity {
public StraightPipeTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new StraightPipeBehaviour(this));
behaviours.add(new StraightPipeAttachmentBehaviour(this));
}
class StraightPipeBehaviour extends FluidPipeBehaviour {
public StraightPipeBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public boolean isConnectedTo(BlockState state, Direction direction) {
return state.get(AxisPipeBlock.AXIS) == direction.getAxis();
}
}
class StraightPipeAttachmentBehaviour extends FluidPipeAttachmentBehaviour {
public StraightPipeAttachmentBehaviour(SmartTileEntity te) {
super(te);
}
@Override
public AttachmentTypes getAttachment(ILightReader world, BlockPos pos, BlockState state, Direction direction) {
AttachmentTypes attachment = super.getAttachment(world, pos, state, direction);
BlockState otherState = world.getBlockState(pos.offset(direction));
if (state.getBlock() instanceof AxisPipeBlock && otherState.getBlock() instanceof AxisPipeBlock) {
if (state.get(AxisPipeBlock.AXIS) == otherState.get(AxisPipeBlock.AXIS)) {
if (state.getBlock() == otherState.getBlock()
|| direction.getAxisDirection() == AxisDirection.POSITIVE)
return AttachmentTypes.NONE;
}
}
return attachment;
}
}
}

View file

@ -0,0 +1,59 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.fluids.FluidPipeBehaviour;
import com.simibubi.create.foundation.fluid.FluidRenderer;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.LerpedFloat;
import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import net.minecraftforge.fluids.FluidStack;
public class TransparentStraightPipeRenderer extends SafeTileEntityRenderer<StraightPipeTileEntity> {
public TransparentStraightPipeRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher);
}
@Override
protected void renderSafe(StraightPipeTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
FluidPipeBehaviour pipe = TileEntityBehaviour.get(te, FluidPipeBehaviour.TYPE);
if (pipe == null)
return;
FluidStack fluidStack = pipe.getFluid();
if (fluidStack.isEmpty())
return;
for (Direction side : Iterate.directions) {
if (!pipe.isConnectedTo(te.getBlockState(), side))
continue;
Pair<Boolean, LerpedFloat> strogestFlow = pipe.getStrogestFlow(side);
if (strogestFlow == null)
continue;
LerpedFloat second = strogestFlow.getSecond();
if (second == null)
continue;
float value = second.getValue(partialTicks);
Boolean inbound = strogestFlow.getFirst();
if (value == 1 && !inbound) {
FluidPipeBehaviour adjacent = TileEntityBehaviour.get(te.getWorld(), te.getPos()
.offset(side), FluidPipeBehaviour.TYPE);
if (adjacent != null && adjacent.getFluid()
.isEmpty())
value -= 1e-6f;
}
FluidRenderer.renderFluidStream(fluidStack, side, 3 / 16f, value, inbound, buffer, ms, light);
}
}
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry; import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour; import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import com.simibubi.create.content.contraptions.fluids.FluidTankBlock.Shape; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock.Shape;
import com.simibubi.create.foundation.data.AssetLookup; import com.simibubi.create.foundation.data.AssetLookup;
import com.simibubi.create.foundation.data.SpecialBlockStateGen; import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.DataGenContext;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.fluid.FluidRenderer;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.contraptions.fluids; package com.simibubi.create.content.contraptions.fluids.tank;
import static java.lang.Math.abs; import static java.lang.Math.abs;
@ -7,7 +7,7 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.content.contraptions.fluids.FluidTankBlock.Shape; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock.Shape;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.fluid.SmartFluidTank; import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;

View file

@ -83,10 +83,8 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
withTileEntityDo(worldIn, entityIn.getPosition(), te -> { withTileEntityDo(worldIn, entityIn.getPosition(), te -> {
ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputItemInventory, itemEntity.getItem() ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputItemInventory, itemEntity.getItem()
.copy(), false); .copy(), false);
if (insertItem.isEmpty()) { if (insertItem.isEmpty()) {
itemEntity.remove(); itemEntity.remove();
if (!itemEntity.world.isRemote) if (!itemEntity.world.isRemote)
AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world, AllTriggers.triggerForNearbyPlayers(AllTriggers.BASIN_THROW, itemEntity.world,
itemEntity.getPosition(), 3); itemEntity.getPosition(), 3);

View file

@ -19,7 +19,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType;
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock;
import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock;
import com.simibubi.create.content.contraptions.fluids.FluidPipeBlock; import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
import com.simibubi.create.content.logistics.block.belts.observer.BeltObserverBlock; import com.simibubi.create.content.logistics.block.belts.observer.BeltObserverBlock;
import com.simibubi.create.content.palettes.PavedBlock; import com.simibubi.create.content.palettes.PavedBlock;
@ -58,7 +58,7 @@ public class BlockStateGen {
boolean customItem) { boolean customItem) {
return (c, p) -> p.directionalBlock(c.get(), getBlockModel(customItem, c, p)); return (c, p) -> p.directionalBlock(c.get(), getBlockModel(customItem, c, p));
} }
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> directionalBlockProviderIgnoresWaterlogged( public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> directionalBlockProviderIgnoresWaterlogged(
boolean customItem) { boolean customItem) {
return (c, p) -> directionalBlockIgnoresWaterlogged(c, p, getBlockModel(customItem, c, p)); return (c, p) -> directionalBlockIgnoresWaterlogged(c, p, getBlockModel(customItem, c, p));
@ -212,9 +212,12 @@ public class BlockStateGen {
.build(); .build();
}); });
} }
public static NonNullBiConsumer<DataGenContext<Block, BlazeBurnerBlock>, RegistrateBlockstateProvider> blazeHeater(){ public static NonNullBiConsumer<DataGenContext<Block, BlazeBurnerBlock>, RegistrateBlockstateProvider> blazeHeater() {
return (c, p) -> ConfiguredModel.builder().modelFile(p.models().getExistingFile(p.modLoc("block/" + c.getName() + "/block"))).build(); return (c, p) -> ConfiguredModel.builder()
.modelFile(p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/block")))
.build();
} }
public static NonNullBiConsumer<DataGenContext<Block, ReinforcedRailBlock>, RegistrateBlockstateProvider> reinforcedRail() { public static NonNullBiConsumer<DataGenContext<Block, ReinforcedRailBlock>, RegistrateBlockstateProvider> reinforcedRail() {

View file

@ -1,8 +1,11 @@
package com.simibubi.create.foundation.fluid; package com.simibubi.create.foundation.fluid;
import java.util.function.Function;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.matrix.MatrixStack.Entry;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.MatrixStacker;
@ -16,6 +19,8 @@ import net.minecraft.inventory.container.PlayerContainer;
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.ResourceLocation;
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.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
@ -23,6 +28,55 @@ import net.minecraftforge.fluids.FluidStack;
public class FluidRenderer { public class FluidRenderer {
public static void renderFluidStream(FluidStack fluidStack, Direction direction, float radius, float progress,
boolean inbound, IRenderTypeBuffer buffer, MatrixStack ms, int light) {
Fluid fluid = fluidStack.getFluid();
FluidAttributes fluidAttributes = fluid.getAttributes();
Function<ResourceLocation, TextureAtlasSprite> spriteAtlas = Minecraft.getInstance()
.getSpriteAtlas(PlayerContainer.BLOCK_ATLAS_TEXTURE);
TextureAtlasSprite flowTexture = spriteAtlas.apply(fluidAttributes.getFlowingTexture(fluidStack));
TextureAtlasSprite stillTexture = spriteAtlas.apply(fluidAttributes.getStillTexture(fluidStack));
int color = fluidAttributes.getColor(fluidStack);
IVertexBuilder builder = buffer.getBuffer(RenderType.getTranslucent());
MatrixStacker msr = MatrixStacker.of(ms);
int blockLightIn = (light >> 4) & 0xf;
int luminosity = Math.max(blockLightIn, fluidAttributes.getLuminosity(fluidStack));
light = (light & 0xf00000) | luminosity << 4;
if (inbound)
direction = direction.getOpposite();
ms.push();
msr.centre()
.rotateY(AngleHelper.horizontalAngle(direction))
.rotateX(direction == Direction.UP ? 0 : direction == Direction.DOWN ? 180 : 90)
.unCentre();
ms.translate(.5, 0, .5);
float h = (float) (radius);
float hMin = (float) (-radius);
float hMax = (float) (radius);
float y = inbound ? 0 : .5f;
float yMin = y;
float yMax = y + MathHelper.clamp(progress * .5f - 1e-6f, 0, 1);
for (int i = 0; i < 4; i++) {
ms.push();
renderTiledHorizontalFace(h, Direction.SOUTH, hMin, yMin, hMax, yMax, builder, ms, light, color,
flowTexture);
ms.pop();
msr.rotateY(90);
}
if (progress != 1)
renderTiledVerticalFace(yMax, Direction.UP, hMin, hMin, hMax, hMax, builder, ms, light, color,
stillTexture);
ms.pop();
}
public static void renderTiledFluidBB(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax, public static void renderTiledFluidBB(FluidStack fluidStack, float xMin, float yMin, float zMin, float xMax,
float yMax, float zMax, IRenderTypeBuffer buffer, MatrixStack ms, int light, boolean renderBottom) { float yMax, float zMax, IRenderTypeBuffer buffer, MatrixStack ms, int light, boolean renderBottom) {
Fluid fluid = fluidStack.getFluid(); Fluid fluid = fluidStack.getFluid();
@ -63,7 +117,7 @@ public class FluidRenderer {
.translateBack(center); .translateBack(center);
boolean X = side.getAxis() == Axis.X; boolean X = side.getAxis() == Axis.X;
int darkColor = ColorHelper.mixColors(color, 0xff000011, 1/4f); int darkColor = ColorHelper.mixColors(color, 0xff000011, 1 / 4f);
renderTiledHorizontalFace(X ? xMax : zMax, side, X ? zMin : xMin, yMin, X ? zMax : xMax, yMax, builder, renderTiledHorizontalFace(X ? xMax : zMax, side, X ? zMin : xMin, yMin, X ? zMax : xMax, yMax, builder,
ms, light, darkColor, fluidTexture); ms, light, darkColor, fluidTexture);
@ -113,10 +167,11 @@ public class FluidRenderer {
for (float y1 = yMin; y1 < yMax; y1 = y2) { for (float y1 = yMin; y1 < yMax; y1 = y2) {
y2 = Math.min((int) (y1 + 1), yMax); y2 = Math.min((int) (y1 + 1), yMax);
float u1 = texture.getInterpolatedU(local(h1) * 16); int multiplier = texture.getWidth() == 32 ? 8 : 16;
float v1 = texture.getInterpolatedV(local(y1) * 16); float u1 = texture.getInterpolatedU(local(h1) * multiplier);
float u2 = texture.getInterpolatedU(h2 == hMax ? local(h2) * 16 : 16); float v1 = texture.getInterpolatedV(local(y1) * multiplier);
float v2 = texture.getInterpolatedV(y2 == yMax ? local(y2) * 16 : 16); float u2 = texture.getInterpolatedU(h2 == hMax ? local(h2) * multiplier : multiplier);
float v2 = texture.getInterpolatedV(y2 == yMax ? local(y2) * multiplier : multiplier);
float x1 = X ? h : h1; float x1 = X ? h : h1;
float x2 = X ? h : h2; float x2 = X ? h : h2;

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [4.5, -3.9, 4.5],
"to": [11.5, -0.9, 11.5],
"faces": {
"north": {"uv": [0, 0, 7, 3], "texture": "#0"},
"east": {"uv": [0, 0, 7, 3], "texture": "#0"},
"south": {"uv": [0, 0, 7, 3], "texture": "#0"},
"west": {"uv": [0, 0, 7, 3], "texture": "#0"},
"up": {"uv": [0, 0, 0, 0], "texture": "#0"},
"down": {"uv": [0, 3, 7, 10], "texture": "#0"}
}
},
{
"from": [3.1, -1.1, 3.1],
"to": [12.9, 1, 12.9],
"faces": {
"north": {"uv": [6, 5, 11, 6], "rotation": 180, "texture": "#1_0"},
"east": {"uv": [11, 6, 6, 5], "texture": "#1_0"},
"south": {"uv": [6, 5, 11, 6], "rotation": 180, "texture": "#1_0"},
"west": {"uv": [11, 6, 6, 5], "texture": "#1_0"},
"up": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"down": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [16.9, 4.5, 4.5],
"to": [19.9, 11.5, 11.5],
"faces": {
"north": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"},
"east": {"uv": [0, 3, 7, 10], "rotation": 180, "texture": "#0"},
"south": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"},
"west": {"uv": [0, 0, 0, 0], "texture": "#0"},
"up": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"},
"down": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"}
}
},
{
"from": [15, 3.1, 3.1],
"to": [17.1, 12.9, 12.9],
"faces": {
"north": {"uv": [11, 6, 6, 5], "rotation": 90, "texture": "#1_0"},
"east": {"uv": [6, 0, 11, 5], "rotation": 270, "texture": "#1_0"},
"south": {"uv": [11, 6, 6, 5], "rotation": 270, "texture": "#1_0"},
"west": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"up": {"uv": [6, 5, 11, 6], "rotation": 90, "texture": "#1_0"},
"down": {"uv": [6, 5, 11, 6], "rotation": 90, "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [4.5, 4.5, -3.9],
"to": [11.5, 11.5, -0.9],
"faces": {
"north": {"uv": [0, 3, 7, 10], "rotation": 180, "texture": "#0"},
"east": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"},
"south": {"uv": [0, 0, 0, 0], "texture": "#0"},
"west": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"},
"up": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"},
"down": {"uv": [0, 0, 7, 3], "texture": "#0"}
}
},
{
"from": [3.1, 3.1, -1.1],
"to": [12.9, 12.9, 1],
"faces": {
"north": {"uv": [6, 0, 11, 5], "rotation": 270, "texture": "#1_0"},
"east": {"uv": [11, 6, 6, 5], "rotation": 270, "texture": "#1_0"},
"south": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"west": {"uv": [11, 6, 6, 5], "rotation": 90, "texture": "#1_0"},
"up": {"uv": [6, 5, 11, 6], "texture": "#1_0"},
"down": {"uv": [6, 5, 11, 6], "rotation": 180, "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [4.5, 4.5, 16.9],
"to": [11.5, 11.5, 19.9],
"faces": {
"north": {"uv": [0, 0, 0, 0], "rotation": 180, "texture": "#0"},
"east": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 3, 7, 10], "texture": "#0"},
"west": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"},
"up": {"uv": [0, 0, 7, 3], "texture": "#0"},
"down": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"}
}
},
{
"from": [3.1, 3.1, 15],
"to": [12.9, 12.9, 17.1],
"faces": {
"north": {"uv": [6, 0, 11, 5], "rotation": 270, "texture": "#1_0"},
"east": {"uv": [11, 6, 6, 5], "rotation": 90, "texture": "#1_0"},
"south": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"west": {"uv": [11, 6, 6, 5], "rotation": 270, "texture": "#1_0"},
"up": {"uv": [6, 5, 11, 6], "rotation": 180, "texture": "#1_0"},
"down": {"uv": [6, 5, 11, 6], "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [4.5, 16.9, 4.5],
"to": [11.5, 19.9, 11.5],
"faces": {
"north": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"},
"east": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"},
"south": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"},
"west": {"uv": [0, 0, 7, 3], "rotation": 180, "texture": "#0"},
"up": {"uv": [0, 3, 7, 10], "texture": "#0"},
"down": {"uv": [0, 0, 0, 0], "texture": "#0"}
}
},
{
"from": [3.1, 15, 3.1],
"to": [12.9, 17.1, 12.9],
"faces": {
"north": {"uv": [6, 5, 11, 6], "texture": "#1_0"},
"east": {"uv": [11, 6, 6, 5], "rotation": 180, "texture": "#1_0"},
"south": {"uv": [6, 5, 11, 6], "texture": "#1_0"},
"west": {"uv": [11, 6, 6, 5], "rotation": 180, "texture": "#1_0"},
"up": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"down": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,41 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/pipe_drain",
"particle": "create:block/fluid_pipe",
"1_0": "create:block/fluid_pipe"
},
"elements": [
{
"from": [-3.9, 4.5, 4.5],
"to": [-0.9, 11.5, 11.5],
"faces": {
"north": {"uv": [0, 0, 7, 3], "rotation": 270, "texture": "#0"},
"east": {"uv": [0, 0, 0, 0], "texture": "#0"},
"south": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"},
"west": {"uv": [0, 3, 7, 10], "rotation": 180, "texture": "#0"},
"up": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"},
"down": {"uv": [0, 0, 7, 3], "rotation": 90, "texture": "#0"}
}
},
{
"from": [-1.1, 3.1, 3.1],
"to": [1, 12.9, 12.9],
"faces": {
"north": {"uv": [11, 6, 6, 5], "rotation": 270, "texture": "#1_0"},
"east": {"uv": [6, 0, 11, 5], "rotation": 90, "texture": "#1_0"},
"south": {"uv": [11, 6, 6, 5], "rotation": 90, "texture": "#1_0"},
"west": {"uv": [6, 0, 11, 5], "rotation": 270, "texture": "#1_0"},
"up": {"uv": [6, 5, 11, 6], "rotation": 270, "texture": "#1_0"},
"down": {"uv": [6, 5, 11, 6], "rotation": 270, "texture": "#1_0"}
}
}
],
"groups": [0,
{
"name": "up",
"origin": [8, 8, 8],
"children": [1]
}
]
}

View file

@ -0,0 +1,58 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "create:block/glass_fluid_pipe",
"particle": "#0"
},
"elements": [
{
"name": "Outer",
"from": [4, 0, 4],
"to": [12, 16, 12],
"shade": false,
"faces": {
"north": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"},
"east": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"},
"west": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4, 0, 11.5],
"to": [12, 16, 11.5],
"shade": false,
"faces": {
"north": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4, 0, 4.5],
"to": [12, 16, 4.5],
"shade": false,
"faces": {
"south": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4.5, 0, 4],
"to": [4.5, 16, 12],
"shade": false,
"faces": {
"east": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [11.5, 0, 4],
"to": [11.5, 16, 12],
"shade": false,
"faces": {
"west": {"uv": [0, 8, 16, 16], "rotation": 90, "texture": "#0"}
}
}
]
}

View file

@ -0,0 +1,58 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"0": "create:block/glass_fluid_pipe",
"particle": "#0"
},
"elements": [
{
"name": "Outer",
"from": [4, 0, 4],
"to": [12, 16, 12],
"shade": false,
"faces": {
"north": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"},
"east": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"},
"south": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"},
"west": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4, 0, 11.5],
"to": [12, 16, 11.5],
"shade": false,
"faces": {
"north": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4, 0, 4.5],
"to": [12, 16, 4.5],
"shade": false,
"faces": {
"south": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [4.5, 0, 4],
"to": [4.5, 16, 12],
"shade": false,
"faces": {
"east": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"}
}
},
{
"name": "Inner",
"from": [11.5, 0, 4],
"to": [11.5, 16, 12],
"shade": false,
"faces": {
"west": {"uv": [0, 0, 16, 8], "rotation": 90, "texture": "#0"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B