From 8dfa27f6528b8fd3b5def2ce747679f73b36ad00 Mon Sep 17 00:00:00 2001
From: Luligabi1 <33578169+Luligabi1@users.noreply.github.com>
Date: Mon, 21 Aug 2023 14:14:50 -0300
Subject: [PATCH] Fix mixin incompat with Aquamirae (and likely other mods)
---
build.gradle | 1 +
gradle.properties | 3 +-
modular-armor/build.gradle.kts | 10 ++++++
.../mixin/LivingEntityMixin.java | 12 ++++---
.../dml/modular_armor/InitPreLaunch.kt | 32 +++++++++++++++++++
.../src/main/resources/fabric.mod.json | 3 +-
6 files changed, 55 insertions(+), 6 deletions(-)
create mode 100644 modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/InitPreLaunch.kt
diff --git a/build.gradle b/build.gradle
index a8825f3c..069afee6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -26,6 +26,7 @@ def getChangeLog() {
repositories {
+ maven { url = "https://jitpack.io" }
maven { url = "https://maven.terraformersmc.com/releases/" }
}
diff --git a/gradle.properties b/gradle.properties
index 3cb87bc2..4a06106f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10
loader_version=0.14.22
#Fabric api
-fabric_version=0.86.1+1.20.1
+fabric_version=0.87.0+1.20.1
loom_version=1.3
# Mod Properties
@@ -30,6 +30,7 @@ libguiVersion=8.0.0-beta.1+1.20-rc1
palVersion=1.8.0
reiVersion=12.0.625
energyVersion=2.3.0
+mixinextrasVersion=0.1.1
modmenuVersion=7.0.0
mcdUsername=mcd
diff --git a/modular-armor/build.gradle.kts b/modular-armor/build.gradle.kts
index 7fbe00b0..bcc0aa9a 100644
--- a/modular-armor/build.gradle.kts
+++ b/modular-armor/build.gradle.kts
@@ -1,5 +1,6 @@
val palVersion: String by project
val libguiVersion: String by project
+val mixinextrasVersion: String by project
repositories {
maven {
@@ -14,6 +15,10 @@ repositories {
name = "CottonMC"
url = uri("https://server.bbkr.space/artifactory/libs-release")
}
+ maven {
+ name = "JitPack"
+ url = uri("https://jitpack.io")
+ }
}
dependencies {
@@ -24,4 +29,9 @@ dependencies {
modApi("io.github.cottonmc:LibGui:${libguiVersion}")
include("io.github.cottonmc:LibGui:${libguiVersion}")
+
+
+ modApi("com.github.LlamaLad7:MixinExtras:${mixinextrasVersion}")
+ include("com.github.LlamaLad7:MixinExtras:${mixinextrasVersion}")
+ annotationProcessor("com.github.LlamaLad7:MixinExtras:${mixinextrasVersion}")
}
diff --git a/modular-armor/src/main/java/dev/nathanpb/dml/modular_armor/mixin/LivingEntityMixin.java b/modular-armor/src/main/java/dev/nathanpb/dml/modular_armor/mixin/LivingEntityMixin.java
index 3fb6bac6..8c236b32 100644
--- a/modular-armor/src/main/java/dev/nathanpb/dml/modular_armor/mixin/LivingEntityMixin.java
+++ b/modular-armor/src/main/java/dev/nathanpb/dml/modular_armor/mixin/LivingEntityMixin.java
@@ -19,13 +19,14 @@
* along with Deep Mob Learning: Refabricated. If not, see .
*/
+import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
+import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import dev.nathanpb.dml.item.ItemEmeritusHat;
import dev.nathanpb.dml.modular_armor.EntityStatusEffectsKt;
import dev.nathanpb.dml.modular_armor.ItemModularGlitchArmor;
import dev.nathanpb.dml.modular_armor.effects.RotResistanceEffect;
import dev.nathanpb.dml.modular_armor.effects.TargetCancellationEffect;
import dev.nathanpb.dml.modular_armor.effects.UndyingEffect;
-import net.minecraft.entity.DamageUtil;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
@@ -109,8 +110,11 @@ public List> applyFoodEffects(List original) {
boolean shouldUncap = StreamSupport.stream(((LivingEntity) (Object) this).getArmorItems().spliterator(), false)
.anyMatch(it -> it.getItem() instanceof ItemModularGlitchArmor);
@@ -119,7 +123,7 @@ public float glitchArmorUncapProtection(float damage, float armor, float armorTo
float g = Math.max(armor - damage / f, armor * 0.2F);
return damage * (1.0F - g / 25.0F);
} else {
- return DamageUtil.getDamageLeft(damage, armor, armorToughness);
+ return original.call(damage, armor, armorToughness);
}
}
diff --git a/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/InitPreLaunch.kt b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/InitPreLaunch.kt
new file mode 100644
index 00000000..1d55845f
--- /dev/null
+++ b/modular-armor/src/main/kotlin/dev/nathanpb/dml/modular_armor/InitPreLaunch.kt
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (C) 2021 Nathan P. Bombana, IterationFunk
+ *
+ * This file is part of Deep Mob Learning: Refabricated.
+ *
+ * Deep Mob Learning: Refabricated is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Deep Mob Learning: Refabricated is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Deep Mob Learning: Refabricated. If not, see .
+ */
+
+package dev.nathanpb.dml.modular_armor
+
+import com.llamalad7.mixinextras.MixinExtrasBootstrap
+import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint
+
+class InitPreLaunch : PreLaunchEntrypoint {
+
+ override fun onPreLaunch() {
+ MixinExtrasBootstrap.init()
+ }
+
+}
\ No newline at end of file
diff --git a/modular-armor/src/main/resources/fabric.mod.json b/modular-armor/src/main/resources/fabric.mod.json
index 79d45dde..07286790 100644
--- a/modular-armor/src/main/resources/fabric.mod.json
+++ b/modular-armor/src/main/resources/fabric.mod.json
@@ -15,7 +15,8 @@
"environment": "*",
"entrypoints": {
"main": ["dev.nathanpb.dml.modular_armor.InitKt::init"],
- "client": ["dev.nathanpb.dml.modular_armor.InitClientKt::initClient"]
+ "client": ["dev.nathanpb.dml.modular_armor.InitClientKt::initClient"],
+ "preLaunch": ["dev.nathanpb.dml.modular_armor.InitPreLaunch"]
},
"mixins": ["mixins.dml-refabricated-modular-armor.json"],
"depends": {