Across the Atlantic

- Train Tracks, Station, Controls and Seats are now waterproof and waterloggable
- Fixed Schedules not stacking with newly crafted ones after entries are cleared
- Fluid tanks are now a little bit better at keeping campfire particles below them
This commit is contained in:
simibubi 2022-05-28 21:14:03 +02:00
parent ba6f2400e7
commit 79b16d6d26
20 changed files with 438 additions and 109 deletions

View file

@ -49,7 +49,7 @@ b59324f051f21d8ce1a48a08f4721a61a3c414d6 assets/create/blockstates/chute.json
e5e3757e99c139d67b2a70288466d8a74d818841 assets/create/blockstates/cogwheel.json e5e3757e99c139d67b2a70288466d8a74d818841 assets/create/blockstates/cogwheel.json
36f54136a7756c97f71bc6b47ef4e8e575e72879 assets/create/blockstates/content_observer.json 36f54136a7756c97f71bc6b47ef4e8e575e72879 assets/create/blockstates/content_observer.json
7d11142092c89ccba3e74e0a3bdd0ccb446d63b5 assets/create/blockstates/controller_rail.json 7d11142092c89ccba3e74e0a3bdd0ccb446d63b5 assets/create/blockstates/controller_rail.json
f292ffa3bc036947b655c0a0ce26a91615c3d40b assets/create/blockstates/controls.json 641de13967ee1e2f3cc238eee4baa93b3324bb2f assets/create/blockstates/controls.json
961b615124ea9a5a5735e8a79f81a702de7da2cf assets/create/blockstates/copper_backtank.json 961b615124ea9a5a5735e8a79f81a702de7da2cf assets/create/blockstates/copper_backtank.json
cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets/create/blockstates/copper_casing.json cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets/create/blockstates/copper_casing.json
b3d0dee8f6e14fa6c637e98cc1c6f1ea55b5f0d5 assets/create/blockstates/copper_shingle_slab.json b3d0dee8f6e14fa6c637e98cc1c6f1ea55b5f0d5 assets/create/blockstates/copper_shingle_slab.json
@ -237,7 +237,7 @@ be3bef7e091d8b50bfc1c6b7275946d1f636aefd assets/create/blockstates/horizontal_fr
10ef455fd61ed1ca831d27bf2b533d05dec9c67d assets/create/blockstates/item_vault.json 10ef455fd61ed1ca831d27bf2b533d05dec9c67d assets/create/blockstates/item_vault.json
5d851c90d23de5087ce546d4bbe509e112b84c49 assets/create/blockstates/jungle_window.json 5d851c90d23de5087ce546d4bbe509e112b84c49 assets/create/blockstates/jungle_window.json
b15bea757ef981e0ca60f740ca234ee2014eb7b7 assets/create/blockstates/jungle_window_pane.json b15bea757ef981e0ca60f740ca234ee2014eb7b7 assets/create/blockstates/jungle_window_pane.json
f8982f0241f33b2cd55d6261ab6ee38cb83b6d8d assets/create/blockstates/large_bogey.json a922b31bc4a91f5825b643ba5fa2c9a836d612cd assets/create/blockstates/large_bogey.json
f651091db216b009b3379b2f48d56d03481c8675 assets/create/blockstates/large_cogwheel.json f651091db216b009b3379b2f48d56d03481c8675 assets/create/blockstates/large_cogwheel.json
a38184e035c2ebca7471e1714494fea213af259e assets/create/blockstates/layered_andesite.json a38184e035c2ebca7471e1714494fea213af259e assets/create/blockstates/layered_andesite.json
2409f04042380a8ad086f9c4f98032e85771c3f3 assets/create/blockstates/layered_asurine.json 2409f04042380a8ad086f9c4f98032e85771c3f3 assets/create/blockstates/layered_asurine.json
@ -423,7 +423,7 @@ e05f2e98984127aa6b601c4e4909e4c8207b5407 assets/create/blockstates/small_asurine
636028cb348cf9a0f060b4232cdb5dc4d26a4d40 assets/create/blockstates/small_asurine_brick_stairs.json 636028cb348cf9a0f060b4232cdb5dc4d26a4d40 assets/create/blockstates/small_asurine_brick_stairs.json
d9b5e23652ca70b29a9142ff8f2efd33dfe74904 assets/create/blockstates/small_asurine_brick_wall.json d9b5e23652ca70b29a9142ff8f2efd33dfe74904 assets/create/blockstates/small_asurine_brick_wall.json
6fc5be0d465faa59aebe016d4ecb4d5284507bef assets/create/blockstates/small_asurine_bricks.json 6fc5be0d465faa59aebe016d4ecb4d5284507bef assets/create/blockstates/small_asurine_bricks.json
f8982f0241f33b2cd55d6261ab6ee38cb83b6d8d assets/create/blockstates/small_bogey.json a922b31bc4a91f5825b643ba5fa2c9a836d612cd assets/create/blockstates/small_bogey.json
2371c092ecbefa9a844889e0a471714d070569dd assets/create/blockstates/small_calcite_brick_slab.json 2371c092ecbefa9a844889e0a471714d070569dd assets/create/blockstates/small_calcite_brick_slab.json
134ba0452fc721333177695882c8cef3cb7eca8e assets/create/blockstates/small_calcite_brick_stairs.json 134ba0452fc721333177695882c8cef3cb7eca8e assets/create/blockstates/small_calcite_brick_stairs.json
7112ac7498acdd196b05af977e7e12cbab29df14 assets/create/blockstates/small_calcite_brick_wall.json 7112ac7498acdd196b05af977e7e12cbab29df14 assets/create/blockstates/small_calcite_brick_wall.json
@ -487,7 +487,7 @@ f385988cb6fa9c48b5d59a6942ec50ed2b60c8bf assets/create/blockstates/stockpile_swi
e815bfd854c2653f10828bb11950f7fb991d7efc assets/create/blockstates/stressometer.json e815bfd854c2653f10828bb11950f7fb991d7efc assets/create/blockstates/stressometer.json
8b0c2c7ac72529565b3339aa8df7565858100afa assets/create/blockstates/tiled_glass.json 8b0c2c7ac72529565b3339aa8df7565858100afa assets/create/blockstates/tiled_glass.json
a2454400b1cf9889f70aebdc89c52a1be25f543c assets/create/blockstates/tiled_glass_pane.json a2454400b1cf9889f70aebdc89c52a1be25f543c assets/create/blockstates/tiled_glass_pane.json
a64fcf2bee9b49f1448d1ff691bd92d7590a59b0 assets/create/blockstates/track.json 96c45abe7a5d9273feaf5f747d14cee8e04b58da assets/create/blockstates/track.json
408ae1009ee8bb2f2b83753d5909c53744f7865f assets/create/blockstates/track_signal.json 408ae1009ee8bb2f2b83753d5909c53744f7865f assets/create/blockstates/track_signal.json
60609cfbcc9be6f7e41fb493ef3147beb9750b60 assets/create/blockstates/track_station.json 60609cfbcc9be6f7e41fb493ef3147beb9750b60 assets/create/blockstates/track_station.json
29af21c8d82891139d48d69f0393f612f2b6f8f1 assets/create/blockstates/tuff_pillar.json 29af21c8d82891139d48d69f0393f612f2b6f8f1 assets/create/blockstates/tuff_pillar.json

