3D Printing is cool again

- Fixed Schematicannon clearing blocks outside of a Schematics' bounding box
- Safety check for onBlockPlacedBy with null player
- Deployers with a positioned Schematic as their filter will place blocks accordingly, taking items from the contraption inventory
This commit is contained in:
simibubi 2021-03-26 22:05:16 +01:00
parent 0afb29f9a6
commit cb759e793e
14 changed files with 301 additions and 190 deletions

View file

@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json
3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json 48086bf71a824faf14841b698050cc8544b09a9b assets/create/blockstates/fluid_pipe.json
f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
@ -337,7 +337,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json 61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
8d7e653bfd9846e684a0d3725595714a19201017 assets/create/blockstates/radial_chassis.json 6fa36883e76e9e403bb429c8f86b8c0d3bba0cff assets/create/blockstates/radial_chassis.json
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json 722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
@ -403,16 +403,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
ce0e5405da381a86625b908c569c5dbe347abdba assets/create/lang/en_ud.json ce0e5405da381a86625b908c569c5dbe347abdba assets/create/lang/en_ud.json
e572959e40b9917e88e6b86b5b9ebbf091d5f1ba assets/create/lang/en_us.json 75e0c8fea601eecd505e00084e3001d54b315484 assets/create/lang/en_us.json
6d55a1325fc8bf894b92285f217b794e32575739 assets/create/lang/unfinished/de_de.json 3f1b5016f59fc581352c4acca569dd68e82d96de assets/create/lang/unfinished/de_de.json
77c60af805305234d28421be451a6091c9222d44 assets/create/lang/unfinished/es_es.json 77c60af805305234d28421be451a6091c9222d44 assets/create/lang/unfinished/es_es.json
d623da600d9f84f7ace4689b44e982746364cd36 assets/create/lang/unfinished/es_mx.json 00cdb52c58844b3d9b00551929866ff7eb23aff8 assets/create/lang/unfinished/es_mx.json
41b68809a2c0267be7e6966274e00a69f370b743 assets/create/lang/unfinished/fr_fr.json 41b68809a2c0267be7e6966274e00a69f370b743 assets/create/lang/unfinished/fr_fr.json
4606b3e7bcbb0b54802e52a800838343e84087ee assets/create/lang/unfinished/it_it.json 4606b3e7bcbb0b54802e52a800838343e84087ee assets/create/lang/unfinished/it_it.json
38e23ba73a515cb238d3899cc7517ff30223a3bc assets/create/lang/unfinished/ja_jp.json 38e23ba73a515cb238d3899cc7517ff30223a3bc assets/create/lang/unfinished/ja_jp.json
0e34e4848b8e0ea0b73778477cc4790d6a637143 assets/create/lang/unfinished/ko_kr.json 0e34e4848b8e0ea0b73778477cc4790d6a637143 assets/create/lang/unfinished/ko_kr.json
3d790d06451adfab91ed133e80239df6e6221567 assets/create/lang/unfinished/nl_nl.json f8c6e3946025b6af0172319b0a4fc12b6f12a10f assets/create/lang/unfinished/nl_nl.json
d2e1804d40933c6b6e3badcc1ae197f80fb839af assets/create/lang/unfinished/pt_br.json 5a0d6736f89c5d9e78d893d8c6ceb4ee07b9428b assets/create/lang/unfinished/pt_br.json
ae45aacb4418411dec1e6248637094efec94bd24 assets/create/lang/unfinished/ru_ru.json ae45aacb4418411dec1e6248637094efec94bd24 assets/create/lang/unfinished/ru_ru.json
ba653601c0452116fd5f8b820a136b4833dcb426 assets/create/lang/unfinished/zh_cn.json ba653601c0452116fd5f8b820a136b4833dcb426 assets/create/lang/unfinished/zh_cn.json
1087875125ce70b1543df07e3957b14b5ef60e9f assets/create/lang/unfinished/zh_tw.json 1087875125ce70b1543df07e3957b14b5ef60e9f assets/create/lang/unfinished/zh_tw.json

View file

