mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 23:25:10 +01:00
Experimental port to 23w06a
Some stuff is still broken, but I managed to implement directional movement in screens
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.0-SNAPSHOT'
|
id 'fabric-loom' version '1.1-SNAPSHOT'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||||
@@ -78,6 +78,9 @@ repositories {
|
|||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
maven { url "https://api.modrinth.com/maven" }
|
maven { url "https://api.modrinth.com/maven" }
|
||||||
maven { url 'https://maven.quiltmc.org/repository/release'}
|
maven { url 'https://maven.quiltmc.org/repository/release'}
|
||||||
|
flatDir {
|
||||||
|
dirs "localMaven"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -113,10 +116,10 @@ dependencies {
|
|||||||
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
|
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
|
||||||
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
|
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
|
||||||
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
|
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
|
||||||
modImplementation "maven.modrinth:emi:${project.emi_version}"
|
modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
|
||||||
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
||||||
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
||||||
modImplementation "dev.isxander:yet-another-config-lib:${project.yacl_version}"
|
modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
|
||||||
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
|
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
|
||||||
modCompileOnlyApi "maven.modrinth:bedrockify:${project.bedrockify_version}"
|
modCompileOnlyApi "maven.modrinth:bedrockify:${project.bedrockify_version}"
|
||||||
// Required for Inventory Tabs
|
// Required for Inventory Tabs
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.19.3
|
minecraft_version=23w06a
|
||||||
yarn_mappings=1.19.3+build.5
|
yarn_mappings=23w06a+build.14
|
||||||
loader_version=0.14.12
|
loader_version=0.14.14
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.7.3
|
mod_version = 1.7.3
|
||||||
@@ -15,9 +15,9 @@ modrinth_id=bXX9h73M
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.71.0+1.19.3
|
fabric_version=0.74.0+1.19.4
|
||||||
sodium_version=mc1.19.2-0.4.4
|
sodium_version=mc1.19.2-0.4.4
|
||||||
spruceui_version=4.1.0+1.19.3
|
spruceui_version=4.2.0+23w06a
|
||||||
midnightlib_version=1.1.0-fabric
|
midnightlib_version=1.1.0-fabric
|
||||||
modmenu_version=5.0.1
|
modmenu_version=5.0.1
|
||||||
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
||||||
|
|||||||
BIN
localMaven/spruceui-4.2.0+23w06a.jar
Normal file
BIN
localMaven/spruceui-4.2.0+23w06a.jar
Normal file
Binary file not shown.
@@ -327,15 +327,13 @@ public class MidnightInput {
|
|||||||
&& (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|
&& (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|
||||||
|| button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) {
|
|| button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) {
|
||||||
if (this.actionGuiCooldown == 0) {
|
if (this.actionGuiCooldown == 0) {
|
||||||
if (MidnightControlsConfig.arrowScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
|
switch (button) {
|
||||||
switch (button) {
|
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_UP);
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_UP);
|
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_DOWN);
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_DOWN);
|
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> pressKeyboardKey(client, GLFW.GLFW_KEY_LEFT);
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> pressKeyboardKey(client, GLFW.GLFW_KEY_LEFT);
|
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_RIGHT);
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_RIGHT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (MidnightControlsConfig.wasdScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
|
if (MidnightControlsConfig.wasdScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_W);
|
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_W);
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_S);
|
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_S);
|
||||||
@@ -343,11 +341,11 @@ public class MidnightInput {
|
|||||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_D);
|
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP) {
|
// else if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP) {
|
||||||
this.changeFocus(client.currentScreen, NavigationDirection.UP);
|
// this.changeFocus(client.currentScreen, NavigationDirection.UP);
|
||||||
} else if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN) {
|
// } else if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN) {
|
||||||
this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
|
// this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
|
||||||
} else this.handleLeftRight(client.currentScreen, button != GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT);
|
// } else this.handleLeftRight(client.currentScreen, button != GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -426,6 +424,9 @@ public class MidnightInput {
|
|||||||
public void pressKeyboardKey(MinecraftClient client, int key) {
|
public void pressKeyboardKey(MinecraftClient client, int key) {
|
||||||
client.keyboard.onKey(client.getWindow().getHandle(), key, 0, 1, 0);
|
client.keyboard.onKey(client.getWindow().getHandle(), key, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
public void pressKeyboardKey(Screen screen, int key) {
|
||||||
|
screen.keyPressed(key, 0, 1);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -732,7 +733,7 @@ public class MidnightInput {
|
|||||||
this.actionGuiCooldown = 2; // Prevent to press too quickly the focused element, so we have to skip 5 ticks.
|
this.actionGuiCooldown = 2; // Prevent to press too quickly the focused element, so we have to skip 5 ticks.
|
||||||
return false;
|
return false;
|
||||||
} else if (element instanceof AlwaysSelectedEntryListWidget) {
|
} else if (element instanceof AlwaysSelectedEntryListWidget) {
|
||||||
((EntryListWidgetAccessor) element).midnightcontrols$moveSelection(right ? EntryListWidget.MoveDirection.DOWN : EntryListWidget.MoveDirection.UP);
|
//TODO((EntryListWidgetAccessor) element).midnightcontrols$moveSelection(right ? EntryListWidget.MoveDirection.DOWN : EntryListWidget.MoveDirection.UP);
|
||||||
return false;
|
return false;
|
||||||
} else if (element instanceof ParentElement entryList) {
|
} else if (element instanceof ParentElement entryList) {
|
||||||
var focused = entryList.getFocused();
|
var focused = entryList.getFocused();
|
||||||
@@ -783,76 +784,13 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
if (FabricLoader.getInstance().isModLoaded("sodium"))
|
if (FabricLoader.getInstance().isModLoaded("sodium"))
|
||||||
SodiumCompat.handleInput(screen, direction.isLookingForward());
|
SodiumCompat.handleInput(screen, direction.isLookingForward());
|
||||||
// This still needs some work
|
else {
|
||||||
// ScreenAccessor accessor = (ScreenAccessor) screen;
|
switch (direction) {
|
||||||
// if (accessor.getSelected() != null && accessor.getSelected() instanceof ClickableWidget selected && accessor.getSelectables() != null) {
|
case UP -> pressKeyboardKey(screen, GLFW.GLFW_KEY_UP);
|
||||||
// //System.out.println(direction);
|
case DOWN -> pressKeyboardKey(screen, GLFW.GLFW_KEY_DOWN);
|
||||||
// if (accessor.getSelectables().size() >= 2) {
|
case LEFT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_LEFT);
|
||||||
// //System.out.println(direction + " 2");
|
case RIGHT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_RIGHT);
|
||||||
// int xDifference = Integer.MAX_VALUE;
|
|
||||||
// int yDifference = Integer.MAX_VALUE;
|
|
||||||
// ClickableWidget newWidget = null;
|
|
||||||
// for (int i = 0; i < accessor.getSelectables().size(); ++i) {
|
|
||||||
// if (accessor.getSelectables().get(i) instanceof ClickableWidget candidate) {
|
|
||||||
// if (!(candidate.x == selected.x && candidate.y == selected.y)) {
|
|
||||||
// int canXDifference = Math.abs(candidate.x - selected.x);
|
|
||||||
// int canYDifference = Math.abs(candidate.y - selected.y);
|
|
||||||
// if (direction.isHorizontal()) {
|
|
||||||
// if (direction.isLookingForward()) {
|
|
||||||
// if (candidate.x >= selected.x && canYDifference <= yDifference && canXDifference <= xDifference) {
|
|
||||||
// System.out.println(direction + " forward horizontal " + candidate);
|
|
||||||
// newWidget = candidate;
|
|
||||||
// xDifference = canXDifference;
|
|
||||||
// yDifference = canYDifference;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (candidate.x <= selected.x && canYDifference <= yDifference && canXDifference >= xDifference) {
|
|
||||||
// System.out.println(direction + " backward horizontal " + candidate);
|
|
||||||
// newWidget = candidate;
|
|
||||||
// xDifference = canXDifference;
|
|
||||||
// yDifference = canYDifference;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (direction.isLookingForward()) {
|
|
||||||
// if (candidate.y >= selected.y && canYDifference <= yDifference && canXDifference <= xDifference) {
|
|
||||||
// System.out.println(direction + " forward vertical " + candidate);
|
|
||||||
// newWidget = candidate;
|
|
||||||
// xDifference = canXDifference;
|
|
||||||
// yDifference = canYDifference;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (candidate.y <= selected.y && canYDifference >= yDifference && canXDifference <= xDifference) {
|
|
||||||
// System.out.println(direction + " backward vertical " + candidate);
|
|
||||||
// newWidget = candidate;
|
|
||||||
// xDifference = canXDifference;
|
|
||||||
// yDifference = canYDifference;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (newWidget != null) {
|
|
||||||
// //selected.changeFocus(true);
|
|
||||||
// ((ClickableWidgetAccessor) selected).setFocused(false);
|
|
||||||
// ((ClickableWidgetAccessor) newWidget).setFocused(true);
|
|
||||||
// screen.setFocused(newWidget);
|
|
||||||
// screen.changeFocus(false);
|
|
||||||
// screen.changeFocus(true);
|
|
||||||
// this.actionGuiCooldown = 5;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (!screen.changeFocus(direction.isLookingForward())) {
|
|
||||||
if (screen.changeFocus(direction.isLookingForward())) {
|
|
||||||
this.actionGuiCooldown = 5;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.actionGuiCooldown = 5;
|
this.actionGuiCooldown = 5;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class InputHandlers {
|
|||||||
return ItemGroupHelper.sortedGroups.stream()
|
return ItemGroupHelper.sortedGroups.stream()
|
||||||
.filter(itemGroup -> {
|
.filter(itemGroup -> {
|
||||||
if (FabricCreativeGuiComponents.COMMON_GROUPS.contains(itemGroup)) return true;
|
if (FabricCreativeGuiComponents.COMMON_GROUPS.contains(itemGroup)) return true;
|
||||||
return ((CreativeGuiExtensions)screen).fabric_currentPage() == ((FabricItemGroup)itemGroup).getPage() && itemGroup.shouldDisplay() && (!itemGroup.equals(ItemGroups.OPERATOR) || ItemGroups.operatorEnabled);
|
return ((CreativeGuiExtensions)screen).fabric_currentPage() == ((FabricItemGroup)itemGroup).getPage() && itemGroup.shouldDisplay();
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
drawCenteredText(matrices, this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215);
|
drawCenteredTextWithShadow(matrices, this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MidnightControlsBackground implements Background {
|
public static class MidnightControlsBackground implements Background {
|
||||||
@@ -447,7 +447,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
float t = (float)(transparency) / 255.0F;
|
float t = (float)(transparency) / 255.0F;
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
//RenderSystem.enableColorLogicOp();//.disableTexture();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
||||||
@@ -456,7 +456,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||||
RenderSystem.enableTexture();
|
//RenderSystem.enableColorLogicOp();//enableTexture
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,18 +65,18 @@ public class RingScreen extends Screen {
|
|||||||
RingPage.selected = -1;
|
RingPage.selected = -1;
|
||||||
this.removed();
|
this.removed();
|
||||||
}
|
}
|
||||||
@Override
|
// @Override
|
||||||
public boolean changeFocus(boolean lookForwards) {
|
// public boolean changeFocus(boolean lookForwards) {
|
||||||
if (lookForwards) {
|
// if (lookForwards) {
|
||||||
if (RingPage.selected < 7) ++RingPage.selected;
|
// if (RingPage.selected < 7) ++RingPage.selected;
|
||||||
else RingPage.selected = -1;
|
// else RingPage.selected = -1;
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
if (RingPage.selected > -1) --RingPage.selected;
|
// if (RingPage.selected > -1) --RingPage.selected;
|
||||||
else RingPage.selected = 7;
|
// else RingPage.selected = 7;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
drawCenteredText(matrices, this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"),
|
drawCenteredTextWithShadow(matrices, 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, 16777215);
|
||||||
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
||||||
super.renderWidget(matrices, mouseX, mouseY, delta);
|
super.renderWidget(matrices, mouseX, mouseY, delta);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public abstract class ChatScreenMixin extends Screen {
|
|||||||
private void midnightcontrols$moveInputField(CallbackInfo ci) {
|
private void midnightcontrols$moveInputField(CallbackInfo ci) {
|
||||||
if (MidnightControlsConfig.moveChat) chatField.setY(4);
|
if (MidnightControlsConfig.moveChat) chatField.setY(4);
|
||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setTextFieldFocused(Z)V", shift = At.Shift.AFTER))
|
@Inject(method = "render", at = @At("HEAD"))
|
||||||
private void midnightcontrols$moveInputFieldBackground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
private void midnightcontrols$moveInputFieldBackground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (MidnightControlsConfig.moveChat) matrices.translate(0f, -this.height + 16, 0f);
|
if (MidnightControlsConfig.moveChat) matrices.translate(0f, -this.height + 16, 0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,13 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.navigation.NavigationDirection;
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
@Mixin(EntryListWidget.class)
|
@Mixin(EntryListWidget.class)
|
||||||
public interface EntryListWidgetAccessor {
|
public interface EntryListWidgetAccessor {
|
||||||
@Invoker("moveSelection")
|
//@Invoker("getNeighbouringEntry")
|
||||||
void midnightcontrols$moveSelection(EntryListWidget.MoveDirection direction);
|
//void midnightcontrols$getNeighbouringEntry(NavigationDirection direction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ public final class MidnightRing {
|
|||||||
for (String binding : configBindings) {
|
for (String binding : configBindings) {
|
||||||
ButtonBinding buttonBinding = InputManager.getBinding(binding);
|
ButtonBinding buttonBinding = InputManager.getBinding(binding);
|
||||||
if (buttonBinding != null) {
|
if (buttonBinding != null) {
|
||||||
RingPage page = this.pages.get(MathHelper.fastFloor(bindingIndex / 8f));
|
RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
|
||||||
page.actions[bindingIndex - 8 * (MathHelper.fastFloor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
||||||
++bindingIndex;
|
++bindingIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,8 +88,8 @@ public final class MidnightRing {
|
|||||||
|
|
||||||
for (ButtonBinding buttonBinding : unboundBindings) {
|
for (ButtonBinding buttonBinding : unboundBindings) {
|
||||||
if (buttonBinding != null) {
|
if (buttonBinding != null) {
|
||||||
RingPage page = this.pages.get(MathHelper.fastFloor(bindingIndex / 8f));
|
RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
|
||||||
page.actions[bindingIndex - 8 * (MathHelper.fastFloor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
||||||
++bindingIndex;
|
++bindingIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class RingPage extends DrawableHelper {
|
|||||||
public void render(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int width, int height, int mouseX, int mouseY, float tickDelta) {
|
public void render(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int width, int height, int mouseX, int mouseY, float tickDelta) {
|
||||||
int centerX = width / 2;
|
int centerX = width / 2;
|
||||||
int centerY = height / 2;
|
int centerY = height / 2;
|
||||||
if (MidnightControlsClient.get().ring.getMaxPages() > 1) drawCenteredText(matrices, textRenderer, name, centerX, 5, 0xffffff);
|
if (MidnightControlsClient.get().ring.getMaxPages() > 1) drawCenteredTextWithShadow(matrices, textRenderer, name, centerX, 5, 0xffffff);
|
||||||
|
|
||||||
int offset = MidnightRing.ELEMENT_SIZE + (MidnightRing.ELEMENT_SIZE / 2) + 5;
|
int offset = MidnightRing.ELEMENT_SIZE + (MidnightRing.ELEMENT_SIZE / 2) + 5;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user