Skip to content
Merged
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
90 changes: 59 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
plugins {
id 'babric-loom' version '1.1.+'
id 'fabric-loom' version '1.10.0-bta'
id 'java'
}

import org.gradle.internal.os.OperatingSystem

project.ext.lwjglVersion = "3.3.3"

switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.ext.lwjglNatives = "natives-linux"
break
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = "natives-windows"
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = "natives-macos"
}

group = project.mod_group
archivesBaseName = project.mod_name
version = project.mod_version

loom {
gluedMinecraftJar()
noIntermediateMappings()
customMinecraftManifest.set("https://github.com/Turnip-Labs/bta-manifest-repo/releases/download/v${project.bta_version}/${project.bta_version}.json")
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${project.bta_channel}/v${project.bta_version}/manifest.json")
}

repositories {
mavenCentral()
maven { url = "https://jitpack.io" }
maven {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
Expand All @@ -23,6 +38,14 @@ repositories {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'SignalumMavenInfrastructure'
url = 'https://maven.thesignalumproject.net/infrastructure'
}
maven {
name = 'SignalumMavenReleases'
url = 'https://maven.thesignalumproject.net/releases'
}
ivy {
url = "https://github.com/Better-than-Adventure"
patternLayout {
Expand All @@ -32,25 +55,17 @@ repositories {
metadataSources { artifact() }
}
ivy {
url = "https://github.com/Turnip-Labs"
patternLayout {
artifact "[organisation]/releases/download/v[revision]/[module]-[revision].jar"
m2compatible = true
}
metadataSources { artifact() }
}
ivy {
url = "https://github.com/Turnip-Labs"
url = "https://downloads.betterthanadventure.net/bta-client/${project.bta_channel}/"
patternLayout {
artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar"
artifact "/v[revision]/client.jar"
m2compatible = true
}
metadataSources { artifact() }
}
ivy {
url = "https://github.com/Turnip-Labs"
url = "https://downloads.betterthanadventure.net/bta-server/${project.bta_channel}/"
patternLayout {
artifact "[organisation]/releases/download/[revision]/[module]-bta-[revision].jar"
artifact "/v[revision]/server.jar"
m2compatible = true
}
metadataSources { artifact() }
Expand All @@ -63,41 +78,49 @@ repositories {
}
metadataSources { artifact() }
}
ivy {
url = "https://github.com/MartinSVK12"
patternLayout {
artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar"
m2compatible = true
}
metadataSources { artifact() }
}

}

dependencies {
minecraft "bta-download-repo:bta:${project.bta_version}"
minecraft "::${project.bta_version}"
mappings loom.layered() {}

modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar
modImplementation "fabric-loader:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Helper library
// If you do not need Halplibe you can comment this line out or delete this line
modImplementation "bta-halplibe:halplibe:${project.halplibe_version}"
modImplementation("turniplabs:halplibe:${project.halplibe_version}")

modImplementation "ModMenu:ModMenu:2.0.6"
modImplementation("turniplabs:modmenu-bta:${project.mod_menu_version}")

implementation "org.slf4j:slf4j-api:1.8.0-beta4"
implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0"

implementation 'com.google.guava:guava:33.0.0-jre'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'

implementation 'org.apache.commons:commons-lang3:3.0'

var log4jVersion = "2.20.0"
implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}")
implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}")
implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}")

include(implementation("org.apache.commons:commons-lang3:3.12.0"))

modImplementation("com.github.Better-than-Adventure:legacy-lwjgl3:1.0.5")
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")

runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
implementation "org.lwjgl:lwjgl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-assimp:$lwjglVersion"
implementation "org.lwjgl:lwjgl-glfw:$lwjglVersion"
implementation "org.lwjgl:lwjgl-openal:$lwjglVersion"
implementation "org.lwjgl:lwjgl-opengl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-stb:$lwjglVersion"
}

java {
Expand All @@ -106,7 +129,7 @@ java {
withSourcesJar()
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.release.set 8
}

Expand All @@ -116,6 +139,11 @@ jar {
}
}

configurations.configureEach {
// Removes LWJGL2 dependencies
exclude group: "org.lwjgl.lwjgl"
}

