Skip to content

Commit

Permalink
Add delay to sword
Browse files Browse the repository at this point in the history
  • Loading branch information
LZDQ committed Mar 31, 2024
1 parent 786632a commit 6867f8a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is a bedwars assistant developed by LZDQ. Currently it requires Minecraft 1

## Usage

**If you don't want to read the long passage, wait for me to release a tutorial video**
This mod will probably only be used by myself lol, so no video tutorial

#### bridge methods

Expand All @@ -44,7 +44,7 @@ Please do not use godbridge cause I can't reproduce it legitmately. My godbridge

#### spam clicking

For swords, I strongly suggest binding your hotbar switch button of `1` to your mouse side button (Button 4). When holding down your side button, you start spam clicking your left mouse button every random 30~50 ms. So you can instantly switch to your sword and spam-click. You can't change this behavior.
For swords, I strongly suggest binding your hotbar switch button of `1` to your mouse side button (Button 4). When holding down your side button, you start spam clicking your left mouse button every random 35~50 ms. So you can instantly switch to your sword and spam-click. To avoid being banned, there is a 50ms delay if you are not holding the sword at the moment. You can't change this behavior.

For blocks, I slightly suggest binding your hotbar switch button of your block slot to your mouse side button (Button 5). This mod has a key of switching to blocks and start spam right clicking. The logic of spam right clicking is as follows:

Expand All @@ -61,6 +61,8 @@ You can change the slots config in the mod's config file, but the items to sort

In the configure file, change the `slot_*` to whatever slot you want. `-1` means you don't want to sort it, and `[0,8]` means slot from 1 to 9.

However, this feature is useless with the help of automatic switches.

-----------------

#### block clutch
Expand All @@ -71,13 +73,13 @@ When holding block, not on the ground, and clicking left button, the mod will tr

#### auto selecting hardest block

Press a key to select the hardest block. Saves a lot time for block-in, cause when you are digging downwards, you will want to use the hardest block (which you gathered from their bed defense) to block other players. This also saves some time when doing your bed defense. Default order: `Obsidian` -> `End Stone` -> `Wood` -> `Clay` -> `Wool`.
Press a key to select the hardest block. Saves a lot time for block-in, cause when you are digging downwards, you will want to use the hardest block (which you gathered from their bed defense) to block other players. This also saves some time when doing your bed defense. Default order: `Obsidian` -> `End Stone` -> `Wood` -> `Clay` -> `Wool`. I realize that there is a better way to decide the order but I don't want to bother to change it.

-----

#### block-in

Press a key to cover your nearby area. See video tutorial for more.
Press a key to cover your nearby area. Instant block-in, and it works.

-----

Expand All @@ -93,4 +95,4 @@ Tired of typing your password again and again? Now configure your password in th

## Future work

I also considered other functions such as locating players, anti-invis, but these would spoil game experience. The purpose of this mod is to reduce accident rate of bridging, not to win by hacking.
I also considered other functions such as locating players, anti-invis, but these would spoil game experience. The purpose of this mod is to reduce accident rate of bridging, not to win by hacking. I really don't want to break my mouse or arm by drag-clicking.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

version = '1.1'
version = '1.2'
group = 'net.lzdq.winterbridge' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'winterbridge'

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/lzdq/winterbridge/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class ModConfig {
public static final ForgeConfigSpec.IntValue blockin_rotate_tick;
public static final ForgeConfigSpec.DoubleValue blockin_offset;
public static final ForgeConfigSpec.BooleanValue use_epearl, use_fireball, use_hard_block;
public static final ForgeConfigSpec.IntValue delay_sword;

static {
BUILDER.push("General Settings");
Expand Down Expand Up @@ -143,7 +144,7 @@ public class ModConfig {

spam_left_min = BUILDER
.comment("Spam left min interval, ms")
.defineInRange("spam_left_min", 30.0, 1.0, 1000.0);
.defineInRange("spam_left_min", 35.0, 1.0, 1000.0);

spam_left_max = BUILDER
.comment("Spam left max interval, ms")
Expand Down Expand Up @@ -173,6 +174,10 @@ public class ModConfig {
.comment("Whether instantly place hardest block after switching to it")
.define("use_hard_block", false);

delay_sword = BUILDER
.comment("Delay after switching to sword, before spam-clicking, in ms")
.defineInRange("delay_sword", 100, 0, 200);

BUILDER.pop();
CONFIG = BUILDER.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,12 @@ public static void autoSwitchTool(){
}
private static void handleSpamClickLeft() {
if (System.currentTimeMillis() < until)
return;
return ;
if (mc.options.keyHotbarSlots[ModConfig.slot_sword.get()].isDown()) {
mc.player.getInventory().selected = ModConfig.slot_sword.get();
if (mc.player.getInventory().selected != ModConfig.slot_sword.get()){
until = System.currentTimeMillis() + ModConfig.delay_sword.get();
return ;
}
// Spam-click when holding switching to sword
KeyMapping.click(mc.options.keyAttack.getKey());
until = (long) (System.currentTimeMillis() +
Expand Down

0 comments on commit 6867f8a

Please sign in to comment.