Skip to content

Commit

Permalink
refactor: rebuild fuji-fabric and fuji-common
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed May 20, 2024
1 parent 75b5d9d commit 458f486
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 91 deletions.
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
plugins {
// id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
// id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"

id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false

}

architectury {
Expand All @@ -22,9 +21,9 @@ subprojects {
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
// mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.20.1+build.10:v2"
mappings "net.fabricmc:yarn:1.20.6+build.2:v2"
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ architectury {
}

loom {
accessWidenerPath = file("src/main/resources/examplemod.accesswidener")
accessWidenerPath = file("src/main/resources/fuji.accesswidener")
}

dependencies {
Expand Down
26 changes: 5 additions & 21 deletions common/src/main/java/net/examplemod/ExampleMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,17 @@
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrarManager;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;

import java.util.function.Supplier;

public class ExampleMod {
public static final String MOD_ID = "examplemod";
// We can use this if we don't want to use DeferredRegister
public static final Supplier<RegistrarManager> REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID));

// Registering a new creative tab
public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(MOD_ID, Registries.CREATIVE_MODE_TAB);
public static final RegistrySupplier<CreativeModeTab> EXAMPLE_TAB = TABS.register("example_tab", () ->
CreativeTabRegistry.create(Component.translatable("itemGroup." + MOD_ID + ".example_tab"),
() -> new ItemStack(ExampleMod.EXAMPLE_ITEM.get())));

public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(MOD_ID, Registries.ITEM);
public static final RegistrySupplier<Item> EXAMPLE_ITEM = ITEMS.register("example_item", () ->
new Item(new Item.Properties().arch$tab(ExampleMod.EXAMPLE_TAB)));

public static void init() {
TABS.register();
ITEMS.register();

System.out.println(ExampleExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString());

// System.out.println(ExampleExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString());
System.out.println("hello");
}
}
15 changes: 0 additions & 15 deletions common/src/main/java/net/examplemod/mixin/MixinTitleScreen.java

This file was deleted.

3 changes: 0 additions & 3 deletions common/src/main/resources/architectury.common.json

This file was deleted.

3 changes: 0 additions & 3 deletions common/src/main/resources/assets/examplemod/lang/en_us.json

This file was deleted.

14 changes: 0 additions & 14 deletions common/src/main/resources/examplemod-common.mixins.json

This file was deleted.

1 change: 0 additions & 1 deletion common/src/main/resources/examplemod.accesswidener

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ accessWidener v2 named

accessible method net/minecraft/server/world/ServerChunkManager getChunkHolder (J)Lnet/minecraft/server/world/ChunkHolder;

accessible method net/minecraft/util/UserCache$Entry getProfile ()Lcom/mojang/authlib/GameProfile;
accessible class net/minecraft/util/UserCache$Entry

accessible field net/minecraft/server/world/ChunkHolder UNLOADED_WORLD_CHUNK Lnet/minecraft/server/world/OptionalChunk;
accessible field net/minecraft/server/world/ChunkHolder UNLOADED_WORLD_CHUNK_FUTURE Ljava/util/concurrent/CompletableFuture;

accessible field net/minecraft/registry/entry/RegistryEntry$Reference value Ljava/lang/Object;
accessible field net/minecraft/registry/entry/RegistryEntry$Reference value Ljava/lang/Object;
14 changes: 8 additions & 6 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ loom {
// splitEnvironmentSourceSets()

// accessWidenerPath = file("src/main/resources/fuji.accesswidener")

mods {
"fuji" {
sourceSet sourceSets.main
}
}
// mods {
// "fuji" {
// sourceSet sourceSets.main
// }
// }

runs {
configureEach {
Expand All @@ -46,6 +45,9 @@ dependencies {

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
// common(project(path: ":fabric-like", configuration: "namedElements")) { transitive false }
// shadowCommon(project(path: ":fabric-like", configuration: "transformProductionFabric")) { transitive false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public abstract class ServerPlayerMixin implements ServerPlayerAccessor {
@Inject(method = "setClientOptions", at = @At("HEAD"))
public void $setClientOptions(SyncedClientOptions clientInformation, CallbackInfo ci) {
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
MessageUtil.getPlayer2lang().put(player.getGameProfile().getName(), clientInformation.comp_1951());
MessageUtil.getPlayer2lang().put(player.getGameProfile().getName(), clientInformation.language());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ abstract class ServerStatusPacketListenerImplMixin {
return new ServerMetadata(module.getRandomDescription(), Optional.empty(), Optional.empty(), module.getRandomIcon(), false);
}

return new ServerMetadata(module.getRandomDescription(), vanillaStatus.comp_1274(), vanillaStatus.comp_1275(), module.getRandomIcon(), vanillaStatus.secureChatEnforced());
return new ServerMetadata(module.getRandomDescription(), vanillaStatus.players(), vanillaStatus.version(), module.getRandomIcon(), vanillaStatus.secureChatEnforced());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public abstract class SimpleRegistryMixin<T> implements SimpleRegistryMixinInter
@Override
public boolean fuji$remove(Identifier key) {
var entry = this.idToEntry.get(key);
return entry != null && entry.hasKeyAndValue() && this.fuji$remove(entry.comp_349());
return entry != null && entry.hasKeyAndValue() && this.fuji$remove(entry.value());
}

@Override
Expand Down
1 change: 0 additions & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"io.github.sakurawald.Fuji"
]
},
"accessWidener": "fuji.accesswidener",
"mixins": [
"fuji.mixins.json"
],
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configurations {
dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
// Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
// modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ side = "BOTH"
[[dependencies.examplemod]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.1,)"
versionRange = "[1.20.6,)"
ordering = "NONE"
side = "BOTH"

Expand Down
31 changes: 16 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# gradle
org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true

Expand All @@ -6,9 +7,22 @@ mod_version=1.1.8
maven_group=io.github.sakurawald
archives_base_name=fuji

# fabric deps
loader_version=0.15.11
# mod framework
enabled_platforms=fabric,forge
minecraft_version=1.20.6
architectury_version=12.0.27

# mod loader -> fabric
yarn_mappings=1.20.6+build.1
fabric_loader_version=0.15.11
fabric_api_version=0.99.0+1.20.6

# mod loader -> forge
forge_version=1.20.6-50.0.22

# mod loader -> quilt
quilt_loader_version=0.21.2-beta.2
quilt_fabric_api_version=7.4.0+0.90.0-1.20.1

# mod deps
carpet_core_version=1.20.6-1.4.141+v240429
Expand All @@ -28,16 +42,3 @@ quartz_version=2.5.0-rc1
reflections_version=0.10.2
javaassist_version=3.29.2-GA

# arch
minecraft_version=1.20.1
enabled_platforms=quilt,fabric,forge

architectury_version=9.1.12

fabric_loader_version=0.14.23
fabric_api_version=0.90.4+1.20.1

forge_version=1.20.1-47.2.1

quilt_loader_version=0.21.2-beta.2
quilt_fabric_api_version=7.4.0+0.90.0-1.20.1

0 comments on commit 458f486

Please sign in to comment.