Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bclib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ dependencies {

modCompileOnly "dev.emi:emi:${emi_version}"
//modImplementation "dev.emi:emi:${emi_version}"

modImplementation "net.darkhax.tips:Tips-Fabric-${project.tips_version}"
modRuntimeOnly "net.darkhax.bookshelf:Bookshelf-Fabric-${project.bookshelf_version}"
}

processResources {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ maven_group=org.betterx.bclib
archives_base_name=bclib
# Dependencies
modmenu_version=4.0.5
emi_version=0.3.0+1.19
emi_version=0.3.0+1.19
tips_version=1.19.2:8.0.15
bookshelf_version=1.19.2:16.1.5
6 changes: 6 additions & 0 deletions src/main/java/org/betterx/bclib/client/BCLibClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import org.betterx.bclib.api.v2.ModIntegrationAPI;
import org.betterx.bclib.api.v2.PostInitAPI;
import org.betterx.bclib.api.v2.dataexchange.DataExchangeAPI;
import org.betterx.bclib.client.gui.screens.ProgressScreen;
import org.betterx.bclib.client.models.CustomModelBakery;
import org.betterx.bclib.config.Configs;
import org.betterx.bclib.integration.tips.Tips;
import org.betterx.bclib.integration.tips.TipsIntegration;
import org.betterx.bclib.registry.BaseBlockEntityRenders;
import org.betterx.bclib.registry.PresetsRegistryClient;
import org.betterx.worlds.together.WorldsTogether;
Expand All @@ -24,6 +27,9 @@ public class BCLibClient implements ClientModInitializer, ModelResourceProvider,

@Override
public void onInitializeClient() {
Tips.addTipsScreen(ProgressScreen.class);
ModIntegrationAPI.register(new TipsIntegration());

WorldsTogetherClient.onInitializeClient();
ModIntegrationAPI.registerAll();
BaseBlockEntityRenders.register();
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/betterx/bclib/integration/tips/Tips.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.betterx.bclib.integration.tips;

import net.minecraft.client.gui.screens.Screen;

import java.util.HashSet;
import java.util.Set;

/**
* Integration, to provide a custom Screen class for Tips.
* <p>
* This integration allows you to use Tips without adding a dependency to your project. If the
* Mod is installed on the Client.
* <p>
* You can add a custom screen from your mod by calling {@link #addTipsScreen(Class)}.
* <p>
* Your custom screen should be a loading-like screen with space in the bottom left for tips.
*/
public class Tips {
static final Set<Class<? extends Screen>> screen = new HashSet<>();

public static void addTipsScreen(Class<? extends Screen> scr) {
screen.add(scr);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.betterx.bclib.integration.tips;

import net.darkhax.tipsmod.api.TipsAPI;
import net.minecraft.client.gui.screens.Screen;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.integration.ModIntegration;

/**
* Internal class to use Tips classes, you should not need to use this class. If you want to register a
* Tips Screen for a Mod using BCLib, use {@link Tips#addTipsScreen(Class)}
*/
public class TipsIntegration extends ModIntegration {
public TipsIntegration() {
super("tipsmod");
}

@Override
public void init() {
try {
TipsAPI.class.getMethod("registerTipScreen", Class.class);
for (Class<? extends Screen> screen : Tips.screen) {
TipsAPI.registerTipScreen(screen);
}
} catch (NoSuchMethodException e) {
BCLib.LOGGER.warning("Tips Mod was detected, but doesn't have the right API. Please update Tips.");
}
}
}