Skip to content

Commit

Permalink
Change method for Fusion detection to use IThirdParty + Fix tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Reabstraction committed Nov 8, 2024
1 parent a1837c8 commit f539dc8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean propagatesSkylightDown(BlockState p_200123_1_, BlockGetter p_2001
public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> 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));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
1 change: 1 addition & 0 deletions src/main/java/me/desht/pneumaticcraft/lib/ModIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
2 changes: 1 addition & 1 deletion src/main/resources/assets/pneumaticcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit f539dc8

Please sign in to comment.