Compare commits
14 Commits
v0.1.1
...
v0.1.2_1.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a2c9a3a000 | ||
![]() |
116b98edf0 | ||
![]() |
f7d3b293e7 | ||
![]() |
e402bd0749 | ||
![]() |
11dd1cf701 | ||
![]() |
1d18ffbe27 | ||
![]() |
d7e5e2846f | ||
![]() |
e9bc7e34d5 | ||
![]() |
f6257060f0 | ||
![]() |
818c061195 | ||
![]() |
8a55f94d37 | ||
![]() |
533dc47607 | ||
![]() |
d119e650e1 | ||
![]() |
bad438ad38 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -3,9 +3,16 @@
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build/
|
||||
bin/
|
||||
|
||||
# Ignore run directory
|
||||
run/
|
||||
|
||||
# IntelliJ IDEA
|
||||
.idea/
|
||||
|
||||
# Gradle wrapper binaries
|
||||
gradle/wrapper/
|
||||
|
||||
# Remapped source file directory
|
||||
remappedSrc/
|
||||
|
30
LICENSE
30
LICENSE
@@ -1,15 +1,21 @@
|
||||
HotbarReplace Minecraft Mod
|
||||
Copyright (C) 2023 Adam Macdonald
|
||||
MIT License
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
Copyright (c) 2023 Adam Macdonald
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
@@ -4,5 +4,4 @@ HotbarReplace is a Minecraft mod for the Fabric modding framework which replaces
|
||||
|
||||
### Known issues/Improvements
|
||||
|
||||
* The mod won't refill your hotbar slot with other stacks in other hotbar slots
|
||||
* Make the mod more resilient to network delay and packet loss (don't hardcode a 50 ms delay)
|
||||
|
@@ -6,14 +6,14 @@ org.gradle.parallel=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.5
|
||||
loader_version=0.14.17
|
||||
minecraft_version=1.20.2
|
||||
yarn_mappings=1.20.2+build.4
|
||||
loader_version=0.14.24
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 0.1.1
|
||||
mod_version = 0.1.2
|
||||
maven_group = io.github.twokilohertz.hotbarreplace
|
||||
archives_base_name = HotbarReplace
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.76.0+1.19.3
|
||||
fabric_version=0.90.4+1.20.2
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
12
gradlew
vendored
12
gradlew
vendored
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -133,11 +130,14 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
@@ -6,7 +6,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.slf4j.Logger;
|
||||
@@ -23,7 +22,7 @@ public class HotbarReplace implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
LOGGER.info("HotbarReplace v0.1.1 initialised");
|
||||
LOGGER.info("HotbarReplace v0.1.2 initialised");
|
||||
}
|
||||
|
||||
public static void tryReplaceSlot(ItemPlacementContext context, Item item) {
|
||||
@@ -41,19 +40,18 @@ public class HotbarReplace implements ModInitializer {
|
||||
// Return if the inventory is empty
|
||||
if (inventory.isEmpty()) return;
|
||||
|
||||
// Attempt to find a stack of matching items
|
||||
for (int i = 0; i < inventory.main.size(); i++) {
|
||||
if (i == inventory.selectedSlot) continue;
|
||||
// If current screen handler is null, return
|
||||
if (player.currentScreenHandler == null) return;
|
||||
|
||||
ItemStack stack = inventory.main.get(i);
|
||||
|
||||
if (stack.isOf(item)) {
|
||||
// Attempt to find a stack of matching items in the player's inventory
|
||||
for (int i = 0; i < player.currentScreenHandler.slots.size(); i++) {
|
||||
if (player.currentScreenHandler.slots.get(i).getStack().isOf(item)) {
|
||||
// Simulate moving the stack from one slot to another
|
||||
if (client != null) {
|
||||
client.interactionManager.clickSlot(player.currentScreenHandler.syncId, i, GLFW.GLFW_MOUSE_BUTTON_1, SlotActionType.PICKUP, player);
|
||||
|
||||
/*
|
||||
Wait 50 seconds (on another thread) before attempting to move the new stack
|
||||
Wait 50 milliseconds (on another thread) before attempting to move the new stack
|
||||
PlayerInventory.MAIN_SIZE added to the selected slot (hotbar slot) is the correct slot ID
|
||||
*/
|
||||
scheduler.schedule(() -> {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -14,7 +14,7 @@
|
||||
"issues": "https://github.com/twokilohertz/HotbarReplace/issues"
|
||||
},
|
||||
|
||||
"license": "GPLv3",
|
||||
"license": "MIT",
|
||||
"icon": "assets/hotbarreplace/icon.png",
|
||||
|
||||
"environment": "*",
|
||||
@@ -28,9 +28,9 @@
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.17",
|
||||
"fabricloader": ">=0.14.21",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "~1.19.3",
|
||||
"minecraft": "~1.20",
|
||||
"java": ">=17"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user