Skip to content

Commit

Permalink
Fixed broken API dependency; need to figure out how to make API depen…
Browse files Browse the repository at this point in the history
…d on Minecraft without the terrible accessWidener issue
  • Loading branch information
floral-qua-floral committed Nov 20, 2024
1 parent 570401d commit a08f6a4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
7 changes: 0 additions & 7 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'java'
id 'maven-publish'
}

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 {
Expand Down
3 changes: 1 addition & 2 deletions api/src/main/java/com/floralquafloral/PlayerPooper.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.floralquafloral;

import net.minecraft.entity.player.PlayerEntity;

public interface PlayerPooper {
PlayerEntity poopasaur();
void stinky();
}
46 changes: 23 additions & 23 deletions mod/src/main/java/com/floralquafloral/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Identifier> 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<Identifier> 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) {
Expand Down

0 comments on commit a08f6a4

Please sign in to comment.