View file

@ -1,32 +1,62 @@
{ {
"variants": { "variants": {
"facing=north,open=false": { "facing=north,open=false,waterlogged=false": {
"model": "create:block/controls/block_closed" "model": "create:block/controls/block_closed"
}, },
"facing=south,open=false": { "facing=south,open=false,waterlogged=false": {
"model": "create:block/controls/block_closed", "model": "create:block/controls/block_closed",
"y": 180 "y": 180
}, },
"facing=west,open=false": { "facing=west,open=false,waterlogged=false": {
"model": "create:block/controls/block_closed", "model": "create:block/controls/block_closed",
"y": 270 "y": 270
}, },
"facing=east,open=false": { "facing=east,open=false,waterlogged=false": {
"model": "create:block/controls/block_closed", "model": "create:block/controls/block_closed",
"y": 90 "y": 90
}, },
"facing=north,open=true": { "facing=north,open=true,waterlogged=false": {
"model": "create:block/controls/block_open" "model": "create:block/controls/block_open"
}, },
"facing=south,open=true": { "facing=south,open=true,waterlogged=false": {
"model": "create:block/controls/block_open", "model": "create:block/controls/block_open",
"y": 180 "y": 180
}, },
"facing=west,open=true": { "facing=west,open=true,waterlogged=false": {
"model": "create:block/controls/block_open", "model": "create:block/controls/block_open",
"y": 270 "y": 270
}, },
"facing=east,open=true": { "facing=east,open=true,waterlogged=false": {
"model": "create:block/controls/block_open",
"y": 90
},
"facing=north,open=false,waterlogged=true": {
"model": "create:block/controls/block_closed"
},
"facing=south,open=false,waterlogged=true": {
"model": "create:block/controls/block_closed",
"y": 180
},
"facing=west,open=false,waterlogged=true": {
"model": "create:block/controls/block_closed",
"y": 270
},
"facing=east,open=false,waterlogged=true": {
"model": "create:block/controls/block_closed",
"y": 90
},
"facing=north,open=true,waterlogged=true": {
"model": "create:block/controls/block_open"
},
"facing=south,open=true,waterlogged=true": {
"model": "create:block/controls/block_open",
"y": 180
},
"facing=west,open=true,waterlogged=true": {
"model": "create:block/controls/block_open",
"y": 270
},
"facing=east,open=true,waterlogged=true": {
"model": "create:block/controls/block_open", "model": "create:block/controls/block_open",
"y": 90 "y": 90
} }

View file

@ -1,10 +1,17 @@
{ {
"variants": { "variants": {
"axis=x": { "axis=x,waterlogged=false": {
"model": "create:block/track/bogey/top", "model": "create:block/track/bogey/top",
"y": 90 "y": 90
}, },
"axis=z": { "axis=z,waterlogged=false": {
"model": "create:block/track/bogey/top"
},
"axis=x,waterlogged=true": {
"model": "create:block/track/bogey/top",
"y": 90
},
"axis=z,waterlogged=true": {
"model": "create:block/track/bogey/top" "model": "create:block/track/bogey/top"
} }
} }

View file

@ -1,10 +1,17 @@
{ {
"variants": { "variants": {
"axis=x": { "axis=x,waterlogged=false": {
"model": "create:block/track/bogey/top", "model": "create:block/track/bogey/top",
"y": 90 "y": 90
}, },
"axis=z": { "axis=z,waterlogged=false": {
"model": "create:block/track/bogey/top"
},
"axis=x,waterlogged=true": {
"model": "create:block/track/bogey/top",
"y": 90
},
"axis=z,waterlogged=true": {
"model": "create:block/track/bogey/top" "model": "create:block/track/bogey/top"
} }
} }

View file

@ -1,129 +1,255 @@
{ {
"variants": { "variants": {
"shape=none,turn=false": { "shape=none,turn=false,waterlogged=false": {
"model": "minecraft:block/air" "model": "minecraft:block/air"
}, },
"shape=zo,turn=false": { "shape=zo,turn=false,waterlogged=false": {
"model": "create:block/track/z_ortho" "model": "create:block/track/z_ortho"
}, },
"shape=xo,turn=false": { "shape=xo,turn=false,waterlogged=false": {
"model": "create:block/track/x_ortho" "model": "create:block/track/x_ortho"
}, },
"shape=pd,turn=false": { "shape=pd,turn=false,waterlogged=false": {
"model": "create:block/track/diag" "model": "create:block/track/diag"
}, },
"shape=nd,turn=false": { "shape=nd,turn=false,waterlogged=false": {
"model": "create:block/track/diag_2" "model": "create:block/track/diag_2"
}, },
"shape=an,turn=false": { "shape=an,turn=false,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 180 "y": 180
}, },
"shape=as,turn=false": { "shape=as,turn=false,waterlogged=false": {
"model": "create:block/track/ascending" "model": "create:block/track/ascending"
}, },
"shape=ae,turn=false": { "shape=ae,turn=false,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 270 "y": 270
}, },
"shape=aw,turn=false": { "shape=aw,turn=false,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 90 "y": 90
}, },
"shape=tn,turn=false": { "shape=tn,turn=false,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 180 "y": 180
}, },
"shape=ts,turn=false": { "shape=ts,turn=false,waterlogged=false": {
"model": "create:block/track/teleport" "model": "create:block/track/teleport"
}, },
"shape=te,turn=false": { "shape=te,turn=false,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 270 "y": 270
}, },
"shape=tw,turn=false": { "shape=tw,turn=false,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 90 "y": 90
}, },
"shape=cr_o,turn=false": { "shape=cr_o,turn=false,waterlogged=false": {
"model": "create:block/track/cross_ortho" "model": "create:block/track/cross_ortho"
}, },
"shape=cr_d,turn=false": { "shape=cr_d,turn=false,waterlogged=false": {
"model": "create:block/track/cross_diag" "model": "create:block/track/cross_diag"
}, },
"shape=cr_pdx,turn=false": { "shape=cr_pdx,turn=false,waterlogged=false": {
"model": "create:block/track/cross_d1_xo" "model": "create:block/track/cross_d1_xo"
}, },
"shape=cr_pdz,turn=false": { "shape=cr_pdz,turn=false,waterlogged=false": {
"model": "create:block/track/cross_d1_zo" "model": "create:block/track/cross_d1_zo"
}, },
"shape=cr_ndx,turn=false": { "shape=cr_ndx,turn=false,waterlogged=false": {
"model": "create:block/track/cross_d2_xo" "model": "create:block/track/cross_d2_xo"
}, },
"shape=cr_ndz,turn=false": { "shape=cr_ndz,turn=false,waterlogged=false": {
"model": "create:block/track/cross_d2_zo" "model": "create:block/track/cross_d2_zo"
}, },
"shape=none,turn=true": { "shape=none,turn=true,waterlogged=false": {
"model": "minecraft:block/air" "model": "minecraft:block/air"
}, },
"shape=zo,turn=true": { "shape=zo,turn=true,waterlogged=false": {
"model": "create:block/track/z_ortho" "model": "create:block/track/z_ortho"
}, },
"shape=xo,turn=true": { "shape=xo,turn=true,waterlogged=false": {
"model": "create:block/track/x_ortho" "model": "create:block/track/x_ortho"
}, },
"shape=pd,turn=true": { "shape=pd,turn=true,waterlogged=false": {
"model": "create:block/track/diag" "model": "create:block/track/diag"
}, },
"shape=nd,turn=true": { "shape=nd,turn=true,waterlogged=false": {
"model": "create:block/track/diag_2" "model": "create:block/track/diag_2"
}, },
"shape=an,turn=true": { "shape=an,turn=true,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 180 "y": 180
}, },
"shape=as,turn=true": { "shape=as,turn=true,waterlogged=false": {
"model": "create:block/track/ascending" "model": "create:block/track/ascending"
}, },
"shape=ae,turn=true": { "shape=ae,turn=true,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 270 "y": 270
}, },
"shape=aw,turn=true": { "shape=aw,turn=true,waterlogged=false": {
"model": "create:block/track/ascending", "model": "create:block/track/ascending",
"y": 90 "y": 90
}, },
"shape=tn,turn=true": { "shape=tn,turn=true,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 180 "y": 180
}, },
"shape=ts,turn=true": { "shape=ts,turn=true,waterlogged=false": {
"model": "create:block/track/teleport" "model": "create:block/track/teleport"
}, },
"shape=te,turn=true": { "shape=te,turn=true,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 270 "y": 270
}, },
"shape=tw,turn=true": { "shape=tw,turn=true,waterlogged=false": {
"model": "create:block/track/teleport", "model": "create:block/track/teleport",
"y": 90 "y": 90
}, },
"shape=cr_o,turn=true": { "shape=cr_o,turn=true,waterlogged=false": {
"model": "create:block/track/cross_ortho" "model": "create:block/track/cross_ortho"
}, },
"shape=cr_d,turn=true": { "shape=cr_d,turn=true,waterlogged=false": {
"model": "create:block/track/cross_diag" "model": "create:block/track/cross_diag"
}, },
"shape=cr_pdx,turn=true": { "shape=cr_pdx,turn=true,waterlogged=false": {
"model": "create:block/track/cross_d1_xo" "model": "create:block/track/cross_d1_xo"
}, },
"shape=cr_pdz,turn=true": { "shape=cr_pdz,turn=true,waterlogged=false": {
"model": "create:block/track/cross_d1_zo" "model": "create:block/track/cross_d1_zo"
}, },
"shape=cr_ndx,turn=true": { "shape=cr_ndx,turn=true,waterlogged=false": {
"model": "create:block/track/cross_d2_xo" "model": "create:block/track/cross_d2_xo"
}, },
"shape=cr_ndz,turn=true": { "shape=cr_ndz,turn=true,waterlogged=false": {
"model": "create:block/track/cross_d2_zo"
},
"shape=none,turn=false,waterlogged=true": {
"model": "minecraft:block/air"
},
"shape=zo,turn=false,waterlogged=true": {
"model": "create:block/track/z_ortho"
},
"shape=xo,turn=false,waterlogged=true": {
"model": "create:block/track/x_ortho"
},
"shape=pd,turn=false,waterlogged=true": {
"model": "create:block/track/diag"
},
"shape=nd,turn=false,waterlogged=true": {
"model": "create:block/track/diag_2"
},
"shape=an,turn=false,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 180
},
"shape=as,turn=false,waterlogged=true": {
"model": "create:block/track/ascending"
},
"shape=ae,turn=false,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 270
},
"shape=aw,turn=false,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 90
},
"shape=tn,turn=false,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 180
},
"shape=ts,turn=false,waterlogged=true": {
"model": "create:block/track/teleport"
},
"shape=te,turn=false,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 270
},
"shape=tw,turn=false,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 90
},
"shape=cr_o,turn=false,waterlogged=true": {
"model": "create:block/track/cross_ortho"
},
"shape=cr_d,turn=false,waterlogged=true": {
"model": "create:block/track/cross_diag"
},
"shape=cr_pdx,turn=false,waterlogged=true": {
"model": "create:block/track/cross_d1_xo"
},
"shape=cr_pdz,turn=false,waterlogged=true": {
"model": "create:block/track/cross_d1_zo"
},
"shape=cr_ndx,turn=false,waterlogged=true": {
"model": "create:block/track/cross_d2_xo"
},
"shape=cr_ndz,turn=false,waterlogged=true": {
"model": "create:block/track/cross_d2_zo"
},
"shape=none,turn=true,waterlogged=true": {
"model": "minecraft:block/air"
},
"shape=zo,turn=true,waterlogged=true": {
"model": "create:block/track/z_ortho"
},
"shape=xo,turn=true,waterlogged=true": {
"model": "create:block/track/x_ortho"
},
"shape=pd,turn=true,waterlogged=true": {
"model": "create:block/track/diag"
},
"shape=nd,turn=true,waterlogged=true": {
"model": "create:block/track/diag_2"
},
"shape=an,turn=true,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 180
},
"shape=as,turn=true,waterlogged=true": {
"model": "create:block/track/ascending"
},
"shape=ae,turn=true,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 270
},
"shape=aw,turn=true,waterlogged=true": {
"model": "create:block/track/ascending",
"y": 90
},
"shape=tn,turn=true,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 180
},
"shape=ts,turn=true,waterlogged=true": {
"model": "create:block/track/teleport"
},
"shape=te,turn=true,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 270
},
"shape=tw,turn=true,waterlogged=true": {
"model": "create:block/track/teleport",
"y": 90
},
"shape=cr_o,turn=true,waterlogged=true": {
"model": "create:block/track/cross_ortho"
},
"shape=cr_d,turn=true,waterlogged=true": {
"model": "create:block/track/cross_diag"
},
"shape=cr_pdx,turn=true,waterlogged=true": {
"model": "create:block/track/cross_d1_xo"
},
"shape=cr_pdz,turn=true,waterlogged=true": {
"model": "create:block/track/cross_d1_zo"
},
"shape=cr_ndx,turn=true,waterlogged=true": {
"model": "create:block/track/cross_d2_xo"
},
"shape=cr_ndz,turn=true,waterlogged=true": {
"model": "create:block/track/cross_d2_zo" "model": "create:block/track/cross_d2_zo"
} }
} }

