Compare commits

..

4 Commits
v1.7.3 ... 1.19

Author SHA1 Message Date
Motschen
3863c45f26 Bump version & require Fabric API 0.71+ 2023-01-05 18:14:55 +01:00
Motschen
0036baee3e Fix #158 (I hate gradle...) 2023-01-05 18:05:19 +01:00
Motschen
5323b72268 Undo 1.19.3 related changes for 1.19.2 version 2023-01-03 19:35:48 +01:00
Martin Prokoph
fdb1024ee3 Merge pull request #156 from TeamMidnightDust/1.19.3
Backport 1.7.3 to 1.19.2
2023-01-03 17:49:54 +00:00
10 changed files with 38 additions and 63 deletions

View File

@@ -102,7 +102,9 @@ dependencies {
} }
include 'org.aperlambda:lambdajcommon:1.8.1' include 'org.aperlambda:lambdajcommon:1.8.1'
modCompileOnlyApi "com.terraformersmc:modmenu:${project.modmenu_version}" modCompileOnlyApi ("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
// Compatibility mods // Compatibility mods
@@ -110,13 +112,17 @@ dependencies {
// modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_version}") // modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_version}")
// modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}" // modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}"
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}" modCompileOnlyApi ("io.github.cottonmc:LibGui:${project.libgui_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
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}" modImplementation "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}" modImplementation ("dev.isxander:yet-another-config-lib:${project.yacl_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
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

View File

@@ -3,30 +3,30 @@ 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=1.19.2
yarn_mappings=1.19.3+build.5 yarn_mappings=1.19.2+build.28
loader_version=0.14.12 loader_version=0.14.12
# Mod Properties # Mod Properties
mod_version = 1.7.3 mod_version = 1.7.4
maven_group = eu.midnightdust maven_group = eu.midnightdust
archives_base_name = midnightcontrols archives_base_name = midnightcontrols
modrinth_id=bXX9h73M 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.72.0+1.19.2
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.0.0+1.19
midnightlib_version=1.1.0-fabric midnightlib_version=1.0.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
bendylib_version=2.0.+ bendylib_version=2.0.+
emi_version=0.5.0+1.19.3 emi_version=0.5.3+1.19.2
libgui_version=6.0.0+1.19 libgui_version=6.0.0+1.19
inventorytabs_version=inventorytabs-0.9.beta-1.19.x inventorytabs_version=inventorytabs-0.9.beta-1.19.x
clothconfig_version=7.0.72 clothconfig_version=7.0.72
yacl_version=2.2.0 yacl_version=1.7.1
bedrockify_version=1.5+mc1.19.1-2 bedrockify_version=1.5+mc1.19.1-2
# Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions. # Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.

View File

@@ -23,10 +23,6 @@ import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAcce
import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor; import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor;
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor; import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
import eu.midnightdust.midnightcontrols.client.util.MouseAccessor; import eu.midnightdust.midnightcontrols.client.util.MouseAccessor;
import net.fabricmc.fabric.impl.client.itemgroup.CreativeGuiExtensions;
import net.fabricmc.fabric.impl.client.itemgroup.FabricCreativeGuiComponents;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroup;
import net.fabricmc.fabric.impl.itemgroup.ItemGroupHelper;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.TitleScreen;
@@ -36,7 +32,6 @@ import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.gui.widget.PressableWidget; import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.client.util.ScreenshotRecorder; import net.minecraft.client.util.ScreenshotRecorder;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType; import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@@ -63,13 +58,6 @@ import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
public class InputHandlers { public class InputHandlers {
private InputHandlers() { private InputHandlers() {
} }
private static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
return ItemGroupHelper.sortedGroups.stream()
.filter(itemGroup -> {
if (FabricCreativeGuiComponents.COMMON_GROUPS.contains(itemGroup)) return true;
return ((CreativeGuiExtensions)screen).fabric_currentPage() == ((FabricItemGroup)itemGroup).getPage() && itemGroup.shouldDisplay() && (!itemGroup.equals(ItemGroups.OPERATOR) || ItemGroups.operatorEnabled);
}).toList();
}
public static PressAction handleHotbar(boolean next) { public static PressAction handleHotbar(boolean next) {
return (client, button, value, action) -> { return (client, button, value, action) -> {
@@ -96,31 +84,13 @@ public class InputHandlers {
} else if (client.currentScreen instanceof RingScreen) { } else if (client.currentScreen instanceof RingScreen) {
MidnightControlsClient.get().ring.cyclePage(next); MidnightControlsClient.get().ring.cyclePage(next);
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) { } else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
ItemGroup currentTab = CreativeInventoryScreenAccessor.getSelectedTab(); int currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
int currentColumn = currentTab.getColumn(); int nextTab = currentTab + (next ? 1 : -1);
ItemGroup.Row currentRow = currentTab.getRow(); if (nextTab < 0)
ItemGroup newTab = null; nextTab = ItemGroup.GROUPS.length - 1;
List<ItemGroup> visibleTabs = getVisibleGroups((CreativeInventoryScreen) client.currentScreen); else if (nextTab >= ItemGroup.GROUPS.length)
for (ItemGroup tab : visibleTabs) { nextTab = 0;
if (tab.getRow().equals(currentRow) && ((newTab == null && ((next && tab.getColumn() > currentColumn) || inventory.midnightcontrols$setSelectedTab(ItemGroup.GROUPS[nextTab]);
(!next && tab.getColumn() < currentColumn))) || (newTab != null && ((next && tab.getColumn() > currentColumn && tab.getColumn() < newTab.getColumn()) ||
(!next && tab.getColumn() < currentColumn && tab.getColumn() > newTab.getColumn())))))
newTab = tab;
}
if (newTab == null)
for (ItemGroup tab : visibleTabs) {
if ((tab.getRow().compareTo(currentRow)) != 0 && ((next && newTab == null || next && newTab.getColumn() > tab.getColumn()) || (!next && newTab == null) || (!next && newTab.getColumn() < tab.getColumn())))
newTab = tab;
}
if (newTab == null) {
for (ItemGroup tab : visibleTabs) {
if ((next && tab.getRow() == ItemGroup.Row.TOP && tab.getColumn() == 0) ||
!next && tab.getRow() == ItemGroup.Row.BOTTOM && (newTab == null || tab.getColumn() > newTab.getColumn()))
newTab = tab;
}
}
if (newTab == null || newTab.equals(currentTab)) newTab = ItemGroups.getDefaultTab();
inventory.midnightcontrols$setSelectedTab(newTab);
return true; return true;
} else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) { } else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) {
RecipeBookWidget recipeBook; RecipeBookWidget recipeBook;

View File

@@ -38,7 +38,7 @@ import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import org.joml.Matrix4f; import net.minecraft.util.math.Matrix4f;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.awt.*; import java.awt.*;
@@ -299,8 +299,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
this.buildTabs(); this.buildTabs();
this.addDrawableChild(this.resetOption.createWidget(Position.of(this.width / 2 - 155, this.height - 29), 150)); this.addDrawableChild(this.resetOption.createWidget(Position.of(this.width / 2 - 155, this.height - 29), 150));
this.addDrawableChild(ButtonWidget.builder(SpruceTexts.GUI_DONE, btn -> this.client.setScreen(this.parent)) this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, 20, SpruceTexts.GUI_DONE, btn -> this.client.setScreen(this.parent)));
.dimensions(this.width / 2 - 155 + 160, this.height - 29, 150, 20).build());
} }
public void buildTabs() { public void buildTabs() {
@@ -449,13 +448,13 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.disableTexture(); RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorProgram); RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t).next();
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x2, (float)y2, 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)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.drawWithShader(bufferBuilder.end());
RenderSystem.enableTexture(); RenderSystem.enableTexture();
RenderSystem.disableBlend(); RenderSystem.disableBlend();
matrixStack.pop(); matrixStack.pop();

