Skip to content

Commit

Permalink
use unimined ExpectPlatform
Browse files Browse the repository at this point in the history
yay
  • Loading branch information
rhysdh540 committed Jun 5, 2024
1 parent 08df673 commit da65447
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 25 deletions.
39 changes: 30 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask
import xyz.wagyourtail.unimined.expect.task.ExpectPlatformFiles
import xyz.wagyourtail.unimined.internal.minecraft.MinecraftProvider
import xyz.wagyourtail.unimined.internal.minecraft.task.RemapJarTaskImpl
import xyz.wagyourtail.unimined.util.sourceSets
import java.util.*

plugins {
id("java")
id("xyz.wagyourtail.unimined")
id("xyz.wagyourtail.unimined.expect-platform")
id("com.github.johnrengelman.shadow")
}

Expand All @@ -17,6 +20,7 @@ setup()
allprojects {
apply(plugin = "java")
apply(plugin = "xyz.wagyourtail.unimined")
apply(plugin = "xyz.wagyourtail.unimined.expect-platform")
apply(plugin = "com.github.johnrengelman.shadow")

base.archivesName.set("archives_base_name"())
Expand Down Expand Up @@ -48,6 +52,7 @@ allprojects {
includeGroup("curse.maven")
}
}
maven("https://maven.wagyourtail.xyz/snapshots")
}

tasks.withType<JavaCompile> {
Expand Down Expand Up @@ -87,12 +92,16 @@ allprojects {
compileOnly("systems.manifold:manifold-props:${"manifold_version"()}") {
annotationProcessor(this)
}
compileOnly("dev.architectury:architectury-injectables:${"arch_injectables_version"()}")
compileOnly("io.github.llamalad7:mixinextras-common:${"mixin_extras_version"()}")

// compileOnly(expectPlatform.annotationsDep)
compileOnly("xyz.wagyourtail.unimined.expect-platform:expect-platform:1.0.0-20240605.031731-2:annotations")
}
}

