From ffbc75abee3c48de8b387c02fbb8d5709251b66a Mon Sep 17 00:00:00 2001 From: xieve Date: Tue, 21 Mar 2023 15:36:48 +0100 Subject: [PATCH 1/4] Added rotate method to Fluid Pipes --- .../fluids/pipes/FluidPipeBlock.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java index d7998b973..4b7c21137 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java @@ -36,7 +36,9 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.PipeBlock; +import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.SimpleWaterloggedBlock; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -337,4 +339,22 @@ public class FluidPipeBlock extends PipeBlock public VoxelShape getOcclusionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos) { return OCCLUSION_BOX; } + + @Override + public BlockState rotate(BlockState state, Rotation rotation) { + BlockState rotated = state; + for (Direction direction : Iterate.horizontalDirections) { + rotated = rotated.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction))); + } + return rotated; + } + + @Override + public BlockState mirror(BlockState state, Mirror mirror) { + BlockState mirrored = state; + for (Direction direction : Iterate.horizontalDirections) { + mirrored = mirrored.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction))); + } + return mirrored; + } } From db51dd1d3d1723dd6716826000ace27a6fd80f2f Mon Sep 17 00:00:00 2001 From: xieve Date: Sun, 26 Mar 2023 15:08:04 +0200 Subject: [PATCH 2/4] Implemented ITransformableBlock for Fluid Pipes --- .../fluids/pipes/FluidPipeBlock.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java index 4b7c21137..b7d167a48 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidPipeBlock.java @@ -7,6 +7,8 @@ import javax.annotation.Nullable; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.components.structureMovement.ITransformableBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform; import com.simibubi.create.content.contraptions.fluids.FluidPropagator; import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour; import com.simibubi.create.content.contraptions.relays.elementary.BracketedTileEntityBehaviour; @@ -53,7 +55,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.ticks.TickPriority; public class FluidPipeBlock extends PipeBlock - implements SimpleWaterloggedBlock, IWrenchableWithBracket, ITE, EncasableBlock { + implements SimpleWaterloggedBlock, IWrenchableWithBracket, ITE, EncasableBlock, ITransformableBlock { private static final VoxelShape OCCLUSION_BOX = Block.box(4, 4, 4, 12, 12, 12); @@ -357,4 +359,21 @@ public class FluidPipeBlock extends PipeBlock } return mirrored; } + + @Override + public BlockState transform(BlockState state, StructureTransform transform) { + if (transform.mirror != null) { + state = mirror(state, transform.mirror); + } + + if (transform.rotationAxis == Direction.Axis.Y) { + return rotate(state, transform.rotation); + } + + BlockState rotated = state; + for (Direction direction : Iterate.directionsInAxis(transform.rotationAxis)) { + rotated = rotated.setValue(PROPERTY_BY_DIRECTION.get(transform.rotateFacing(direction)), state.getValue(PROPERTY_BY_DIRECTION.get(direction))); + } + return rotated; + } } From 0f68201f2d9e48a9caf4da4624b906083b9f8148 Mon Sep 17 00:00:00 2001 From: Kanzaji <60540476+Kanzaji@users.noreply.github.com> Date: Fri, 7 Apr 2023 07:55:14 +0200 Subject: [PATCH 3/4] Remove Mangrove_Wood from BYG Compat to stop generating invalid recipes --- .../b256105d8411632b0d585496ea8944a751a08034 | 6 +----- .../cutting/compat/byg/mangrove_log.json | 20 ------------------ .../cutting/compat/byg/mangrove_wood.json | 20 ------------------ .../compat/byg/stripped_mangrove_log.json | 21 ------------------- .../compat/byg/stripped_mangrove_wood.json | 21 ------------------- .../data/recipe/CuttingRecipeGen.java | 2 +- 6 files changed, 2 insertions(+), 88 deletions(-) delete mode 100644 src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_log.json delete mode 100644 src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_wood.json delete mode 100644 src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_log.json delete mode 100644 src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_wood.json diff --git a/src/generated/resources/.cache/b256105d8411632b0d585496ea8944a751a08034 b/src/generated/resources/.cache/b256105d8411632b0d585496ea8944a751a08034 index 72d64109f..2e89bf13d 100644 --- a/src/generated/resources/.cache/b256105d8411632b0d585496ea8944a751a08034 +++ b/src/generated/resources/.cache/b256105d8411632b0d585496ea8944a751a08034 @@ -1,4 +1,4 @@ -// 1.19.2 2023-01-30T00:12:02.3188402 Create's Processing Recipes +// 1.19.2 2023-04-07T07:54:09.2112896 Create's Processing Recipes 3c94326fb730f68c1e44fe1e2ef09c9db6ffd92b data/create/recipes/compacting/andesite_from_flint.json 8d3d5b31f3601b9f681ff710e0545a483a1494c6 data/create/recipes/compacting/blaze_cake.json 8bd7f4e3a686ab520b2d55594d2018d0e9a50c91 data/create/recipes/compacting/chocolate.json @@ -235,8 +235,6 @@ a24ac854f3b3ebf57bea9ebd58fd9655fed8e922 data/create/recipes/cutting/compat/byg/ d93f6deefd5bcf4d91242534d9b588fa2ab1a7de data/create/recipes/cutting/compat/byg/lament_wood.json 6f3a120fae7fdcc98a416185107381a6caf739b0 data/create/recipes/cutting/compat/byg/mahogany_log.json 19cf897802135c3ebdf68f6e2bc41f3cf8d0ddb0 data/create/recipes/cutting/compat/byg/mahogany_wood.json -3a43eb5e02d1ac6f4ea95d4b376d5876a36f0b61 data/create/recipes/cutting/compat/byg/mangrove_log.json -9660d7a107fecef2975f55aa4a221742abb6095f data/create/recipes/cutting/compat/byg/mangrove_wood.json d13e02245ca4acd0c4c4d38359eddf3b22fcff7f data/create/recipes/cutting/compat/byg/maple_log.json 9c947dd9fb94709b481daa3ec5156b227b061cdd data/create/recipes/cutting/compat/byg/maple_wood.json f25cdfa7c0ff0d9c0bfb8fd4c678d1ad61d6f755 data/create/recipes/cutting/compat/byg/nightshade_log.json @@ -283,8 +281,6 @@ b7647e89ee29a4e116c49c1ae419d3d053608017 data/create/recipes/cutting/compat/byg/ 0b4478eba4e2d9bd835d9ad91dcf2eccfc538f12 data/create/recipes/cutting/compat/byg/stripped_lament_wood.json 3550d5eb7f8eab95f4dd840d72cc14dea7acdb67 data/create/recipes/cutting/compat/byg/stripped_mahogany_log.json d66b3e69b6bcf38a9d01fc9290b81778b46459f0 data/create/recipes/cutting/compat/byg/stripped_mahogany_wood.json -e82ba4d10c33003e06c85bc4f21092453a3a8286 data/create/recipes/cutting/compat/byg/stripped_mangrove_log.json -15fbb8520e495097186a1563fc185c0e14f06951 data/create/recipes/cutting/compat/byg/stripped_mangrove_wood.json 4778e5d9e1b5a5d254483dedf9cf22cbda73ca2d data/create/recipes/cutting/compat/byg/stripped_maple_log.json 18b5f67be3d28bc6c8764d2ad576f16745d95109 data/create/recipes/cutting/compat/byg/stripped_maple_wood.json 1446329655130e0cf0f0da7c1c17f517bbfb9d79 data/create/recipes/cutting/compat/byg/stripped_nightshade_log.json diff --git a/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_log.json b/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_log.json deleted file mode 100644 index 0f4b24e33..000000000 --- a/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_log.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "create:cutting", - "conditions": [ - { - "type": "forge:mod_loaded", - "modid": "byg" - } - ], - "ingredients": [ - { - "item": "byg:mangrove_log" - } - ], - "processingTime": 50, - "results": [ - { - "item": "byg:stripped_mangrove_log" - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_wood.json b/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_wood.json deleted file mode 100644 index bc78983cc..000000000 --- a/src/generated/resources/data/create/recipes/cutting/compat/byg/mangrove_wood.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "create:cutting", - "conditions": [ - { - "type": "forge:mod_loaded", - "modid": "byg" - } - ], - "ingredients": [ - { - "item": "byg:mangrove_wood" - } - ], - "processingTime": 50, - "results": [ - { - "item": "byg:stripped_mangrove_wood" - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_log.json b/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_log.json deleted file mode 100644 index 901ef74a7..000000000 --- a/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_log.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "create:cutting", - "conditions": [ - { - "type": "forge:mod_loaded", - "modid": "byg" - } - ], - "ingredients": [ - { - "item": "byg:stripped_mangrove_log" - } - ], - "processingTime": 50, - "results": [ - { - "count": 6, - "item": "byg:mangrove_planks" - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_wood.json b/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_wood.json deleted file mode 100644 index dea6c7065..000000000 --- a/src/generated/resources/data/create/recipes/cutting/compat/byg/stripped_mangrove_wood.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "create:cutting", - "conditions": [ - { - "type": "forge:mod_loaded", - "modid": "byg" - } - ], - "ingredients": [ - { - "item": "byg:stripped_mangrove_wood" - } - ], - "processingTime": 50, - "results": [ - { - "count": 6, - "item": "byg:mangrove_planks" - } - ] -} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/CuttingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/CuttingRecipeGen.java index 6dd8b0150..334dcefa9 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/CuttingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/CuttingRecipeGen.java @@ -64,7 +64,7 @@ public class CuttingRecipeGen extends ProcessingRecipeGen { // Oh The Biomes You'll Go BYG = cuttingCompat(Mods.BYG, "aspen", "baobab", "blue_enchanted", "cherry", "cika", "cypress", "ebony", "ether", - "fir", "green_enchanted", "holly", "jacaranda", "lament", "mahogany", "mangrove", "maple", "nightshade", + "fir", "green_enchanted", "holly", "jacaranda", "lament", "mahogany", "maple", "nightshade", "palm", "pine", "rainbow_eucalyptus", "redwood", "skyris", "willow", "witch_hazel", "zelkova"), BYG_2 = stripAndMakePlanks(Mods.BYG, "bulbis_stem", "stripped_bulbis_stem", "bulbis_planks"), BYG_3 = stripAndMakePlanks(Mods.BYG, "bulbis_wood", "stripped_bulbis_wood", "bulbis_planks"), From 18bdec4b5466aecf80994cc41d1f6e737b094f78 Mon Sep 17 00:00:00 2001 From: Matt598 <24874369+Matt5981@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:42:05 +1000 Subject: [PATCH 4/4] Add check to contraption disassembly code to not set NBT data for Sculk sensors/shriekers. Add check in same location to reset Sculk shriekers to their default block state after contraption disassembly. (Fixes #4677) --- .../components/structureMovement/Contraption.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 8d5cb27cb..931789959 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -1006,7 +1006,7 @@ public abstract class Contraption { if (disassembled) return; disassembled = true; - + for (boolean nonBrittles : Iterate.trueAndFalse) { for (StructureBlockInfo block : blocks.values()) { if (nonBrittles == BlockMovementChecks.isBrittle(block.state)) @@ -1047,6 +1047,10 @@ public abstract class Contraption { if (state.hasProperty(SlidingDoorBlock.VISIBLE)) state = state.setValue(SlidingDoorBlock.VISIBLE, !state.getValue(SlidingDoorBlock.OPEN)) .setValue(SlidingDoorBlock.POWERED, false); + // Stop Sculk shriekers from getting "stuck" if moved mid-shriek. + if(state.is(Blocks.SCULK_SHRIEKER)){ + state = Blocks.SCULK_SHRIEKER.defaultBlockState(); + } world.setBlock(targetPos, state, Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_ALL); @@ -1060,6 +1064,12 @@ public abstract class Contraption { BlockEntity tileEntity = world.getBlockEntity(targetPos); CompoundTag tag = block.nbt; + + // Temporary fix: Calling load(CompoundTag tag) on a Sculk sensor causes it to not react to vibrations. + if(state.is(Blocks.SCULK_SENSOR) || state.is(Blocks.SCULK_SHRIEKER)){ + tag = null; + } + if (tileEntity != null) tag = NBTProcessors.process(tileEntity, tag, false); if (tileEntity != null && tag != null) {