Skip to content

Commit

Permalink
That's all.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Jul 28, 2024
1 parent 0a03330 commit eaed686
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jobs:
build:
strategy:
matrix:
minecraft: [ 1.16.5, 1.19.4 ]
loader: [ fabric ] #forge
minecraft: [ 1.16.5, 1.17.1, 1.18.2, 1.19.2, 1.19.4, 1.20.1, 1.20.4 ]
loader: [ fabric, forge ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
1 change: 0 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dependencies {
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".
configurations.configureEach {
resolutionStrategy {
force("net.fabricmc:fabric-loader:${FabricVersion}")
Expand Down
25 changes: 0 additions & 25 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,3 @@
# check these on https://fabricmc.net/develop
fabric_loader_version=0.15.11
loader_name=fabric

yarn_mappings_1.20.4=1.20.4+build.3
yarn_mappings_1.20.1=1.20.1+build.10
yarn_mappings_1.19.4=1.19.4+build.2
yarn_mappings_1.19.2=1.19.2+build.28
yarn_mappings_1.18.2=1.18.2+build.4
yarn_mappings_1.17.1=1.17.1+build.65
yarn_mappings_1.16.5=1.16.5+build.10

# Dependencies
fabric_api_version_1.20.4=0.97.0+1.20.4
fabric_api_version_1.20.1=0.92.1+1.20.1
fabric_api_version_1.19.4=0.87.2+1.19.4
fabric_api_version_1.19.2=0.77.0+1.19.2
fabric_api_version_1.18.2=0.77.0+1.18.2
fabric_api_version_1.17.1=0.46.1+1.17
fabric_api_version_1.16.5=0.42.0+1.16

mod_menu_version_1.20.4=9.0.0
mod_menu_version_1.20.1=7.2.2
mod_menu_version_1.19.4=6.3.1
mod_menu_version_1.19.2=4.1.2
mod_menu_version_1.18.2=3.2.5
mod_menu_version_1.17.1=2.0.17
mod_menu_version_1.16.5=1.16.23
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class ConfigClient
{
public static final Property<Boolean> ENABLE_MTR_FILTERS = new Property<>("enable_mtr_filters", false)
public static final Property<Boolean> ENABLE_MTR_FILTERS = new Property<Boolean>("enable_mtr_filters", false)
{
@Override
public void set(Boolean value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"credit": "Made by ZiYueCommentary, made with Blockbench.",
"textures": {
"0": "mtr:block/metal",
"1": "tjmetro:sign/emergency_exit",
"2": "tjmetro:sign/arrow_green",
"1": "tjmetro:block/emergency_exit",
"2": "tjmetro:block/arrow_green",
"4": "tjmetro:block/air",
"particle": "mtr:block/metal"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"credit": "Made by ZiYueCommentary, made with Blockbench.",
"textures": {
"0": "mtr:block/metal",
"1": "tjmetro:sign/emergency_exit",
"2": "tjmetro:sign/arrow_green",
"1": "tjmetro:block/emergency_exit",
"2": "tjmetro:block/arrow_green",
"particle": "mtr:block/metal"
},
"elements": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"credit": "Made by ZiYueCommentary, made with Blockbench.",
"textures": {
"0": "mtr:block/metal",
"1": "tjmetro:sign/emergency_exit",
"2": "tjmetro:sign/arrow_green",
"1": "tjmetro:block/emergency_exit",
"2": "tjmetro:block/arrow_green",
"4": "tjmetro:block/air",
"particle": "mtr:block/metal"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"credit": "Made by ZiYueCommentary, made with Blockbench.",
"textures": {
"1": "tjmetro:sign/metal_detection_door_sign",
"1": "tjmetro:block/metal_detection_door_block",
"2": "mtr:block/metal",
"3": "block/air",
"particle": "mtr:block/metal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"textures": {
"arrow": "tjmetro:sign/platform_arrow"
"arrow": "tjmetro:block/platform_arrow"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"textures": {
"arrow": "tjmetro:sign/platform_arrow"
"arrow": "tjmetro:block/platform_arrow"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"textures": {
"arrow": "tjmetro:sign/platform_arrow"
"arrow": "tjmetro:block/platform_arrow"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"textures": {
"arrow": "tjmetro:sign/platform_arrow"
"arrow": "tjmetro:block/platform_arrow"
},
"elements": [
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
],
"depends": {
"fabric": "*",
"minecraft": "*",
"minecraft": "${minecraft_version}",
"filters": ">=1.0.0",
"mtr": "*"
}
Expand Down
8 changes: 0 additions & 8 deletions forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
loader_name=forge

forge_version_1.20.4=49.0.50
forge_version_1.20.1=47.2.32
forge_version_1.19.4=45.3.0
forge_version_1.19.2=43.3.13
forge_version_1.18.2=40.2.21
forge_version_1.17.1=37.1.1
forge_version_1.16.5=36.2.42
51 changes: 35 additions & 16 deletions forge/src/main/java/ziyue/tjmetro/forge/MainForge.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package ziyue.tjmetro.forge;

import net.minecraftforge.api.distmarker.Dist;
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.screen.ConfigClientScreen;

@Mod(Reference.MOD_ID)
public final class MainForge
Expand All @@ -21,26 +23,43 @@ public MainForge() {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> TianjinMetroClient::init);
MinecraftForge.EVENT_BUS.register(this);

#if MC_VERSION <= "11605"
#if MC_VERSION <= "11605"
ModLoadingContext.get().registerExtensionPoint(net.minecraftforge.fml.ExtensionPoint.CONFIGGUIFACTORY, () -> (client, parent) -> new ConfigClientScreen(new Screen(parent)));
#elif MC_VERSION <= "11905"
#endif
#elif MC_VERSION <= "11701"
ModLoadingContext.get().registerExtensionPoint(net.minecraftforge.fmlclient.ConfigGuiHandler.ConfigGuiFactory.class, () -> new net.minecraftforge.fmlclient.ConfigGuiHandler.ConfigGuiFactory((client, parent) -> new ConfigClientScreen(new Screen(parent))));
#elif MC_VERSION <= "11802"
ModLoadingContext.get().registerExtensionPoint(net.minecraftforge.client.ConfigGuiHandler.ConfigGuiFactory.class, () -> new net.minecraftforge.client.ConfigGuiHandler.ConfigGuiFactory((client, parent) -> new ConfigClientScreen(new Screen(parent))));
#elif MC_VERSION <= "12004"
ModLoadingContext.get().registerExtensionPoint(net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory.class, () -> new net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory((client, parent) -> new ConfigClientScreen(new Screen(parent))));
#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(ScreenEvent.Init.Post event) {
//FilterList filterTianjinMetro = FilterList.empty();
//filterTianjinMetro.add(Filters.MISCELLANEOUS);
//filterTianjinMetro.add(Filters.BUILDING);
//filterTianjinMetro.add(Filters.SIGNS);
//filterTianjinMetro.add(Filters.GATES);
//filterTianjinMetro.add(Filters.DECORATION);
//filterTianjinMetro.add(Filters.CEILINGS);
//filterTianjinMetro.add(Filters.RAILWAY_SIGNS);
//FilterBuilder.FILTERS.put(CreativeModeTabRegistry.getTab(TianjinMetro.CREATIVE_MODE_TAB.creativeModeTab), filterTianjinMetro);
public void afterRegistry(
#if MC_VERSION <= "11701"
net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent.Post event
#elif MC_VERSION <= "11802"
net.minecraftforge.client.event.ScreenEvent.DrawScreenEvent.Post event
#elif MC_VERSION <= "12004"
net.minecraftforge.client.event.ScreenEvent.Init.Pre event
#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.
#if MC_VERSION >= "11904"
ziyue.filters.FilterList filterTianjinMetro = ziyue.filters.FilterList.empty();
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.MISCELLANEOUS);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.BUILDING);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.SIGNS);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.GATES);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.DECORATION);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.CEILINGS);
filterTianjinMetro.add(ziyue.tjmetro.mod.client.Filters.RAILWAY_SIGNS);
ziyue.filters.FilterBuilder.FILTERS.put(net.minecraftforge.common.CreativeModeTabRegistry.getTab(TianjinMetro.CREATIVE_MODE_TAB.identifier), filterTianjinMetro);
ziyue.tjmetro.mapping.FilterBuilder.setReservedButton(TianjinMetro.CREATIVE_MODE_TAB, org.mtr.mapping.mapper.TextHelper.translatable("button.tjmetro.tianjin_metro_options"), button ->
org.mtr.mapping.holder.MinecraftClient.getInstance().openScreen(new Screen(new ConfigClientScreen(org.mtr.mapping.holder.MinecraftClient.getInstance().getCurrentScreenMapped()))));
#endif
if (filterInitialized) return;
Registry.FILTERS_REGISTRY_ITEM.forEach(pair -> pair.getFirst().addItems(pair.getSecond().get().data));
Registry.FILTERS_REGISTRY_BLOCK.forEach(pair -> pair.getFirst().addItems(pair.getSecond().get().asItem().data));
Expand Down
19 changes: 19 additions & 0 deletions forge/src/main/java/ziyue/tjmetro/mapping/FilterBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ziyue.tjmetro.mapping;

import net.minecraft.world.item.CreativeModeTab;
import org.mtr.mapping.holder.ItemStack;
import org.mtr.mapping.holder.MutableText;
import org.mtr.mapping.holder.PressAction;
Expand All @@ -10,6 +11,7 @@

public interface FilterBuilder
{
#if MC_VERSION <= "11802"
static Filter registerFilter(CreativeModeTabHolder creativeModeTab, MutableText filterName, Supplier<ItemStack> filterIcon) {
return ziyue.filters.FilterBuilder.registerFilter(creativeModeTab.creativeModeTab, filterName.data, () -> filterIcon.get().data);
}
Expand All @@ -25,4 +27,21 @@ static void filtersVisibility(CreativeModeTabHolder creativeModeTab, boolean vis
static void setReservedButton(CreativeModeTabHolder creativeModeTab, MutableText tooltip, PressAction onPress) {
ziyue.filters.FilterBuilder.setReservedButton(creativeModeTab.creativeModeTab, tooltip.data, onPress);
}
#else
static Filter registerFilter(CreativeModeTabHolder creativeModeTab, MutableText filterName, Supplier<ItemStack> filterIcon) {
return ziyue.filters.FilterBuilder.registerFilter((CreativeModeTab) null, filterName.data, () -> filterIcon.get().data);
}

static Filter registerUncategorizedItemsFilter(CreativeModeTabHolder creativeModeTab) {
return ziyue.filters.FilterBuilder.registerUncategorizedItemsFilter((CreativeModeTab) null);
}

static void filtersVisibility(CreativeModeTabHolder creativeModeTab, boolean visible) {
ziyue.filters.FilterBuilder.filtersVisibility((CreativeModeTab) null, visible);
}

static void setReservedButton(CreativeModeTabHolder creativeModeTab, MutableText tooltip, PressAction onPress) {
ziyue.filters.FilterBuilder.setReservedButton(net.minecraftforge.common.CreativeModeTabRegistry.getTab(creativeModeTab.identifier), tooltip.data, onPress);
}
#endif
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true
org.gradle.daemon=false

minecraft_version=1.19.2
minecraft_version=1.20.4

# Mod Properties
mod_version=1.0.0-beta-1
Expand Down

0 comments on commit eaed686

Please sign in to comment.