diff --git a/forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java b/forge116/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java similarity index 70% rename from forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java rename to forge116/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java index c538654..2cb553e 100644 --- a/forge116/src/main/java/me/neovitalism/neomixins/NeoMixins.java +++ b/forge116/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java @@ -1,15 +1,15 @@ -package me.neovitalism.neomixins; +package me.neovitalism.broketrainers; 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("broketrainers") +public class BrokeTrainers { private static final Logger LOGGER = LogManager.getLogger(); - public NeoMixins() { + public BrokeTrainers() { LOGGER.log(Level.INFO, "Loaded!"); } } diff --git a/forge116/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java b/forge116/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java new file mode 100644 index 0000000..4670faf --- /dev/null +++ b/forge116/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java @@ -0,0 +1,18 @@ +package me.neovitalism.broketrainers.mixins; + +import com.pixelmonmod.pixelmon.api.economy.BankAccount; +import com.pixelmonmod.pixelmon.entities.npcs.NPCTrainer; +import net.minecraft.entity.player.ServerPlayerEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.Optional; + +@Mixin(value = NPCTrainer.class, remap = false) +public class NPCTrainerMixin { // We make the account null to avoid sending without altering the winMoney variable. + @Redirect(method = "loseBattle", at = @At(value = "INVOKE", target = "Lcom/pixelmonmod/pixelmon/api/economy/BankAccountProxy;getBankAccount(Lnet/minecraft/entity/player/ServerPlayerEntity;)Ljava/util/Optional;")) + public Optional getBankAccount(ServerPlayerEntity player) { + return Optional.empty(); + } +} diff --git a/forge116/src/main/resources/mixins.neomixins.json b/forge116/src/main/resources/mixins.broketrainers.json similarity index 92% rename from forge116/src/main/resources/mixins.neomixins.json rename to forge116/src/main/resources/mixins.broketrainers.json index 09daee9..d4c386f 100644 --- a/forge116/src/main/resources/mixins.neomixins.json +++ b/forge116/src/main/resources/mixins.broketrainers.json @@ -5,7 +5,7 @@ "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_8", "mixins": [ - + "NPCTrainerMixin" ], "injectors": { "defaultRequire": 1 diff --git a/forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java b/forge120/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java similarity index 70% rename from forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java rename to forge120/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java index c538654..2cb553e 100644 --- a/forge120/src/main/java/me/neovitalism/neomixins/NeoMixins.java +++ b/forge120/src/main/java/me/neovitalism/broketrainers/BrokeTrainers.java @@ -1,15 +1,15 @@ -package me.neovitalism.neomixins; +package me.neovitalism.broketrainers; 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("broketrainers") +public class BrokeTrainers { private static final Logger LOGGER = LogManager.getLogger(); - public NeoMixins() { + public BrokeTrainers() { LOGGER.log(Level.INFO, "Loaded!"); } } diff --git a/forge120/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java b/forge120/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java new file mode 100644 index 0000000..ce1b0b9 --- /dev/null +++ b/forge120/src/main/java/me/neovitalism/broketrainers/mixins/NPCTrainerMixin.java @@ -0,0 +1,16 @@ +package me.neovitalism.broketrainers.mixins; + +import com.pixelmonmod.pixelmon.api.economy.BankAccount; +import com.pixelmonmod.pixelmon.entities.npcs.NPCTrainer; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = NPCTrainer.class, remap = false) +public class NPCTrainerMixin { // We make the account null to avoid sending without altering the winMoney variable. + @Redirect(method = "loseBattle", at = @At(value = "INVOKE", target = "Lcom/pixelmonmod/pixelmon/api/economy/BankAccountProxy;getBankAccountNow(Lnet/minecraft/server/level/ServerPlayer;)Lcom/pixelmonmod/pixelmon/api/economy/BankAccount;")) + public BankAccount getBankAccount(Player player) { + return null; + } +} \ No newline at end of file diff --git a/forge120/src/main/resources/mixins.neomixins.json b/forge120/src/main/resources/mixins.broketrainers.json similarity index 92% rename from forge120/src/main/resources/mixins.neomixins.json rename to forge120/src/main/resources/mixins.broketrainers.json index 0af23d8..f4d3448 100644 --- a/forge120/src/main/resources/mixins.neomixins.json +++ b/forge120/src/main/resources/mixins.broketrainers.json @@ -5,7 +5,7 @@ "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_17", "mixins": [ - + "NPCTrainerMixin ], "injectors": { "defaultRequire": 1 diff --git a/gradle.properties b/gradle.properties index 707b506..3a84efc 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 -github_page = https://github.com/Neovitalism/NeoMixins \ No newline at end of file +mod_id = broketrainers +mod_name = BrokeTrainers +mod_description = A mixin to remove trainer money rewards. +github_page = https://github.com/Neovitalism/NeoMixins/tree/broke-trainers \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 8a8e3e2..61af5ef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'NeoMixins' +rootProject.name = 'BrokeTrainers' include 'forge116' include 'forge120'