@ -61,9 +61,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "true",
"up": "true", "up": "true",
"south": "false" "south": "false",
"north": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lu_x" "model": "create:block/fluid_pipe/lu_x"
@ -72,9 +72,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "false",
"up": "true", "up": "true",
"south": "true" "south": "true",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ru_x" "model": "create:block/fluid_pipe/ru_x"
@ -83,9 +83,9 @@
{ {
"when": { "when": {
"down": "true", "down": "true",
"north": "true",
"up": "false", "up": "false",
"south": "false" "south": "false",
"north": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ld_x" "model": "create:block/fluid_pipe/ld_x"
@ -94,9 +94,9 @@
{ {
"when": { "when": {
"down": "true", "down": "true",
"north": "false",
"up": "false", "up": "false",
"south": "true" "south": "true",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/rd_x" "model": "create:block/fluid_pipe/rd_x"
@ -105,9 +105,9 @@
{ {
"when": { "when": {
"down": "true", "down": "true",
"north": "false",
"up": "true", "up": "true",
"south": "false" "south": "false",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_x" "model": "create:block/fluid_pipe/ud_x"
@ -116,9 +116,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "false",
"up": "true", "up": "true",
"south": "false" "south": "false",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_x" "model": "create:block/fluid_pipe/ud_x"
@ -127,9 +127,9 @@
{ {
"when": { "when": {
"down": "true", "down": "true",
"north": "false",
"up": "false", "up": "false",
"south": "false" "south": "false",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_x" "model": "create:block/fluid_pipe/ud_x"
@ -138,9 +138,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "true",
"up": "false", "up": "false",
"south": "true" "south": "true",
"north": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_x" "model": "create:block/fluid_pipe/lr_x"
@ -149,9 +149,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "true",
"up": "false", "up": "false",
"south": "false" "south": "false",
"north": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_x" "model": "create:block/fluid_pipe/lr_x"
@ -160,9 +160,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "false",
"up": "false", "up": "false",
"south": "true" "south": "true",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_x" "model": "create:block/fluid_pipe/lr_x"
@ -171,9 +171,9 @@
{ {
"when": { "when": {
"down": "false", "down": "false",
"north": "false",
"up": "false", "up": "false",
"south": "false" "south": "false",
"north": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/none_x" "model": "create:block/fluid_pipe/none_x"
@ -181,10 +181,10 @@
}, },
{ {
"when": { "when": {
"south": "true",
"west": "true", "west": "true",
"east": "false",
"north": "false", "north": "false",
"south": "true" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lu_y" "model": "create:block/fluid_pipe/lu_y"
@ -192,10 +192,10 @@
}, },
{ {
"when": { "when": {
"south": "true",
"west": "false", "west": "false",
"east": "true",
"north": "false", "north": "false",
"south": "true" "east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ru_y" "model": "create:block/fluid_pipe/ru_y"
@ -203,10 +203,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "true", "west": "true",
"east": "false",
"north": "true", "north": "true",
"south": "false" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ld_y" "model": "create:block/fluid_pipe/ld_y"
@ -214,10 +214,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "false", "west": "false",
"east": "true",
"north": "true", "north": "true",
"south": "false" "east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/rd_y" "model": "create:block/fluid_pipe/rd_y"
@ -225,10 +225,10 @@
}, },
{ {
"when": { "when": {
"south": "true",
"west": "false", "west": "false",
"east": "false",
"north": "true", "north": "true",
"south": "true" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_y" "model": "create:block/fluid_pipe/ud_y"
@ -236,10 +236,10 @@
}, },
{ {
"when": { "when": {
"south": "true",
"west": "false", "west": "false",
"east": "false",
"north": "false", "north": "false",
"south": "true" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_y" "model": "create:block/fluid_pipe/ud_y"
@ -247,10 +247,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "false", "west": "false",
"east": "false",
"north": "true", "north": "true",
"south": "false" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_y" "model": "create:block/fluid_pipe/ud_y"
@ -258,10 +258,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "true", "west": "true",
"east": "true",
"north": "false", "north": "false",
"south": "false" "east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_y" "model": "create:block/fluid_pipe/lr_y"
@ -269,10 +269,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "true", "west": "true",
"east": "false",
"north": "false", "north": "false",
"south": "false" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_y" "model": "create:block/fluid_pipe/lr_y"
@ -280,10 +280,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "false", "west": "false",
"east": "true",
"north": "false", "north": "false",
"south": "false" "east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_y" "model": "create:block/fluid_pipe/lr_y"
@ -291,10 +291,10 @@
}, },
{ {
"when": { "when": {
"south": "false",
"west": "false", "west": "false",
"east": "false",
"north": "false", "north": "false",
"south": "false" "east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/none_y" "model": "create:block/fluid_pipe/none_y"
@ -302,10 +302,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "false", "down": "false",
"east": "true", "up": "true",
"up": "true" "west": "false",
"east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lu_z" "model": "create:block/fluid_pipe/lu_z"
@ -313,10 +313,10 @@
}, },
{ {
"when": { "when": {
"west": "true",
"down": "false", "down": "false",
"east": "false", "up": "true",
"up": "true" "west": "true",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ru_z" "model": "create:block/fluid_pipe/ru_z"
@ -324,10 +324,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "true", "down": "true",
"east": "true", "up": "false",
"up": "false" "west": "false",
"east": "true"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ld_z" "model": "create:block/fluid_pipe/ld_z"
@ -335,10 +335,10 @@
}, },
{ {
"when": { "when": {
"west": "true",
"down": "true", "down": "true",
"east": "false", "up": "false",
"up": "false" "west": "true",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/rd_z" "model": "create:block/fluid_pipe/rd_z"
@ -346,10 +346,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "true", "down": "true",
"east": "false", "up": "true",
"up": "true" "west": "false",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_z" "model": "create:block/fluid_pipe/ud_z"
@ -357,10 +357,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "false", "down": "false",
"east": "false", "up": "true",
"up": "true" "west": "false",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_z" "model": "create:block/fluid_pipe/ud_z"
@ -368,10 +368,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "true", "down": "true",
"east": "false", "up": "false",
"up": "false" "west": "false",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/ud_z" "model": "create:block/fluid_pipe/ud_z"
@ -379,10 +379,10 @@
}, },
{ {
"when": { "when": {
"down": "false",
"up": "false",
"west": "true", "west": "true",
"down": "false", "east": "true"
"east": "true",
"up": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_z" "model": "create:block/fluid_pipe/lr_z"
@ -390,10 +390,10 @@
}, },
{ {
"when": { "when": {
"down": "false",
"up": "false",
"west": "false", "west": "false",
"down": "false", "east": "true"
"east": "true",
"up": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_z" "model": "create:block/fluid_pipe/lr_z"
@ -401,10 +401,10 @@
}, },
{ {
"when": { "when": {
"down": "false",
"up": "false",
"west": "true", "west": "true",
"down": "false", "east": "false"
"east": "false",
"up": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/lr_z" "model": "create:block/fluid_pipe/lr_z"
@ -412,10 +412,10 @@
}, },
{ {
"when": { "when": {
"west": "false",
"down": "false", "down": "false",
"east": "false", "up": "false",
"up": "false" "west": "false",
"east": "false"
}, },
"apply": { "apply": {
"model": "create:block/fluid_pipe/none_z" "model": "create:block/fluid_pipe/none_z"

View file

@ -29,8 +29,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "x",
"axis": "x" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -39,8 +39,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "y",
"axis": "y" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky" "model": "create:block/radial_chassis_side_y_sticky"
@ -48,8 +48,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "z",
"axis": "z" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -59,8 +59,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "x",
"axis": "x" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -69,8 +69,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "y",
"axis": "y" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y" "model": "create:block/radial_chassis_side_y"
@ -78,8 +78,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "z",
"axis": "z" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",

View file

@ -878,7 +878,7 @@
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "Removed selection.", "create.schematicAndQuill.abort": "Removed selection.",
"create.schematicAndQuill.title": "Schematic Name:", "create.schematicAndQuill.title": "Schematic Name:",
"create.schematicAndQuill.convert": "Save and Deploy Immediately", "create.schematicAndQuill.convert": "Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "My Schematic", "create.schematicAndQuill.fallbackName": "My Schematic",
"create.schematicAndQuill.saved": "Saved as %1$s", "create.schematicAndQuill.saved": "Saved as %1$s",
@ -893,12 +893,12 @@
"create.schematic.mirror.none": "None", "create.schematic.mirror.none": "None",
"create.schematic.mirror.frontBack": "Front-Back", "create.schematic.mirror.frontBack": "Front-Back",
"create.schematic.mirror.leftRight": "Left-Right", "create.schematic.mirror.leftRight": "Left-Right",
"create.schematic.tool.deploy": "Deploy", "create.schematic.tool.deploy": "Position",
"create.schematic.tool.move": "Move XZ", "create.schematic.tool.move": "Move XZ",
"create.schematic.tool.movey": "Move Y", "create.schematic.tool.movey": "Move Y",
"create.schematic.tool.rotate": "Rotate", "create.schematic.tool.rotate": "Rotate",
"create.schematic.tool.print": "Print", "create.schematic.tool.print": "Print",
"create.schematic.tool.flip": "Flip", "create.schematic.tool.flip": "Mirror",
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.", "create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.", "create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
"create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.", "create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.",
@ -974,7 +974,7 @@
"create.schematicannon.status.placing": "Placing", "create.schematicannon.status.placing": "Placing",
"create.schematicannon.status.clearing": "Clearing Blocks", "create.schematicannon.status.clearing": "Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "Schematic Invalid", "create.schematicannon.status.schematicInvalid": "Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed", "create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "Schematic File Expired", "create.schematicannon.status.schematicExpired": "Schematic File Expired",
"create.materialChecklist": "Material Checklist", "create.materialChecklist": "Material Checklist",

View file

@ -879,7 +879,7 @@
"create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.", "create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.",
"create.schematicAndQuill.abort": "Auswahl zurückgesetzt.", "create.schematicAndQuill.abort": "Auswahl zurückgesetzt.",
"create.schematicAndQuill.title": "Bauplanname:", "create.schematicAndQuill.title": "Bauplanname:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately", "create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Mein Bauplan", "create.schematicAndQuill.fallbackName": "Mein Bauplan",
"create.schematicAndQuill.saved": "Gespeichert als %1$s", "create.schematicAndQuill.saved": "Gespeichert als %1$s",

View file

@ -879,7 +879,7 @@
"create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.", "create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:", "create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately", "create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "UNLOCALIZED: My Schematic", "create.schematicAndQuill.fallbackName": "UNLOCALIZED: My Schematic",
"create.schematicAndQuill.saved": "UNLOCALIZED: Saved as %1$s", "create.schematicAndQuill.saved": "UNLOCALIZED: Saved as %1$s",
@ -894,12 +894,12 @@
"create.schematic.mirror.none": "UNLOCALIZED: None", "create.schematic.mirror.none": "UNLOCALIZED: None",
"create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back", "create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back",
"create.schematic.mirror.leftRight": "UNLOCALIZED: Left-Right", "create.schematic.mirror.leftRight": "UNLOCALIZED: Left-Right",
"create.schematic.tool.deploy": "UNLOCALIZED: Deploy", "create.schematic.tool.deploy": "UNLOCALIZED: Position",
"create.schematic.tool.move": "UNLOCALIZED: Move XZ", "create.schematic.tool.move": "UNLOCALIZED: Move XZ",
"create.schematic.tool.movey": "UNLOCALIZED: Move Y", "create.schematic.tool.movey": "UNLOCALIZED: Move Y",
"create.schematic.tool.rotate": "UNLOCALIZED: Rotate", "create.schematic.tool.rotate": "UNLOCALIZED: Rotate",
"create.schematic.tool.print": "UNLOCALIZED: Print", "create.schematic.tool.print": "UNLOCALIZED: Print",
"create.schematic.tool.flip": "UNLOCALIZED: Flip", "create.schematic.tool.flip": "UNLOCALIZED: Mirror",
"create.schematic.tool.deploy.description.0": "UNLOCALIZED: Moves the structure to a location.", "create.schematic.tool.deploy.description.0": "UNLOCALIZED: Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "UNLOCALIZED: Right-Click on the ground to place.", "create.schematic.tool.deploy.description.1": "UNLOCALIZED: Right-Click on the ground to place.",
"create.schematic.tool.deploy.description.2": "UNLOCALIZED: Hold [Ctrl] to select at a fixed distance.", "create.schematic.tool.deploy.description.2": "UNLOCALIZED: Hold [Ctrl] to select at a fixed distance.",
@ -975,7 +975,7 @@
"create.schematicannon.status.placing": "UNLOCALIZED: Placing", "create.schematicannon.status.placing": "UNLOCALIZED: Placing",
"create.schematicannon.status.clearing": "UNLOCALIZED: Clearing Blocks", "create.schematicannon.status.clearing": "UNLOCALIZED: Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "UNLOCALIZED: Schematic Invalid", "create.schematicannon.status.schematicInvalid": "UNLOCALIZED: Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic Not Deployed", "create.schematicannon.status.schematicNotPlaced": "UNLOCALIZED: Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "UNLOCALIZED: Schematic File Expired", "create.schematicannon.status.schematicExpired": "UNLOCALIZED: Schematic File Expired",
"create.materialChecklist": "UNLOCALIZED: Material Checklist", "create.materialChecklist": "UNLOCALIZED: Material Checklist",

View file

@ -879,7 +879,7 @@
"create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.", "create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.",
"create.schematicAndQuill.abort": "Keuze verwijderd.", "create.schematicAndQuill.abort": "Keuze verwijderd.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:", "create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately", "create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Mijn Bouwtekening", "create.schematicAndQuill.fallbackName": "Mijn Bouwtekening",
"create.schematicAndQuill.saved": "Opgeslagen als %1$s", "create.schematicAndQuill.saved": "Opgeslagen als %1$s",

View file

@ -879,7 +879,7 @@
"create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.", "create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.",
"create.schematicAndQuill.abort": "Seleção removida.", "create.schematicAndQuill.abort": "Seleção removida.",
"create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:", "create.schematicAndQuill.title": "UNLOCALIZED: Schematic Name:",
"create.schematicAndQuill.convert": "UNLOCALIZED: Save and Deploy Immediately", "create.schematicAndQuill.convert": "UNLOCALIZED: Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "Meu Esquema", "create.schematicAndQuill.fallbackName": "Meu Esquema",
"create.schematicAndQuill.saved": "Salvo como %1$s", "create.schematicAndQuill.saved": "Salvo como %1$s",

View file

@ -3,31 +3,48 @@ package com.simibubi.create.content.contraptions.components.deployer;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import javax.annotation.Nullable;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode; import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
import com.simibubi.create.content.logistics.item.filter.FilterItem; import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.content.schematics.filtering.SchematicInstances;
import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.NBTProcessors;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.Constants.NBT;
import net.minecraftforge.event.ForgeEventFactory;
import javax.annotation.Nullable; import net.minecraftforge.items.IItemHandler;
public class DeployerMovementBehaviour extends MovementBehaviour { public class DeployerMovementBehaviour extends MovementBehaviour {
@ -54,6 +71,12 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
} }
public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) { public void activate(MovementContext context, BlockPos pos, DeployerFakePlayer player, Mode mode) {
World world = context.world;
ItemStack filter = getFilter(context);
if (AllItems.SCHEMATIC.isIn(filter))
activateAsSchematicPrinter(context, pos, player, world, filter);
Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING) Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING)
.getDirectionVec()); .getDirectionVec());
facingVec = context.rotation.apply(facingVec); facingVec = context.rotation.apply(facingVec);
@ -64,6 +87,61 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
DeployerHandler.activate(player, vec, pos, facingVec, mode); DeployerHandler.activate(player, vec, pos, facingVec, mode);
} }
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, World world,
ItemStack filter) {
if (!filter.hasTag())
return;
if (!world.getBlockState(pos)
.getMaterial()
.isReplaceable())
return;
CompoundNBT tag = filter.getTag();
if (!tag.getBoolean("Deployed"))
return;
SchematicWorld schematicWorld = SchematicInstances.get(world, filter);
if (!schematicWorld.getBounds()
.isVecInside(pos.subtract(schematicWorld.anchor)))
return;
BlockState blockState = schematicWorld.getBlockState(pos);
ItemRequirement requirement = ItemRequirement.of(blockState);
if (requirement.isInvalid() || requirement.isEmpty())
return;
if (AllBlocks.BELT.has(blockState))
return;
List<ItemStack> requiredItems = requirement.getRequiredItems();
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
IItemHandler iItemHandler = context.contraption.inventory;
for (ItemStack required : requiredItems) {
int amountFound = ItemHelper
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), true)
.getCount();
if (amountFound < required.getCount())
return;
}
for (ItemStack required : requiredItems)
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
required.getCount(), false);
CompoundNBT data = null;
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null) {
data = tile.write(new CompoundNBT());
data = NBTProcessors.process(tile, data, true);
}
}
BlockSnapshot blocksnapshot = BlockSnapshot.getBlockSnapshot(world, pos);
BlockHelper.placeSchematicBlock(world, blockState, pos, firstRequired, data);
if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))
blocksnapshot.restore(true, false);
}
@Override @Override
public void tick(MovementContext context) { public void tick(MovementContext context) {
if (context.world.isRemote) if (context.world.isRemote)
@ -111,6 +189,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
if (player.getHeldItemMainhand() if (player.getHeldItemMainhand()
.isEmpty()) { .isEmpty()) {
ItemStack filter = getFilter(context); ItemStack filter = getFilter(context);
if (AllItems.SCHEMATIC.isIn(filter))
return;
ItemStack held = ItemHelper.extract(context.contraption.inventory, ItemStack held = ItemHelper.extract(context.contraption.inventory,
stack -> FilterItem.test(context.world, stack, filter), 1, false); stack -> FilterItem.test(context.world, stack, filter), 1, false);
player.setHeldItem(Hand.MAIN_HAND, held); player.setHeldItem(Hand.MAIN_HAND, held);

View file

@ -3,31 +3,22 @@ package com.simibubi.create.content.schematics.block;
import java.util.Optional; import java.util.Optional;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem; import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem;
import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock; import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.FluidTags;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
public abstract class LaunchedItem { public abstract class LaunchedItem {
@ -128,46 +119,7 @@ public abstract class LaunchedItem {
@Override @Override
void place(World world) { void place(World world) {
// Piston BlockHelper.placeSchematicBlock(world, state, target, stack, data);
if (state.has(BlockStateProperties.EXTENDED))
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
if (state.has(BlockStateProperties.WATERLOGGED))
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
if (AllBlocks.BELT.has(state)) {
world.setBlockState(target, state, 2);
return;
}
else if (state.getBlock() == Blocks.COMPOSTER)
state = Blocks.COMPOSTER.getDefaultState();
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
state = ((IPlantable) state.getBlock()).getPlant(world, target);
if (world.dimension.doesWaterVaporize() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) {
int i = target.getX();
int j = target.getY();
int k = target.getZ();
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);
}
Block.spawnDrops(state, world, target);
return;
}
world.setBlockState(target, state, 18);
if (data != null) {
TileEntity tile = world.getTileEntity(target);
if (tile != null) {
data.putInt("x", target.getX());
data.putInt("y", target.getY());
data.putInt("z", target.getZ());
if (tile instanceof KineticTileEntity)
((KineticTileEntity) tile).warnOfMovement();
tile.read(data);
}
}
state.getBlock().onBlockPlacedBy(world, target, state, null, stack);
} }
} }

View file

@ -376,11 +376,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
} }
if (missingItem == null && !positionNotLoaded) { if (missingItem == null && !positionNotLoaded) {
advanceCurrentPos(); do {
advanceCurrentPos();
if (state == State.STOPPED)
return;
// End reached } while (!blockReader.getBounds()
if (state == State.STOPPED) .isVecInside(currentPos));
return;
sendUpdate = true; sendUpdate = true;
target = schematicAnchor.add(currentPos); target = schematicAnchor.add(currentPos);
@ -711,10 +713,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (world == null) if (world == null)
return false; return false;
BlockState toReplace = world.getBlockState(pos); BlockState toReplace = world.getBlockState(pos);
boolean placingAir = state.getBlock().isAir(state, world, pos); boolean placingAir = state.getBlock()
.isAir(state, world, pos);
BlockState toReplaceOther = null; BlockState toReplaceOther = null;
if (state.has(BlockStateProperties.BED_PART) && state.has(BlockStateProperties.HORIZONTAL_FACING) && state.get(BlockStateProperties.BED_PART) == BedPart.FOOT) if (state.has(BlockStateProperties.BED_PART) && state.has(BlockStateProperties.HORIZONTAL_FACING)
&& state.get(BlockStateProperties.BED_PART) == BedPart.FOOT)
toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING))); toReplaceOther = world.getBlockState(pos.offset(state.get(BlockStateProperties.HORIZONTAL_FACING)));
if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF) if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF)
&& state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER) && state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER)
@ -727,11 +731,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
return false; return false;
if (toReplace == state) if (toReplace == state)
return false; return false;
if (toReplace.getBlockHardness(world, pos) == -1 || (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1)) if (toReplace.getBlockHardness(world, pos) == -1
|| (toReplaceOther != null && toReplaceOther.getBlockHardness(world, pos) == -1))
return false; return false;
if (pos.withinDistance(getPos(), 2f)) if (pos.withinDistance(getPos(), 2f))
return false; return false;
if (!replaceTileEntities && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity()))) if (!replaceTileEntities
&& (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity())))
return false; return false;
if (shouldIgnoreBlockState(state)) if (shouldIgnoreBlockState(state))
@ -742,10 +748,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (replaceMode == 2 && !placingAir) if (replaceMode == 2 && !placingAir)
return true; return true;
if (replaceMode == 1 if (replaceMode == 1
&& (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)))) && (state.isNormalCube(blockReader, pos.subtract(schematicAnchor)) || (!toReplace.isNormalCube(world, pos)
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos))))
&& !placingAir) && !placingAir)
return true; return true;
if (replaceMode == 0 && !toReplace.isNormalCube(world, pos) && (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir) if (replaceMode == 0 && !toReplace.isNormalCube(world, pos)
&& (toReplaceOther == null || !toReplaceOther.isNormalCube(world, pos)) && !placingAir)
return true; return true;
return false; return false;
@ -852,7 +860,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
} }
protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) { protected void launchBlock(BlockPos target, ItemStack stack, BlockState state, @Nullable CompoundNBT data) {
if (state.getBlock().isAir(state, world, target)) if (state.getBlock()
.isAir(state, world, target))
blocksPlaced++; blocksPlaced++;
flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data)); flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data));
playFiringSound(); playFiringSound();

View file

@ -20,6 +20,7 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.AABBOutline; import com.simibubi.create.foundation.utility.outliner.AABBOutline;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
@ -206,7 +207,10 @@ public class SchematicHandler {
return; return;
if (mc.objectMouseOver instanceof BlockRayTraceResult) { if (mc.objectMouseOver instanceof BlockRayTraceResult) {
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) mc.objectMouseOver; BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) mc.objectMouseOver;
if (AllBlocks.SCHEMATICANNON.has(mc.world.getBlockState(blockRayTraceResult.getPos()))) BlockState clickedBlock = mc.world.getBlockState(blockRayTraceResult.getPos());
if (AllBlocks.SCHEMATICANNON.has(clickedBlock))
return;
if (AllBlocks.DEPLOYER.has(clickedBlock))
return; return;
} }
currentTool.getTool() currentTool.getTool()

View file

@ -2,10 +2,16 @@ package com.simibubi.create.foundation.utility;
import java.util.function.Consumer; import java.util.function.Consumer;
import javax.annotation.Nullable;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.particle.DiggingParticle; import net.minecraft.client.particle.DiggingParticle;
import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.particle.ParticleManager;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -13,10 +19,15 @@ import net.minecraft.fluid.IFluidState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.SlabType; import net.minecraft.state.properties.SlabType;
import net.minecraft.tags.FluidTags;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
@ -26,6 +37,7 @@ import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.IPlantable;
public class BlockHelper { public class BlockHelper {
@ -187,7 +199,61 @@ public class BlockHelper {
} }
public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) { public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) {
return reader.getBlockState(pos).getCollisionShape(reader, pos).isEmpty(); return reader.getBlockState(pos)
.getCollisionShape(reader, pos)
.isEmpty();
}
public static void placeSchematicBlock(World world, BlockState state, BlockPos target, ItemStack stack,
@Nullable CompoundNBT data) {
// Piston
if (state.has(BlockStateProperties.EXTENDED))
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
if (state.has(BlockStateProperties.WATERLOGGED))
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
if (AllBlocks.BELT.has(state)) {
world.setBlockState(target, state, 2);
return;
} else if (state.getBlock() == Blocks.COMPOSTER)
state = Blocks.COMPOSTER.getDefaultState();
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
state = ((IPlantable) state.getBlock()).getPlant(world, target);
if (world.dimension.doesWaterVaporize() && state.getFluidState()
.getFluid()
.isIn(FluidTags.WATER)) {
int i = target.getX();
int j = target.getY();
int k = target.getZ();
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F,
2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(),
0.0D, 0.0D, 0.0D);
}
Block.spawnDrops(state, world, target);
return;
}
world.setBlockState(target, state, 18);
if (data != null) {
TileEntity tile = world.getTileEntity(target);
if (tile != null) {
data.putInt("x", target.getX());
data.putInt("y", target.getY());
data.putInt("z", target.getZ());
if (tile instanceof KineticTileEntity)
((KineticTileEntity) tile).warnOfMovement();
tile.read(data);
}
}
try {
state.getBlock()
.onBlockPlacedBy(world, target, state, null, stack);
} catch (Exception e) {
}
} }
} }

View file

@ -228,7 +228,7 @@
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "Removed selection.", "create.schematicAndQuill.abort": "Removed selection.",
"create.schematicAndQuill.title": "Schematic Name:", "create.schematicAndQuill.title": "Schematic Name:",
"create.schematicAndQuill.convert": "Save and Deploy Immediately", "create.schematicAndQuill.convert": "Save and Upload Immediately",
"create.schematicAndQuill.fallbackName": "My Schematic", "create.schematicAndQuill.fallbackName": "My Schematic",
"create.schematicAndQuill.saved": "Saved as %1$s", "create.schematicAndQuill.saved": "Saved as %1$s",
@ -244,12 +244,12 @@
"create.schematic.mirror.frontBack": "Front-Back", "create.schematic.mirror.frontBack": "Front-Back",
"create.schematic.mirror.leftRight": "Left-Right", "create.schematic.mirror.leftRight": "Left-Right",
"create.schematic.tool.deploy": "Deploy", "create.schematic.tool.deploy": "Position",
"create.schematic.tool.move": "Move XZ", "create.schematic.tool.move": "Move XZ",
"create.schematic.tool.movey": "Move Y", "create.schematic.tool.movey": "Move Y",
"create.schematic.tool.rotate": "Rotate", "create.schematic.tool.rotate": "Rotate",
"create.schematic.tool.print": "Print", "create.schematic.tool.print": "Print",
"create.schematic.tool.flip": "Flip", "create.schematic.tool.flip": "Mirror",
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.", "create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.", "create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
@ -329,7 +329,7 @@
"create.schematicannon.status.placing": "Placing", "create.schematicannon.status.placing": "Placing",
"create.schematicannon.status.clearing": "Clearing Blocks", "create.schematicannon.status.clearing": "Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "Schematic Invalid", "create.schematicannon.status.schematicInvalid": "Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed", "create.schematicannon.status.schematicNotPlaced": "Schematic not Positioned",
"create.schematicannon.status.schematicExpired": "Schematic File Expired", "create.schematicannon.status.schematicExpired": "Schematic File Expired",
"create.materialChecklist": "Material Checklist", "create.materialChecklist": "Material Checklist",