From 7d1a190b6f7f7b88b3fe0bf9569a5dcbb30806d9 Mon Sep 17 00:00:00 2001 From: Neovitalism <70066544+Neovitalism@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:29:49 -0500 Subject: [PATCH] level-cap-patch --- .../LevelCapPatch.java} | 8 +- .../mixins/PixelmonWrapperMixin.java | 18 +++ ...omixins.json => mixins.levelcappatch.json} | 2 +- forge120/build.gradle | 104 ------------------ .../me/neovitalism/neomixins/NeoMixins.java | 15 --- .../src/main/resources/META-INF/mods.toml | 24 ---- .../src/main/resources/mixins.neomixins.json | 14 --- forge120/src/main/resources/pack.mcmeta | 6 - gradle.properties | 6 +- 9 files changed, 26 insertions(+), 171 deletions(-) rename forge116/src/main/java/me/neovitalism/{neomixins/NeoMixins.java => levelcappatch/LevelCapPatch.java} (70%) create mode 100644 forge116/src/main/java/me/neovitalism/levelcappatch/mixins/PixelmonWrapperMixin.java rename forge116/src/main/resources/{mixins.neomixins.json => mixins.levelcappatch.json} (90%) delete mode 100644 forge120/build.gradle delete mode 100644 forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java delete mode 100644 forge120/src/main/resources/META-INF/mods.toml delete mode 100644 forge120/src/main/resources/mixins.neomixins.json delete mode 100644 forge120/src/main/resources/pack.mcmeta diff --git a/forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java b/forge116/src/main/java/me/neovitalism/levelcappatch/LevelCapPatch.java similarity index 70% rename from forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java rename to forge116/src/main/java/me/neovitalism/levelcappatch/LevelCapPatch.java index c538654..91f0257 100644 --- a/forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java +++ b/forge116/src/main/java/me/neovitalism/levelcappatch/LevelCapPatch.java @@ -1,15 +1,15 @@ -package me.neovitalism.neomixins; +package me.neovitalism.levelcappatch; import net.minecraftforge.fml.common.Mod; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@Mod("neomixins") -public class NeoMixins { +@Mod("levelcappatch") +public class LevelCapPatch { private static final Logger LOGGER = LogManager.getLogger(); - public NeoMixins() { + public LevelCapPatch() { LOGGER.log(Level.INFO, "Loaded!"); } } diff --git a/forge116/src/main/java/me/neovitalism/levelcappatch/mixins/PixelmonWrapperMixin.java b/forge116/src/main/java/me/neovitalism/levelcappatch/mixins/PixelmonWrapperMixin.java new file mode 100644 index 0000000..00535e8 --- /dev/null +++ b/forge116/src/main/java/me/neovitalism/levelcappatch/mixins/PixelmonWrapperMixin.java @@ -0,0 +1,18 @@ +package me.neovitalism.levelcappatch.mixins; + +import com.pixelmonmod.pixelmon.battles.controller.participants.PixelmonWrapper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value=PixelmonWrapper.class, remap = false) +public abstract class PixelmonWrapperMixin { + @Shadow public abstract void recalculateMaxHP(); + + @Inject(method={"setTempLevel"}, at={@At(value="RETURN")}) + public void levelCapPatch$setTempLevel(int level, CallbackInfo ci) { + this.recalculateMaxHP(); + } +} diff --git a/forge116/src/main/resources/mixins.neomixins.json b/forge116/src/main/resources/mixins.levelcappatch.json similarity index 90% rename from forge116/src/main/resources/mixins.neomixins.json rename to forge116/src/main/resources/mixins.levelcappatch.json index 09daee9..1854710 100644 --- a/forge116/src/main/resources/mixins.neomixins.json +++ b/forge116/src/main/resources/mixins.levelcappatch.json @@ -5,7 +5,7 @@ "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_8", "mixins": [ - + "PixelmonWrapperMixin" ], "injectors": { "defaultRequire": 1 diff --git a/forge120/build.gradle b/forge120/build.gradle deleted file mode 100644 index 9dea8b2..0000000 --- a/forge120/build.gradle +++ /dev/null @@ -1,104 +0,0 @@ -buildscript { - repositories { - maven { - name = 'forge' - url = 'https://maven.minecraftforge.net' - } - maven { - url = 'https://plugins.gradle.org/m2/' - } - maven { url = 'https://repo.spongepowered.org/maven' } - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.+', changing: true - classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' - } -} -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.spongepowered.mixin' - -sourceSets.main.resources { srcDir 'src/generated/resources' } -compileJava { - [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -} - -version = "${rootProject.mod_version}" as String -group = "me.neovitalism.${rootProject.mod_id}" as String -archivesBaseName = "${rootProject.mod_name}" - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -minecraft { - mappings channel: 'official', version: '1.20.2' -} - -repositories { - mavenCentral() - mavenLocal() - ivy { - setUrl('https://download.nodecdn.net/containers/reforged/server/release') - metadataSources { - artifact() - } - patternLayout { - artifact('[revision]/[artifact].[ext]') - } - } -} - -dependencies { - implementation 'org.jetbrains:annotations:24.0.1' - - minecraft "net.minecraftforge:forge:1.20.2-48.0.30" - implementation fg.deobf('pixelmon:Pixelmon-1.20.2-9.2.8-server:9.2.8') - annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' -} - -Map attributes = new HashMap<>() -attributes.put("Specification-Title", "${rootProject.mod_id}") -attributes.put("Specification-Vendor", "neovitalism") -attributes.put("Specification-Version", "1") -attributes.put("Implementation-Title", "${rootProject.mod_name}") -attributes.put("Implementation-Version", "${rootProject.mod_version}") -attributes.put("Implementation-Vendor","neovitalism") -attributes.put("Implementation-Timestamp", new Date().format("yyyy-MM-dd'T'HH,mm,ssZ")) -attributes.put("TweakClass", "org.spongepowered.asm.launch.MixinTweaker") -attributes.put("TweakOrder", 0) -attributes.put("MixinConfigs", "mixins.${rootProject.mod_id}.json") - -jar.manifest.attributes(attributes) - -mixin { - add sourceSets.main, "mixins.${rootProject.mod_id}.refmap.json" - config "mixins.${rootProject.mod_id}.json" -} - -jar.finalizedBy('reobfJar') - -Map properties = new HashMap<>() -properties.put('version', rootProject.mod_version) -properties.put('mod_id', rootProject.mod_id) -properties.put('mod_name', rootProject.mod_name) -properties.put('mod_description', rootProject.mod_description) -properties.put('github_page', rootProject.github_page) - -processResources { - inputs.properties(properties) - duplicatesStrategy = DuplicatesStrategy.INCLUDE - from(sourceSets.main.resources.srcDirs) { - include 'META-INF/mods.toml', "pack.mcmeta", "mixins.${rootProject.mod_id}.json" - expand(properties) - } -} - -tasks.getByName('build').finalizedBy('copyToBuilds') - -task copyToBuilds { - doLast { - copy { - from "/build/libs/${rootProject.mod_name}-${rootProject.mod_version}.jar" - rename("${rootProject.mod_name}-${rootProject.mod_version}.jar", "${rootProject.mod_name}-${rootProject.mod_version}-1.20.jar") - into "${rootDir}/builds" - } - }.finalizedBy(clean) -} \ No newline at end of file diff --git a/forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java b/forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java deleted file mode 100644 index c538654..0000000 --- a/forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.neovitalism.neomixins; - -import net.minecraftforge.fml.common.Mod; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Mod("neomixins") -public class NeoMixins { - private static final Logger LOGGER = LogManager.getLogger(); - - public NeoMixins() { - LOGGER.log(Level.INFO, "Loaded!"); - } -} diff --git a/forge120/src/main/resources/META-INF/mods.toml b/forge120/src/main/resources/META-INF/mods.toml deleted file mode 100644 index af963a4..0000000 --- a/forge120/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,24 +0,0 @@ -modLoader="javafml" -loaderVersion="[48,)" -license="All rights reserved" -[[mods]] -modId="${mod_id}" -version="${version}" -displayName="${mod_name}" -displayURL="${github_page}" -authors="Neovitalism" -description=''' -${mod_description} -''' -[[dependencies.${mod_id}]] -modId="forge" -mandatory=true -versionRange="[48,)" -ordering="NONE" -side="SERVER" -[[dependencies.${mod_id}]] -modId="minecraft" -mandatory=true -versionRange="[1.20.2,)" -ordering="NONE" -side="SERVER" diff --git a/forge120/src/main/resources/mixins.neomixins.json b/forge120/src/main/resources/mixins.neomixins.json deleted file mode 100644 index 0af23d8..0000000 --- a/forge120/src/main/resources/mixins.neomixins.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "me.neovitalism.${mod_id}.mixins", - "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_17", - "mixins": [ - - ], - "injectors": { - "defaultRequire": 1 - }, - "refmap": "mixins.${mod_id}.refmap.json" -} \ No newline at end of file diff --git a/forge120/src/main/resources/pack.mcmeta b/forge120/src/main/resources/pack.mcmeta deleted file mode 100644 index f486357..0000000 --- a/forge120/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "${mod_description}", - "pack_format": 18 - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 707b506..a8535f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ mod_version = 1.0.0 -mod_id = neomixins -mod_name = NeoMixins -mod_description = Mixins for use with Pixelmon +mod_id = levelcappatch +mod_name = LevelCapPatch +mod_description = Fixes Level Cap not recalculating Pokémon's health. github_page = https://github.com/Neovitalism/NeoMixins \ No newline at end of file