Skip to content

Commit

Permalink
Replaced ModifyConstant with ModifyVariable and ModifyArg.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Feb 10, 2022
1 parent 4b9f223 commit 42a2e35
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 75 deletions.
32 changes: 3 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,23 @@ sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
//version = project.mod_version
version = "${minecraft_version}-${mod_version}"
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// 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' }
maven { url "https://jitpack.io" }
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// 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}
modCompileOnly ("com.github.Lizard-Of-Oz.Inventorio:inventorio-1.18-fabric:1.18-SNAPSHOT") {transitive = false}
}

processResources {
Expand All @@ -45,24 +35,15 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 17
}

minecraft {
accessWidener = file("src/main/resources/raised.accesswidener")
accessWidenerPath = file("src/main/resources/raised.accesswidener")
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

Expand All @@ -76,11 +57,9 @@ jar {
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
Expand All @@ -90,11 +69,6 @@ publishing {
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12

# Mod Properties
mod_version = 1.0.1
mod_version = 1.0.2
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.46.2+1.18
fabric_version=0.46.4+1.18
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,49 @@
@Mixin(value = InGameHud.class, priority = 9001)
public class InGameHudMixin {

@ModifyConstant(method = "renderExperienceBar", constant = @Constant(intValue = 31))
private int xpTextDistance(int value) {
return value + 1;
@ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), index = 2)
private int hotbarDistance(int value) {
return value - 1;
}

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 22, ordinal = 4))
@ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V", ordinal = 1), index = 6)
private int selectorHeight(int value) {
return value + 2;
}

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

@ModifyConstant(method = "renderHotbar", constant = @Constant(intValue = 22, ordinal = 2))
private int selectorDistance(int value) {
return value + 1;
@ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbarItem(IIFLnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;I)V"), index = 1)
private int itemDistance(int value) {
return value - 1;
}

@ModifyConstant(method = "renderMountJumpBar", constant = @Constant(intValue = 3))
@ModifyVariable(method = "renderMountJumpBar", at = @At(value = "STORE"), ordinal = 3)
private int jumpBarDistance(int value) {
return value - 1;
}

@ModifyConstant(method = "renderExperienceBar", constant = @Constant(intValue = 3))
@ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), index = 2)
private int experienceBarDistance(int value) {
return value - 1;
}

@ModifyConstant(method = "renderHeldItemTooltip", constant = @Constant(intValue = 59))
@ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I"), index = 3)
private float xpTextDistance(float value) {
return value - 1.0F;
}

@ModifyVariable(method = "renderHeldItemTooltip", at = @At(value = "STORE"), ordinal = 2)
private int heldItemTooltipDistance(int value) {
return value + 1;
return value - 1;
}

@ModifyConstant(method = "renderStatusBars", constant = @Constant(intValue = 39))
@ModifyVariable(method = "renderStatusBars", at = @At(value = "STORE"), ordinal = 5)
private int statusBarsDistance(int value) {
return value + 1;
return value - 1;
}

@ModifyConstant(method = "renderMountHealth", constant = @Constant(intValue = 39))
@ModifyVariable(method = "renderMountHealth", at = @At(value = "STORE"), ordinal = 2)
private int mountHealthDistance(int value) {
return value + 1;
}

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

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

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

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

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yurisuika.raised.mixin.client;
package com.yurisuika.raised.mixin.mods.appleskin;

import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yurisuika.raised.mixin.client.ui;
package com.yurisuika.raised.mixin.mods.inventorio;

import me.lizardofoz.inventorio.client.ui.HotbarHUDRenderer;
import net.minecraft.client.util.Window;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/raised.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"mixins": [
],
"client": [
"client.HUDOverlayHandlerMixin",
"client.gui.hud.InGameHudMixin",
"client.ui.HotbarHUDRendererMixin"
"mods.appleskin.HUDOverlayHandlerMixin",
"mods.inventorio.HotbarHUDRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 42a2e35

Please sign in to comment.