View file

@ -1438,9 +1438,9 @@ public class AllBlocks {
.register(); .register();
public static final BlockEntry<TrackBlock> TRACK = REGISTRATE.block("track", TrackBlock::new) public static final BlockEntry<TrackBlock> TRACK = REGISTRATE.block("track", TrackBlock::new)
.initialProperties(Material.DECORATION) .initialProperties(Material.STONE)
.properties(p -> p.color(MaterialColor.NONE)) .properties(p -> p.color(MaterialColor.NONE)
.properties(p -> p.strength(0.8F) .strength(0.8F)
.sound(SoundType.METAL) .sound(SoundType.METAL)
.noOcclusion()) .noOcclusion())
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
@ -1477,7 +1477,6 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.color(MaterialColor.PODZOL)) .properties(p -> p.color(MaterialColor.PODZOL))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(BlockBehaviour.Properties::noOcclusion)
.transform(pickaxeOnly()) .transform(pickaxeOnly())
.blockstate((c, p) -> p.getVariantBuilder(c.get()) .blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStates(state -> ConfiguredModel.builder() .forAllStates(state -> ConfiguredModel.builder()

View file

@ -8,10 +8,12 @@ import javax.annotation.ParametersAreNonnullByDefault;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -23,10 +25,14 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
@ -37,7 +43,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public class SeatBlock extends Block { public class SeatBlock extends Block implements ProperWaterloggedBlock {
protected final DyeColor color; protected final DyeColor color;
protected final boolean inCreativeTab; protected final boolean inCreativeTab;
@ -46,6 +52,29 @@ public class SeatBlock extends Block {
super(properties); super(properties);
this.color = color; this.color = color;
this.inCreativeTab = inCreativeTab; this.inCreativeTab = inCreativeTab;
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
}
@Override
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder.add(WATERLOGGED));
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return withWater(super.getStateForPlacement(pContext), pContext);
}
@Override
public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {
updateWater(pLevel, pState, pCurrentPos);
return pState;
}
@Override
public FluidState getFluidState(BlockState pState) {
return fluidState(pState);
} }
@Override @Override

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.in
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionWorld; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionWorld;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -15,32 +16,40 @@ import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
public class ControlsBlock extends HorizontalDirectionalBlock implements IWrenchable { public class ControlsBlock extends HorizontalDirectionalBlock implements IWrenchable, ProperWaterloggedBlock {
public static final BooleanProperty OPEN = BooleanProperty.create("open"); public static final BooleanProperty OPEN = BooleanProperty.create("open");
public ControlsBlock(Properties p_54120_) { public ControlsBlock(Properties p_54120_) {
super(p_54120_); super(p_54120_);
registerDefaultState(defaultBlockState().setValue(OPEN, false)); registerDefaultState(defaultBlockState().setValue(OPEN, false)
.setValue(WATERLOGGED, false));
} }
@Override @Override
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) { protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder.add(FACING, OPEN)); super.createBlockStateDefinition(pBuilder.add(FACING, OPEN, WATERLOGGED));
} }
@Override @Override
public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState, public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) { LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {
updateWater(pLevel, pState, pCurrentPos);
return pState.setValue(OPEN, pLevel instanceof ContraptionWorld); return pState.setValue(OPEN, pLevel instanceof ContraptionWorld);
} }
@Override
public FluidState getFluidState(BlockState pState) {
return fluidState(pState);
}
@Override @Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) { public BlockState getStateForPlacement(BlockPlaceContext pContext) {
BlockState state = super.getStateForPlacement(pContext); BlockState state = withWater(super.getStateForPlacement(pContext), pContext);
Direction horizontalDirection = pContext.getHorizontalDirection(); Direction horizontalDirection = pContext.getHorizontalDirection();
Player player = pContext.getPlayer(); Player player = pContext.getPlayer();

View file

@ -45,6 +45,8 @@ import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.util.ForgeSoundType; import net.minecraftforge.common.util.ForgeSoundType;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
@ -111,6 +113,16 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE<FluidTankT
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
static final VoxelShape CAMPFIRE_SMOKE_CLIP = Block.box(0, 4, 0, 16, 16, 16);
@Override
public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos,
CollisionContext pContext) {
if (pContext == CollisionContext.empty())
return CAMPFIRE_SMOKE_CLIP;
return pState.getShape(pLevel, pPos);
}
@Override @Override
public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState, public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) { LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.relays.elementary;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -12,16 +13,14 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
public abstract class AbstractShaftBlock extends RotatedPillarKineticBlock public abstract class AbstractShaftBlock extends RotatedPillarKineticBlock
implements ITE<KineticTileEntity>, SimpleWaterloggedBlock { implements ITE<KineticTileEntity>, ProperWaterloggedBlock {
public AbstractShaftBlock(Properties properties) { public AbstractShaftBlock(Properties properties) {
super(properties); super(properties);
@ -50,30 +49,24 @@ public abstract class AbstractShaftBlock extends RotatedPillarKineticBlock
@Override @Override
public FluidState getFluidState(BlockState state) { public FluidState getFluidState(BlockState state) {
return state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) return fluidState(state);
: Fluids.EMPTY.defaultFluidState();
} }
@Override @Override
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(BlockStateProperties.WATERLOGGED); super.createBlockStateDefinition(builder.add(BlockStateProperties.WATERLOGGED));
super.createBlockStateDefinition(builder);
} }
@Override @Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world, public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world,
BlockPos pos, BlockPos neighbourPos) { BlockPos pos, BlockPos neighbourPos) {
if (state.getValue(BlockStateProperties.WATERLOGGED)) updateWater(world, state, pos);
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
return state; return state;
} }
@Override @Override
public BlockState getStateForPlacement(BlockPlaceContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
FluidState ifluidstate = context.getLevel() return withWater(super.getStateForPlacement(context), context);
.getFluidState(context.getClickedPos());
return super.getStateForPlacement(context).setValue(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getType() == Fluids.WATER));
} }
} }

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.logistics.trains; package com.simibubi.create.content.logistics.trains;
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@ -75,7 +77,9 @@ public interface IBogeyBlock extends IWrenchable {
if (newBlock instanceof IBogeyBlock bogey) { if (newBlock instanceof IBogeyBlock bogey) {
BlockState matchingBogey = bogey.getMatchingBogey(bogeyUpDirection, trackAxisAlongFirstCoordinate); BlockState matchingBogey = bogey.getMatchingBogey(bogeyUpDirection, trackAxisAlongFirstCoordinate);
if (matchingBogey != null) if (matchingBogey != null)
return matchingBogey; return matchingBogey.hasProperty(WATERLOGGED)
? matchingBogey.setValue(WATERLOGGED, state.getValue(WATERLOGGED))
: matchingBogey;
} }
index = (index + 1) % BOGEYS.size(); index = (index + 1) % BOGEYS.size();
} }

