diff --git a/changelog.txt b/changelog.txt index 2eea69ca2..590af8dfd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -14,6 +14,9 @@ Changed: - Changed AP Shell texture to better show base fuze location - Changed wording on some tooltips - Made the Quick-Firing Breech openable using the side lever +- Copycats+ is now supported for 2.1.4 + - Added more support for Copycats+ block armor properties + - Copycats+ 1.2.5 is the minimum supported version Fixed: - Fixed autocannon round duplication glitch - Fixed projectile ground tracking diff --git a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java index 84b9e962d..5c9695975 100644 --- a/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java +++ b/fabric/src/main/java/rbasamoyai/createbigcannons/fabric/CBCCommonFabricEvents.java @@ -3,6 +3,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import javax.annotation.Nullable; + import com.simibubi.create.content.kinetics.deployer.DeployerRecipeSearchEvent; import io.github.fabricators_of_create.porting_lib.event.common.ModsLoadedCallback; @@ -42,8 +44,6 @@ import rbasamoyai.createbigcannons.compat.trinkets.CBCTrinketsIntegration; import rbasamoyai.createbigcannons.equipment.gas_mask.GasMaskItem; -import javax.annotation.Nullable; - public class CBCCommonFabricEvents { public static void register() { @@ -66,7 +66,7 @@ public static void onModsLoaded(EnvType type) { GasMaskItem.registerDefaultHandlers(); DefaultCreateCompat.init(); DefaultCannonMountPropertiesSerializers.init(); - CBCModsFabric.COPYCATS.executeIfInstalled(() -> () -> CopycatsCompat.init()); + CBCModsFabric.COPYCATS.executeIfInstalled(() -> () -> CopycatsCompat.init(CBCModsFabric.COPYCATS::getBlock)); CBCModsFabric.TRINKETS.executeIfInstalled(() -> () -> CBCTrinketsIntegration.init()); } diff --git a/forge/src/main/java/rbasamoyai/createbigcannons/forge/CreateBigCannonsForge.java b/forge/src/main/java/rbasamoyai/createbigcannons/forge/CreateBigCannonsForge.java index 47bf9b7d7..910d817c0 100644 --- a/forge/src/main/java/rbasamoyai/createbigcannons/forge/CreateBigCannonsForge.java +++ b/forge/src/main/java/rbasamoyai/createbigcannons/forge/CreateBigCannonsForge.java @@ -83,7 +83,7 @@ private void onCommonSetup(FMLCommonSetupEvent event) { CreateBigCannons.onCommonSetup(); DefaultCreateCompat.init(); DefaultCannonMountPropertiesSerializers.init(); - CBCModsForge.COPYCATS.executeIfInstalled(() -> () -> CopycatsCompat.init()); + CBCModsForge.COPYCATS.executeIfInstalled(() -> () -> CopycatsCompat.init(CBCModsForge.COPYCATS::getBlock)); CBCModsForge.FRAMEDBLOCKS.executeIfInstalled(() -> () -> FramedBlocksCompat.init()); } diff --git a/src/main/java/rbasamoyai/createbigcannons/compat/copycats/CopycatsCompat.java b/src/main/java/rbasamoyai/createbigcannons/compat/copycats/CopycatsCompat.java index f0159fd3f..6defc9900 100644 --- a/src/main/java/rbasamoyai/createbigcannons/compat/copycats/CopycatsCompat.java +++ b/src/main/java/rbasamoyai/createbigcannons/compat/copycats/CopycatsCompat.java @@ -2,7 +2,9 @@ import static rbasamoyai.createbigcannons.block_armor_properties.mimicking_blocks.AbstractMimickingBlockArmorProperties.createMimicrySerializer; -import com.copycatsplus.copycats.CCBlocks; +import java.util.function.Function; + +import javax.annotation.Nullable; import net.minecraft.world.level.block.Block; import rbasamoyai.createbigcannons.block_armor_properties.BlockArmorPropertiesHandler; @@ -10,42 +12,47 @@ public class CopycatsCompat { - public static void init() { - registerCopycatSerializer(CCBlocks.COPYCAT_BLOCK.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_BEAM.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_BOARD.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_WOODEN_BUTTON.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_STONE_BUTTON.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_BYTE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_FENCE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_FENCE_GATE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_HALF_LAYER.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_HALF_PANEL.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_LADDER.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_LAYER.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_WOODEN_PRESSURE_PLATE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_STONE_PRESSURE_PLATE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_HEAVY_WEIGHTED_PRESSURE_PLATE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_LIGHT_WEIGHTED_PRESSURE_PLATE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_SLAB.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_SLICE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_STAIRS.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_VERTICAL_STAIRS.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_TRAPDOOR.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_IRON_TRAPDOOR.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_VERTICAL_SLICE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_VERTICAL_STEP.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_WALL.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_SLOPE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_VERTICAL_SLOPE.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_SLOPE_LAYER.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_DOOR.get()); - registerCopycatSerializer(CCBlocks.COPYCAT_IRON_DOOR.get()); - + public static void init(Function blockGetter) { + registerCopycatSerializer(blockGetter.apply("copycat_block")); + registerCopycatSerializer(blockGetter.apply("copycat_beam")); + registerCopycatSerializer(blockGetter.apply("copycat_board")); + registerCopycatSerializer(blockGetter.apply("copycat_wooden_button")); + registerCopycatSerializer(blockGetter.apply("copycat_stone_button")); + registerCopycatSerializer(blockGetter.apply("copycat_byte")); + registerCopycatSerializer(blockGetter.apply("copycat_fence")); + registerCopycatSerializer(blockGetter.apply("copycat_fence_gate")); + registerCopycatSerializer(blockGetter.apply("copycat_half_layer")); + registerCopycatSerializer(blockGetter.apply("copycat_half_panel")); + registerCopycatSerializer(blockGetter.apply("copycat_ladder")); + registerCopycatSerializer(blockGetter.apply("copycat_layer")); + registerCopycatSerializer(blockGetter.apply("copycat_wooden_pressure_plate")); + registerCopycatSerializer(blockGetter.apply("copycat_stone_pressure_plate")); + registerCopycatSerializer(blockGetter.apply("copycat_heavy_weighted_pressure_plate")); + registerCopycatSerializer(blockGetter.apply("copycat_light_weighted_pressure_plate")); + registerCopycatSerializer(blockGetter.apply("copycat_slab")); + registerCopycatSerializer(blockGetter.apply("copycat_slice")); + registerCopycatSerializer(blockGetter.apply("copycat_stairs")); + registerCopycatSerializer(blockGetter.apply("copycat_vertical_stairs")); + registerCopycatSerializer(blockGetter.apply("copycat_trapdoor")); + registerCopycatSerializer(blockGetter.apply("copycat_iron_trapdoor")); + registerCopycatSerializer(blockGetter.apply("copycat_vertical_slice")); + registerCopycatSerializer(blockGetter.apply("copycat_vertical_step")); + registerCopycatSerializer(blockGetter.apply("copycat_wall")); + registerCopycatSerializer(blockGetter.apply("copycat_slope")); + registerCopycatSerializer(blockGetter.apply("copycat_vertical_slope")); + registerCopycatSerializer(blockGetter.apply("copycat_slope_layer")); + registerCopycatSerializer(blockGetter.apply("copycat_door")); + registerCopycatSerializer(blockGetter.apply("copycat_iron_door")); + registerCopycatSerializer(blockGetter.apply("copycat_fluid_pipe")); + registerCopycatSerializer(blockGetter.apply("copycat_glass_fluid_pipe")); + registerCopycatSerializer(blockGetter.apply("copycat_shaft")); + registerCopycatSerializer(blockGetter.apply("copycat_cogwheel")); + registerCopycatSerializer(blockGetter.apply("copycat_large_cogwheel")); } - private static void registerCopycatSerializer(Block block) { - BlockArmorPropertiesHandler.registerCustomSerializer(block, createMimicrySerializer(CopycatBlockArmorProperties::new)); + private static void registerCopycatSerializer(@Nullable Block block) { + if (block != null) + BlockArmorPropertiesHandler.registerCustomSerializer(block, createMimicrySerializer(CopycatBlockArmorProperties::new)); } } diff --git a/src/main/resources/data/copycats/block_armor/copycat_cogwheel.json b/src/main/resources/data/copycats/block_armor/copycat_cogwheel.json new file mode 100644 index 000000000..2831dc9de --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_cogwheel.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.25, + "material_toughness_multiplier": 0.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_fluid_pipe.json b/src/main/resources/data/copycats/block_armor/copycat_fluid_pipe.json new file mode 100644 index 000000000..2831dc9de --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_fluid_pipe.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.25, + "material_toughness_multiplier": 0.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_glass_fluid_pipe.json b/src/main/resources/data/copycats/block_armor/copycat_glass_fluid_pipe.json new file mode 100644 index 000000000..2831dc9de --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_glass_fluid_pipe.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.25, + "material_toughness_multiplier": 0.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_iron_trapdoor.json b/src/main/resources/data/copycats/block_armor/copycat_iron_trapdoor.json new file mode 100644 index 000000000..ffd6253d2 --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_iron_trapdoor.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 1.25, + "material_toughness_multiplier": 1.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_ladder.json b/src/main/resources/data/copycats/block_armor/copycat_ladder.json new file mode 100644 index 000000000..6ec3b74cc --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_ladder.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.5, + "material_toughness_multiplier": 0.5, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_large_cogwheel.json b/src/main/resources/data/copycats/block_armor/copycat_large_cogwheel.json new file mode 100644 index 000000000..2831dc9de --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_large_cogwheel.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.25, + "material_toughness_multiplier": 0.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_shaft.json b/src/main/resources/data/copycats/block_armor/copycat_shaft.json new file mode 100644 index 000000000..2831dc9de --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_shaft.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.25, + "material_toughness_multiplier": 0.25, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_slope.json b/src/main/resources/data/copycats/block_armor/copycat_slope.json new file mode 100644 index 000000000..6ec3b74cc --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_slope.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.5, + "material_toughness_multiplier": 0.5, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_slope_layer.json b/src/main/resources/data/copycats/block_armor/copycat_slope_layer.json new file mode 100644 index 000000000..7f961a8e4 --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_slope_layer.json @@ -0,0 +1,14 @@ +{ + "default_toughness": 0.5, + "material_toughness_multiplier": 0.5, + "default_hardness": 1, + "material_hardness_multiplier": 1, + "variants": { + "layers=8": { + "default_toughness": 1, + "material_toughness_multiplier": 1, + "default_hardness": 1, + "material_hardness_multiplier": 1 + } + } +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_vertical_slope.json b/src/main/resources/data/copycats/block_armor/copycat_vertical_slope.json new file mode 100644 index 000000000..6ec3b74cc --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_vertical_slope.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.5, + "material_toughness_multiplier": 0.5, + "default_hardness": 1, + "material_hardness_multiplier": 1 +} diff --git a/src/main/resources/data/copycats/block_armor/copycat_vertical_stairs.json b/src/main/resources/data/copycats/block_armor/copycat_vertical_stairs.json new file mode 100644 index 000000000..708c363a5 --- /dev/null +++ b/src/main/resources/data/copycats/block_armor/copycat_vertical_stairs.json @@ -0,0 +1,6 @@ +{ + "default_toughness": 0.75, + "material_toughness_multiplier": 0.75, + "default_hardness": 1, + "material_hardness_multiplier": 1 +}