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'
modCompileOnlyApi "com.terraformersmc:modmenu:${project.modmenu_version}"
modCompileOnlyApi ("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
// Compatibility mods
@@ -110,13 +112,17 @@ dependencies {
// modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_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"
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
modImplementation "maven.modrinth:emi:${project.emi_version}"
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_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:bedrockify:${project.bedrockify_version}"
// Required for Inventory Tabs

View File

@@ -3,30 +3,30 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.12
# Mod Properties
mod_version = 1.7.3
mod_version = 1.7.4
maven_group = eu.midnightdust
archives_base_name = midnightcontrols
modrinth_id=bXX9h73M
# Dependencies
# 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
spruceui_version=4.1.0+1.19.3
midnightlib_version=1.1.0-fabric
spruceui_version=4.0.0+1.19
midnightlib_version=1.0.0-fabric
modmenu_version=5.0.1
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
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
inventorytabs_version=inventorytabs-0.9.beta-1.19.x
clothconfig_version=7.0.72
yacl_version=2.2.0
yacl_version=1.7.1
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.

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.util.HandledScreenAccessor;
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.minecraft.client.MinecraftClient;
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.util.ScreenshotRecorder;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.math.MathHelper;
@@ -63,13 +58,6 @@ import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
public class 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) {
return (client, button, value, action) -> {
@@ -96,31 +84,13 @@ public class InputHandlers {
} else if (client.currentScreen instanceof RingScreen) {
MidnightControlsClient.get().ring.cyclePage(next);
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
ItemGroup currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
int currentColumn = currentTab.getColumn();
ItemGroup.Row currentRow = currentTab.getRow();
ItemGroup newTab = null;
List<ItemGroup> visibleTabs = getVisibleGroups((CreativeInventoryScreen) client.currentScreen);
for (ItemGroup tab : visibleTabs) {
if (tab.getRow().equals(currentRow) && ((newTab == null && ((next && tab.getColumn() > currentColumn) ||
(!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);
int currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
int nextTab = currentTab + (next ? 1 : -1);
if (nextTab < 0)
nextTab = ItemGroup.GROUPS.length - 1;
else if (nextTab >= ItemGroup.GROUPS.length)
nextTab = 0;
inventory.midnightcontrols$setSelectedTab(ItemGroup.GROUPS[nextTab]);
return true;
} else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) {
RecipeBookWidget recipeBook;

View File

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

View File

@@ -36,8 +36,8 @@ public class RingScreen extends Screen {
protected void init() {
super.init();
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(ButtonWidget.builder(Text.of(""), button -> this.mod.ring.cyclePage(true)).dimensions(width - 25, 5, 20, 20).build());
this.addDrawableChild(new ButtonWidget(5, 5, 20, 20, Text.of(""), button -> this.mod.ring.cyclePage(false)));
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")
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))
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 {
private boolean midnightcontrols$driftingPrevented = false;
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
super(world, profile);
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, @Nullable PlayerPublicKey publicKey) {
super(world, profile, publicKey);
}
@Shadow

View File

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

View File

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

View File

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