subprojects {
val platform = project.name.lowercase()

tasks.processResources {
from(rootProject.sourceSets["main"].resources)

Expand All @@ -110,27 +119,33 @@ subprojects {
}
}

tasks.withType<JavaCompile> {
source(rootProject.sourceSets["main"].allSource)
}

tasks.jar {
archiveClassifier = "unmapped"
archiveClassifier = "$platform-dev-unmapped"
destinationDirectory.set(layout.buildDirectory.dir("devlibs"))
}

val common by configurations.registering {
isTransitive = false
configurations.compileClasspath.get().extendsFrom(this)
configurations.runtimeClasspath.get().extendsFrom(this)
}

val expectPlatform by rootProject.tasks.register<ExpectPlatformFiles>("expectPlatform${platform.replaceFirstChar(Char::uppercase)}") {
group = "unimined"
platformName = platform
inputCollection = rootProject.sourceSets["main"].output
}

dependencies {
common(rootProject)
compileOnly(rootProject) // for ide
common(expectPlatform.outputCollection)
}

tasks.shadowJar {
dependsOn(expectPlatform)
archiveBaseName.set("archives_base_name"())
archiveVersion.set("modVersion"())
archiveClassifier.set("${project.name}-unmapped")
archiveClassifier.set("$platform-unmapped")
destinationDirectory.set(layout.buildDirectory.dir("devlibs"))

configurations = listOf(common.get())
Expand All @@ -145,6 +160,7 @@ subprojects {
remapShadowJar.configure {
dependsOn("shadowJar")
inputFile.set(tasks.shadowJar.get().archiveFile)
archiveClassifier = platform
}
}

Expand All @@ -153,14 +169,19 @@ tasks.jar { enabled = false }
unimined.minecraft {
fabric { loader("fabric_version"()) }

defaultRemapJar = false
runs.off = true

mods {
modImplementation {
catchAWNamespaceAssertion()
}
}

runs {
config("client") {
launchClasspath
}
}
}

repositories {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repositories {
maven("https://maven.neoforged.net/releases")
maven("https://maven.firstdarkdev.xyz/releases")
maven("https://maven.wagyourtail.xyz/releases")
maven("https://maven.wagyourtail.xyz/snapshots")
gradlePluginPortal()
}

Expand All @@ -35,5 +36,6 @@ dependencies {
implementation(group = "org.jetbrains", name = "annotations")

plugin(id = "xyz.wagyourtail.unimined", version = "unimined_version"())
plugin(id = "xyz.wagyourtail.unimined.expect-platform", version = "expectplatform_version"())
plugin(id = "com.github.johnrengelman.shadow", version = "shadow_version"())
}
File renamed without changes.
11 changes: 11 additions & 0 deletions fabric/run/server/config/fabric_loader_dependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": 1,
"overrides": {
"forgeconfigapiport": {
"-depends": {
"com_electronwill_night-config_core": "",
"com_electronwill_night-config_toml": ""
}
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mixin.debug = true

# gradle plugin versions
unimined_version = 1.2.6
expectplatform_version = 1.0.0-SNAPSHOT
forgix_version = 1.2.9
shadow_version = 8.1.1

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/rdh/createunlimited/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.mojang.brigadier.arguments.ArgumentType;

import dev.architectury.injectables.annotations.ExpectPlatform;

import com.simibubi.create.foundation.config.ConfigBase.CValue;
import com.simibubi.create.foundation.config.ConfigBase.ConfigBool;

Expand All @@ -16,6 +14,8 @@
import net.minecraftforge.fml.config.IConfigSpec;
import net.minecraftforge.fml.config.ModConfig;

import xyz.wagyourtail.unimined.expect.annotation.ExpectPlatform;

public abstract class Util {

@ExpectPlatform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;

import dev.architectury.injectables.annotations.PlatformOnly;

import dev.rdh.createunlimited.Util;
import dev.rdh.createunlimited.config.CUConfigs;

import java.util.UUID;
import java.util.function.Supplier;

@Mixin(value = ExtendoGripItem.class, remap = false)
@Mixin(value = ExtendoGripItem.class)
public abstract class ExtendoGripItemMixin {

// the annotation processor is a little broken so we have to specify `remap = false` and use the obfuscated names

@Dynamic
@ModifyExpressionValue(method = {
"holdingExtendoGripIncreasesRange(Lnet/minecraft/world/entity/LivingEntity;)V",
"holdingExtendoGripIncreasesRange(Lnet/minecraft/class_1309;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/nbt/CompoundTag;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/class_1297;Lnet/minecraft/class_2487;)V",
}, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;rangeModifier:Ljava/util/function/Supplier;"))
@PlatformOnly(PlatformOnly.FABRIC)
// @PlatformOnly(PlatformOnly.FABRIC)
private static Supplier<Multimap<Attribute, AttributeModifier>> modifySingleFabric(Supplier<?> original) {
return cu$singleRange();
}
Expand All @@ -46,19 +40,17 @@ private static Supplier<Multimap<Attribute, AttributeModifier>> modifySingleFabr
"holdingExtendoGripIncreasesRange(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V"
}, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;rangeModifier:Ljava/util/function/Supplier;"))
@PlatformOnly(PlatformOnly.FORGE)
// @PlatformOnly(PlatformOnly.FORGE)
private static Supplier<Multimap<Attribute, AttributeModifier>> modifySingleForge(Supplier<?> original) {
return cu$singleRange();
}

@Dynamic
@ModifyExpressionValue(method = {
"holdingExtendoGripIncreasesRange(Lnet/minecraft/world/entity/LivingEntity;)V",
"holdingExtendoGripIncreasesRange(Lnet/minecraft/class_1309;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/nbt/CompoundTag;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/class_1297;Lnet/minecraft/class_2487;)V",
}, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;doubleRangeModifier:Ljava/util/function/Supplier;"))
@PlatformOnly(PlatformOnly.FABRIC)
// @PlatformOnly(PlatformOnly.FABRIC)
private static Supplier<Multimap<Attribute, AttributeModifier>> modifyDoubleFabric(Supplier<?> original) {
return cu$doubleRange();
}
Expand All @@ -68,7 +60,7 @@ private static Supplier<Multimap<Attribute, AttributeModifier>> modifyDoubleFabr
"holdingExtendoGripIncreasesRange(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V",
"addReachToJoiningPlayersHoldingExtendo(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V"
}, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;doubleRangeModifier:Ljava/util/function/Supplier;"))
@PlatformOnly(PlatformOnly.FORGE)
// @PlatformOnly(PlatformOnly.FORGE)
private static Supplier<Multimap<Attribute, AttributeModifier>> modifyDoubleForge(Supplier<?> original) {
return cu$doubleRange();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private static double[] modifyIntersect3(Vec3 p1, Vec3 p2, Vec3 r, Vec3 s, Axis
}

@Unique
@SuppressWarnings("SuspiciousNameCombination") // javac doesn't like when we pass a value called "y" to a method that expects a value called "x"
private static double[] cu$intersect(Vec3 p1, Vec3 p2, Vec3 r, Vec3 s, Axis plane) {
if (plane == Axis.X) {
p1 = new Vec3(p1.y, 0, p1.z);
Expand Down

0 comments on commit da65447

Please sign in to comment.