View File

@@ -36,8 +36,8 @@ public class RingScreen extends Screen {
protected void init() { protected void init() {
super.init(); super.init();
if (mod.ring.getMaxPages() > 1) { if (mod.ring.getMaxPages() > 1) {
this.addDrawableChild(ButtonWidget.builder(Text.of(""), button -> this.mod.ring.cyclePage(false)).dimensions(5, 5, 20, 20).build()); this.addDrawableChild(new ButtonWidget(5, 5, 20, 20, Text.of(""), button -> this.mod.ring.cyclePage(false)));
this.addDrawableChild(ButtonWidget.builder(Text.of(""), button -> this.mod.ring.cyclePage(true)).dimensions(width - 25, 5, 20, 20).build()); this.addDrawableChild(new ButtonWidget(width - 25, 5, 20, 20, Text.of(""), button -> this.mod.ring.cyclePage(true)));
} }
} }

View File

@@ -22,7 +22,7 @@ public abstract class ChatScreenMixin extends Screen {
@Inject(at = @At("TAIL"), method = "init") @Inject(at = @At("TAIL"), method = "init")
private void midnightcontrols$moveInputField(CallbackInfo ci) { private void midnightcontrols$moveInputField(CallbackInfo ci) {
if (MidnightControlsConfig.moveChat) chatField.setY(4); if (MidnightControlsConfig.moveChat) chatField.y = 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(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setTextFieldFocused(Z)V", shift = At.Shift.AFTER))
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) {

View File

@@ -38,8 +38,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity { public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
private boolean midnightcontrols$driftingPrevented = false; private boolean midnightcontrols$driftingPrevented = false;
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) { public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, @Nullable PlayerPublicKey publicKey) {
super(world, profile); super(world, profile, publicKey);
} }
@Shadow @Shadow

View File

@@ -11,7 +11,6 @@ package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -30,8 +29,8 @@ public interface CreativeInventoryScreenAccessor {
* @return the selected tab index * @return the selected tab index
*/ */
@Accessor("selectedTab") @Accessor("selectedTab")
static ItemGroup getSelectedTab() { static int getSelectedTab() {
return ItemGroups.getDefaultTab(); return 0;
} }
/** /**

View File

@@ -22,8 +22,8 @@ import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;

View File

@@ -53,7 +53,7 @@
"depends": { "depends": {
"fabricloader": ">=0.11.3", "fabricloader": ">=0.11.3",
"fabric": ">=0.71.0", "fabric": ">=0.71.0",
"minecraft": "~1.19.3", "minecraft": "<1.19.3",
"spruceui": ">=3.2.0", "spruceui": ">=3.2.0",
"java": ">=17" "java": ">=17"
}, },
@@ -64,6 +64,7 @@
"kontrolo": "*" "kontrolo": "*"
}, },
"breaks": { "breaks": {
"emi": "<0.5.0",
"lambdacontrols": "*", "lambdacontrols": "*",
"modmenu": "<1.12.2" "modmenu": "<1.12.2"
} }