diff --git a/buildSrc/src/main/java/org/mtr/mod/BuildTools.java b/buildSrc/src/main/java/org/mtr/mod/BuildTools.java index 01ef6d9..0522721 100644 --- a/buildSrc/src/main/java/org/mtr/mod/BuildTools.java +++ b/buildSrc/src/main/java/org/mtr/mod/BuildTools.java @@ -7,8 +7,6 @@ import com.jonafanho.apitools.ModLoader; import com.jonafanho.apitools.ModProvider; import org.apache.commons.io.IOUtils; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.gradle.api.Project; import java.net.URL; @@ -63,6 +61,13 @@ public String getModMenuVersion() { return modMenuVersion; } + public String getFiltersAPIVersion() { + final String modIdString = "filters-api"; + String modMenuVersion = "1.0.0+" + minecraftVersion; + System.out.println("Filters API version: " + modMenuVersion); + return modMenuVersion; + } + public String getForgeVersion() { String forgeVersion = getJson("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getAsJsonObject().getAsJsonObject("promos").get(minecraftVersion + "-latest").getAsString(); System.out.println("Forge version: " + forgeVersion); diff --git a/fabric/build.gradle b/fabric/build.gradle index 2dbb0f7..073156e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -22,7 +22,7 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${buildTools.getFabricApiVersion()}" //modImplementation(files("E:\\Tianjin-Metro\\libs\\MTR-fabric-4.0.0-beta-8+1.16.5-server.jar")) modApi "com.terraformersmc:modmenu:${buildTools.getModMenuVersion()}" - modApi("ziyue.filters:filters-fabric:1.0.0+${minecraft_version}") { + modApi("ziyue.filters:filters-fabric:${buildTools.getFiltersAPIVersion()}") { exclude(group: "net.fabricmc") } // Uncomment this if you got "java.lang.IllegalStateException: duplicate fabric loader classes found on classpath". diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/config/ConfigClient.java b/fabric/src/main/java/ziyue/tjmetro/mod/config/ConfigClient.java index 837df85..56b1d08 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/config/ConfigClient.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/config/ConfigClient.java @@ -28,10 +28,11 @@ public class ConfigClient { - public static final Property ENABLE_MTR_FILTERS = new Property("enable_mtr_filters", false) + public static final Property ENABLE_MTR_FILTERS = new Property<>("enable_mtr_filters", false) { @Override public void set(Boolean value) { + value = false; //todo remove this FilterBuilder.filtersVisibility(CreativeModeTabs.CORE, value); FilterBuilder.filtersVisibility(CreativeModeTabs.ESCALATORS_LIFTS, value); FilterBuilder.filtersVisibility(CreativeModeTabs.RAILWAY_FACILITIES, value); diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/mixin/BlockRailwaySignPoleMixin.java b/fabric/src/main/java/ziyue/tjmetro/mod/mixin/BlockRailwaySignPoleMixin.java index 157a37a..c9ef9c2 100644 --- a/fabric/src/main/java/ziyue/tjmetro/mod/mixin/BlockRailwaySignPoleMixin.java +++ b/fabric/src/main/java/ziyue/tjmetro/mod/mixin/BlockRailwaySignPoleMixin.java @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import ziyue.tjmetro.mod.BlockList; import ziyue.tjmetro.mod.block.BlockRailwaySignTianjinBMT; import ziyue.tjmetro.mod.block.BlockStationNamePlate; diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 4b60a09..e9e8807 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -45,7 +45,6 @@ "fabric": "*", "minecraft": "*", "filters": ">=1.0.0", - "mtr": "*", - "java": ">=16" + "mtr": "*" } } diff --git a/forge/build.gradle b/forge/build.gradle index ffb10d7..00e5ed7 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -25,7 +25,7 @@ dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${buildTools.getForgeVersion()}" annotationProcessor "org.spongepowered:mixin:+:processor" implementation fg.deobf("org.mtr:MTR-forge:${mtr_version}+${minecraft_version}-server") - implementation(fg.deobf("ziyue.filters:filters-forge:1.0.0+${minecraft_version}")) + implementation(fg.deobf("ziyue.filters:filters-forge:${buildTools.getFiltersAPIVersion()}")) annotationProcessor 'systems.manifold:manifold-preprocessor:+' } diff --git a/forge/src/main/java/ziyue/tjmetro/forge/MainForge.java b/forge/src/main/java/ziyue/tjmetro/forge/MainForge.java index 9ffadca..428fbc8 100644 --- a/forge/src/main/java/ziyue/tjmetro/forge/MainForge.java +++ b/forge/src/main/java/ziyue/tjmetro/forge/MainForge.java @@ -1,19 +1,15 @@ package ziyue.tjmetro.forge; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; -import org.mtr.mapping.holder.Screen; import ziyue.tjmetro.mod.Reference; import ziyue.tjmetro.mod.Registry; import ziyue.tjmetro.mod.TianjinMetro; import ziyue.tjmetro.mod.TianjinMetroClient; -import ziyue.tjmetro.mod.config.ConfigClient; -import ziyue.tjmetro.mod.screen.ConfigClientScreen; @Mod(Reference.MOD_ID) public final class MainForge @@ -25,13 +21,16 @@ public MainForge() { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> TianjinMetroClient::init); MinecraftForge.EVENT_BUS.register(this); + #if MC_VERSION <= "11605" ModLoadingContext.get().registerExtensionPoint(net.minecraftforge.fml.ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> new ConfigClientScreen(new Screen(parent))); + #elif MC_VERSION <= "11905" + #endif } // As you see, this is a very dumb thing due to we are using Forge. // Please read Fabric codes so that you will know how Fabric is awesome. @SubscribeEvent - public void afterRegistry(GuiScreenEvent.InitGuiEvent event) { + public void afterRegistry(ScreenEvent.Init.Post event) { //FilterList filterTianjinMetro = FilterList.empty(); //filterTianjinMetro.add(Filters.MISCELLANEOUS); //filterTianjinMetro.add(Filters.BUILDING); diff --git a/gradle.properties b/gradle.properties index fc531cf..5ff3954 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true org.gradle.daemon=false -minecraft_version=1.16.5 +minecraft_version=1.19.2 # Mod Properties mod_version=1.0.0-beta-1