processResources {
inputs.property "version", version

Expand Down
15 changes: 10 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel = true
org.gradle.daemon = true
fabric.loom.multiProjectOptimisation=true

# BTA
bta_version=7.2-pre2
bta_version=7.3_03
bta_channel=release

# Loader
loader_version=0.15.6-babric.6-bta
loader_version=0.15.6-bta.7

# HalpLibe
halplibe_version=4.1.3
# Other Mods
mod_menu_version=3.0.0
halplibe_version=5.2.1

# Mod
mod_version=1.1.2-7.2-pre2
mod_version=1.2.1-7.3_01
mod_group=toufoumaster
mod_name=btwaila
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
Expand All @@ -13,5 +13,9 @@ pluginManagement {
name = 'Babric'
url = 'https://maven.glass-launcher.net/babric'
}
maven {
name = 'SignalumMavenInfrastructure'
url = 'https://maven.thesignalumproject.net/infrastructure'
}
}
}
16 changes: 3 additions & 13 deletions src/main/java/toufoumaster/btwaila/BTWaila.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.slf4j.LoggerFactory;
import toufoumaster.btwaila.entryplugins.waila.BTWailaCustomTooltipPlugin;
import toufoumaster.btwaila.entryplugins.waila.BTWailaPlugin;
import toufoumaster.btwaila.gui.components.WailaTextComponent;
import toufoumaster.btwaila.mixin.mixins.accessors.PacketAccessor;
import toufoumaster.btwaila.network.packet.PacketEntityData;
import toufoumaster.btwaila.network.packet.PacketRequestEntityData;
Expand Down Expand Up @@ -52,25 +51,16 @@ public void beforeGameStart() {

@Override
public void afterGameStart() {
WailaTextComponent.init();
translator = I18n.getInstance();
LOGGER.info("Loading implementations.");

if (!Global.isServer){
BTWailaClient.onLoad();
}

new BTWailaPlugin().initializePlugin(TooltipRegistry.getInstance(), LOGGER); // Load BTWaila tooltips first
FabricLoader.getInstance().getEntrypointContainers("btwaila", BTWailaCustomTooltipPlugin.class).forEach(plugin -> plugin.getEntrypoint().initializePlugin(TooltipRegistry.getInstance(), LOGGER));

LOGGER.info("BTWaila initialized.");
System.out.println(modVersion);
}

@Override
public void onInitialize() {
PacketAccessor.callAddIdClassMapping(220, false, true, PacketRequestTileEntityData.class);
PacketAccessor.callAddIdClassMapping(221, false, true, PacketRequestEntityData.class);
PacketAccessor.callAddIdClassMapping(222, true, false, PacketEntityData.class);
PacketAccessor.callAddMapping(220, false, true, PacketRequestTileEntityData.class);
PacketAccessor.callAddMapping(221, false, true, PacketRequestEntityData.class);
PacketAccessor.callAddMapping(222, true, false, PacketEntityData.class);
}
}
48 changes: 40 additions & 8 deletions src/main/java/toufoumaster/btwaila/BTWailaClient.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
package toufoumaster.btwaila;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.options.GuiOptions;

import net.minecraft.client.gui.Screen;
import net.minecraft.client.gui.options.ScreenOptions;
import net.minecraft.client.gui.options.components.BooleanOptionComponent;
import net.minecraft.client.gui.options.components.KeyBindingComponent;
import net.minecraft.client.gui.options.components.OptionsCategory;
import net.minecraft.client.gui.options.components.ToggleableOptionComponent;
import net.minecraft.client.gui.options.data.OptionsPage;
import net.minecraft.client.gui.options.data.OptionsPages;
import net.minecraft.client.option.GameSettings;
import net.minecraft.core.item.Item;
import net.minecraft.core.item.Items;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import toufoumaster.btwaila.entryplugins.waila.BTWailaCustomTooltipPlugin;
import toufoumaster.btwaila.entryplugins.waila.BTWailaPlugin;
import toufoumaster.btwaila.gui.components.WailaTextComponent;
import toufoumaster.btwaila.mixin.interfaces.IOptions;
import toufoumaster.btwaila.tooltips.TooltipRegistry;
import turniplabs.halplibe.util.ClientStartEntrypoint;

import java.util.HashMap;
import java.util.Map;

