-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from majorsopa/main
add fly
- Loading branch information
Showing
3 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/evaan/frostburn/module/modules/movement/Fly.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.evaan.frostburn.module.modules.movement; | ||
|
||
import com.evaan.frostburn.module.Module; | ||
import com.evaan.frostburn.util.Setting; | ||
import net.minecraft.entity.player.PlayerAbilities; | ||
|
||
public class Fly extends Module { | ||
public Fly() {super("Fly", Module.Category.MOVEMENT);} | ||
|
||
Setting<Float> speed = register( | ||
new Setting( | ||
"Speed", | ||
this, | ||
100f, | ||
1f, | ||
500f | ||
) | ||
); | ||
|
||
@Override | ||
public void onUpdate() { | ||
assert mc.player != null; | ||
|
||
PlayerAbilities abilities = mc.player.getAbilities(); | ||
abilities.flying = true; | ||
|
||
abilities.setFlySpeed(speed.getValue() / 5000); | ||
|
||
mc.player.sendAbilitiesUpdate(); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
assert mc.player != null; | ||
|
||
PlayerAbilities abilities = mc.player.getAbilities(); | ||
abilities.flying = false; | ||
|
||
mc.player.sendAbilitiesUpdate(); | ||
|
||
} | ||
} |