mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 15:25:08 +01:00
port: Chase the Skies (1.21.6)
- Needs my ObsidianUI PR - Virtual keyboard currently does not work in book edit screen
This commit is contained in:
@@ -107,7 +107,7 @@ public class MappingsStringInputWidget extends SpruceContainerWidget {
|
||||
@Override
|
||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
super.renderWidget(context, mouseX, mouseY, delta);
|
||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.multiple_mapping_tip"), this.textArea.getX() + this.textArea.getWidth() / 2, this.textArea.getY() + this.textArea.getHeight() - 12, 0x888888);
|
||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.current_controller_guid", MidnightControlsConfig.getController().getGuid()), this.textArea.getX() + this.textArea.getWidth() / 2, this.height - 21, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.multiple_mapping_tip"), this.textArea.getX() + this.textArea.getWidth() / 2, this.textArea.getY() + this.textArea.getHeight() - 12, 0xFF888888);
|
||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.current_controller_guid", MidnightControlsConfig.getController().getGuid()), this.textArea.getX() + this.textArea.getWidth() / 2, this.height - 21, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import org.joml.Matrix3x2fStack;
|
||||
import org.thinkingstudio.obsidianui.hud.Hud;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
@@ -83,13 +83,13 @@ public class MidnightControlsHud extends Hud {
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
|
||||
isCrammed = client.getWindow().getScaledWidth() < 520;
|
||||
int y = bottom(2);
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
Matrix3x2fStack matrices = context.getMatrices();
|
||||
matrices.pushMatrix();
|
||||
this.renderFirstIcons(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||
this.renderSecondIcons(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||
this.renderFirstSection(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||
this.renderSecondSection(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||
matrices.pop();
|
||||
matrices.popMatrix();
|
||||
}
|
||||
|
||||
if (MidnightControlsClient.reacharound.isLastReacharoundVertical()) {
|
||||
@@ -102,7 +102,7 @@ public class MidnightControlsHud extends Hud {
|
||||
int opacity = ((int) (255 * scale)) << 24;
|
||||
|
||||
context.drawText(client.textRenderer, text, (int) (window.getScaledWidth() / 2.f - this.client.textRenderer.getWidth(text) / 2.f),
|
||||
(int) (window.getScaledHeight() / 2.f - 4), 0xCCCCCC | opacity, false);
|
||||
(int) (window.getScaledHeight() / 2.f - 4), 0xFFCCCCCC | opacity, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +298,6 @@ public class MidnightControlsHud extends Hud {
|
||||
return;
|
||||
var translatedAction = I18n.translate(action);
|
||||
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - this.client.textRenderer.fontHeight / 2) + 1;
|
||||
context.drawText(this.client.textRenderer, translatedAction, x, (y + textY), 14737632, false);
|
||||
context.drawText(this.client.textRenderer, translatedAction, x, (y + textY), 0xFFFFFFFF, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.gui;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
@@ -18,24 +20,31 @@ import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.render.UnalignedTexturedQuadGuiElementRenderState;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.DrawContextAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.render.state.TexturedQuadGuiElementRenderState;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.TextureSetup;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix3x2f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
|
||||
/**
|
||||
* Represents the midnightcontrols renderer.
|
||||
@@ -171,8 +180,8 @@ public class MidnightControlsRenderer {
|
||||
|
||||
int assetSize = axis || (button >= 15 && button <= 18) ? AXIS_SIZE : BUTTON_SIZE;
|
||||
|
||||
RenderSystem.setShaderColor(1.f, second ? 0.f : 1.f, 1.f, 1.f);
|
||||
context.drawTexture(RenderLayer::getGuiTextured, axis ? MidnightControlsClient.CONTROLLER_AXIS : button >= 15 && button <= 19 ? MidnightControlsClient.CONTROLLER_EXPANDED :MidnightControlsClient.CONTROLLER_BUTTONS
|
||||
//RenderSystem.setShaderColor(1.f, second ? 0.f : 1.f, 1.f, 1.f);
|
||||
context.drawTexture(RenderPipelines.GUI_TEXTURED, axis ? MidnightControlsClient.CONTROLLER_AXIS : button >= 15 && button <= 19 ? MidnightControlsClient.CONTROLLER_EXPANDED :MidnightControlsClient.CONTROLLER_BUTTONS
|
||||
, x + (ICON_SIZE / 2 - assetSize / 2), y + (ICON_SIZE / 2 - assetSize / 2),
|
||||
(float) buttonOffset, (float) (controllerType * assetSize),
|
||||
assetSize, assetSize,
|
||||
@@ -192,7 +201,8 @@ public class MidnightControlsRenderer {
|
||||
var translatedAction = I18n.translate(action);
|
||||
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - client.textRenderer.fontHeight / 2) + 1;
|
||||
|
||||
return context.drawTextWithShadow(client.textRenderer, translatedAction, (x + buttonWidth + 2), (y + textY), 14737632);
|
||||
context.drawTextWithShadow(client.textRenderer, translatedAction, (x + buttonWidth + 2), (y + textY), 0xFFFFFFFF);
|
||||
return (x + buttonWidth + 2) + client.textRenderer.getWidth(translatedAction);
|
||||
}
|
||||
|
||||
return -10;
|
||||
@@ -212,7 +222,7 @@ public class MidnightControlsRenderer {
|
||||
if (MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.DEFAULT_DARK || MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.SECOND_DARK)
|
||||
spritePath = MidnightControlsClient.WAYLAND_CURSOR_TEXTURE_DARK;
|
||||
Sprite sprite = client.getGuiAtlasManager().getSprite(spritePath);
|
||||
drawUnalignedTexturedQuad(RenderLayer::getGuiTextured, sprite.getAtlasId(), context, mouseX, mouseX + 8, mouseY, mouseY + 8, 999, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 8, mouseY, mouseY + 8, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
|
||||
@@ -256,20 +266,12 @@ public class MidnightControlsRenderer {
|
||||
|
||||
try {
|
||||
Sprite sprite = client.getGuiAtlasManager().getSprite(id(MidnightControlsConfig.virtualMouseSkin.getSpritePath() + (hoverSlot ? "_slot" : "")));
|
||||
drawUnalignedTexturedQuad(RenderLayer::getGuiTextured, sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, 999, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||
} catch (IllegalStateException ignored) {}
|
||||
}
|
||||
private static void drawUnalignedTexturedQuad(Function<Identifier, RenderLayer> renderLayers, Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float z, float u1, float u2, float v1, float v2) {
|
||||
RenderLayer renderLayer = renderLayers.apply(texture);
|
||||
//RenderSystem.setShaderTexture(0, texture);
|
||||
Matrix4f matrix4f = context.getMatrices().peek().getPositionMatrix();
|
||||
//BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
|
||||
VertexConsumer vertexConsumer = ((DrawContextAccessor)context).getVertexConsumers().getBuffer(renderLayer);
|
||||
vertexConsumer.vertex(matrix4f, x1, y1, z).texture(u1, v1).color(ColorHelper.getWhite(1.0f));
|
||||
vertexConsumer.vertex(matrix4f, x1, y2, z).texture(u1, v2).color(ColorHelper.getWhite(1.0f));
|
||||
vertexConsumer.vertex(matrix4f, x2, y2, z).texture(u2, v2).color(ColorHelper.getWhite(1.0f));
|
||||
vertexConsumer.vertex(matrix4f, x2, y1, z).texture(u2, v1).color(ColorHelper.getWhite(1.0f));
|
||||
context.draw();
|
||||
private static void drawUnalignedTexturedQuad(RenderPipeline pipeline, Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float u1, float u2, float v1, float v2) {
|
||||
DrawContextAccessor accessor = (DrawContextAccessor) context;
|
||||
accessor.getState().addSimpleElement(new UnalignedTexturedQuadGuiElementRenderState(pipeline, TextureSetup.withoutGlTexture(client.getTextureManager().getTexture(texture).getGlTextureView()), new Matrix3x2f(context.getMatrices()), x1, y1, x2, y2, u1, u2, v1, v2, 0xffffffff, accessor.getScissorStack().peekLast()));
|
||||
}
|
||||
|
||||
public record ButtonSize(int length, int height) {
|
||||
|
||||
@@ -15,6 +15,8 @@ import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
||||
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.KeyboardLayoutManager;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import org.thinkingstudio.obsidianui.background.Background;
|
||||
import org.thinkingstudio.obsidianui.mixin.DrawContextAccessor;
|
||||
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
|
||||
@@ -507,7 +509,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
||||
|
||||
@Override
|
||||
public void renderTitle(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215);
|
||||
context.drawCenteredTextWithShadow(this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public static class MidnightControlsBackground implements Background {
|
||||
@@ -518,21 +520,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
||||
}
|
||||
@Override
|
||||
public void render(DrawContext context, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
|
||||
fill(context, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), Color.black);
|
||||
}
|
||||
private static void fill(DrawContext context, int x2, int y2, int x1, int y1, Color color) {
|
||||
RenderLayer renderLayer = RenderLayer.getGui();
|
||||
VertexConsumer vertexConsumer = ((DrawContextAccessor)context).getVertexConsumers().getBuffer(renderLayer);
|
||||
|
||||
float r = (float)(color.getRed()) / 255.0F;
|
||||
float g = (float)(color.getGreen()) / 255.0F;
|
||||
float b = (float)(color.getBlue()) / 255.0F;
|
||||
float t = (float)(transparency) / 255.0F;
|
||||
vertexConsumer.vertex((float)x1, (float)y2, 0.0F).color(r, g, b, t);
|
||||
vertexConsumer.vertex((float)x2, (float)y2, 0.0F).color(r, g, b, t);
|
||||
vertexConsumer.vertex((float)x2, (float)y1, 0.0F).color(r, g, b, t);
|
||||
vertexConsumer.vertex((float)x1, (float)y1, 0.0F).color(r, g, b, t);
|
||||
context.draw();
|
||||
context.fill(widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), ColorHelper.getArgb(transparency, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package eu.midnightdust.midnightcontrols.client.gui.render;
|
||||
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.ScreenRect;
|
||||
import net.minecraft.client.gui.render.state.SimpleGuiElementRenderState;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.texture.TextureSetup;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Matrix3x2f;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public record UnalignedTexturedQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, float x1, float y1, float x2, float y2, float u1, float u2, float v1, float v2, int color, @Nullable ScreenRect scissorArea, @Nullable ScreenRect bounds) implements SimpleGuiElementRenderState {
|
||||
public UnalignedTexturedQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, float x1, float y1, float x2, float y2, float u1, float u2, float v1, float v2, int color, @Nullable ScreenRect scissorArea) {
|
||||
this(pipeline, textureSetup, pose, x1, y1, x2, y2, u1, u2, v1, v2, color, scissorArea, createBounds(x1, y1, x2, y2, pose, scissorArea));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupVertices(VertexConsumer vertices, float depth) {
|
||||
vertices.vertex(pose(), x1(), y1(), depth).texture(u1(), v1()).color(color());
|
||||
vertices.vertex(pose(), x1(), y2(), depth).texture(u1(), v2()).color(color());
|
||||
vertices.vertex(pose(), x2(), y2(), depth).texture(u2(), v2()).color(color());
|
||||
vertices.vertex(pose(), x2(), y1(), depth).texture(u2(), v1()).color(color());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ScreenRect createBounds(float x1, float y1, float x2, float y2, Matrix3x2f pose, @Nullable ScreenRect scissorArea) {
|
||||
ScreenRect screenRect = (new ScreenRect((int) x1, (int) y1, (int) (x2 - x1), (int) (y2 - y1))).transformEachVertex(pose);
|
||||
return scissorArea != null ? scissorArea.intersection(screenRect) : screenRect;
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
|
||||
@Override
|
||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"),
|
||||
this.getX() + this.width / 2, this.getY() + 4, 16777215);
|
||||
this.getX() + this.width / 2, this.getY() + 4, 0xFFFFFFFF);
|
||||
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
||||
super.renderWidget(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.thinkingstudio.obsidianui.Position;
|
||||
@@ -114,7 +115,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
||||
int size = 12;
|
||||
int x = this.getX() + this.getWidth() / 2 - size / 2;
|
||||
int y = this.getY() + this.getHeight() / 2 - size / 2;
|
||||
drawContext.drawGuiTexture(RenderLayer::getGuiTextured, resetTexture, x, y, size, size);
|
||||
drawContext.drawGuiTexture(RenderPipelines.GUI_TEXTURED, resetTexture, x, y, size, size);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
@@ -247,7 +248,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
||||
int height = this.getHeight();
|
||||
//float textX = (float) (this.getX() + 70 - ControlsListWidget.this.maxTextLength);
|
||||
int textY = this.getY() + height / 2;
|
||||
context.drawText(textRenderer, this.bindingName, this.getX(), (textY - 9 / 2), 16777215, true);
|
||||
context.drawText(textRenderer, this.bindingName, this.getX(), (textY - 9 / 2), 0xFFFFFFFF, true);
|
||||
|
||||
this.resetButton.setVisible(!focused);
|
||||
this.unbindButton.setVisible(focused);
|
||||
|
||||
@@ -6,23 +6,13 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(BookEditScreen.class)
|
||||
public interface BookEditScreenAccessor {
|
||||
@Accessor("signing")
|
||||
boolean midnightcontrols$isSigning();
|
||||
@Accessor("pages")
|
||||
List<String> midnightcontrols$getPages();
|
||||
|
||||
@Accessor("title")
|
||||
String midnightcontrols$getTitle();
|
||||
|
||||
@Accessor("title")
|
||||
void midnightcontrols$setTitle(String title);
|
||||
|
||||
@Accessor("currentPageSelectionManager")
|
||||
SelectionManager midnightcontrols$getCurrentPageSelectionManager();
|
||||
|
||||
@Invoker("getCurrentPageContent")
|
||||
String midnightcontrols$getCurrentPageContent();
|
||||
|
||||
@Invoker("setPageContent")
|
||||
void midnightcontrols$setPageContent(String newContent);
|
||||
@Accessor("currentPage")
|
||||
int midnightcontrols$getCurrentPage();
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ public abstract class ChatScreenMixin extends Screen {
|
||||
}
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void midnightcontrols$moveInputFieldBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, -this.height + 16, 0f);
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, -this.height + 16);
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.BEFORE))
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V", shift = At.Shift.AFTER))
|
||||
private void midnightcontrols$dontMoveOtherStuff(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, this.height - 16, 0f);
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, this.height - 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.gui.render.state.GuiRenderState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(DrawContext.class)
|
||||
public interface DrawContextAccessor {
|
||||
@Accessor("vertexConsumers")
|
||||
VertexConsumerProvider.Immediate getVertexConsumers();
|
||||
@Accessor("state")
|
||||
GuiRenderState getState();
|
||||
|
||||
@Accessor("scissorStack")
|
||||
DrawContext.ScissorStack getScissorStack();
|
||||
}
|
||||
|
||||
@@ -37,16 +37,16 @@ public abstract class GameRendererMixin {
|
||||
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
||||
MidnightControlsClient.input.onPreRenderScreen(this.client.currentScreen);
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;draw()V", shift = At.Shift.BEFORE))
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER))
|
||||
private void midnightcontrols$renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
||||
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
||||
if (MidnightControlsClient.isWayland) MidnightControlsRenderer.renderWaylandCursor(drawContext, client);
|
||||
drawContext.draw();
|
||||
//drawContext.draw();
|
||||
}
|
||||
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
|
||||
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrices) {
|
||||
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(FZLorg/joml/Matrix4f;)V"), method = "renderWorld")
|
||||
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f projectionMatrix, @Local(ordinal = 2) Matrix4f worldSpaceMatrix) {
|
||||
TouchUtils.lastProjMat.set(projectionMatrix);
|
||||
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
||||
TouchUtils.lastWorldSpaceMatrix.set(matrices);
|
||||
TouchUtils.lastWorldSpaceMatrix.set(worldSpaceMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,8 @@
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||
import eu.midnightdust.midnightcontrols.client.util.storage.AxisStorage;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@@ -36,10 +34,8 @@ import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.texture.MissingSprite;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -94,7 +90,7 @@ public class TouchscreenOverlay extends Screen {
|
||||
assert this.client != null;
|
||||
this.client.setScreen(new GameMenuScreen(true));
|
||||
if (this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote()) {
|
||||
this.client.getSoundManager().pauseAll();
|
||||
this.client.getSoundManager().pauseAllExcept();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,19 +17,20 @@ public class BookEditScreenClickHandler extends AbstractScreenClickHandler<BookE
|
||||
var accessor = (BookEditScreenAccessor) screen;
|
||||
|
||||
VirtualKeyboardScreen virtualKeyboardScreen;
|
||||
if(accessor.midnightcontrols$isSigning()) {
|
||||
virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getTitle(), (text) -> {
|
||||
// if(accessor.midnightcontrols$isSigning()) {
|
||||
// virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getTitle(), (text) -> {
|
||||
// client.setScreen(screen);
|
||||
// accessor.midnightcontrols$setTitle(text);
|
||||
// }, true);
|
||||
// }
|
||||
// else {
|
||||
virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getPages().get(accessor.midnightcontrols$getCurrentPage()), (text) -> {
|
||||
client.setScreen(screen);
|
||||
accessor.midnightcontrols$setTitle(text);
|
||||
accessor.midnightcontrols$getPages().add(accessor.midnightcontrols$getCurrentPage(), text);
|
||||
accessor.midnightcontrols$getPages().remove(accessor.midnightcontrols$getCurrentPage()+1);
|
||||
//accessor.midnightcontrols$getCurrentPageSelectionManager().putCursorAtEnd();
|
||||
}, true);
|
||||
}
|
||||
else {
|
||||
virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getCurrentPageContent(), (text) -> {
|
||||
client.setScreen(screen);
|
||||
accessor.midnightcontrols$setPageContent(text);
|
||||
accessor.midnightcontrols$getCurrentPageSelectionManager().putCursorAtEnd();
|
||||
}, true);
|
||||
}
|
||||
//}
|
||||
|
||||
client.setScreen(virtualKeyboardScreen);
|
||||
}
|
||||
|
||||
@@ -74,12 +74,6 @@ public class VirtualKeyboardScreen extends SpruceScreen {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(drawContext, mouseX, mouseY, delta);
|
||||
super.render(drawContext, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPause() {
|
||||
return false;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
accessWidener v1 named
|
||||
|
||||
#accessible class net/minecraft/client/gui/widget/EntryListWidget$MoveDirection
|
||||
accessible class net/minecraft/client/gui/DrawContext$ScissorStack
|
||||
@@ -2,9 +2,9 @@
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx2048M
|
||||
|
||||
minecraft_version=1.21.5
|
||||
minecraft_version=1.21.6
|
||||
supported_versions=
|
||||
yarn_mappings=1.21.5+build.1
|
||||
yarn_mappings=1.21.6+build.1
|
||||
enabled_platforms=fabric,neoforge
|
||||
|
||||
archives_base_name=midnightcontrols
|
||||
@@ -15,12 +15,12 @@ modrinth_id = bXX9h73M
|
||||
curseforge_id = 621768
|
||||
# Configure the IDs here after creating the projects on the websites
|
||||
|
||||
midnightlib_version=1.7.3+1.21.4
|
||||
midnightlib_version=1.7.4+1.21.6
|
||||
|
||||
fabric_loader_version=0.16.10
|
||||
fabric_api_version=0.119.5+1.21.5
|
||||
fabric_loader_version=0.16.14
|
||||
fabric_api_version=0.127.0+1.21.6
|
||||
|
||||
neoforge_version=21.5.2-beta
|
||||
neoforge_version=21.6.0-beta
|
||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||
|
||||
quilt_loader_version=0.19.0-beta.18
|
||||
|
||||
Reference in New Issue
Block a user