Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Changed build system from arch loom to unimined #3

Merged
merged 16 commits into from
May 18, 2024
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
116 changes: 73 additions & 43 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import org.gradle.api.tasks.compile.JavaCompile

plugins {
id "maven-publish"
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply(false)
id "com.github.johnrengelman.shadow" version "7.0.0" apply(false)
}

architectury {
minecraft = rootProject.minecraft_version
id "xyz.wagyourtail.unimined" version "1.2.6-SNAPSHOT" apply false
}

//Print out JVM information so that we know what version is running. Extreamly useful for people to know when helping you.
Expand All @@ -23,11 +17,10 @@ def gitHash() {
return ""
}

allprojects {
subprojects {
apply plugin: "xyz.wagyourtail.unimined"
apply plugin: "maven-publish"
apply plugin: "java"
apply plugin: "architectury-plugin"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

group = rootProject.maven_group

Expand All @@ -37,6 +30,13 @@ allprojects {
withSourcesJar()
}

configurations {
modCompileOnly
compileOnly.extendsFrom modCompileOnly
modRuntimeOnly
runtimeOnly.extendsFrom modRuntimeOnly
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
}
Expand All @@ -47,14 +47,68 @@ allprojects {
}
println("In CI mode")
}
}

subprojects {
apply plugin: "dev.architectury.loom"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
repositories {
maven {
url "https://mcentral.firstdark.dev/releases"
}
}

jar {
manifest {
attributes([
'Specification-Title' : project.archivesBaseName,
'Specification-Vendor' : "Trinsdar",
'Specification-Version' : project.version,
'Implementation-Title' : project.name,
'Implementation-Version' : project.version,
'Implementation-Vendor' : "Trinsdar",
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}

unimined.minecraft(sourceSets.main, true) {
version minecraft_version
if (project.name != "common"){
combineWith(project(":common"), project(":common").sourceSets.main)
} else {
if (project.name == "common") {
mappings {
intermediary()
}

mods.modImplementation {
namespace("intermediary")
}
}
}

mods {
remap(configurations.modCompileOnly){
catchAWNamespaceAssertion()
}
remap(configurations.modRuntimeOnly){
catchAWNamespaceAssertion()
}
modImplementation {
catchAWNamespaceAssertion()
}
}

mappings {
mojmap()
devFallbackNamespace "official"
devNamespace "mojmap"
parchment(rootProject.minecraft_version, rootProject.mappings_version)
}
}


if (!project.path.contains("common")){
apply plugin: "com.github.johnrengelman.shadow"
/*if (!project.path.contains("common")){

configurations {
common
Expand Down Expand Up @@ -88,37 +142,13 @@ subprojects {
skip()
}
}
}

loom {
silentMojangMappingsLicense()
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.mappings_version}@zip")
}
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.17.1+build.32:v2"
}
}*/

publishing {
publications {
mavenJava(org.gradle.api.publish.maven.MavenPublication) {
artifactId = "gtcore-" + project.name
artifact(sourcesJar) {
builtBy remapSourcesJar
}

afterEvaluate {
artifact remapJar
if (project.name != "common"){
artifact shadowJar
}
}
from components.java
}
}
repositories {
Expand Down
23 changes: 14 additions & 9 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
archivesBaseName = "${rootProject.archive_base_name}-common"
version = "${project.mod_version}-${rootProject.minecraft_version}"

loom {
/*loom {
accessWidenerPath = file("src/main/resources/gtcore.accesswidener")
}*/

unimined.minecraft {
accessWidener {
accessWidener(file("src/main/resources/gtcore.accesswidener"))
}

defaultRemapJar = true
}

dependencies {
compileOnly("org.spongepowered:mixin:0.8.5")
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation("io.github.gregtechintergalactical:antimatter-common:${antimatter_version}"){
exclude(group: "maven.modrinth")
Expand All @@ -18,16 +27,12 @@ dependencies {
modImplementation("earth.terrarium:botarium-common-1.18.2:${project.botarium_version}")
modImplementation("com.gtnewhorizon.structurelib:structurelib-common:${project.structurelib_version}-${project.minecraft_version}")
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-common-1.18.2:${project.resourcefullib_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin:${rootProject.rei_version}"
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modImplementation "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"
modImplementation "me.shedaniel:RoughlyEnoughItems-default-plugin:${rootProject.rei_version}"
modImplementation("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modImplementation("com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraform_version_fabric}"){
transitive = false
}
modCompileOnly("curse.maven:the-one-probe-fabric-581847:${project.top_fabric_file}")
modImplementation("curse.maven:the-one-probe-fabric-581847:${project.top_fabric_file}")
modImplementation "maven.modrinth:carbon-config:${project.carbon_config_fabric_version}"
}

architectury {
common("forge", "fabric")
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import muramasa.antimatter.gui.SlotType;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.machine.types.Machine;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.Container;
Expand Down Expand Up @@ -118,7 +116,7 @@ public boolean triggerEvent(BlockState state, Level worldIn, BlockPos pos, int i
return tileentity != null && tileentity.triggerEvent(id, param);
}

@Environment(EnvType.CLIENT)
//@Environment(EnvType.CLIENT)
public static DoubleBlockCombiner.Combiner<BlockEntityChest, Float2FloatFunction> getLid(final LidBlockEntity p_226917_0_) {
return new DoubleBlockCombiner.Combiner<BlockEntityChest, Float2FloatFunction>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import io.github.gregtechintergalactical.gtcore.machine.MaterialMachine;
import muramasa.antimatter.gui.container.ContainerMachine;
import muramasa.antimatter.machine.MachineState;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import muramasa.antimatter.capability.machine.MachineItemHandler;
import muramasa.antimatter.gui.SlotType;
import muramasa.antimatter.gui.container.ContainerMachine;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
Expand Down Expand Up @@ -123,7 +121,7 @@ private static void playSound(Level world, BlockPos pos, BlockState state, Sound
}

@Override
@Environment(EnvType.CLIENT)
//@Environment(EnvType.CLIENT)
public float getOpenNess(float partialTicks) {
return lidController.getOpenness(partialTicks);
//return Mth.lerp(partialTicks, this.prevLidAngle, this.lidAngle);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.gregtechintergalactical.gtcore.data;

import dev.architectury.injectables.annotations.ExpectPlatform;
import io.github.gregtechintergalactical.gtcore.GTCore;
import io.github.gregtechintergalactical.gtcore.block.BlockSapBag;
import io.github.gregtechintergalactical.gtcore.blockentity.BlockEntitySapBag;
Expand Down Expand Up @@ -98,9 +97,8 @@ public static void init() {
AntimatterAPI.register(BlockEntityType.class, "sap_bag", GTCore.ID, SAP_BAG_BLOCK_ENTITY);
}

@ExpectPlatform
private static void initTFC(){
throw new AssertionError();
IGTBlockInit.INSTANCE.init();
}

public static DrumMachine createDrum(Material material, int maxCapacity){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.github.gregtechintergalactical.gtcore.data;

import tesseract.TesseractCapUtils;

import java.util.ServiceLoader;

public interface IGTBlockInit {
IGTBlockInit INSTANCE = ServiceLoader.load(IGTBlockInit.class).findFirst().orElse(null);
void init();
}
7 changes: 6 additions & 1 deletion common/src/main/resources/gtcore.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ accessible field net/minecraft/world/level/biome/Biome$ClimateSettings precipita
accessible method net/minecraft/world/level/levelgen/feature/foliageplacers/FoliagePlacerType <init> (Lcom/mojang/serialization/Codec;)V
accessible method net/minecraft/world/level/levelgen/feature/trunkplacers/TrunkPlacerType <init> (Lcom/mojang/serialization/Codec;)V
extendable method net/minecraft/world/level/levelgen/feature/TreeFeature getMaxFreeTreeHeight (Lnet/minecraft/world/level/LevelSimulatedReader;ILnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration;)I
accessible method net/minecraft/world/level/block/state/properties/WoodType register (Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType;
accessible method net/minecraft/world/level/block/state/properties/WoodType register (Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType;
accessible class net/minecraft/client/gui/screens/MenuScreens$ScreenConstructor
accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
accessible method net/minecraft/data/loot/BlockLoot createLeavesDrops (Lnet/minecraft/world/level/block/Block;Lnet/minecraft/world/level/block/Block;[F)Lnet/minecraft/world/level/storage/loot/LootTable$Builder;
accessible method net/minecraft/data/loot/BlockLoot createSlabItemTable (Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder;
accessible method net/minecraft/data/loot/BlockLoot createSingleItemTable (Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/world/level/storage/loot/LootTable$Builder;
37 changes: 21 additions & 16 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,33 @@ version = "${project.mod_version}-${rootProject.minecraft_version}"
def generatedResources = file("src/generated/resources")
def accessWidenerFile = project(":common").file("src/main/resources/gtcore.accesswidener")

architectury {
platformSetupLoomIde()
fabric()
}

loom {
/*loom {
accessWidenerPath = accessWidenerFile
}*/
unimined.minecraft {
fabric {
loader fabric_loader_version
accessWidener(accessWidenerFile)
}

defaultRemapJar = true
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
common(project(path: ":common", configuration: "namedElements"))
shadowCommon(project(path: ":common", configuration: "transformProductionFabric"))
//modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
implementation(project(path: ":common"))
//shadowCommon(project(path: ":common", configuration: "transformProductionFabric"))
modImplementation("io.github.gregtechintergalactical:antimatter-fabric:${antimatter_version}"){
exclude(group: "maven.modrinth")
exclude(group: "TechReborn")
exclude(group: "com.github.Trins-mods")
exclude(group: "com.github.Trinsdar")
}
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-fabric:${rootProject.jei_version}"){
exclude(group: "mezz.jei", module: "jei-1.18.2-fabric-api")
}
modCompileOnly("curse.maven:the-one-probe-fabric-581847:${project.top_fabric_file}")
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${rootProject.port_lib_version}-beta+1.18.2-stable")){
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "com.github.LlamaLad7")
Expand All @@ -38,16 +45,16 @@ task copyAccessWidener(type: Copy) {
into generatedResources
}

sourceSets {
/*sourceSets {
main {
resources {
srcDir copyAccessWidener
}
}
}
}*/

processResources {
dependsOn copyAccessWidener
//dependsOn copyAccessWidener
inputs.property "version", project.mod_version

filesMatching("fabric.mod.json") {
Expand All @@ -56,7 +63,5 @@ processResources {
}

sourcesJar {
from(project(':common').sourceSets.main.allSource) {
exclude("gtcore.accesswidener") // duplicate on fabric, unneeded on forge
}
from(project(':common').sourceSets.main.allSource)
}
9 changes: 0 additions & 9 deletions fabric/src/generated/resources/gtcore.accesswidener

This file was deleted.

Loading
Loading