diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index a14f23093..a7ed66061 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json +48086bf71a824faf14841b698050cc8544b09a9b assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json @@ -337,7 +337,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json -8d7e653bfd9846e684a0d3725595714a19201017 assets/create/blockstates/radial_chassis.json +6fa36883e76e9e403bb429c8f86b8c0d3bba0cff assets/create/blockstates/radial_chassis.json 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json 722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json @@ -403,16 +403,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json ce0e5405da381a86625b908c569c5dbe347abdba assets/create/lang/en_ud.json -e572959e40b9917e88e6b86b5b9ebbf091d5f1ba assets/create/lang/en_us.json -6d55a1325fc8bf894b92285f217b794e32575739 assets/create/lang/unfinished/de_de.json +75e0c8fea601eecd505e00084e3001d54b315484 assets/create/lang/en_us.json +3f1b5016f59fc581352c4acca569dd68e82d96de assets/create/lang/unfinished/de_de.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 4606b3e7bcbb0b54802e52a800838343e84087ee assets/create/lang/unfinished/it_it.json 38e23ba73a515cb238d3899cc7517ff30223a3bc assets/create/lang/unfinished/ja_jp.json 0e34e4848b8e0ea0b73778477cc4790d6a637143 assets/create/lang/unfinished/ko_kr.json -3d790d06451adfab91ed133e80239df6e6221567 assets/create/lang/unfinished/nl_nl.json -d2e1804d40933c6b6e3badcc1ae197f80fb839af assets/create/lang/unfinished/pt_br.json +f8c6e3946025b6af0172319b0a4fc12b6f12a10f assets/create/lang/unfinished/nl_nl.json +5a0d6736f89c5d9e78d893d8c6ceb4ee07b9428b assets/create/lang/unfinished/pt_br.json ae45aacb4418411dec1e6248637094efec94bd24 assets/create/lang/unfinished/ru_ru.json ba653601c0452116fd5f8b820a136b4833dcb426 assets/create/lang/unfinished/zh_cn.json 1087875125ce70b1543df07e3957b14b5ef60e9f assets/create/lang/unfinished/zh_tw.json diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index a4cffcde7..80a25280c 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -61,9 +61,9 @@ { "when": { "down": "false", - "north": "true", "up": "true", - "south": "false" + "south": "false", + "north": "true" }, "apply": { "model": "create:block/fluid_pipe/lu_x" @@ -72,9 +72,9 @@ { "when": { "down": "false", - "north": "false", "up": "true", - "south": "true" + "south": "true", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/ru_x" @@ -83,9 +83,9 @@ { "when": { "down": "true", - "north": "true", "up": "false", - "south": "false" + "south": "false", + "north": "true" }, "apply": { "model": "create:block/fluid_pipe/ld_x" @@ -94,9 +94,9 @@ { "when": { "down": "true", - "north": "false", "up": "false", - "south": "true" + "south": "true", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/rd_x" @@ -105,9 +105,9 @@ { "when": { "down": "true", - "north": "false", "up": "true", - "south": "false" + "south": "false", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -116,9 +116,9 @@ { "when": { "down": "false", - "north": "false", "up": "true", - "south": "false" + "south": "false", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -127,9 +127,9 @@ { "when": { "down": "true", - "north": "false", "up": "false", - "south": "false" + "south": "false", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -138,9 +138,9 @@ { "when": { "down": "false", - "north": "true", "up": "false", - "south": "true" + "south": "true", + "north": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -149,9 +149,9 @@ { "when": { "down": "false", - "north": "true", "up": "false", - "south": "false" + "south": "false", + "north": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -160,9 +160,9 @@ { "when": { "down": "false", - "north": "false", "up": "false", - "south": "true" + "south": "true", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -171,9 +171,9 @@ { "when": { "down": "false", - "north": "false", "up": "false", - "south": "false" + "south": "false", + "north": "false" }, "apply": { "model": "create:block/fluid_pipe/none_x" @@ -181,10 +181,10 @@ }, { "when": { + "south": "true", "west": "true", - "east": "false", "north": "false", - "south": "true" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/lu_y" @@ -192,10 +192,10 @@ }, { "when": { + "south": "true", "west": "false", - "east": "true", "north": "false", - "south": "true" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/ru_y" @@ -203,10 +203,10 @@ }, { "when": { + "south": "false", "west": "true", - "east": "false", "north": "true", - "south": "false" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ld_y" @@ -214,10 +214,10 @@ }, { "when": { + "south": "false", "west": "false", - "east": "true", "north": "true", - "south": "false" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/rd_y" @@ -225,10 +225,10 @@ }, { "when": { + "south": "true", "west": "false", - "east": "false", "north": "true", - "south": "true" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_y" @@ -236,10 +236,10 @@ }, { "when": { + "south": "true", "west": "false", - "east": "false", "north": "false", - "south": "true" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_y" @@ -247,10 +247,10 @@ }, { "when": { + "south": "false", "west": "false", - "east": "false", "north": "true", - "south": "false" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_y" @@ -258,10 +258,10 @@ }, { "when": { + "south": "false", "west": "true", - "east": "true", "north": "false", - "south": "false" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -269,10 +269,10 @@ }, { "when": { + "south": "false", "west": "true", - "east": "false", "north": "false", - "south": "false" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -280,10 +280,10 @@ }, { "when": { + "south": "false", "west": "false", - "east": "true", "north": "false", - "south": "false" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -291,10 +291,10 @@ }, { "when": { + "south": "false", "west": "false", - "east": "false", "north": "false", - "south": "false" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/none_y" @@ -302,10 +302,10 @@ }, { "when": { - "west": "false", "down": "false", - "east": "true", - "up": "true" + "up": "true", + "west": "false", + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/lu_z" @@ -313,10 +313,10 @@ }, { "when": { - "west": "true", "down": "false", - "east": "false", - "up": "true" + "up": "true", + "west": "true", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ru_z" @@ -324,10 +324,10 @@ }, { "when": { - "west": "false", "down": "true", - "east": "true", - "up": "false" + "up": "false", + "west": "false", + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/ld_z" @@ -335,10 +335,10 @@ }, { "when": { - "west": "true", "down": "true", - "east": "false", - "up": "false" + "up": "false", + "west": "true", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/rd_z" @@ -346,10 +346,10 @@ }, { "when": { - "west": "false", "down": "true", - "east": "false", - "up": "true" + "up": "true", + "west": "false", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -357,10 +357,10 @@ }, { "when": { - "west": "false", "down": "false", - "east": "false", - "up": "true" + "up": "true", + "west": "false", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -368,10 +368,10 @@ }, { "when": { - "west": "false", "down": "true", - "east": "false", - "up": "false" + "up": "false", + "west": "false", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -379,10 +379,10 @@ }, { "when": { + "down": "false", + "up": "false", "west": "true", - "down": "false", - "east": "true", - "up": "false" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -390,10 +390,10 @@ }, { "when": { + "down": "false", + "up": "false", "west": "false", - "down": "false", - "east": "true", - "up": "false" + "east": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -401,10 +401,10 @@ }, { "when": { + "down": "false", + "up": "false", "west": "true", - "down": "false", - "east": "false", - "up": "false" + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -412,10 +412,10 @@ }, { "when": { - "west": "false", "down": "false", - "east": "false", - "up": "false" + "up": "false", + "west": "false", + "east": "false" }, "apply": { "model": "create:block/fluid_pipe/none_z" diff --git a/src/generated/resources/assets/create/blockstates/radial_chassis.json b/src/generated/resources/assets/create/blockstates/radial_chassis.json index 9d00ea8b1..f97d8c8bc 100644 --- a/src/generated/resources/assets/create/blockstates/radial_chassis.json +++ b/src/generated/resources/assets/create/blockstates/radial_chassis.json @@ -29,8 +29,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "x" + "axis": "x", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -39,8 +39,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "y" + "axis": "y", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky" @@ -48,8 +48,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "z" + "axis": "z", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -59,8 +59,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "x" + "axis": "x", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -69,8 +69,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "y" + "axis": "y", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_y" @@ -78,8 +78,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "z" + "axis": "z", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 690dd2fbe..a3054d2c0 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -878,7 +878,7 @@ "create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.abort": "Removed selection.", "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.saved": "Saved as %1$s", @@ -893,12 +893,12 @@ "create.schematic.mirror.none": "None", "create.schematic.mirror.frontBack": "Front-Back", "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.movey": "Move Y", "create.schematic.tool.rotate": "Rotate", "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.1": "Right-Click on the ground to place.", "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.clearing": "Clearing Blocks", "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.materialChecklist": "Material Checklist", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 8e489b370..8403ebbb3 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -879,7 +879,7 @@ "create.schematicAndQuill.noTarget": "Halte [Strg] zur Auswahl von Luft.", "create.schematicAndQuill.abort": "Auswahl zurückgesetzt.", "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.saved": "Gespeichert als %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index 854c8e156..e0c794f9e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -879,7 +879,7 @@ "create.schematicAndQuill.noTarget": "UNLOCALIZED: Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.abort": "UNLOCALIZED: Removed selection.", "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.saved": "UNLOCALIZED: Saved as %1$s", @@ -894,12 +894,12 @@ "create.schematic.mirror.none": "UNLOCALIZED: None", "create.schematic.mirror.frontBack": "UNLOCALIZED: Front-Back", "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.movey": "UNLOCALIZED: Move Y", "create.schematic.tool.rotate": "UNLOCALIZED: Rotate", "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.1": "UNLOCALIZED: Right-Click on the ground to place.", "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.clearing": "UNLOCALIZED: Clearing Blocks", "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.materialChecklist": "UNLOCALIZED: Material Checklist", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index 8c7090e72..1d6f597aa 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -879,7 +879,7 @@ "create.schematicAndQuill.noTarget": "Houd [Ctrl] ingedrukt om een Lucht block te kiezen.", "create.schematicAndQuill.abort": "Keuze verwijderd.", "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.saved": "Opgeslagen als %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index 69c3540e9..7d318a947 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -879,7 +879,7 @@ "create.schematicAndQuill.noTarget": "Seguro [Ctrl] para selecionar Blocos de Ar.", "create.schematicAndQuill.abort": "Seleção removida.", "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.saved": "Salvo como %1$s", diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index 83738f6dd..d1825eef9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -3,31 +3,48 @@ package com.simibubi.create.content.contraptions.components.deployer; import java.util.Arrays; import java.util.List; -import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; -import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer; -import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; +import javax.annotation.Nullable; + import org.apache.commons.lang3.tuple.Pair; 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.structureMovement.AbstractContraptionEntity; 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.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.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.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.NBTProcessors; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.Constants.NBT; - -import javax.annotation.Nullable; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.items.IItemHandler; 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) { + 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) .getDirectionVec()); facingVec = context.rotation.apply(facingVec); @@ -64,6 +87,61 @@ public class DeployerMovementBehaviour extends MovementBehaviour { 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 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 public void tick(MovementContext context) { if (context.world.isRemote) @@ -111,6 +189,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour { if (player.getHeldItemMainhand() .isEmpty()) { ItemStack filter = getFilter(context); + if (AllItems.SCHEMATIC.isIn(filter)) + return; ItemStack held = ItemHelper.extract(context.contraption.inventory, stack -> FilterItem.test(context.world, stack, filter), 1, false); player.setHeldItem(Hand.MAIN_HAND, held); diff --git a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java index f2127a1cb..1e123ebfb 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java @@ -3,31 +3,22 @@ package com.simibubi.create.content.schematics.block; import java.util.Optional; 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.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem; 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.Blocks; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; 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.SoundCategory; -import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.Constants; public abstract class LaunchedItem { @@ -128,46 +119,7 @@ public abstract class LaunchedItem { @Override void place(World world) { - // 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); - } - } - state.getBlock().onBlockPlacedBy(world, target, state, null, stack); + BlockHelper.placeSchematicBlock(world, state, target, stack, data); } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index e3317d9aa..156c434fd 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -176,7 +176,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (compound.contains("CurrentPos")) currentPos = NBTUtil.readBlockPos(compound.getCompound("CurrentPos")); } - + // Gui information statusMsg = compound.getString("Status"); schematicProgress = compound.getFloat("Progress"); @@ -186,17 +186,17 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC blocksPlaced = compound.getInt("AmountPlaced"); blocksToPlace = compound.getInt("AmountToPlace"); printingEntityIndex = compound.getInt("EntityProgress"); - + missingItem = null; if (compound.contains("MissingItem")) missingItem = ItemStack.read(compound.getCompound("MissingItem")); - + // Settings CompoundNBT options = compound.getCompound("Options"); replaceMode = options.getInt("ReplaceMode"); skipMissing = options.getBoolean("SkipMissing"); replaceTileEntities = options.getBoolean("ReplaceTileEntities"); - + // Printer & Flying Blocks if (compound.contains("Target")) target = NBTUtil.readBlockPos(compound.getCompound("Target")); @@ -251,7 +251,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC compound.put("CurrentPos", NBTUtil.writeBlockPos(currentPos)); } } - + // Gui information compound.putFloat("Progress", schematicProgress); compound.putFloat("PaperProgress", bookPrintingProgress); @@ -261,17 +261,17 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC compound.putInt("AmountPlaced", blocksPlaced); compound.putInt("AmountToPlace", blocksToPlace); compound.putInt("EntityProgress", printingEntityIndex); - + if (missingItem != null) compound.put("MissingItem", missingItem.serializeNBT()); - + // Settings CompoundNBT options = new CompoundNBT(); options.putInt("ReplaceMode", replaceMode); options.putBoolean("SkipMissing", skipMissing); options.putBoolean("ReplaceTileEntities", replaceTileEntities); compound.put("Options", options); - + // Printer & Flying Blocks if (target != null) compound.put("Target", NBTUtil.writeBlockPos(target)); @@ -376,11 +376,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC } if (missingItem == null && !positionNotLoaded) { - advanceCurrentPos(); + do { + advanceCurrentPos(); + if (state == State.STOPPED) + return; - // End reached - if (state == State.STOPPED) - return; + } while (!blockReader.getBounds() + .isVecInside(currentPos)); sendUpdate = true; target = schematicAnchor.add(currentPos); @@ -711,10 +713,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (world == null) return false; BlockState toReplace = world.getBlockState(pos); - boolean placingAir = state.getBlock().isAir(state, world, pos); + boolean placingAir = state.getBlock() + .isAir(state, world, pos); 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))); if (state.has(BlockStateProperties.DOUBLE_BLOCK_HALF) && state.get(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.LOWER) @@ -727,11 +731,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC return false; if (toReplace == state) 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; if (pos.withinDistance(getPos(), 2f)) return false; - if (!replaceTileEntities && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity()))) + if (!replaceTileEntities + && (toReplace.hasTileEntity() || (toReplaceOther != null && toReplaceOther.hasTileEntity()))) return false; if (shouldIgnoreBlockState(state)) @@ -742,10 +748,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC if (replaceMode == 2 && !placingAir) return true; 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) 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 false; @@ -755,7 +763,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC // Block doesnt have a mapping (Water, lava, etc) if (state.getBlock() == Blocks.STRUCTURE_VOID) return true; - + ItemRequirement requirement = ItemRequirement.of(state); if (requirement.isEmpty()) 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) { - if (state.getBlock().isAir(state, world, target)) + if (state.getBlock() + .isAir(state, world, target)) blocksPlaced++; flyingBlocks.add(new LaunchedItem.ForBlockState(this.getPos(), target, stack, state, data)); playFiringSound(); diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java index 74c6b9eac..8d30e6f8f 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java @@ -20,6 +20,7 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.outliner.AABBOutline; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -206,7 +207,10 @@ public class SchematicHandler { return; if (mc.objectMouseOver instanceof BlockRayTraceResult) { 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; } currentTool.getTool() diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index e516b3c6d..bd2045f84 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -2,10 +2,16 @@ package com.simibubi.create.foundation.utility; import java.util.function.Consumer; +import javax.annotation.Nullable; + 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.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.client.particle.DiggingParticle; import net.minecraft.client.particle.ParticleManager; import net.minecraft.entity.player.PlayerEntity; @@ -13,10 +19,15 @@ import net.minecraft.fluid.IFluidState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; 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.SlabType; +import net.minecraft.tags.FluidTags; import net.minecraft.tileentity.TileEntity; 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.MathHelper; import net.minecraft.util.math.shapes.VoxelShape; @@ -26,6 +37,7 @@ import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.IPlantable; public class BlockHelper { @@ -164,7 +176,7 @@ public class BlockHelper { public static void destroyBlock(World world, BlockPos pos, float effectChance, Consumer droppedItemCallback) { - + IFluidState ifluidstate = world.getFluidState(pos); BlockState state = world.getBlockState(pos); if (world.rand.nextFloat() < effectChance) @@ -185,9 +197,63 @@ public class BlockHelper { return Block.hasSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader, fromPos.offset(toDirection), toDirection.getOpposite()); } - + 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) { + } } } diff --git a/src/main/resources/assets/create/lang/default/messages.json b/src/main/resources/assets/create/lang/default/messages.json index a5176a70f..f2212a3c6 100644 --- a/src/main/resources/assets/create/lang/default/messages.json +++ b/src/main/resources/assets/create/lang/default/messages.json @@ -228,7 +228,7 @@ "create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.", "create.schematicAndQuill.abort": "Removed selection.", "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.saved": "Saved as %1$s", @@ -244,12 +244,12 @@ "create.schematic.mirror.frontBack": "Front-Back", "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.movey": "Move Y", "create.schematic.tool.rotate": "Rotate", "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.1": "Right-Click on the ground to place.", @@ -329,7 +329,7 @@ "create.schematicannon.status.placing": "Placing", "create.schematicannon.status.clearing": "Clearing Blocks", "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.materialChecklist": "Material Checklist",