This commit is contained in:
2025-12-11 21:25:05 +01:00
parent a2860b1e8c
commit 973915db19
6 changed files with 9 additions and 145 deletions

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.11-SNAPSHOT' id 'fabric-loom' version "${loom_version}"
id 'maven-publish' id 'maven-publish'
} }
@@ -10,21 +10,10 @@ base {
archivesName = project.archives_base_name archivesName = project.archives_base_name
} }
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
dependencies { dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
} }
@@ -43,10 +32,6 @@ processResources {
def targetJavaVersion = 21 def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion) it.options.release.set(targetJavaVersion)
@@ -58,32 +43,5 @@ java {
if (JavaVersion.current() < javaVersion) { if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
} }
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
} }
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}

View File

@@ -2,13 +2,14 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.10 minecraft_version=1.21.11
yarn_mappings=1.21.10+build.2 yarn_mappings=1.21.11+build.2
loader_version=0.17.3 loader_version=0.18.2
loom_version=1.14-SNAPSHOT
# Mod Properties # Mod Properties
mod_version=1.6 mod_version=1.8
maven_group=com.kasetoatz maven_group=com.kasetoatz
archives_base_name=biggerhotbar archives_base_name=biggerhotbar
# Dependencies # Dependencies
# check this on https://modmuss50.me/fabric.html # check this on https://modmuss50.me/fabric.html
fabric_version=0.135.0+1.21.10 fabric_version=0.139.5+1.21.11

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,48 +0,0 @@
package com.kasetoatz.biggerhotbar.mixin;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.slot.SlotActionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.OptionalInt;
import static com.kasetoatz.biggerhotbar.Biggerhotbar.tickers;
import static com.kasetoatz.biggerhotbar.state.StateManager.isFlipped;
@Mixin(GenericContainerScreenHandler.class)
public class GenericContainerScreenHandlerMixin
{
@Inject(method="quickMove", at=@At(value="INVOKE", target="Lnet/minecraft/screen/slot/Slot;setStack(Lnet/minecraft/item/ItemStack;)V"))
public void quickMove(PlayerEntity player, int s, CallbackInfoReturnable<ItemStack> cir, @Local(ordinal = 0) ItemStack stack)
{
ClientPlayerInteractionManager manager = MinecraftClient.getInstance().interactionManager;
if (isFlipped() || manager == null || stack.isEmpty())
{
return;
}
int slot = player.getInventory().getMatchingSlot(Registries.ITEM.getEntry(stack.getItem()), stack);
if (slot < 0 || slot > 8)
{
return;
}
for (int i = 35; i > 26; i--)
{
OptionalInt index = player.currentScreenHandler.getSlotIndex(player.getInventory(), i);
if (index.isEmpty() || !player.currentScreenHandler.getSlot(index.getAsInt()).getStack().isEmpty())
{
continue;
}
tickers.add(() -> manager.clickSlot(player.currentScreenHandler.syncId, index.getAsInt(), slot, SlotActionType.SWAP, player));
break;
}
}
}

View File

@@ -1,45 +0,0 @@
package com.kasetoatz.biggerhotbar.mixin;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static com.kasetoatz.biggerhotbar.state.StateManager.isFlipped;
@Mixin(ScreenHandler.class)
public abstract class ScreenHandlerMixin
{
@Shadow public abstract Slot getSlot(int index);
@Inject(method="setStackInSlot", at=@At("HEAD"))
public void setStackInSlot(int slot, int revision, ItemStack stack, CallbackInfo ci)
{
if ((slot > 8 && slot < 27) || (isFlipped() && slot > 35 && slot < 45) && getSlot(slot).getStack().isEmpty())
{
for (int i = 27; i < 36; i++)
{
if (getSlot(i).getStack().isEmpty())
{
ClientPlayerEntity player = MinecraftClient.getInstance().player;
ClientPlayerInteractionManager manager = MinecraftClient.getInstance().interactionManager;
if (player == null || manager == null)
{
return;
}
manager.clickSlot(player.playerScreenHandler.syncId, slot, 0, SlotActionType.PICKUP, player);
manager.clickSlot(player.playerScreenHandler.syncId, i, 0, SlotActionType.PICKUP, player);
return;
}
}
}
}
}

View File

@@ -8,9 +8,7 @@
"InGameHudMixin", "InGameHudMixin",
"MinecraftClientMixin", "MinecraftClientMixin",
"MouseMixin", "MouseMixin",
"ScreenHandlerMixin", "SlotMixin"
"SlotMixin",
"GenericContainerScreenHandlerMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1