Skip to content

Commit 855290b

Browse files
committed
fix: get 1.21.11 support working again
1 parent 1b98381 commit 855290b

21 files changed

Lines changed: 41 additions & 15 deletions

src/main/java/eu/midnightdust/midnightcontrols/client/controller/InputHandlers.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ else if (client.screen instanceof AbstractContainerScreen && client.player != nu
231231
public static boolean handleScreenshot(@NotNull Minecraft client, @NotNull ButtonBinding binding, float value, @NotNull ButtonState action) {
232232
if (action == ButtonState.RELEASE)
233233
//~ if >=26.1 '.addMessage' -> '.addClientSystemMessage'
234-
Screenshot.grab(client.gameDirectory, client.getMainRenderTarget(),
235-
text -> client.execute(() -> client.gui.getChat().addClientSystemMessage(text)));
234+
Screenshot.grab(client.gameDirectory, client.getMainRenderTarget(), text -> client.execute(() -> client.gui.getChat().addClientSystemMessage(text)));
236235
return true;
237236
}
238237

src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* @version 1.7.0
3535
* @since 1.0.0
3636
*/
37+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor' {
3738
public class MidnightControlsHud {
3839
private Minecraft client = Minecraft.getInstance();
3940
private int attackWidth = 0;
@@ -74,6 +75,7 @@ public void init() {
7475
/**
7576
* Renders the MidnightControls HUD.
7677
*/
78+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
7779
public void extractRenderState(GuiGraphicsExtractor context, DeltaTracker tickCounter) {
7880
if (this.client == null) this.client = Minecraft.getInstance();
7981
if (!isVisible) return;
@@ -293,3 +295,4 @@ private void drawTip(GuiGraphicsExtractor context, int x, int y, @NotNull String
293295
context.text(this.client.font, translatedAction, x, (y + textY), 0xFFFFFFFF, false);
294296
}
295297
}
298+
//~}

src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsRenderer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @version 1.7.0
2929
* @since 1.2.0
3030
*/
31+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor' {
3132
public class MidnightControlsRenderer {
3233
public static final int ICON_SIZE = 20;
3334
private static final int BUTTON_SIZE = 15;
@@ -191,3 +192,4 @@ private static int getButtonTipWidth(@NotNull String action, @NotNull Font textR
191192
public record ButtonSize(int length, int height) {
192193
}
193194
}
195+
//~}

src/main/java/eu/midnightdust/midnightcontrols/client/gui/RingScreen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public boolean isPauseScreen() {
4848
}
4949

5050
@Override
51+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
5152
public void extractRenderState(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) {
5253
super.extractRenderState(context, mouseX, mouseY, delta);
5354

src/main/java/eu/midnightdust/midnightcontrols/client/gui/config/ControllerBindingButton.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public void extractDefaultLabel(ActiveTextCollector consumer) {
118118
//~}
119119

120120
@Override
121+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor' {
121122
protected void extractContents(GuiGraphicsExtractor context, int mouseX, int mouseY, float deltaTicks) {
122123
//~ if >=26.1 'renderDefault' -> 'extractDefault' {
123124
this.extractDefaultSprite(context);
@@ -130,6 +131,7 @@ protected void extractContents(GuiGraphicsExtractor context, int mouseX, int mou
130131
var size = MidnightControlsRenderer.drawButton(context, x, this.getY(), this.binding, Minecraft.getInstance());
131132
iconWidth = size.length();
132133
}
134+
//~}
133135

134136
@Override
135137
public void finishBindingEdit(int... buttons) {

src/main/java/eu/midnightdust/midnightcontrols/client/gui/cursor/CursorRenderer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
public abstract class CursorRenderer {
1616
public static CursorType currentCursorStyle = CursorType.DEFAULT;
1717

18+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
1819
public abstract void renderCursor(@NotNull GuiGraphicsExtractor context, @NotNull Minecraft client);
1920

21+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
2022
public static void drawUnalignedTexturedQuad(RenderPipeline pipeline, Identifier texture, GuiGraphicsExtractor context, float x1, float x2, float y1, float y2, float u1, float u2, float v1, float v2) {
2123
DrawContextAccessor accessor = (DrawContextAccessor) context;
2224
var tex = client.getTextureManager().getTexture(texture);

src/main/java/eu/midnightdust/midnightcontrols/client/gui/cursor/VirtualCursorRenderer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public static VirtualCursorRenderer getInstance() {
2121
return INSTANCE;
2222
}
2323

24+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
2425
public void renderCursor(@NotNull GuiGraphicsExtractor context, @NotNull Minecraft client) {
2526
if (!MidnightControlsConfig.virtualMouse || (client.screen == null
2627
|| MidnightInput.isScreenInteractive(client.screen)))

src/main/java/eu/midnightdust/midnightcontrols/client/gui/cursor/WaylandCursorRenderer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static WaylandCursorRenderer getInstance() {
3535
return INSTANCE;
3636
}
3737

38+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
3839
public void renderCursor(@NotNull GuiGraphicsExtractor context, @NotNull Minecraft client) {
3940
if (MidnightControlsConfig.virtualMouse || client.screen == null || MidnightControlsConfig.controlsMode != ControlsMode.CONTROLLER) return;
4041

src/main/java/eu/midnightdust/midnightcontrols/client/mixin/ChatScreenMixin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ protected ChatScreenMixin(Component title) {
2525
if (MidnightControlsConfig.moveChat) input.setY(4);
2626
}
2727
//~ if >= 26.1 'render' -> 'extractRenderState' {
28+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor' {
2829
@Inject(method = "extractRenderState", at = @At("HEAD"))
2930
private void midnightcontrols$moveInputFieldBackground(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
3031
if (MidnightControlsConfig.moveChat) context.pose().translate(0f, -this.height + 16);
@@ -34,4 +35,5 @@ protected ChatScreenMixin(Component title) {
3435
if (MidnightControlsConfig.moveChat) context.pose().translate(0f, this.height - 16);
3536
}
3637
//~}
38+
//~}
3739
}

src/main/java/eu/midnightdust/midnightcontrols/client/mixin/DrawContextAccessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
import org.spongepowered.asm.mixin.Mixin;
1515
import org.spongepowered.asm.mixin.gen.Accessor;
1616

17+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
1718
@Mixin(GuiGraphicsExtractor.class)
1819
public interface DrawContextAccessor {
1920
@Accessor("guiRenderState")
2021
GuiRenderState getState();
2122

23+
//? if fabric {
2224
@Accessor("scissorStack")
25+
//~ if >= 26.1 'GuiGraphics' -> 'GuiGraphicsExtractor'
2326
GuiGraphicsExtractor.ScissorStack getScissorStack();
27+
//?}
2428
}

0 commit comments

Comments
 (0)