From a08f6a44bc9cb30eab6497263c2cff956c5ceec1 Mon Sep 17 00:00:00 2001 From: Floral <49110090+floral-qua-floral@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:26:08 -0500 Subject: [PATCH] Fixed broken API dependency; need to figure out how to make API depend on Minecraft without the terrible accessWidener issue --- api/build.gradle | 7 --- .../com/floralquafloral/PlayerPooper.java | 3 +- .../floralquafloral/mixin/InGameHudMixin.java | 46 +++++++++---------- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index 46964d5..a0404da 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,5 +1,4 @@ plugins { - id 'fabric-loom' version '1.8-SNAPSHOT' id 'java' id 'maven-publish' } @@ -7,13 +6,7 @@ plugins { group = 'com.floralquafloral' // Customize with your mod's group ID version = '1.0.0' // API version -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" -} publishing { publications { diff --git a/api/src/main/java/com/floralquafloral/PlayerPooper.java b/api/src/main/java/com/floralquafloral/PlayerPooper.java index 4b5a754..3dfaabb 100644 --- a/api/src/main/java/com/floralquafloral/PlayerPooper.java +++ b/api/src/main/java/com/floralquafloral/PlayerPooper.java @@ -1,7 +1,6 @@ package com.floralquafloral; -import net.minecraft.entity.player.PlayerEntity; public interface PlayerPooper { - PlayerEntity poopasaur(); + void stinky(); } diff --git a/mod/src/main/java/com/floralquafloral/mixin/InGameHudMixin.java b/mod/src/main/java/com/floralquafloral/mixin/InGameHudMixin.java index 1de058d..bb0095e 100644 --- a/mod/src/main/java/com/floralquafloral/mixin/InGameHudMixin.java +++ b/mod/src/main/java/com/floralquafloral/mixin/InGameHudMixin.java @@ -35,29 +35,29 @@ public abstract class InGameHudMixin { @Shadow @Final private MinecraftClient client; -// @WrapOperation(method = "drawHeart", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud$HeartType;getTexture(ZZZ)Lnet/minecraft/util/Identifier;")) -// public Identifier usePowerUpHeart(InGameHud.HeartType instance, boolean hardcore, boolean half, boolean blinking, Operation original) { -// // Cancel if the power-up hearts are disabled in the config or if this is a special heart -// if(!MarioQuaMario.CONFIG.shouldUsePowerUpHearts() || (instance != InGameHud.HeartType.CONTAINER && instance != InGameHud.HeartType.NORMAL)) -// return original.call(instance, hardcore, half, blinking); -// -// MarioMainClientData data = MarioMainClientData.getInstance(); -// // Cancel if there's no Mario Client Data or if the player isn't Mario -// if(data == null || !data.isEnabled()) -// return original.call(instance, hardcore, half, blinking); -// -// if(instance == InGameHud.HeartType.CONTAINER) { -// PowerUpDefinition.PowerHeart heartContainer = data.getPowerUp().HEART_EMPTY; -// if(heartContainer == null) return original.call(instance, hardcore, half, blinking); -// else return heartContainer.getTexture(half, blinking); -// } -// else if(hardcore) { -// return data.getPowerUp().HEART_HARDCORE.getTexture(half, blinking); -// } -// else { -// return data.getPowerUp().HEART.getTexture(half, blinking); -// } -// } + @WrapOperation(method = "drawHeart", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud$HeartType;getTexture(ZZZ)Lnet/minecraft/util/Identifier;")) + public Identifier usePowerUpHeart(InGameHud.HeartType instance, boolean hardcore, boolean half, boolean blinking, Operation original) { + // Cancel if the power-up hearts are disabled in the config or if this is a special heart + if(!MarioQuaMario.CONFIG.shouldUsePowerUpHearts() || (instance != InGameHud.HeartType.CONTAINER && instance != InGameHud.HeartType.NORMAL)) + return original.call(instance, hardcore, half, blinking); + + MarioMainClientData data = MarioMainClientData.getInstance(); + // Cancel if there's no Mario Client Data or if the player isn't Mario + if(data == null || !data.isEnabled()) + return original.call(instance, hardcore, half, blinking); + + if(instance == InGameHud.HeartType.CONTAINER) { + PowerUpDefinition.PowerHeart heartContainer = data.getPowerUp().HEART_EMPTY; + if(heartContainer == null) return original.call(instance, hardcore, half, blinking); + else return heartContainer.getTexture(half, blinking); + } + else if(hardcore) { + return data.getPowerUp().HEART_HARDCORE.getTexture(half, blinking); + } + else { + return data.getPowerUp().HEART.getTexture(half, blinking); + } + } @Inject(method = "render", at = @At("TAIL")) public void renderSpeedometerWithServerData(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {