diff --git a/src/generated/resources/assets/create/blockstates/controller_rail.json b/src/generated/resources/assets/create/blockstates/controller_rail.json new file mode 100644 index 000000000..65f6ee81b --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/controller_rail.json @@ -0,0 +1,724 @@ +{ + "variants": { + "backwards=false,power=0,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_off" + }, + "backwards=true,power=0,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 180 + }, + "backwards=false,power=1,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=1,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=2,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=2,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=3,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=3,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=4,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=4,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=5,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=5,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=6,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=6,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=7,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=7,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=8,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=8,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=9,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=9,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=10,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=10,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=11,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=11,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=12,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=12,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=13,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=13,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=14,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog" + }, + "backwards=true,power=14,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 180 + }, + "backwards=false,power=15,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_on" + }, + "backwards=true,power=15,shape=north_south": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 180 + }, + "backwards=false,power=0,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 270 + }, + "backwards=true,power=0,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_off", + "y": 90 + }, + "backwards=false,power=1,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=1,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=2,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=2,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=3,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=3,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=4,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=4,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=5,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=5,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=6,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=6,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=7,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=7,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=8,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=8,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=9,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=9,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=10,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=10,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=11,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=11,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=12,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=12,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=13,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=13,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=14,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 270 + }, + "backwards=true,power=14,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_analog", + "y": 90 + }, + "backwards=false,power=15,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 270 + }, + "backwards=true,power=15,shape=east_west": { + "model": "create:block/controller_rail/block_north_south_on", + "y": 90 + }, + "backwards=false,power=0,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 90 + }, + "backwards=true,power=0,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 270 + }, + "backwards=false,power=1,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=1,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=2,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=2,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=3,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=3,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=4,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=4,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=5,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=5,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=6,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=6,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=7,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=7,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=8,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=8,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=9,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=9,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=10,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=10,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=11,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=11,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=12,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=12,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=13,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=13,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=14,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 90 + }, + "backwards=true,power=14,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 270 + }, + "backwards=false,power=15,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 90 + }, + "backwards=true,power=15,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 270 + }, + "backwards=false,power=0,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 270 + }, + "backwards=true,power=0,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 90 + }, + "backwards=false,power=1,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=1,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=2,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=2,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=3,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=3,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=4,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=4,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=5,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=5,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=6,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=6,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=7,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=7,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=8,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=8,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=9,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=9,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=10,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=10,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=11,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=11,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=12,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=12,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=13,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=13,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=14,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 270 + }, + "backwards=true,power=14,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 90 + }, + "backwards=false,power=15,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 270 + }, + "backwards=true,power=15,shape=ascending_west": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 90 + }, + "backwards=false,power=0,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_off" + }, + "backwards=true,power=0,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_off", + "y": 180 + }, + "backwards=false,power=1,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=1,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=2,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=2,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=3,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=3,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=4,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=4,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=5,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=5,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=6,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=6,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=7,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=7,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=8,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=8,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=9,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=9,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=10,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=10,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=11,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=11,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=12,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=12,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=13,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=13,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=14,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_analog" + }, + "backwards=true,power=14,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_analog", + "y": 180 + }, + "backwards=false,power=15,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_north_on" + }, + "backwards=true,power=15,shape=ascending_north": { + "model": "create:block/controller_rail/block_ascending_south_on", + "y": 180 + }, + "backwards=false,power=0,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_off", + "y": 180 + }, + "backwards=true,power=0,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_off" + }, + "backwards=false,power=1,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=1,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=2,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=2,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=3,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=3,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=4,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=4,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=5,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=5,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=6,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=6,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=7,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=7,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=8,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=8,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=9,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=9,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=10,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=10,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=11,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=11,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=12,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=12,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=13,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=13,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=14,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_analog", + "y": 180 + }, + "backwards=true,power=14,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_analog" + }, + "backwards=false,power=15,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_north_on", + "y": 180 + }, + "backwards=true,power=15,shape=ascending_south": { + "model": "create:block/controller_rail/block_ascending_south_on" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index fa8fb5569..3ebfed1c9 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -50,6 +50,7 @@ "block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186", "block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186", "block.create.content_observer": "\u0279\u01DD\u028C\u0279\u01DDsqO \u0287u\u01DD\u0287uo\u0186", + "block.create.controller_rail": "\u05DF\u0131\u0250\u1D1A \u0279\u01DD\u05DF\u05DFo\u0279\u0287uo\u0186", "block.create.copper_block": "\u029E\u0254o\u05DF\u15FA \u0279\u01DDddo\u0186", "block.create.copper_casing": "bu\u0131s\u0250\u0186 \u0279\u01DDddo\u0186", "block.create.copper_ore": "\u01DD\u0279O \u0279\u01DDddo\u0186", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 52cae1510..e9a1b628d 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -53,6 +53,7 @@ "block.create.clutch": "Clutch", "block.create.cogwheel": "Cogwheel", "block.create.content_observer": "Content Observer", + "block.create.controller_rail": "Controller Rail", "block.create.copper_block": "Copper Block", "block.create.copper_casing": "Copper Casing", "block.create.copper_ore": "Copper Ore", diff --git a/src/generated/resources/assets/create/models/item/controller_rail.json b/src/generated/resources/assets/create/models/item/controller_rail.json new file mode 100644 index 000000000..3524bff1a --- /dev/null +++ b/src/generated/resources/assets/create/models/item/controller_rail.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json b/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json new file mode 100644 index 000000000..d68ce3cec --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/controller_rail.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:controller_rail" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/rails.json b/src/generated/resources/data/minecraft/tags/blocks/rails.json index c75102c53..9f6c12628 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/rails.json +++ b/src/generated/resources/data/minecraft/tags/blocks/rails.json @@ -2,6 +2,7 @@ "replace": false, "values": [ "create:cart_assembler", - "create:reinforced_rail" + "create:reinforced_rail", + "create:controller_rail" ] } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 83755b480..79aaac79a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -61,6 +61,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonHeadBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock; +import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; 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.waterwheel.WaterWheelBlock; @@ -736,6 +737,16 @@ public class AllBlocks { .build() .register(); + public static final BlockEntry CONTROLLER_RAIL = + REGISTRATE.block("controller_rail", ControllerRailBlock::new) + .initialProperties(() -> Blocks.POWERED_RAIL) + .blockstate(BlockStateGen.controllerRail()) + .addLayer(() -> RenderType::getCutoutMipped) + .tag(BlockTags.RAILS) + .item() + .model((c, p) -> p.generated(c, Create.asResource("block/controller_rail_analog"))) + .build().register(); + public static final BlockEntry MINECART_ANCHOR = REGISTRATE.block("minecart_anchor", MinecartAnchorBlock::new) .initialProperties(SharedProperties::stone) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index 529a99e66..10dbe64a9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -43,6 +43,7 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; @@ -257,26 +258,38 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat @OnlyIn(Dist.CLIENT) private void triggerPlaceBlock(PlayerEntity player, Hand hand) { - if (player instanceof ClientPlayerEntity && player.world instanceof ClientWorld) { - ClientPlayerEntity cPlayer = (ClientPlayerEntity) player; - Minecraft mc = Minecraft.getInstance(); - RayTraceResult ray = - cPlayer.pick(mc.playerController.getBlockReachDistance(), mc.getRenderPartialTicks(), false); - if (ray instanceof BlockRayTraceResult) { - for (Hand handIn : Hand.values()) { - ItemStack itemstack = cPlayer.getHeldItem(handIn); - int countBefore = itemstack.getCount(); - ActionResultType actionResultType = mc.playerController.func_217292_a(cPlayer, - (ClientWorld) cPlayer.world, handIn, (BlockRayTraceResult) ray); - if (actionResultType == ActionResultType.SUCCESS) { - cPlayer.swingArm(handIn); - if (!itemstack.isEmpty() - && (itemstack.getCount() != countBefore || mc.playerController.isInCreativeMode())) - mc.gameRenderer.itemRenderer.resetEquippedProgress(handIn); - return; - } - } - } + if (!(player instanceof ClientPlayerEntity)) + return; + if (!(player.world instanceof ClientWorld)) + return; + + ClientPlayerEntity cPlayer = (ClientPlayerEntity) player; + Minecraft mc = Minecraft.getInstance(); + RayTraceResult ray = + cPlayer.pick(mc.playerController.getBlockReachDistance(), mc.getRenderPartialTicks(), false); + + if (!(ray instanceof BlockRayTraceResult)) + return; + if (ray.getType() == Type.MISS) + return; + BlockRayTraceResult blockRay = (BlockRayTraceResult) ray; + if (!blockRay.getPos() + .offset(blockRay.getFace()) + .equals(getHangingPosition())) + return; + + for (Hand handIn : Hand.values()) { + ItemStack itemstack = cPlayer.getHeldItem(handIn); + int countBefore = itemstack.getCount(); + ActionResultType actionResultType = + mc.playerController.func_217292_a(cPlayer, (ClientWorld) cPlayer.world, handIn, blockRay); + if (actionResultType != ActionResultType.SUCCESS) + return; + + cPlayer.swingArm(handIn); + if (!itemstack.isEmpty() && (itemstack.getCount() != countBefore || mc.playerController.isInCreativeMode())) + mc.gameRenderer.itemRenderer.resetEquippedProgress(handIn); + return; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java index 088b3d06a..7ab4d1bbe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java @@ -11,8 +11,10 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.MoverType; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.state.properties.RailShape; +import net.minecraft.tags.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class CouplingPhysics { @@ -23,12 +25,18 @@ public class CouplingPhysics { public static void tickCoupling(World world, Couple c) { Couple carts = c.map(MinecartController::cart); - float couplingLength = c.getFirst().getCouplingLength(true); + float couplingLength = c.getFirst() + .getCouplingLength(true); softCollisionStep(world, carts, couplingLength); + if (world.isRemote) + return; hardCollisionStep(world, carts, couplingLength); } public static void hardCollisionStep(World world, Couple carts, double couplingLength) { + if (!MinecartSim2020.canAddMotion(carts.get(false)) && MinecartSim2020.canAddMotion(carts.get(true))) + carts = carts.swap(); + Couple corrections = Couple.create(null, null); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); boolean firstLoop = true; @@ -39,6 +47,9 @@ public class CouplingPhysics { float stress = (float) (couplingLength - cart.getPositionVec() .distanceTo(otherCart.getPositionVec())); + if (Math.abs(stress) < 1 / 8f) + continue; + RailShape shape = null; BlockPos railPosition = cart.getCurrentRailPosition(); BlockState railState = world.getBlockState(railPosition.up()); @@ -53,7 +64,12 @@ public class CouplingPhysics { Vector3d link = otherCart.getPositionVec() .subtract(pos); float correctionMagnitude = firstLoop ? -stress / 2f : -stress; - correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos) + + if (!MinecartSim2020.canAddMotion(cart)) + correctionMagnitude /= 2; + + correction = shape != null + ? followLinkOnRail(link, pos, correctionMagnitude, MinecartSim2020.getRailVec(shape)).subtract(pos) : link.normalize() .scale(correctionMagnitude); @@ -75,27 +91,30 @@ public class CouplingPhysics { } public static void softCollisionStep(World world, Couple carts, double couplingLength) { - - Couple positions = carts.map(Entity::getPositionVec); Couple maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail); Couple canAddmotion = carts.map(MinecartSim2020::canAddMotion); + Couple motions = carts.map(Entity::getMotion); + Couple nextPositions = carts.map(MinecartSim2020::predictNextPositionOf); - Couple shapes = carts.map(current -> { - BlockPos railPosition = current.getCurrentRailPosition(); + Couple shapes = carts.mapWithContext((cart, current) -> { + AbstractMinecartEntity minecart = cart.getMinecart(); + Vector3d vec = nextPositions.get(current); + int x = MathHelper.floor(vec.getX()); + int y = MathHelper.floor(vec.getY()); + int z = MathHelper.floor(vec.getZ()); + BlockPos pos = new BlockPos(x, y - 1, z); + if (minecart.world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down(); + BlockPos railPosition = pos; BlockState railState = world.getBlockState(railPosition.up()); if (!(railState.getBlock() instanceof AbstractRailBlock)) return null; AbstractRailBlock block = (AbstractRailBlock) railState.getBlock(); - return block.getRailDirection(railState, world, railPosition, current); + return block.getRailDirection(railState, world, railPosition, cart); }); - Couple motions = carts.map(MinecartSim2020::predictMotionOf); - Couple nextPositions = positions.copy(); - nextPositions.replaceWithParams(Vector3d::add, motions); - float futureStress = (float) (couplingLength - nextPositions.getFirst() .distanceTo(nextPositions.getSecond())); - if (Math.abs(futureStress) < 1 / 128f) + if (MathHelper.epsilonEquals(futureStress, 0D)) return; for (boolean current : Iterate.trueAndFalse) { @@ -107,12 +126,19 @@ public class CouplingPhysics { if (canAddmotion.get(current) != canAddmotion.get(!current)) correctionMagnitude = !canAddmotion.get(current) ? 0 : correctionMagnitude * 2; + if (!canAddmotion.get(current)) + continue; RailShape shape = shapes.get(current); - correction = shape != null ? followLinkOnRail(link, pos, correctionMagnitude, shape).subtract(pos) - : link.normalize() + if (shape != null) { + Vector3d railVec = MinecartSim2020.getRailVec(shape); + correction = followLinkOnRail(link, pos, correctionMagnitude, railVec).subtract(pos); + } else + correction = link.normalize() .scale(correctionMagnitude); + correction = VecHelper.clamp(correction, maxSpeed.get(current)); + motions.set(current, motions.get(current) .add(correction)); } @@ -121,8 +147,7 @@ public class CouplingPhysics { carts.forEachWithParams(Entity::setMotion, motions); } - public static Vector3d followLinkOnRail(Vector3d link, Vector3d cart, float diffToReduce, RailShape shape) { - Vector3d railAxis = MinecartSim2020.getRailVec(shape); + public static Vector3d followLinkOnRail(Vector3d link, Vector3d cart, float diffToReduce, Vector3d railAxis) { double dotProduct = railAxis.dotProduct(link); if (Double.isNaN(dotProduct) || dotProduct == 0 || diffToReduce == 0) return cart; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java index a390aad40..892d0de19 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartSim2020.java @@ -44,34 +44,21 @@ public class MinecartSim2020 { map.put(RailShape.NORTH_WEST, Pair.of(north, west)); map.put(RailShape.NORTH_EAST, Pair.of(north, east)); }); - - public static Vector3d predictMotionOf(AbstractMinecartEntity cart) { -// if (cart instanceof FurnaceMinecartEntity) { -// return cart.getPositionVec() -// .subtract(cart.lastTickPosX, cart.lastTickPosY, cart.lastTickPosZ); -// } - return cart.getMotion().scale(1f); -// if (cart instanceof ContainerMinecartEntity) { -// ContainerMinecartEntity containerCart = (ContainerMinecartEntity) cart; -// float f = 0.98F; -// if (containerCart.isEmpty()) -// return cart.getMotion() -// .mul(f, 0.0D, f); -// int i = 15 - Container.calcRedstoneFromInventory(containerCart); -// f += (float) i * 0.001F; -// return cart.getMotion() -// .mul(f, 0.0D, f); -// } -// return cart.getMotion() -// .scale(cart.isBeingRidden() ? 0.997D : 0.96D); + + public static Vector3d predictNextPositionOf(AbstractMinecartEntity cart) { + Vector3d position = cart.getPositionVec(); + Vector3d motion = cart.getMotion(); + return position.add(motion); } public static boolean canAddMotion(AbstractMinecartEntity c) { if (c instanceof FurnaceMinecartEntity) return MathHelper.epsilonEquals(((FurnaceMinecartEntity) c).pushX, 0) && MathHelper.epsilonEquals(((FurnaceMinecartEntity) c).pushZ, 0); - LazyOptional capability = c.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); - if (capability.isPresent() && capability.orElse(null).isStalled()) + LazyOptional capability = + c.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); + if (capability.isPresent() && capability.orElse(null) + .isStalled()) return false; return true; } @@ -195,21 +182,6 @@ public class MinecartSim2020 { } cart.setMotion(previousMotion); - - if (cart instanceof FurnaceMinecartEntity) { -// FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) cart; -// Vector3d Vector3d = cart.getMotion(); -// double d2 = horizontalMag(Vector3d); -// double d3 = furnaceCart.pushX * furnaceCart.pushX + furnaceCart.pushZ * furnaceCart.pushZ; -// if (d3 > 1.0E-4D && d2 > 0.001D) { -// double d40 = (double) MathHelper.sqrt(d2); -// double d50 = (double) MathHelper.sqrt(d3); -// furnaceCart.pushX = Vector3d.x / d40 * d50; -// furnaceCart.pushZ = Vector3d.z / d40 * d50; -// furnaceCart.setMotion(Vector3d.mul(0.8D, 0.0D, 0.8D) -// .add(furnaceCart.pushX, 0.0D, furnaceCart.pushZ)); -// } - } } public static Vector3d getRailVec(RailShape shape) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java index 3e9e037c9..2c24738a0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/MinecartController.java @@ -188,9 +188,9 @@ public class MinecartController implements INBTSerializable { } })); mc.couplings = mc.couplings.swap(); + mc.needsEntryRefresh = true; if (mc == this) continue; - mc.needsEntryRefresh = true; mc.sendData(); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java new file mode 100644 index 000000000..d4ecf5998 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -0,0 +1,292 @@ +package com.simibubi.create.content.contraptions.components.tracks; + +import com.simibubi.create.content.contraptions.wrench.IWrenchable; +import com.simibubi.create.foundation.utility.VecHelper; +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.block.AbstractRailBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemUseContext; +import net.minecraft.state.*; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.state.properties.RailShape; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import static net.minecraft.state.properties.RailShape.*; + + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@SuppressWarnings("deprecation") +public class ControllerRailBlock extends AbstractRailBlock implements IWrenchable { + public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; + public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15; + public static final BooleanProperty BACKWARDS = BooleanProperty.create("backwards"); + + public ControllerRailBlock(Properties p_i48444_2_) { + super(true, p_i48444_2_); + this.setDefaultState(this.stateContainer.getBaseState().with(POWER, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); + } + + private static Vec3i getAccelerationVector(BlockState state) { + Direction pointingTo = getPointingTowards(state); + return (state.get(BACKWARDS) ? pointingTo.getOpposite() : pointingTo).getDirectionVec(); + } + + private static Direction getPointingTowards(BlockState state) { + switch (state.get(SHAPE)) { + case ASCENDING_WEST: + case EAST_WEST: + return Direction.WEST; + case ASCENDING_EAST: + return Direction.EAST; + case ASCENDING_SOUTH: + return Direction.SOUTH; + default: + return Direction.NORTH; + } + } + + private static void decelerateCart(BlockPos pos, AbstractMinecartEntity cart) { + Vec3d diff = VecHelper.getCenterOf(pos).subtract(cart.getPositionVec()); + cart.setMotion(diff.x / 16f, 0, diff.z / 16f); + } + + private static boolean isStableWith(BlockState testState, IBlockReader world, BlockPos pos) { + return hasSolidSideOnTop(world, pos.down()) && (!testState.get(SHAPE).isAscending() || hasSolidSideOnTop(world, pos.offset(getPointingTowards(testState)))); + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { + Direction direction = p_196258_1_.getPlacementHorizontalFacing(); + BlockState base = super.getStateForPlacement(p_196258_1_); + return (base == null ? getDefaultState() : base).with(BACKWARDS, direction == Direction.SOUTH || direction == Direction.EAST); + } + + @Override + public IProperty getShapeProperty() { + return SHAPE; + } + + @Override + protected void fillStateContainer(StateContainer.Builder p_206840_1_) { + p_206840_1_.add(SHAPE, POWER, BACKWARDS); + } + + @Override + public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) { + if (world.isRemote) + return; + Vec3d accelerationVec = new Vec3d(getAccelerationVector(state)); + double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWER) / 15.; + if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) + cart.setMotion(accelerationVec.scale(targetSpeed)); + else + decelerateCart(pos, cart); + } + + @Override + protected void updateState(BlockState state, World world, BlockPos pos, Block block) { + int newPower = calculatePower(world, pos); + if (state.get(POWER) != newPower) + placeAndNotify(state.with(POWER, newPower), pos, world); + } + + private int calculatePower(World world, BlockPos pos) { + int newPower = world.getRedstonePowerFromNeighbors(pos); + if (newPower != 0) + return newPower; + + int forwardDistance = 0; + int backwardsDistance = 0; + BlockPos lastForwardRail = pos; + BlockPos lastBackwardsRail = pos; + int forwardPower = 0; + int backwardsPower = 0; + + for (int i = 0; i < 15; i++) { + BlockPos testPos = findNextRail(lastForwardRail, world, false); + if (testPos == null) + break; + forwardDistance++; + lastForwardRail = testPos; + forwardPower = world.getRedstonePowerFromNeighbors(testPos); + if (forwardPower != 0) + break; + } + for (int i = 0; i < 15; i++) { + BlockPos testPos = findNextRail(lastBackwardsRail, world, true); + if (testPos == null) + break; + backwardsDistance++; + lastBackwardsRail = testPos; + backwardsPower = world.getRedstonePowerFromNeighbors(testPos); + if (backwardsPower != 0) + break; + } + if (forwardDistance > 8 && backwardsDistance > 8) + return 0; + else if (backwardsPower == 0 && forwardDistance <= 8) + return forwardPower; + else if (forwardPower == 0 && backwardsDistance <= 8) + return backwardsPower; + else if (backwardsPower != 0 && forwardPower != 0) + return MathHelper.ceil((backwardsPower * forwardDistance + forwardPower * backwardsDistance) / (double) (forwardDistance + backwardsDistance)); + return 0; + } + + @Override + public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) { + switch (p_185499_2_) { + case CLOCKWISE_180: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + default: + return p_185499_1_.with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + } + case COUNTERCLOCKWISE_90: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case NORTH_SOUTH: + return p_185499_1_.with(SHAPE, EAST_WEST); + case EAST_WEST: + return p_185499_1_.with(SHAPE, NORTH_SOUTH).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + } + case CLOCKWISE_90: + switch (p_185499_1_.get(SHAPE)) { + case ASCENDING_EAST: + return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); + case ASCENDING_WEST: + return p_185499_1_.with(SHAPE, ASCENDING_NORTH); + case ASCENDING_NORTH: + return p_185499_1_.with(SHAPE, ASCENDING_EAST); + case ASCENDING_SOUTH: + return p_185499_1_.with(SHAPE, ASCENDING_WEST); + case NORTH_SOUTH: + return p_185499_1_.with(SHAPE, EAST_WEST).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); + case EAST_WEST: + return p_185499_1_.with(SHAPE, NORTH_SOUTH); + } + default: + return p_185499_1_; + } + } + + @Override + public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) { + RailShape railshape = p_185471_1_.get(SHAPE); + switch (p_185471_2_) { + case LEFT_RIGHT: + switch (railshape) { + case ASCENDING_NORTH: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_SOUTH); + case ASCENDING_SOUTH: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_NORTH); + case NORTH_SOUTH: + return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); + default: + return super.mirror(p_185471_1_, p_185471_2_); + } + case FRONT_BACK: + switch (railshape) { + case ASCENDING_EAST: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_WEST); + case ASCENDING_WEST: + return p_185471_1_.with(SHAPE, RailShape.ASCENDING_EAST); + case EAST_WEST: + return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); + default: + break; + } + } + return super.mirror(p_185471_1_, p_185471_2_); + } + + @Override + public ActionResultType onWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + if (world.isRemote) + return ActionResultType.SUCCESS; + BlockPos pos = context.getPos(); + for (Rotation testRotation : new Rotation[]{Rotation.CLOCKWISE_90, Rotation.CLOCKWISE_180, Rotation.COUNTERCLOCKWISE_90}) { + BlockState testState = rotate(state, testRotation); + if (isStableWith(testState, world, pos)) { + placeAndNotify(testState, pos, world); + break; + } + } + return ActionResultType.SUCCESS; + } + + @Override + public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + BlockPos pos = context.getPos(); + BlockState testState = state.with(BACKWARDS, !state.get(BACKWARDS)); + if (isStableWith(testState, world, pos)) + placeAndNotify(testState, pos, world); + return ActionResultType.SUCCESS; + } + + private void placeAndNotify(BlockState state, BlockPos pos, World world) { + world.setBlockState(pos, state, 3); + world.notifyNeighborsOfStateChange(pos.down(), this); + if (state.get(SHAPE).isAscending()) + world.notifyNeighborsOfStateChange(pos.up(), this); + } + + @Nullable + private BlockPos findNextRail(BlockPos from, IBlockReader world, boolean reversed) { + BlockState current = world.getBlockState(from); + if (!(current.getBlock() instanceof ControllerRailBlock)) + return null; + Vec3i accelerationVec = getAccelerationVector(current); + BlockPos baseTestPos = reversed ? from.subtract(accelerationVec) : from.add(accelerationVec); + for (BlockPos testPos : new BlockPos[]{baseTestPos, baseTestPos.down(), baseTestPos.up()}) { + if (testPos.getY() > from.getY() && !current.get(SHAPE).isAscending()) + continue; + BlockState testState = world.getBlockState(testPos); + if (testState.getBlock() instanceof ControllerRailBlock && getAccelerationVector(testState).equals(accelerationVec)) + return testPos; + } + return null; + } + + @Override + public boolean hasComparatorInputOverride(BlockState state) { + return true; + } + + @Override + public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { + return state.get(POWER); + } +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 113adc2cd..90e0c640a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -252,7 +252,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt newFacing = test; } - if (preferredSpoutput != null && BasinBlock.canOutputTo(world, pos, preferredSpoutput)) + if (preferredSpoutput != null && BasinBlock.canOutputTo(world, pos, preferredSpoutput) && preferredSpoutput != Direction.UP) newFacing = preferredSpoutput; if (newFacing != currentFacing) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java index 9fbcfd4ea..befb231e6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPointHandler.java @@ -112,8 +112,9 @@ public class ArmInteractionPointHandler { else inputs++; } - player.sendStatusMessage(Lang.createTranslationTextComponent("mechanical_arm.summary", inputs, outputs) - .formatted(TextFormatting.WHITE), true); + if (inputs + outputs > 0) + player.sendStatusMessage(Lang.createTranslationTextComponent("mechanical_arm.summary", inputs, outputs) + .formatted(TextFormatting.WHITE), true); } AllPackets.channel.sendToServer(new ArmPlacementPacket(currentSelection, pos)); diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index 8463c4561..1e696490c 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -9,6 +9,7 @@ import java.util.Vector; import java.util.function.BiFunction; import java.util.function.Function; +import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.ImmutableList; @@ -434,4 +435,47 @@ public class BlockStateGen { .end(); } + public static NonNullBiConsumer, RegistrateBlockstateProvider> controllerRail() { + return (c, p) -> p.getVariantBuilder(c.get()) + .forAllStates(state -> { + int power = state.get(ControllerRailBlock.POWER); + boolean backwards = state.get(ControllerRailBlock.BACKWARDS); + String powerStr = power == 0 ? "off" : (power == 15 ? "on" : "analog"); + RailShape shape = state.get(ControllerRailBlock.SHAPE); + String shapeName = shape.isAscending() ? RailShape.ASCENDING_NORTH.getName() : RailShape.NORTH_SOUTH.getName(); + int rotation = 0; + + switch (shape) { + case EAST_WEST: + rotation += 270; + shapeName = RailShape.NORTH_SOUTH.getName(); + break; + case ASCENDING_EAST: + rotation += 90; + break; + case ASCENDING_SOUTH: + rotation += 180; + break; + case ASCENDING_WEST: + rotation += 270; + break; + default: + break; + } + + if (backwards) { + rotation += 180; + shapeName = shape.isAscending() ? RailShape.ASCENDING_SOUTH.getName() : RailShape.NORTH_SOUTH.getName(); + } + + + return ConfiguredModel.builder() + .modelFile(p.models() + .getExistingFile(p.modLoc( + "block/" + c.getName() + "/block_" + shapeName + "_" + + powerStr))) + .rotationY(rotation % 360) + .build(); + }); + } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/Couple.java b/src/main/java/com/simibubi/create/foundation/utility/Couple.java index 0df6950b6..9c36c903f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Couple.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Couple.java @@ -49,6 +49,14 @@ public class Couple extends Pair implements Iterable { return Couple.create(function.apply(first), function.apply(second)); } + public Couple mapWithContext(BiFunction function) { + return Couple.create(function.apply(first, true), function.apply(second, false)); + } + + public Couple mapWithParams(BiFunction function, Couple values) { + return Couple.create(function.apply(first, values.first), function.apply(second, values.second)); + } + public void replace(Function function) { setFirst(function.apply(getFirst())); setSecond(function.apply(getSecond())); @@ -95,17 +103,17 @@ public class Couple extends Pair implements Iterable { public Iterator iterator() { return new Couplerator<>(this); } - + private static class Couplerator implements Iterator { int state; private Couple couple; - + public Couplerator(Couple couple) { this.couple = couple; state = 0; } - + @Override public boolean hasNext() { return state != 2; @@ -120,7 +128,7 @@ public class Couple extends Pair implements Iterable { return couple.second; return null; } - + } } diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json new file mode 100644 index 000000000..73815cb0d --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json new file mode 100644 index 000000000..f339682a0 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json new file mode 100644 index 000000000..0fe3100de --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_north_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_ne", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json new file mode 100644 index 000000000..de285565e --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json new file mode 100644 index 000000000..f4fbd0df1 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json new file mode 100644 index 000000000..cffc1646a --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_ascending_south_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_rail_raised_sw", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json new file mode 100644 index 000000000..ba0d436dc --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_analog.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_analog" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json new file mode 100644 index 000000000..280d61983 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_off.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_off" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json new file mode 100644 index 000000000..749918039 --- /dev/null +++ b/src/main/resources/assets/create/models/block/controller_rail/block_north_south_on.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/rail_flat", + "textures": { + "rail": "create:block/controller_rail_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/controller_rail_analog.png b/src/main/resources/assets/create/textures/block/controller_rail_analog.png new file mode 100644 index 000000000..f114dde12 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/controller_rail_analog.png differ diff --git a/src/main/resources/assets/create/textures/block/controller_rail_off.png b/src/main/resources/assets/create/textures/block/controller_rail_off.png new file mode 100644 index 000000000..346d2fb67 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/controller_rail_off.png differ diff --git a/src/main/resources/assets/create/textures/block/controller_rail_on.png b/src/main/resources/assets/create/textures/block/controller_rail_on.png new file mode 100644 index 000000000..bd61741a5 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/controller_rail_on.png differ