Skip to content

Commit

Permalink
feat: config to disable swapping items with sneak
Browse files Browse the repository at this point in the history
fix #40
  • Loading branch information
Jamalam360 committed Apr 14, 2024
1 parent f1ac99d commit a42633c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
7 changes: 2 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
- Fix item rendering in hotbar being 1 pixel to the left
- When moving to or from the belt where there is an empty slot to place the item you are moving, you will now move to that empty slot.
- New config option to move the location of the hotbar.

## **WARNING**: Utility Belt 2.0.0 is currently in a **BETA STATE**: backup your worlds and tread with caution! Please report any issues.
- Add an option, `useSneakSwapping`, to disable the sneak-to-swap-items behavior (#40).
- Release as non-beta version.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

</div>

### **WARNING**: Utility Belt is currently in a **BETA STATE**: backup your worlds and tread with caution! Please report any issues at the link above :)

## How to Use

<div align="center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class Config {
public boolean displayUtilityBeltWhenNotSelected = true;
public boolean invertScrolling = false;
public boolean useSneakSwapping = true;
public HotbarKeyBehaviour hotbarKeyBehaviour = HotbarKeyBehaviour.SWITCH_BELT_SLOT;
public Position hotbarPosition = Position.MIDDLE_LEFT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ public static void init() {
NetworkManager.registerReceiver(NetworkManager.Side.S2C, UtilityBelt.S2C_SET_HOTBAR_SLOT, ClientNetworking::handleSetHotbarSlot);
}

public static void sendNewStateToServer(boolean inBelt, int slot, boolean swap) {
public static void sendNewStateToServer(boolean inBelt, int slot, boolean swapItems) {
// swapItems |= UtilityBelt.CONFIG.get().useSneakSwapping;

if (swapItems && !UtilityBelt.CONFIG.get().useSneakSwapping) {
swapItems = false;
}

FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
buf.writeBoolean(inBelt);
buf.writeInt(slot);
buf.writeBoolean(swap);
buf.writeBoolean(swapItems);
NetworkManager.sendToServer(UtilityBelt.C2S_UPDATE_STATE, buf);
}

Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/utility_belt/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"key.utility_belt.open_screen": "Open Utility Belt GUI",
"config.utility_belt.invertScrolling": "Invert Scrolling in Belt Hotbar",
"config.utility_belt.displayUtilityBeltWhenNotSelected": "Show Utility Belt Hotbar When Not Selected",
"config.utility_belt.useSneakSwapping": "Use Sneak to Swap Items Between Hotbars",
"config.utility_belt.useSneakSwapping.tooltip": "When enabled, you can press the sneak key while switching to the belt or hotbar to swap the items between the hotbar and the belt. Otherwise, you have to use the GUI.",
"config.utility_belt.hotbarPosition": "Hotbar Position",
"config.utility_belt.hotbarPosition.top_left": "Top Left",
"config.utility_belt.hotbarPosition.middle_left": "Middle Left",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=true

version=2.0.0-beta.2+1.20.4
version=2.0.0+1.20.4
minecraft_version=1.20.4
branch=main
group=io.github.jamalam360
Expand Down

0 comments on commit a42633c

Please sign in to comment.