Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Fix build for Minecraft 1.18.2 for real
Browse files Browse the repository at this point in the history
Commit 77c54ac did not really fix the build for Minecraft 1.18.2 issue.
This commit should. It uses complete signatures for the injections, so
there is no ambiguity which function should be targeted.

It uses the new mappings for 1.18.2, but also adds the signature for
<1.18.2. These injections are grouped so one and only one should succeed.
  • Loading branch information
pascallj committed May 21, 2022
1 parent 77c54ac commit bd2493b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
modmenu_version=3.0.1

# Mod Properties
mod_version = 3.1.1
mod_version = 3.1.2
archives_base_name = mineshot-revived
maven_group = com.example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -50,8 +51,24 @@ private void onRenderClear(CallbackInfo ci) {
}
}

@Inject(method = "renderSky*", at = @At("HEAD"), cancellable = true)
private void onRenderSky(CallbackInfo ci) {
@Inject(method = "renderSky(Lnet/minecraft/client/render/BufferBuilder;F)V", at = @At("HEAD"), cancellable = true)
private static void onRenderSky(CallbackInfo ci) {
if (Mineshot.getOrthoViewHandler().getBackground() != 0)
ci.cancel();
}

// Group renderSky injection for <1.18.2 compatibility
@Group(name = "renderSky", min = 1, max = 1)
@Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At("HEAD"), cancellable = true)
private void onRenderSky2(CallbackInfo ci) {
if (Mineshot.getOrthoViewHandler().getBackground() != 0)
ci.cancel();
}

// Minecraft <1.18.2 compatibility
@Group(name = "renderSky")
@Inject(method = "method_3257(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLjava/lang/Runnable;)V", at = @At("HEAD"), cancellable = true)
private void onRenderSky3(CallbackInfo ci) {
if (Mineshot.getOrthoViewHandler().getBackground() != 0)
ci.cancel();
}
Expand Down
6 changes: 3 additions & 3 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"latest": "3.1.1",
"latest": "3.1.2",
"dev": "4.0.0-beta.1",
"1.19.x": {
"latest": "4.0.0-beta.1",
"dev": "4.0.0-beta.1"
},
"1.18.x": {
"latest": "3.1.1",
"dev": "3.1.1"
"latest": "3.1.2",
"dev": "3.1.2"
},
"1.17": {
"latest": "2.0.0",
Expand Down

0 comments on commit bd2493b

Please sign in to comment.