Skip to content

Commit

Permalink
Support for Appleskin and Inventorio
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Jan 24, 2022
1 parent 2fc9221 commit 4b9f223
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 21 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven { url "https://maven.ryanliptak.com/" }
maven { url 'https://jitpack.io' }
}

dependencies {
Expand All @@ -30,6 +32,8 @@ dependencies {

// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
modCompileOnly ("squeek.appleskin:appleskin-fabric:mc1.18-2.2.0") {transitive = false}
modCompileOnly ('com.github.Lizard-Of-Oz.Inventorio:inventorio-1.18-fabric:1.18-SNAPSHOT') {transitive = false}
}

processResources {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.18
yarn_mappings=1.18.1+build.22
loader_version=0.12.12

# Mod Properties
mod_version = 1.0.0
mod_version = 1.0.1
maven_group = com.yurisuika.raised
archives_base_name = raised

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.45.2+1.18
fabric_version=0.46.2+1.18
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.yurisuika.raised.mixin.client;

import org.objectweb.asm.Opcodes;
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.Redirect;
import squeek.appleskin.client.HUDOverlayHandler;

@Mixin(HUDOverlayHandler.class)
public class HUDOverlayHandlerMixin {

@Shadow public int foodIconsOffset;
@Shadow public int FOOD_BAR_HEIGHT;

@Redirect(method = "onPreRender", at = @At(value = "FIELD", target = "squeek/appleskin/client/HUDOverlayHandler.foodIconsOffset:I", opcode = Opcodes.PUTFIELD))
private void modifyFoodIconsOffset(HUDOverlayHandler instance, int value) {
foodIconsOffset = FOOD_BAR_HEIGHT + 1;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,72 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;

@Mixin(InGameHud.class)
public class MixinInGameHud {
@Mixin(value = InGameHud.class, priority = 9001)
public class InGameHudMixin {

@ModifyConstant(method = "renderExperienceBar", constant = @Constant(intValue = 31))
private int xpTextDistance(int value) {
return 32;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 22, ordinal = 4))
private int selectorHeight(int value) {
return 24;
return value + 2;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 22, ordinal = 0))
private int hotbarDistance(int value) {
return 23;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 22, ordinal = 2))
private int selectorDistance(int value) {
return 23;
return value + 1;
}

@ModifyConstant(method = "renderMountJumpBar", constant = @Constant(intValue = 3))
private int jumpBarDistance(int value) {
return 2;
return value - 1;
}

@ModifyConstant(method = "renderExperienceBar", constant = @Constant(intValue = 3))
private int experienceBarDistance(int value) {
return 2;
return value - 1;
}

@ModifyConstant(method = "renderHeldItemTooltip", constant = @Constant(intValue = 59))
private int heldItemTooltipDistance(int value) {
return 60;
return value + 1;
}

@ModifyConstant(method = "renderStatusBars", constant = @Constant(intValue = 39))
private int statusBarsDistance(int value) {
return 40;
return value + 1;
}

@ModifyConstant(method = "renderMountHealth", constant = @Constant(intValue = 39))
private int mountHealthDistance(int value) {
return 40;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 23, ordinal = 1))
private int emptyOffhandDistance(int value) {
return 24;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 23, ordinal = 0))
private int heldOffhandDistance(int value) {
return 24;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 3, ordinal = 1))
private int offhandItemDistance(int value) {
return 4;
return value + 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 3, ordinal = 0))
private int itemDistance(int value) {
return 4;
return value + 1;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.yurisuika.raised.mixin.client.ui;

import me.lizardofoz.inventorio.client.ui.HotbarHUDRenderer;
import net.minecraft.client.util.Window;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(HotbarHUDRenderer.class)
public class HotbarHUDRendererMixin {

@Redirect(method = "renderSegmentedHotbar", at = @At(value = "INVOKE", target = "net/minecraft/client/util/Window.getScaledHeight()I"))
private int modifyScaledHeight(Window instance) {
return instance.getScaledHeight() - 1;
}

@Redirect(method = "renderHotbarAddons", at = @At(value = "INVOKE", target = "net/minecraft/client/util/Window.getScaledHeight()I"))
private int modifyAddonsScaledHeight(Window instance) {
return instance.getScaledHeight() - 1;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "${version}",

"name": "Raised",
"description": "Fixes the hotbar!",
"description": "Raises the hotbar so the selector is not cut off!",
"authors": [
"yurisuika"
],
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/raised.accesswidener
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessWidener v1 named

accessible method net/minecraft/client/gui/hud/InGameHud renderHotbar (FLnet/minecraft/client/util/math/MatrixStack;)V
accessible method net/minecraft/client/gui/hud/InGameHud renderHotbar (FLnet/minecraft/client/util/math/MatrixStack;)V
4 changes: 3 additions & 1 deletion src/main/resources/raised.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"mixins": [
],
"client": [
"client.gui.hud.MixinInGameHud"
"client.HUDOverlayHandlerMixin",
"client.gui.hud.InGameHudMixin",
"client.ui.HotbarHUDRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 4b9f223

Please sign in to comment.