public class BTWailaClient {
public class BTWailaClient implements ClientModInitializer, ClientStartEntrypoint {
public static GameSettings gameSettings;
public static IOptions modSettings;
public static OptionsPage wailaOptions;
public static Map<String, String > modIds = new HashMap<>();

public static final String MOD_ID = "btwaila|client";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

public static void onLoad(){
gameSettings = Minecraft.getMinecraft(Minecraft.class).gameSettings;
gameSettings = Minecraft.getMinecraft().gameSettings;
modSettings = (IOptions) gameSettings;
wailaOptions = new OptionsPage("btwaila.options.title", Item.basket.getDefaultStack())
wailaOptions = new OptionsPage("btwaila.options.title", Items.BASKET.getDefaultStack())
.withComponent(new OptionsCategory("btwaila.options.category.general")
.withComponent(new ToggleableOptionComponent<>(modSettings.bTWaila$getTooltipFormatting())))
.withComponent(new OptionsCategory("btwaila.options.category.block")
Expand Down Expand Up @@ -55,7 +68,26 @@ public static void onLoad(){
.withComponent(new KeyBindingComponent(modSettings.bTWaila$getKeyDemoCycle())));

}
public static GuiOptions getOptionsPage(GuiScreen parent){
return new GuiOptions(parent, wailaOptions);
public static Screen getOptionsPage(Screen parent){
return new ScreenOptions(parent, wailaOptions);
}

@Override
public void onInitializeClient() {

}

@Override
public void beforeClientStart() {

}

@Override
public void afterClientStart() {
onLoad();
WailaTextComponent.init();
LOGGER.info("Loading implementations.");
new BTWailaPlugin().initializePlugin(TooltipRegistry.getInstance(), LOGGER); // Load BTWaila tooltips first
FabricLoader.getInstance().getEntrypointContainers("btwaila", BTWailaCustomTooltipPlugin.class).forEach(plugin -> plugin.getEntrypoint().initializePlugin(TooltipRegistry.getInstance(), LOGGER));
}
}
15 changes: 10 additions & 5 deletions src/main/java/toufoumaster/btwaila/BTWailaComponents.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package toufoumaster.btwaila;

import net.minecraft.client.gui.hud.*;
import net.minecraft.client.gui.hud.component.ComponentAnchor;
import net.minecraft.client.gui.hud.component.HudComponent;
import net.minecraft.client.gui.hud.component.HudComponents;
import net.minecraft.client.gui.hud.component.layout.LayoutAbsolute;
import net.minecraft.client.gui.hud.component.layout.LayoutSnap;
import toufoumaster.btwaila.gui.components.*;
import turniplabs.halplibe.util.ClientStartEntrypoint;

Expand All @@ -20,18 +25,18 @@ public void beforeClientStart() {
public void afterClientStart() {
BlockBaseInfoComp = HudComponents.register(
new BaseInfoComponent("wailaInfoBase",
new AbsoluteLayout(0.5f, 0.0f, ComponentAnchor.TOP_CENTER)));
new LayoutAbsolute(0.5f, 0.0f, ComponentAnchor.TOP_CENTER)));
BlockBreakComp = HudComponents.register(
new HarvestInfoComponent("wailaInfoHarvest",
new SnapLayout(BlockBaseInfoComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
new LayoutSnap(BlockBaseInfoComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
BlockAdvancedInfoComp = HudComponents.register(
new AdvancedInfoComponent("wailaInfoAdvanced",
new SnapLayout(BlockBreakComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
new LayoutSnap(BlockBreakComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
BlockDisplayedComp = HudComponents.register(
new DropIconComponent("wailaInfoIcon",
new SnapLayout(BlockBaseInfoComp, ComponentAnchor.TOP_LEFT, ComponentAnchor.TOP_RIGHT)));
new LayoutSnap(BlockBaseInfoComp, ComponentAnchor.TOP_LEFT, ComponentAnchor.TOP_RIGHT)));
BlockToolComp = HudComponents.register(
new HarvestToolComponent("wailaInfoTool",
new SnapLayout(BlockDisplayedComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
new LayoutSnap(BlockDisplayedComp, ComponentAnchor.BOTTOM_CENTER, ComponentAnchor.TOP_CENTER)));
}
}
Loading
Loading