From a1837c89fdb5d8a02e3d56a0815e7eccdd3453ca Mon Sep 17 00:00:00 2001 From: Reabstraction Date: Wed, 2 Oct 2024 20:44:09 +0200 Subject: [PATCH 1/2] Add fusion integration for the pressure_chamber_glass texture --- .../PneumaticCraftRepressurized.java | 12 ++++++++++++ .../models/block/pressure_chamber_glass.json | 14 ++++++++++++++ .../textures/block/pressure_chamber/window.png | Bin 0 -> 1736 bytes .../block/pressure_chamber/window.png.mcmeta | 6 ++++++ .../resources/fusion_integration/pack.mcmeta | 7 +++++++ 5 files changed, 39 insertions(+) create mode 100644 src/main/resources/fusion_integration/assets/pneumaticcraft/models/block/pressure_chamber_glass.json create mode 100644 src/main/resources/fusion_integration/assets/pneumaticcraft/textures/block/pressure_chamber/window.png create mode 100644 src/main/resources/fusion_integration/assets/pneumaticcraft/textures/block/pressure_chamber/window.png.mcmeta create mode 100644 src/main/resources/fusion_integration/pack.mcmeta diff --git a/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java b/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java index bae548268..e8227e574 100644 --- a/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java +++ b/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java @@ -53,6 +53,11 @@ import me.desht.pneumaticcraft.common.util.chunkloading.PlayerLogoutTracker; import me.desht.pneumaticcraft.common.villages.VillageStructures; import me.desht.pneumaticcraft.lib.Log; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.repository.PackSource; +import net.minecraft.server.packs.repository.Pack.Position; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModList; @@ -60,6 +65,7 @@ import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.fml.loading.FMLEnvironment; import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.AddPackFindersEvent; import net.neoforged.neoforge.event.AddReloadListenerEvent; import net.neoforged.neoforge.event.RegisterCommandsEvent; import net.neoforged.neoforge.event.server.ServerStartedEvent; @@ -86,6 +92,7 @@ public PneumaticCraftRepressurized(ModContainer container, IEventBus modBus) { modBus.addListener(this::newRegistries); modBus.addListener(ForcedChunks.INSTANCE::registerTicketController); modBus.addListener(CapabilitySetup::registerCaps); + modBus.addListener(this::addPackFinders); registerAllDeferredRegistryObjects(modBus); @@ -103,6 +110,11 @@ public PneumaticCraftRepressurized(ModContainer container, IEventBus modBus) { forgeBus.addListener(VillageStructures::addMechanicHouse); forgeBus.register(PlayerLogoutTracker.INSTANCE); } + + private void addPackFinders(AddPackFindersEvent event) { + if (ModList.get().isLoaded("fusion")) + event.addPackFinders(ResourceLocation.fromNamespaceAndPath("pneumaticcraft", "fusion_integration"), PackType.CLIENT_RESOURCES, Component.literal("Fusion for PneumaticCraft"), PackSource.BUILT_IN, false, Position.TOP); + } private void newRegistries(NewRegistryEvent event) { // bit kludgy, but this event is fired right after we know for sure which mods are present, diff --git a/src/main/resources/fusion_integration/assets/pneumaticcraft/models/block/pressure_chamber_glass.json b/src/main/resources/fusion_integration/assets/pneumaticcraft/models/block/pressure_chamber_glass.json new file mode 100644 index 000000000..ac53b503b --- /dev/null +++ b/src/main/resources/fusion_integration/assets/pneumaticcraft/models/block/pressure_chamber_glass.json @@ -0,0 +1,14 @@ +{ + "loader": "fusion:model", + "type": "connecting", + "connections": [ + { + "type": "is_same_block" + } + ], + "parent": "minecraft:block/cube_all", + "textures": { + "all": "pneumaticcraft:block/pressure_chamber/window" + }, + "render_type": "cutout" +} diff --git a/src/main/resources/fusion_integration/assets/pneumaticcraft/textures/block/pressure_chamber/window.png b/src/main/resources/fusion_integration/assets/pneumaticcraft/textures/block/pressure_chamber/window.png new file mode 100644 index 0000000000000000000000000000000000000000..1acce980b34b8354ef61917f382b8d090fc5e23d GIT binary patch literal 1736 zcmV;(1~>VMP)EX>4Tx04R}tkv&MmKpe$iQ>9W`9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H&5UA8vP*cZyOT&h!6HAFANni4Zh1i`S@-C`v&jc0I_-Hy91DH{IV>YgS|=b;0Jq? z=XJD?-Wr#G>hY8J1Ed}wKS1K~@dG3tKY2eu>fi@RJU+F6)Sm#U`vH>Ir|t(xJ$~}v z7ogpr?_0-r)xaRm2T1w*0<`<{Z}09^pTR+#51`#2uif7sV|=IgjqlL<5q$Yo&6JV0 z9<zy=D9%^ufUlIbl7W$Kaz+R1W|E00000z?vC7jo)&;cO`15@2~gO4~5IaYJa}Q zPcTIPsXT$&{qZ5}ueXe^jXgyFsm)Ac?w;X(J|Gi26 zOp=)4qi68Zr=|x0000000AS6Gp2lyvKC`NaJAC6?*VBj6TYt|&9&v(Km|#0000 Date: Fri, 8 Nov 2024 11:13:59 +0100 Subject: [PATCH 2/2] Change method for Fusion detection to use IThirdParty + Fix tooltip --- .../PneumaticCraftRepressurized.java | 11 --------- .../block/PressureChamberGlassBlock.java | 2 +- .../common/thirdparty/Fusion.java | 23 +++++++++++++++++++ .../common/thirdparty/ThirdPartyManager.java | 1 + .../me/desht/pneumaticcraft/lib/ModIds.java | 1 + .../assets/pneumaticcraft/lang/en_us.json | 2 +- 6 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 src/main/java/me/desht/pneumaticcraft/common/thirdparty/Fusion.java diff --git a/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java b/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java index e8227e574..2e5fc2969 100644 --- a/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java +++ b/src/main/java/me/desht/pneumaticcraft/PneumaticCraftRepressurized.java @@ -53,11 +53,6 @@ import me.desht.pneumaticcraft.common.util.chunkloading.PlayerLogoutTracker; import me.desht.pneumaticcraft.common.villages.VillageStructures; import me.desht.pneumaticcraft.lib.Log; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.PackType; -import net.minecraft.server.packs.repository.PackSource; -import net.minecraft.server.packs.repository.Pack.Position; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModList; @@ -92,7 +87,6 @@ public PneumaticCraftRepressurized(ModContainer container, IEventBus modBus) { modBus.addListener(this::newRegistries); modBus.addListener(ForcedChunks.INSTANCE::registerTicketController); modBus.addListener(CapabilitySetup::registerCaps); - modBus.addListener(this::addPackFinders); registerAllDeferredRegistryObjects(modBus); @@ -110,11 +104,6 @@ public PneumaticCraftRepressurized(ModContainer container, IEventBus modBus) { forgeBus.addListener(VillageStructures::addMechanicHouse); forgeBus.register(PlayerLogoutTracker.INSTANCE); } - - private void addPackFinders(AddPackFindersEvent event) { - if (ModList.get().isLoaded("fusion")) - event.addPackFinders(ResourceLocation.fromNamespaceAndPath("pneumaticcraft", "fusion_integration"), PackType.CLIENT_RESOURCES, Component.literal("Fusion for PneumaticCraft"), PackSource.BUILT_IN, false, Position.TOP); - } private void newRegistries(NewRegistryEvent event) { // bit kludgy, but this event is fired right after we know for sure which mods are present, diff --git a/src/main/java/me/desht/pneumaticcraft/common/block/PressureChamberGlassBlock.java b/src/main/java/me/desht/pneumaticcraft/common/block/PressureChamberGlassBlock.java index 56d92095f..4871074b6 100644 --- a/src/main/java/me/desht/pneumaticcraft/common/block/PressureChamberGlassBlock.java +++ b/src/main/java/me/desht/pneumaticcraft/common/block/PressureChamberGlassBlock.java @@ -74,7 +74,7 @@ public boolean propagatesSkylightDown(BlockState p_200123_1_, BlockGetter p_2001 public void appendHoverText(ItemStack stack, Item.TooltipContext context, List curInfo, TooltipFlag flag) { super.appendHoverText(stack, context, curInfo, flag); - if (!ModList.get().isLoaded(ModIds.CTM)) { + if (!ModList.get().isLoaded(ModIds.CTM) && !ModList.get().isLoaded(ModIds.FUSION)) { curInfo.add(xlate("gui.tooltip.block.pneumaticcraft.pressure_chamber_glass.ctm").withStyle(ChatFormatting.GRAY)); } } diff --git a/src/main/java/me/desht/pneumaticcraft/common/thirdparty/Fusion.java b/src/main/java/me/desht/pneumaticcraft/common/thirdparty/Fusion.java new file mode 100644 index 000000000..b1c9579a0 --- /dev/null +++ b/src/main/java/me/desht/pneumaticcraft/common/thirdparty/Fusion.java @@ -0,0 +1,23 @@ +package me.desht.pneumaticcraft.common.thirdparty; + +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.repository.PackSource; +import net.minecraft.server.packs.repository.Pack.Position; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModList; +import net.neoforged.neoforge.event.AddPackFindersEvent; + +public class Fusion implements IThirdParty { + + private void addPackFinders(AddPackFindersEvent event) { + if (ModList.get().isLoaded("fusion")) + event.addPackFinders(ResourceLocation.fromNamespaceAndPath("pneumaticcraft", "fusion_integration"), PackType.CLIENT_RESOURCES, Component.literal("Fusion for PneumaticCraft"), PackSource.BUILT_IN, false, Position.TOP); + } + + @Override + public void clientPreInit(IEventBus modBus) { + modBus.addListener(this::addPackFinders); + } +} diff --git a/src/main/java/me/desht/pneumaticcraft/common/thirdparty/ThirdPartyManager.java b/src/main/java/me/desht/pneumaticcraft/common/thirdparty/ThirdPartyManager.java index 8fffcdc4e..0ced5be33 100644 --- a/src/main/java/me/desht/pneumaticcraft/common/thirdparty/ThirdPartyManager.java +++ b/src/main/java/me/desht/pneumaticcraft/common/thirdparty/ThirdPartyManager.java @@ -74,6 +74,7 @@ private void discoverMods() { thirdPartyClasses.put(ModIds.CRAFTTWEAKER, () -> IMPLICIT_INIT); thirdPartyClasses.put(ModIds.GAMESTAGES, Gamestages::new); thirdPartyClasses.put(ModIds.CREATE, Create::new); + thirdPartyClasses.put(ModIds.FUSION, Fusion::new); thirdPartyClasses.put(ModIds.FFS, FTBFilterSystem::new); // these were supported in 1.12.2 and may or may not come back... diff --git a/src/main/java/me/desht/pneumaticcraft/lib/ModIds.java b/src/main/java/me/desht/pneumaticcraft/lib/ModIds.java index 05ebfb708..156792665 100644 --- a/src/main/java/me/desht/pneumaticcraft/lib/ModIds.java +++ b/src/main/java/me/desht/pneumaticcraft/lib/ModIds.java @@ -45,4 +45,5 @@ public class ModIds { public static final String THE_ONE_PROBE = "theoneprobe"; public static final String FFS = "ftbfiltersystem"; public static final String CTM = "ctm"; + public static final String FUSION = "fusion"; } diff --git a/src/main/resources/assets/pneumaticcraft/lang/en_us.json b/src/main/resources/assets/pneumaticcraft/lang/en_us.json index 4e38e3c14..9b1d55aff 100644 --- a/src/main/resources/assets/pneumaticcraft/lang/en_us.json +++ b/src/main/resources/assets/pneumaticcraft/lang/en_us.json @@ -247,7 +247,7 @@ "gui.tooltip.block.pneumaticcraft.pneumatic_dynamo" : "Converts compressed air into Forge Energy (compatible with RF and many other mods' energy). It has a base efficiency of 40%%, i.e. 100mL of air be used to generate 40 FE. Speed Upgrades will reduce this efficiency slightly.\nThis Dynamo generates heat, which must be dissipated to avoid efficiency loss.", "gui.tooltip.block.pneumaticcraft.pneumatic_generator" : "This machine converts compressed air into Industrial Craft 2 EU. You can interact with this machine with an IC2 Wrench just like any other IC2 machine.", "gui.tooltip.block.pneumaticcraft.pressure_chamber_glass" : "This block is used to create a Pressure Chamber. Create a hollow 3x3x3/4x4x4/5x5x5 structure with at least one Pressure Chamber Valve in a face (not edge or corner) of the structure. Pressure Chamber Walls and Pressure Chamber Glass can be used interchangeably.", - "gui.tooltip.block.pneumaticcraft.pressure_chamber_glass.ctm" : "Install ConnectedTexturesMod (CTM) for connected textures", + "gui.tooltip.block.pneumaticcraft.pressure_chamber_glass.ctm" : "Install ConnectedTexturesMod (CTM) or Fusion for connected textures", "gui.tooltip.block.pneumaticcraft.pressure_chamber_interface" : "This block is used to import/export items to/from a Pressure Chamber. It imports on the 'I' face, and exports on the 'O' face. You should have at least two Pressure Chamber Interfaces in your Pressure Chamber: one with the 'O' face pointing into the chamber, and one with the 'O' face pointing out to the outside world.", "gui.tooltip.block.pneumaticcraft.pressure_chamber_valve" : "This multi-block structure can be used as air storage. Its primary usage, however, is to compress various materials into other materials. Like Iron into Compressed Iron. Or Coal into Diamonds.", "gui.tooltip.block.pneumaticcraft.pressure_chamber_wall" : "This block is used to create a Pressure Chamber. Create a hollow 3x3x3/4x4x4/5x5x5 structure with at least one Pressure Chamber Valve in a face (not edge or corner) of the structure. Pressure Chamber Walls and Pressure Chamber Glass can be used interchangeably.",