mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 13:04:19 +01:00
Controlling the Assembler
This commit is contained in:
parent
f3653d6b15
commit
0fe8a24041
@ -39,7 +39,7 @@ b8dd6e505943e06706d0718ece620ab3cf943650 assets/create/blockstates/brass_casing.
|
||||
11ebdd9bd0815833e62ec1bea03a4cdd86ce00f3 assets/create/blockstates/brown_sail.json
|
||||
e81608346d43406ee72cae0f78b8bcfb37ba2d75 assets/create/blockstates/brown_seat.json
|
||||
322289524c058fac66bbe76b4924c3b0c0c33b84 assets/create/blockstates/brown_valve_handle.json
|
||||
26f3b6a8f8249e4e622ab200057d75e228762817 assets/create/blockstates/cart_assembler.json
|
||||
1ef072f86d95fd84638bbb6c298603eb311d1e53 assets/create/blockstates/cart_assembler.json
|
||||
7299cea212d879d6d5611bd139b24768b9af236f assets/create/blockstates/chiseled_dark_scoria.json
|
||||
0f01f813388d3e6907c1cfd992e4b21c914e267e assets/create/blockstates/chiseled_dolomite.json
|
||||
324488e0c228f38f2597b2f76849e962bc1a7d90 assets/create/blockstates/chiseled_gabbro.json
|
||||
@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
|
||||
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
|
||||
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
|
||||
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json
|
||||
499aade14db59f62b46e8a266998feb41e1922a1 assets/create/blockstates/fluid_pipe.json
|
||||
3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json
|
||||
f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
|
||||
5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json
|
||||
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
|
||||
@ -335,7 +335,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
|
||||
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
|
||||
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
|
||||
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
|
||||
9e7ea57c58889fa0021e3c4f19da3f763108399f assets/create/blockstates/radial_chassis.json
|
||||
8d7e653bfd9846e684a0d3725595714a19201017 assets/create/blockstates/radial_chassis.json
|
||||
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
|
||||
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
|
||||
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
|
||||
|
@ -24,36 +24,66 @@
|
||||
"powered=true,rail_type=activator_rail,shape=north_south": {
|
||||
"model": "create:block/cart_assembler/block_activator_rail_powered"
|
||||
},
|
||||
"powered=false,rail_type=controller_rail,shape=north_south": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail"
|
||||
},
|
||||
"powered=true,rail_type=controller_rail,shape=north_south": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail_powered"
|
||||
},
|
||||
"powered=false,rail_type=controller_rail_backwards,shape=north_south": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail",
|
||||
"y": 180
|
||||
},
|
||||
"powered=true,rail_type=controller_rail_backwards,shape=north_south": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail_powered",
|
||||
"y": 180
|
||||
},
|
||||
"powered=false,rail_type=regular,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_regular",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=true,rail_type=regular,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_regular_powered",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=false,rail_type=powered_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_powered_rail",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=true,rail_type=powered_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_powered_rail_powered",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=false,rail_type=detector_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_detector_rail",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=true,rail_type=detector_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_detector_rail_powered",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=false,rail_type=activator_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_activator_rail",
|
||||
"y": 90
|
||||
"y": 270
|
||||
},
|
||||
"powered=true,rail_type=activator_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_activator_rail_powered",
|
||||
"y": 270
|
||||
},
|
||||
"powered=false,rail_type=controller_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail",
|
||||
"y": 270
|
||||
},
|
||||
"powered=true,rail_type=controller_rail,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail_powered",
|
||||
"y": 270
|
||||
},
|
||||
"powered=false,rail_type=controller_rail_backwards,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail",
|
||||
"y": 90
|
||||
},
|
||||
"powered=true,rail_type=controller_rail_backwards,shape=east_west": {
|
||||
"model": "create:block/cart_assembler/block_controller_rail_powered",
|
||||
"y": 90
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "true",
|
||||
"down": "false",
|
||||
"up": "true"
|
||||
"north": "true",
|
||||
"up": "true",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lu_x"
|
||||
@ -71,10 +71,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"north": "false",
|
||||
"down": "false",
|
||||
"up": "true"
|
||||
"north": "false",
|
||||
"up": "true",
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ru_x"
|
||||
@ -82,10 +82,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "true",
|
||||
"down": "true",
|
||||
"up": "false"
|
||||
"north": "true",
|
||||
"up": "false",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ld_x"
|
||||
@ -93,10 +93,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"north": "false",
|
||||
"down": "true",
|
||||
"up": "false"
|
||||
"north": "false",
|
||||
"up": "false",
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/rd_x"
|
||||
@ -104,10 +104,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "false",
|
||||
"down": "true",
|
||||
"up": "true"
|
||||
"north": "false",
|
||||
"up": "true",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_x"
|
||||
@ -115,10 +115,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "false",
|
||||
"down": "false",
|
||||
"up": "true"
|
||||
"north": "false",
|
||||
"up": "true",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_x"
|
||||
@ -126,10 +126,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "false",
|
||||
"down": "true",
|
||||
"up": "false"
|
||||
"north": "false",
|
||||
"up": "false",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_x"
|
||||
@ -137,10 +137,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"down": "false",
|
||||
"north": "true",
|
||||
"down": "false",
|
||||
"up": "false"
|
||||
"up": "false",
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_x"
|
||||
@ -148,10 +148,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"down": "false",
|
||||
"north": "true",
|
||||
"down": "false",
|
||||
"up": "false"
|
||||
"up": "false",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_x"
|
||||
@ -159,10 +159,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"north": "false",
|
||||
"down": "false",
|
||||
"up": "false"
|
||||
"north": "false",
|
||||
"up": "false",
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_x"
|
||||
@ -170,10 +170,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"north": "false",
|
||||
"down": "false",
|
||||
"up": "false"
|
||||
"north": "false",
|
||||
"up": "false",
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/none_x"
|
||||
@ -181,10 +181,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"north": "false",
|
||||
"east": "false"
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lu_y"
|
||||
@ -192,10 +192,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"north": "false",
|
||||
"east": "true"
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ru_y"
|
||||
@ -203,10 +203,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"north": "true",
|
||||
"east": "false"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ld_y"
|
||||
@ -214,10 +214,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"north": "true",
|
||||
"east": "true"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/rd_y"
|
||||
@ -225,10 +225,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"north": "true",
|
||||
"east": "false"
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_y"
|
||||
@ -236,10 +236,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "true",
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"north": "false",
|
||||
"east": "false"
|
||||
"south": "true"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_y"
|
||||
@ -247,10 +247,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"north": "true",
|
||||
"east": "false"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/ud_y"
|
||||
@ -258,10 +258,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "true",
|
||||
"east": "true",
|
||||
"north": "false",
|
||||
"east": "true"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_y"
|
||||
@ -269,10 +269,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"north": "false",
|
||||
"east": "false"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_y"
|
||||
@ -280,10 +280,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"north": "false",
|
||||
"east": "true"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/lr_y"
|
||||
@ -291,10 +291,10 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"south": "false",
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"north": "false",
|
||||
"east": "false"
|
||||
"south": "false"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/fluid_pipe/none_y"
|
||||
@ -303,8 +303,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"down": "false",
|
||||
"east": "true",
|
||||
"up": "true"
|
||||
},
|
||||
"apply": {
|
||||
@ -314,8 +314,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"down": "false",
|
||||
"east": "false",
|
||||
"up": "true"
|
||||
},
|
||||
"apply": {
|
||||
@ -325,8 +325,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"down": "true",
|
||||
"east": "true",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -336,8 +336,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"down": "true",
|
||||
"east": "false",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -347,8 +347,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"down": "true",
|
||||
"east": "false",
|
||||
"up": "true"
|
||||
},
|
||||
"apply": {
|
||||
@ -358,8 +358,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"down": "false",
|
||||
"east": "false",
|
||||
"up": "true"
|
||||
},
|
||||
"apply": {
|
||||
@ -369,8 +369,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"down": "true",
|
||||
"east": "false",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -380,8 +380,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "true",
|
||||
"east": "true",
|
||||
"down": "false",
|
||||
"east": "true",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -391,8 +391,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "true",
|
||||
"down": "false",
|
||||
"east": "true",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -402,8 +402,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "true",
|
||||
"east": "false",
|
||||
"down": "false",
|
||||
"east": "false",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
@ -413,8 +413,8 @@
|
||||
{
|
||||
"when": {
|
||||
"west": "false",
|
||||
"east": "false",
|
||||
"down": "false",
|
||||
"east": "false",
|
||||
"up": "false"
|
||||
},
|
||||
"apply": {
|
||||
|
@ -89,8 +89,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_west": "true"
|
||||
"sticky_west": "true",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky",
|
||||
@ -99,8 +99,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_west": "true"
|
||||
"sticky_west": "true",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y_sticky",
|
||||
@ -109,8 +109,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_west": "true"
|
||||
"sticky_west": "true",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_z_sticky",
|
||||
@ -119,8 +119,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_west": "false"
|
||||
"sticky_west": "false",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x",
|
||||
@ -129,8 +129,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_west": "false"
|
||||
"sticky_west": "false",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y",
|
||||
@ -139,8 +139,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_west": "false"
|
||||
"sticky_west": "false",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_z",
|
||||
@ -149,8 +149,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky"
|
||||
@ -158,8 +158,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y_sticky",
|
||||
@ -168,8 +168,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_north": "true"
|
||||
"sticky_north": "true",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x_sticky",
|
||||
@ -178,8 +178,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "x",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "x"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x"
|
||||
@ -187,8 +187,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "y",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "y"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_y",
|
||||
@ -197,8 +197,8 @@
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"axis": "z",
|
||||
"sticky_north": "false"
|
||||
"sticky_north": "false",
|
||||
"axis": "z"
|
||||
},
|
||||
"apply": {
|
||||
"model": "create:block/radial_chassis_side_x",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:block/controller_rail_item"
|
||||
"layer0": "create:block/controller_rail"
|
||||
}
|
||||
}
|
@ -1,27 +1,54 @@
|
||||
package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum CartAssembleRailType implements IStringSerializable {
|
||||
|
||||
REGULAR(Blocks.RAIL),
|
||||
POWERED_RAIL(Blocks.POWERED_RAIL),
|
||||
DETECTOR_RAIL(Blocks.DETECTOR_RAIL),
|
||||
ACTIVATOR_RAIL(Blocks.ACTIVATOR_RAIL),
|
||||
CONTROLLER_RAIL(AllBlocks.CONTROLLER_RAIL, blockState -> AllBlocks.CONTROLLER_RAIL.has(blockState)
|
||||
&& blockState.has(ControllerRailBlock.BACKWARDS) && !blockState.get(ControllerRailBlock.BACKWARDS)),
|
||||
CONTROLLER_RAIL_BACKWARDS(AllBlocks.CONTROLLER_RAIL, blockState -> AllBlocks.CONTROLLER_RAIL.has(blockState)
|
||||
&& blockState.has(ControllerRailBlock.BACKWARDS) && blockState.get(ControllerRailBlock.BACKWARDS))
|
||||
|
||||
;
|
||||
|
||||
public Block railBlock;
|
||||
public Item railItem;
|
||||
private final Supplier<Block> railBlockSupplier;
|
||||
private final Supplier<Item> railItemSupplier;
|
||||
public final Predicate<BlockState> matches;
|
||||
|
||||
private CartAssembleRailType(Block block) {
|
||||
this.railBlock = block;
|
||||
this.railItem = block.asItem();
|
||||
CartAssembleRailType(Block block) {
|
||||
this.railBlockSupplier = () -> block;
|
||||
this.railItemSupplier = block::asItem;
|
||||
this.matches = blockState -> blockState.getBlock() == getBlock();
|
||||
}
|
||||
|
||||
CartAssembleRailType(BlockEntry<?> block, Predicate<BlockState> matches) {
|
||||
this.railBlockSupplier = block::get;
|
||||
this.railItemSupplier = () -> block.get().asItem();
|
||||
this.matches = matches;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return railBlockSupplier.get();
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return railItemSupplier.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,13 +1,5 @@
|
||||
package com.simibubi.create.content.contraptions.components.structureMovement.mounted;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
@ -16,6 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.mou
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.CouplingHandler;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
@ -24,7 +17,6 @@ import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -45,16 +37,9 @@ import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
@ -66,6 +51,13 @@ import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootParameters;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CartAssemblerBlock extends AbstractRailBlock
|
||||
implements ITE<CartAssemblerTileEntity>, IWrenchable, ISpecialBlockItemRequirement {
|
||||
|
||||
@ -88,13 +80,17 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
}
|
||||
|
||||
private static Item getRailItem(BlockState state) {
|
||||
return state.get(RAIL_TYPE).railItem;
|
||||
return state.get(RAIL_TYPE).getItem();
|
||||
}
|
||||
|
||||
public static BlockState getRailBlock(BlockState state) {
|
||||
AbstractRailBlock railBlock = (AbstractRailBlock) state.get(RAIL_TYPE).railBlock;
|
||||
return railBlock.getDefaultState()
|
||||
AbstractRailBlock railBlock = (AbstractRailBlock) state.get(RAIL_TYPE).getBlock();
|
||||
BlockState railState = railBlock.getDefaultState()
|
||||
.with(railBlock.getShapeProperty(), state.get(RAIL_SHAPE));
|
||||
if (railState.has(ControllerRailBlock.BACKWARDS)) {
|
||||
railState = railState.with(ControllerRailBlock.BACKWARDS, state.get(RAIL_TYPE) == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS);
|
||||
}
|
||||
return railState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -140,6 +136,11 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
float speed = getRailMaxSpeed(state, world, pos, cart);
|
||||
cart.setMotion(facing.getXOffset() * speed, facing.getYOffset() * speed, facing.getZOffset() * speed);
|
||||
}
|
||||
if (action == CartAssemblerAction.ASSEMBLE_ACCELERATE_DIRECTIONAL) {
|
||||
Vec3i accelerationVector = ControllerRailBlock.getAccelerationVector(AllBlocks.CONTROLLER_RAIL.getDefaultState().with(ControllerRailBlock.SHAPE, state.get(RAIL_SHAPE)).with(ControllerRailBlock.BACKWARDS, state.get(RAIL_TYPE) == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS));
|
||||
float speed = getRailMaxSpeed(state, world, pos, cart);
|
||||
cart.setMotion(new Vec3d(accelerationVector).scale(speed));
|
||||
}
|
||||
if (action == CartAssemblerAction.DISASSEMBLE_BRAKE) {
|
||||
Vec3d diff = VecHelper.getCenterOf(pos)
|
||||
.subtract(cart.getPositionVec());
|
||||
@ -150,10 +151,10 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
}
|
||||
|
||||
public enum CartAssemblerAction {
|
||||
ASSEMBLE, DISASSEMBLE, ASSEMBLE_ACCELERATE, DISASSEMBLE_BRAKE, PASS;
|
||||
ASSEMBLE, DISASSEMBLE, ASSEMBLE_ACCELERATE, DISASSEMBLE_BRAKE, ASSEMBLE_ACCELERATE_DIRECTIONAL, PASS;
|
||||
|
||||
public boolean shouldAssemble() {
|
||||
return this == ASSEMBLE || this == ASSEMBLE_ACCELERATE;
|
||||
return this == ASSEMBLE || this == ASSEMBLE_ACCELERATE || this == ASSEMBLE_ACCELERATE_DIRECTIONAL;
|
||||
}
|
||||
|
||||
public boolean shouldDisassemble() {
|
||||
@ -178,6 +179,9 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
return cart.getPassengers()
|
||||
.isEmpty() ? CartAssemblerAction.ASSEMBLE_ACCELERATE : CartAssemblerAction.DISASSEMBLE;
|
||||
|
||||
if (type == CartAssembleRailType.CONTROLLER_RAIL || type == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS)
|
||||
return powered ? CartAssemblerAction.ASSEMBLE_ACCELERATE_DIRECTIONAL : CartAssemblerAction.DISASSEMBLE_BRAKE;
|
||||
|
||||
return CartAssemblerAction.PASS;
|
||||
}
|
||||
|
||||
@ -197,7 +201,7 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
|
||||
CartAssembleRailType newType = null;
|
||||
for (CartAssembleRailType type : CartAssembleRailType.values())
|
||||
if (heldItem == type.railItem)
|
||||
if (heldItem == type.getItem())
|
||||
newType = type;
|
||||
if (newType == null)
|
||||
return ActionResultType.PASS;
|
||||
@ -448,4 +452,22 @@ public class CartAssemblerBlock extends AbstractRailBlock
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
|
||||
World world = context.getWorld();
|
||||
if (world.isRemote)
|
||||
return ActionResultType.SUCCESS;
|
||||
BlockPos pos = context.getPos();
|
||||
BlockState newState = state.with(RAIL_SHAPE, state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
|
||||
if (state.get(RAIL_TYPE) == CartAssembleRailType.CONTROLLER_RAIL || state.get(RAIL_TYPE) == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS) {
|
||||
newState = newState.with(RAIL_TYPE, AllBlocks.CONTROLLER_RAIL.get().rotate(AllBlocks.CONTROLLER_RAIL.getDefaultState()
|
||||
.with(ControllerRailBlock.SHAPE, state.get(RAIL_SHAPE)).with(ControllerRailBlock.BACKWARDS,
|
||||
state.get(RAIL_TYPE) == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS), Rotation.CLOCKWISE_90)
|
||||
.get(ControllerRailBlock.BACKWARDS) ? CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS : CartAssembleRailType.CONTROLLER_RAIL);
|
||||
}
|
||||
context.getWorld().setBlockState(pos, newState, 3);
|
||||
world.notifyNeighborsOfStateChange(pos.down(), this);
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class CartAssemblerBlockItem extends BlockItem {
|
||||
.with(CartAssemblerBlock.RAIL_SHAPE, shape);
|
||||
CartAssembleRailType newType = null;
|
||||
for (CartAssembleRailType type : CartAssembleRailType.values())
|
||||
if (block == type.railBlock)
|
||||
if (type.matches.test(state))
|
||||
newType = type;
|
||||
if (newType == null)
|
||||
return false;
|
||||
|
@ -55,7 +55,7 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl
|
||||
.with(SHAPE, NORTH_SOUTH));
|
||||
}
|
||||
|
||||
private static Vec3i getAccelerationVector(BlockState state) {
|
||||
public static Vec3i getAccelerationVector(BlockState state) {
|
||||
Direction pointingTo = getPointingTowards(state);
|
||||
return (isStateBackwards(state) ? pointingTo.getOpposite() : pointingTo).getDirectionVec();
|
||||
}
|
||||
|
@ -209,12 +209,17 @@ public class BlockStateGen {
|
||||
CartAssembleRailType type = state.get(CartAssemblerBlock.RAIL_TYPE);
|
||||
Boolean powered = state.get(CartAssemblerBlock.POWERED);
|
||||
RailShape shape = state.get(CartAssemblerBlock.RAIL_SHAPE);
|
||||
int yRotation = shape == RailShape.EAST_WEST ? 270 : 0;
|
||||
if (type == CartAssembleRailType.CONTROLLER_RAIL_BACKWARDS) {
|
||||
yRotation += 180;
|
||||
type = CartAssembleRailType.CONTROLLER_RAIL;
|
||||
}
|
||||
|
||||
return ConfiguredModel.builder()
|
||||
.modelFile(p.models()
|
||||
.getExistingFile(p
|
||||
.modLoc("block/" + c.getName() + "/block_" + type.getName() + (powered ? "_powered" : ""))))
|
||||
.rotationY(shape == RailShape.EAST_WEST ? 90 : 0)
|
||||
.rotationY(yRotation % 360)
|
||||
.build();
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "create:block/cart_assembler/block",
|
||||
"textures": {
|
||||
"rail": "create:block/controller_rail"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"parent": "create:block/cart_assembler/block",
|
||||
"textures": {
|
||||
"clutch_off": "create:block/clutch_on",
|
||||
"rail": "create:block/controller_rail_powered"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 328 B |
Binary file not shown.
After Width: | Height: | Size: 703 B |
Loading…
Reference in New Issue
Block a user