From 0c6bbcc5ed43d278cf1da457fe0c736699d13372 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Mon, 6 Jul 2020 23:37:44 +0200 Subject: [PATCH] Brittle and Non-movable block tags - added a block tag non_movable conatining blocks that should not be moved with contraptions - added a block tag for brittle blocks breaking without support - moved obsidian from hardcoded to non_movable block tag - moved flower pots, doors and bells from hardcoded to brittle block tag - registrate block tagging of brittle blocks - made immersive engineering connectors non-movable to avoid reported weird behavior --- src/generated/resources/.cache/cache | 1 + .../data/create/tags/blocks/brittle.json | 17 ++++++++++ .../java/com/simibubi/create/AllBlocks.java | 13 ++++++++ .../java/com/simibubi/create/AllTags.java | 2 +- .../BlockMovementTraits.java | 31 +++---------------- .../data/create/tags/blocks/brittle.json | 11 +++++++ .../data/create/tags/blocks/non_movable.json | 19 ++++++++++++ 7 files changed, 66 insertions(+), 28 deletions(-) create mode 100644 src/generated/resources/data/create/tags/blocks/brittle.json create mode 100644 src/main/resources/data/create/tags/blocks/brittle.json create mode 100644 src/main/resources/data/create/tags/blocks/non_movable.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 1f7fcc917..b995d12f4 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -2444,6 +2444,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data\create\recipes\weathered_limestone 6eceb25fabbb6b389ca35de3b829ad061c9c456a data\create\recipes\weathered_limestone_pillar.json 11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data\create\recipes\weathered_limestone_pillar_from_weathered_limestone_stonecutting.json 266f08e604d229a9d2b46f7272c0b06ec270bf3d data\create\recipes\zinc_block.json +87024323ea933fa10a4e7802f68ce5b9054021e6 data\create\tags\blocks\brittle.json 081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\create\tags\items\create_ingots.json d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data\create\tags\items\crushed_ores.json 16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\blocks\glass\colorless.json diff --git a/src/generated/resources/data/create/tags/blocks/brittle.json b/src/generated/resources/data/create/tags/blocks/brittle.json new file mode 100644 index 000000000..b07e222fb --- /dev/null +++ b/src/generated/resources/data/create/tags/blocks/brittle.json @@ -0,0 +1,17 @@ +{ + "replace": false, + "values": [ + "create:nozzle", + "create:hand_crank", + "create:rope", + "create:pulley_magnet", + "create:furnace_engine", + "create:redstone_link", + "create:extractor", + "create:vertical_extractor", + "create:linked_extractor", + "create:vertical_linked_extractor", + "create:funnel", + "create:vertical_funnel" + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index b21f000bd..b7eba372a 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -8,6 +8,7 @@ import static com.simibubi.create.foundation.data.CreateRegistrate.connectedText import static com.simibubi.create.foundation.data.ModelGen.customItemModel; import static com.simibubi.create.foundation.data.ModelGen.oxidizedItemModel; +import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.content.AllSections; import com.simibubi.create.content.contraptions.base.CasingBlock; import com.simibubi.create.content.contraptions.components.actors.DrillBlock; @@ -301,6 +302,7 @@ public class AllBlocks { public static final BlockEntry NOZZLE = REGISTRATE.block("nozzle", NozzleBlock::new) .initialProperties(SharedProperties::stone) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(BlockStateGen.directionalBlockProvider(true)) .addLayer(() -> RenderType::getCutoutMipped) .item() @@ -318,6 +320,7 @@ public class AllBlocks { .initialProperties(SharedProperties::wooden) .blockstate(BlockStateGen.directionalBlockProvider(true)) .transform(StressConfigDefaults.setCapacity(32.0)) + .tag(AllBlockTags.BRITTLE.tag) .item() .transform(customItemModel()) .register(); @@ -482,6 +485,7 @@ public class AllBlocks { public static final BlockEntry ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new) .initialProperties(SharedProperties.beltMaterial, MaterialColor.BROWN) + .tag(AllBlockTags.BRITTLE.tag) .properties(p -> p.sound(SoundType.CLOTH)) .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .getExistingFile(p.modLoc("block/rope_pulley/" + c.getName())))) @@ -490,6 +494,7 @@ public class AllBlocks { public static final BlockEntry PULLEY_MAGNET = REGISTRATE.block("pulley_magnet", PulleyBlock.MagnetBlock::new) .initialProperties(SharedProperties::stone) + .tag(AllBlockTags.BRITTLE.tag) .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .getExistingFile(p.modLoc("block/rope_pulley/" + c.getName())))) .register(); @@ -650,6 +655,7 @@ public class AllBlocks { public static final BlockEntry FURNACE_ENGINE = REGISTRATE.block("furnace_engine", FurnaceEngineBlock::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(BlockStateGen.horizontalBlockProvider(true)) .transform(StressConfigDefaults.setCapacity(1024.0)) .item() @@ -682,6 +688,7 @@ public class AllBlocks { public static final BlockEntry REDSTONE_LINK = REGISTRATE.block("redstone_link", RedstoneLinkBlock::new) .initialProperties(SharedProperties::wooden) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(new RedstoneLinkGenerator()::generate) .addLayer(() -> RenderType::getCutoutMipped) .item() @@ -795,6 +802,7 @@ public class AllBlocks { public static final BlockEntry EXTRACTOR = REGISTRATE.block("extractor", ExtractorBlock::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate((c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, c.getName() + "/horizontal"))) .item() .transform(customItemModel("_", "horizontal")) @@ -803,12 +811,14 @@ public class AllBlocks { public static final BlockEntry VERTICAL_EXTRACTOR = REGISTRATE.block("vertical_extractor", ExtractorBlock.Vertical::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(new VerticalExtractorGenerator(false)::generate) .loot((p, b) -> p.registerDropping(b, EXTRACTOR.get())) .register(); public static final BlockEntry LINKED_EXTRACTOR = REGISTRATE .block("linked_extractor", LinkedExtractorBlock::new) + .tag(AllBlockTags.BRITTLE.tag) .initialProperties(SharedProperties::softMetal) .addLayer(() -> RenderType::getCutoutMipped) .blockstate((c, p) -> p.horizontalBlock(c.get(), AssetLookup.forPowered(c, p, "extractor/horizontal_linked"))) @@ -819,6 +829,7 @@ public class AllBlocks { public static final BlockEntry VERTICAL_LINKED_EXTRACTOR = REGISTRATE.block("vertical_linked_extractor", LinkedExtractorBlock.Vertical::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(new VerticalExtractorGenerator(true)::generate) .loot((p, b) -> p.registerDropping(b, LINKED_EXTRACTOR.get())) .addLayer(() -> RenderType::getCutoutMipped) @@ -826,6 +837,7 @@ public class AllBlocks { public static final BlockEntry FUNNEL = REGISTRATE.block("funnel", FunnelBlock::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate((c, p) -> p.horizontalBlock(c.get(), state -> p.models() .getExistingFile(p.modLoc("block/funnel/horizontal" + (state.get(FunnelBlock.BELT) ? "_belt" : ""))))) .item() @@ -835,6 +847,7 @@ public class AllBlocks { public static final BlockEntry VERTICAL_FUNNEL = REGISTRATE.block("vertical_funnel", FunnelBlock.Vertical::new) .initialProperties(SharedProperties::softMetal) + .tag(AllBlockTags.BRITTLE.tag) .blockstate(new VerticalFunnelGenerator()::generate) .loot((p, b) -> p.registerDropping(b, FUNNEL.get())) .register(); diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 360e500ca..72a957c20 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -88,7 +88,7 @@ public class AllTags { } public static enum AllBlockTags { - WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, + WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE ; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java index 0c045e624..9d99d6491 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.content.contraptions.components.actors.AttachedActorBlock; import com.simibubi.create.content.contraptions.components.actors.HarvesterBlock; import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceBlock; @@ -15,8 +16,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock; -import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.MagnetBlock; -import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.RopeBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock; import com.simibubi.create.content.logistics.block.extractor.ExtractorBlock; @@ -29,7 +28,6 @@ import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.BellBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.block.CarpetBlock; import net.minecraft.block.DoorBlock; import net.minecraft.block.FenceGateBlock; @@ -73,7 +71,7 @@ public class BlockMovementTraits { return true; if (blockState.getBlockHardness(world, pos) == -1) return false; - if (block == Blocks.OBSIDIAN) + if (AllBlockTags.NON_MOVABLE.tag.contains(block)) return false; // Move controllers only when they aren't moving @@ -112,22 +110,13 @@ public class BlockMovementTraits { Block block = state.getBlock(); if (state.has(BlockStateProperties.HANGING)) return true; - if (block instanceof HandCrankBlock) - return true; + if (block instanceof LadderBlock) return true; - if (block instanceof ExtractorBlock) - return true; - if (block instanceof FunnelBlock) - return true; if (block instanceof TorchBlock) return true; - if (block instanceof FlowerPotBlock) - return true; if (block instanceof AbstractPressurePlateBlock) return true; - if (block instanceof DoorBlock) - return true; if (block instanceof HorizontalFaceBlock) return true; if (block instanceof AbstractRailBlock) @@ -136,21 +125,9 @@ public class BlockMovementTraits { return true; if (block instanceof RedstoneWireBlock) return true; - if (block instanceof RedstoneLinkBlock) - return true; - if (block instanceof RopeBlock) - return true; - if (block instanceof NozzleBlock) - return true; - if (block instanceof MagnetBlock) - return true; - if (block instanceof EngineBlock) - return true; if (block instanceof CarpetBlock) return true; - if (block instanceof BellBlock) - return true; - return false; + return AllBlockTags.BRITTLE.tag.contains(block); } /** diff --git a/src/main/resources/data/create/tags/blocks/brittle.json b/src/main/resources/data/create/tags/blocks/brittle.json new file mode 100644 index 000000000..4308e5b7c --- /dev/null +++ b/src/main/resources/data/create/tags/blocks/brittle.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "#minecraft:doors", + "minecraft:flower_pot", + "minecraft:bell" + ], + "optional": [ + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/create/tags/blocks/non_movable.json b/src/main/resources/data/create/tags/blocks/non_movable.json new file mode 100644 index 000000000..974dda4c5 --- /dev/null +++ b/src/main/resources/data/create/tags/blocks/non_movable.json @@ -0,0 +1,19 @@ +{ + "replace": false, + "values": [ + "minecraft:obsidian" + ], + "optional": [ + "immersiveengineering:connector_lv", + "immersiveengineering:connector_lv_relay", + "immersiveengineering:connector_mv", + "immersiveengineering:connector_mv_relay", + "immersiveengineering:connector_hv", + "immersiveengineering:connector_hv_relay", + "immersiveengineering:connector_bundled", + "immersiveengineering:connector_structural", + "immersiveengineering:connector_redstone", + "immersiveengineering:connector_probe", + "immersiveengineering:breaker_switch" + ] +} \ No newline at end of file