Zergatul / cheatutils

MIT License
33 stars 11 forks source link

[Feature Request (Hopefully for 1.18.2 as well) ] FastBreak or a module to make water or flight not affect break speed #10

Closed GoliathX211 closed 1 year ago

GoliathX211 commented 1 year ago

I use Fly most of the time and while my tools are strong enough to break the blocks somewhat quickly, it would be nice if you could make a FastBreak packet hack or even better would be negating the breaking speed for while flying or underwater. Thanks <3

Zergatul commented 1 year ago

I can move Fast Break from 1.19.2 version. As for other things. I tried to remove penalty in calculation of digging speed (penalty is applied if player eyes are in water, or player is not staying on ground). It doesn't work in water (with Fast Break enabled). The problem is even vanilla server uses the same code to calculate dig speed, and you cannot trick server that you are not underwater, when you actually are. As for on ground flag. We can trick vanilla server that player is staying on the ground while using fly hack. I tested it for few minutes and it works fine. But this will require to add new setting to fly hack (current fly hack always set this flag to false).

GoliathX211 commented 1 year ago

Will setting that flag as true cause issues with that other issue I had created on your GitHub with fall damage when using NoFall?

GoliathX211 commented 1 year ago

"I fixed this by adjusting MovePlayerPacket. It has flag onGround. I added code to always send onGround=false while fly hack is enabled. This fixed instadeath when touching surface."

Zergatul commented 1 year ago

That was my first concern. But I think it should work fine. With very first initial version of fly I wasn't touching onGround flag, so client was calculating it. And if you touch the ground while in fly, on the server side it could look like you were falling for a lot of time and then touched surface. That's why you could die in first version of fly. I fixed it by sending always onGround=false. But always setting onGround=true should also work. It is like fly+no fall combined.

Zergatul commented 1 year ago

I added 0.11.0 version with Fast Break. Unfortunately Disable Fly Penalty option doesn't work properly. I spent some time playing with settings, no success. You can try it by yourself, but most likely this option is useless. It looks like server realizes that player is not actually on the ground.

GoliathX211 commented 1 year ago

Does FastBreak work whilst using fly mode?

GoliathX211 commented 1 year ago

Out of curiosity how does the Aerial Affinity enchantment work? I know there is a mod that adds more enchantments, one of which removing the flying mining penalty similar to how aqua affinity removes it underwater. That might be a lead to look into.

GoliathX211 commented 1 year ago

Here is a snippet from a standalone mod that implements this. Keep in mind that the latest version of this was 1.14

@SubscribeEvent public static void breakSpeed(PlayerEvent.BreakSpeed e) { PlayerEntity p = e.getPlayer();

if (!p.onGround && EnchantmentHelper.getMaxEnchantmentLevel(AerialAffinity.aerial_affinity, p) > 0) {
  float oldSpeed = e.getOriginalSpeed();
  //float newSpeed = e.getNewSpeed();
  //if (oldSpeed < newSpeed*5F)
  e.setNewSpeed(oldSpeed * 5F);
}

}

GoliathX211 commented 1 year ago

If this is still something you cannot implement, go ahead and close this issue if you want. <3

Zergatul commented 1 year ago

I implemented it, but it doesn't work as expected. Server calculates dig speed on its own, and if it doesn't match delay between 2 block breaking packets - it sends rollback packet, and block stays in its original place.

I am doing similar to your snippet: https://github.com/Zergatul/cheatutils/blob/1.18.2/src/main/java/com/zergatul/cheatutils/mixins/MixinLocalPlayer.java#L116

GoliathX211 commented 1 year ago

Okay, I appreciate the effort. One thing about your mod is that you seem to be confining all of the things it does to the logistical and physical client so it works on multiplayer servers without the mod installed. This just isn't possible I guess.

Edit: I don't know how to close an issue on the GitHub app on my phone.

Edit 2: got it