View file

@ -17,6 +17,7 @@ import com.simibubi.create.foundation.gui.element.GuiGameElement;
import com.simibubi.create.foundation.gui.widget.IconButton; import com.simibubi.create.foundation.gui.widget.IconButton;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public abstract class AbstractStationScreen extends AbstractSimiScreen { public abstract class AbstractStationScreen extends AbstractSimiScreen {
@ -83,11 +84,12 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen {
.scale(40) .scale(40)
.rotateX(-22) .rotateX(-22)
.rotateY(63); .rotateY(63);
GuiGameElement.of(te.getBlockState()) GuiGameElement.of(te.getBlockState()
.setValue(BlockStateProperties.WATERLOGGED, false))
.render(ms); .render(ms);
if (te.resolveFlagAngle()) { if (te.resolveFlagAngle()) {
msr.translate(1 / 16f, -9 / 16f, -11 / 16f); msr.translate(1 / 16f, -19 / 16f, -12 / 16f);
StationRenderer.transformFlag(msr, te, partialTicks, 180, false); StationRenderer.transformFlag(msr, te, partialTicks, 180, false);
GuiGameElement.of(getFlag(partialTicks)) GuiGameElement.of(getFlag(partialTicks))
.render(ms); .render(ms);

View file

@ -7,10 +7,12 @@ import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.logistics.block.depot.SharedDepotBlockMethods; import com.simibubi.create.content.logistics.block.depot.SharedDepotBlockMethods;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.ScreenOpener;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -18,13 +20,16 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
@ -33,18 +38,36 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
public class StationBlock extends Block implements ITE<StationTileEntity>, IWrenchable { public class StationBlock extends Block implements ITE<StationTileEntity>, IWrenchable, ProperWaterloggedBlock {
public static final BooleanProperty ASSEMBLING = BooleanProperty.create("assembling"); public static final BooleanProperty ASSEMBLING = BooleanProperty.create("assembling");
public StationBlock(Properties p_54120_) { public StationBlock(Properties p_54120_) {
super(p_54120_); super(p_54120_);
registerDefaultState(defaultBlockState().setValue(ASSEMBLING, false)); registerDefaultState(defaultBlockState().setValue(ASSEMBLING, false)
.setValue(WATERLOGGED, false));
} }
@Override @Override
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) { protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
super.createBlockStateDefinition(pBuilder.add(ASSEMBLING)); super.createBlockStateDefinition(pBuilder.add(ASSEMBLING, WATERLOGGED));
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
return withWater(super.getStateForPlacement(pContext), pContext);
}
@Override
public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {
updateWater(pLevel, pState, pCurrentPos);
return pState;
}
@Override
public FluidState getFluidState(BlockState pState) {
return fluidState(pState);
} }
@Override @Override

View file

@ -37,6 +37,7 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.EdgePoi
import com.simibubi.create.content.logistics.trains.management.edgePoint.TrackTargetingBehaviour; import com.simibubi.create.content.logistics.trains.management.edgePoint.TrackTargetingBehaviour;
import com.simibubi.create.content.logistics.trains.management.schedule.Schedule; import com.simibubi.create.content.logistics.trains.management.schedule.Schedule;
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleItem; import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleItem;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
@ -251,7 +252,7 @@ public class StationTileEntity extends SmartTileEntity implements ITransformable
BlockPos bogeyPos = pos.relative(assemblyDirection, i) BlockPos bogeyPos = pos.relative(assemblyDirection, i)
.offset(up); .offset(up);
BlockState blockState = level.getBlockState(bogeyPos); BlockState blockState = level.getBlockState(bogeyPos);
if (blockState.getBlock()instanceof IBogeyBlock bogey) { if (blockState.getBlock() instanceof IBogeyBlock bogey) {
level.setBlock(bogeyPos, bogey.getRotatedBlockState(blockState, Direction.DOWN), 3); level.setBlock(bogeyPos, bogey.getRotatedBlockState(blockState, Direction.DOWN), 3);
bogey.playRotateSound(level, bogeyPos); bogey.playRotateSound(level, bogeyPos);
return true; return true;
@ -267,7 +268,7 @@ public class StationTileEntity extends SmartTileEntity implements ITransformable
return false; return false;
} }
BlockState bogeyAnchor = track.getBogeyAnchor(level, pos, state); BlockState bogeyAnchor = ProperWaterloggedBlock.withWater(level, track.getBogeyAnchor(level, pos, state), pos);
level.setBlock(pos.offset(up), bogeyAnchor, 3); level.setBlock(pos.offset(up), bogeyAnchor, 3);
player.displayClientMessage(Lang.translate("train_assembly.bogey_created"), true); player.displayClientMessage(Lang.translate("train_assembly.bogey_created"), true);
SoundType soundtype = bogeyAnchor.getBlock() SoundType soundtype = bogeyAnchor.getBlock()
@ -354,7 +355,7 @@ public class StationTileEntity extends SmartTileEntity implements ITransformable
} }
BlockState potentialBogeyState = level.getBlockState(bogeyOffset.offset(currentPos)); BlockState potentialBogeyState = level.getBlockState(bogeyOffset.offset(currentPos));
if (potentialBogeyState.getBlock()instanceof IBogeyBlock bogey && bogeyIndex < bogeyLocations.length) { if (potentialBogeyState.getBlock() instanceof IBogeyBlock bogey && bogeyIndex < bogeyLocations.length) {
bogeyTypes[bogeyIndex] = bogey; bogeyTypes[bogeyIndex] = bogey;
bogeyLocations[bogeyIndex] = i; bogeyLocations[bogeyIndex] = i;
bogeyIndex++; bogeyIndex++;
@ -677,7 +678,7 @@ public class StationTileEntity extends SmartTileEntity implements ITransformable
return true; return true;
BlockState target = edgePoint.getTrackBlockState(); BlockState target = edgePoint.getTrackBlockState();
if (!(target.getBlock()instanceof ITrackBlock def)) if (!(target.getBlock() instanceof ITrackBlock def))
return false; return false;
Vec3 axis = null; Vec3 axis = null;

View file

@ -5,6 +5,7 @@ import java.util.function.Supplier;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.networking.SimplePacketBase; import com.simibubi.create.foundation.networking.SimplePacketBase;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -36,8 +37,15 @@ public class ScheduleEditPacket extends SimplePacketBase {
ItemStack mainHandItem = sender.getMainHandItem(); ItemStack mainHandItem = sender.getMainHandItem();
if (!AllItems.SCHEDULE.isIn(mainHandItem)) if (!AllItems.SCHEDULE.isIn(mainHandItem))
return; return;
mainHandItem.getOrCreateTag()
.put("Schedule", schedule.write()); CompoundTag tag = mainHandItem.getOrCreateTag();
if (schedule.entries.isEmpty()) {
tag.remove("Schedule");
if (tag.isEmpty())
mainHandItem.setTag(null);
} else
tag.put("Schedule", schedule.write());
sender.getCooldowns() sender.getCooldowns()
.addCooldown(mainHandItem.getItem(), 5); .addCooldown(mainHandItem.getItem(), 5);
}); });

View file

@ -14,6 +14,7 @@ import com.simibubi.create.content.logistics.trains.IBogeyBlock;
import com.simibubi.create.content.logistics.trains.entity.BogeyInstance; import com.simibubi.create.content.logistics.trains.entity.BogeyInstance;
import com.simibubi.create.content.logistics.trains.entity.CarriageBogey; import com.simibubi.create.content.logistics.trains.entity.CarriageBogey;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.render.CachedBufferer; import com.simibubi.create.foundation.render.CachedBufferer;
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;
@ -26,6 +27,7 @@ import net.minecraft.core.Direction.Axis;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.Rotation;
@ -34,12 +36,14 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<StandardBogeyTileEntity> { public class StandardBogeyBlock extends Block
implements IBogeyBlock, ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock {
public static final EnumProperty<Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS; public static final EnumProperty<Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
private final boolean large; private final boolean large;
@ -47,11 +51,12 @@ public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<Standa
public StandardBogeyBlock(Properties p_i48440_1_, boolean large) { public StandardBogeyBlock(Properties p_i48440_1_, boolean large) {
super(p_i48440_1_); super(p_i48440_1_);
this.large = large; this.large = large;
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
} }
@Override @Override
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(AXIS); builder.add(AXIS, WATERLOGGED);
super.createBlockStateDefinition(builder); super.createBlockStateDefinition(builder);
} }
@ -63,6 +68,18 @@ public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<Standa
return state.getValue(BlockStateProperties.HORIZONTAL_AXIS) == Axis.X ? STICKY_X : STICKY_Z; return state.getValue(BlockStateProperties.HORIZONTAL_AXIS) == Axis.X ? STICKY_X : STICKY_Z;
} }
@Override
public BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState,
LevelAccessor pLevel, BlockPos pCurrentPos, BlockPos pNeighborPos) {
updateWater(pLevel, pState, pCurrentPos);
return pState;
}
@Override
public FluidState getFluidState(BlockState pState) {
return fluidState(pState);
}
@Override @Override
public double getWheelPointSpacing() { public double getWheelPointSpacing() {
return 2; return 2;

View file

@ -39,6 +39,7 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.station
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement; import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement; import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.block.render.DestroyProgressRenderingHandler; import com.simibubi.create.foundation.block.render.DestroyProgressRenderingHandler;
import com.simibubi.create.foundation.block.render.ReducedDestroyEffects; import com.simibubi.create.foundation.block.render.ReducedDestroyEffects;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
@ -84,6 +85,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.portal.PortalForcer; import net.minecraft.world.level.portal.PortalForcer;
import net.minecraft.world.level.portal.PortalInfo; import net.minecraft.world.level.portal.PortalInfo;
@ -98,7 +100,8 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IBlockRenderProperties; import net.minecraftforge.client.IBlockRenderProperties;
public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrackBlock, ISpecialBlockItemRequirement { public class TrackBlock extends Block
implements EntityBlock, IWrenchable, ITrackBlock, ISpecialBlockItemRequirement, ProperWaterloggedBlock {
public static final EnumProperty<TrackShape> SHAPE = EnumProperty.create("shape", TrackShape.class); public static final EnumProperty<TrackShape> SHAPE = EnumProperty.create("shape", TrackShape.class);
public static final BooleanProperty HAS_TE = BooleanProperty.create("turn"); public static final BooleanProperty HAS_TE = BooleanProperty.create("turn");
@ -106,12 +109,18 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
public TrackBlock(Properties p_49795_) { public TrackBlock(Properties p_49795_) {
super(p_49795_); super(p_49795_);
registerDefaultState(defaultBlockState().setValue(SHAPE, TrackShape.ZO) registerDefaultState(defaultBlockState().setValue(SHAPE, TrackShape.ZO)
.setValue(HAS_TE, false)); .setValue(HAS_TE, false)
.setValue(WATERLOGGED, false));
} }
@Override @Override
protected void createBlockStateDefinition(Builder<Block, BlockState> p_49915_) { protected void createBlockStateDefinition(Builder<Block, BlockState> p_49915_) {
super.createBlockStateDefinition(p_49915_.add(SHAPE, HAS_TE)); super.createBlockStateDefinition(p_49915_.add(SHAPE, HAS_TE, WATERLOGGED));
}
@Override
public FluidState getFluidState(BlockState state) {
return fluidState(state);
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -121,7 +130,8 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
@Override @Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) { public BlockState getStateForPlacement(BlockPlaceContext ctx) {
BlockState stateForPlacement = super.getStateForPlacement(ctx); BlockState stateForPlacement = withWater(super.getStateForPlacement(ctx), ctx);
if (ctx.getPlayer() == null) if (ctx.getPlayer() == null)
return stateForPlacement; return stateForPlacement;
@ -298,6 +308,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
@Override @Override
public BlockState updateShape(BlockState state, Direction pDirection, BlockState pNeighborState, public BlockState updateShape(BlockState state, Direction pDirection, BlockState pNeighborState,
LevelAccessor level, BlockPos pCurrentPos, BlockPos pNeighborPos) { LevelAccessor level, BlockPos pCurrentPos, BlockPos pNeighborPos) {
updateWater(level, state, pCurrentPos);
TrackShape shape = state.getValue(SHAPE); TrackShape shape = state.getValue(SHAPE);
if (!shape.isPortal()) if (!shape.isPortal())
return state; return state;
@ -424,7 +435,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
if (!entry.getValue() if (!entry.getValue()
.isInside(pos)) .isInside(pos))
continue; continue;
if (world.getBlockEntity(entry.getKey())instanceof StationTileEntity station) if (world.getBlockEntity(entry.getKey()) instanceof StationTileEntity station)
if (station.trackClicked(player, hand, this, state, pos)) if (station.trackClicked(player, hand, this, state, pos))
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} }
@ -440,7 +451,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
BlockPos girderPos = pPos.below() BlockPos girderPos = pPos.below()
.offset(vec3.z * side, 0, vec3.x * side); .offset(vec3.z * side, 0, vec3.x * side);
BlockState girderState = pLevel.getBlockState(girderPos); BlockState girderState = pLevel.getBlockState(girderPos);
if (girderState.getBlock()instanceof GirderBlock girderBlock if (girderState.getBlock() instanceof GirderBlock girderBlock
&& !blockTicks.hasScheduledTick(girderPos, girderBlock)) && !blockTicks.hasScheduledTick(girderPos, girderBlock))
pLevel.scheduleTick(girderPos, girderBlock, 1); pLevel.scheduleTick(girderPos, girderBlock, 1);
} }
@ -635,7 +646,7 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
Vec3 normal = null; Vec3 normal = null;
Vec3 offset = null; Vec3 offset = null;
if (bezierPoint != null && world.getBlockEntity(pos)instanceof TrackTileEntity trackTE) { if (bezierPoint != null && world.getBlockEntity(pos) instanceof TrackTileEntity trackTE) {
BezierConnection bc = trackTE.connections.get(bezierPoint.curveTarget()); BezierConnection bc = trackTE.connections.get(bezierPoint.curveTarget());
if (bc != null) { if (bc != null) {
double length = Mth.floor(bc.getLength() * 2); double length = Mth.floor(bc.getLength() * 2);
@ -698,7 +709,8 @@ public class TrackBlock extends Block implements EntityBlock, IWrenchable, ITrac
int girderAmount = 0; int girderAmount = 0;
if (te instanceof TrackTileEntity track) { if (te instanceof TrackTileEntity track) {
for (BezierConnection bezierConnection : track.getConnections().values()) { for (BezierConnection bezierConnection : track.getConnections()
.values()) {
if (!bezierConnection.isPrimary()) if (!bezierConnection.isPrimary())
continue; continue;
trackAmount += bezierConnection.getTrackItemCost(); trackAmount += bezierConnection.getTrackItemCost();

View file

@ -9,6 +9,7 @@ import java.util.Set;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.curiosities.girder.GirderBlock; import com.simibubi.create.content.curiosities.girder.GirderBlock;
import com.simibubi.create.content.logistics.trains.BezierConnection; import com.simibubi.create.content.logistics.trains.BezierConnection;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.Pair;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
@ -182,7 +183,7 @@ public class TrackPaver {
if (stateAtPos.getBlock() != state.getBlock() && stateAtPos.getMaterial() if (stateAtPos.getBlock() != state.getBlock() && stateAtPos.getMaterial()
.isReplaceable()) { .isReplaceable()) {
if (!simulate) if (!simulate)
level.setBlock(pos, state, 3); level.setBlock(pos, ProperWaterloggedBlock.withWater(level, state, pos), 3);
return true; return true;
} }
return false; return false;

View file

@ -13,6 +13,7 @@ import com.simibubi.create.CreateClient;
import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer; import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer;
import com.simibubi.create.content.logistics.trains.BezierConnection; import com.simibubi.create.content.logistics.trains.BezierConnection;
import com.simibubi.create.content.logistics.trains.ITrackBlock; import com.simibubi.create.content.logistics.trains.ITrackBlock;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
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;
@ -504,7 +505,7 @@ public class TrackPlacement {
} }
if (canPlace) if (canPlace)
level.setBlock(offsetPos, toPlace, 3); level.setBlock(offsetPos, ProperWaterloggedBlock.withWater(level, toPlace, offsetPos), 3);
} }
} }
@ -513,14 +514,14 @@ public class TrackPlacement {
if (!simulate) { if (!simulate) {
BlockState stateAtPos = level.getBlockState(targetPos1); BlockState stateAtPos = level.getBlockState(targetPos1);
level.setBlock(targetPos1, level.setBlock(targetPos1, ProperWaterloggedBlock.withWater(level,
(stateAtPos.getBlock() == state1.getBlock() ? stateAtPos : state1).setValue(TrackBlock.HAS_TE, true), (stateAtPos.getBlock() == state1.getBlock() ? stateAtPos : state1).setValue(TrackBlock.HAS_TE, true),
3); targetPos1), 3);
stateAtPos = level.getBlockState(targetPos2); stateAtPos = level.getBlockState(targetPos2);
level.setBlock(targetPos2, level.setBlock(targetPos2, ProperWaterloggedBlock.withWater(level,
(stateAtPos.getBlock() == state2.getBlock() ? stateAtPos : state2).setValue(TrackBlock.HAS_TE, true), (stateAtPos.getBlock() == state2.getBlock() ? stateAtPos : state2).setValue(TrackBlock.HAS_TE, true),
3); targetPos2), 3);
} }
BlockEntity te1 = level.getBlockEntity(targetPos1); BlockEntity te1 = level.getBlockEntity(targetPos1);

View file

@ -0,0 +1,48 @@
package com.simibubi.create.foundation.block;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
/**
* Waterlog checklist: <br>
* 1. createBlockStateDefinition -> add WATERLOGGED <br>
* 2. constructor -> default WATERLOGGED to false <br>
* 3. getFluidState -> return fluidState <br>
* 4. getStateForPlacement -> call withWater <br>
* 5. updateShape -> call updateWater
*/
public interface ProperWaterloggedBlock extends SimpleWaterloggedBlock {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
default FluidState fluidState(BlockState state) {
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState();
}
default void updateWater(LevelAccessor level, BlockState state, BlockPos pos) {
if (state.getValue(BlockStateProperties.WATERLOGGED))
level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
}
default BlockState withWater(BlockState placementState, BlockPlaceContext ctx) {
return withWater(ctx.getLevel(), placementState, ctx.getClickedPos());
}
public static BlockState withWater(LevelAccessor level, BlockState placementState, BlockPos pos) {
if (placementState == null)
return null;
if (!(placementState.getBlock() instanceof SimpleWaterloggedBlock))
return null;
FluidState ifluidstate = level.getFluidState(pos);
return placementState.setValue(BlockStateProperties.WATERLOGGED,
Boolean.valueOf(ifluidstate.getType() == Fluids.WATER));
}
}