-
Notifications
You must be signed in to change notification settings - Fork 18
Feature (Module): Add BetterFirework Module #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
| private fun SafeContext.getFireworkAtHotbar(): Int { | ||
| for (i in 0..8) { | ||
| val itemStack: ItemStack = player.getInventory().getStack(i) | ||
| if (itemStack.item !== Items.FIREWORK_ROCKET) continue | ||
| return i | ||
| } | ||
| return -1 | ||
| } | ||
|
|
||
| private fun SafeContext.getFireworkInInventoryScreen(): Int { | ||
| val screenHandler: PlayerScreenHandler = player.playerScreenHandler | ||
| for (i in PlayerScreenHandler.INVENTORY_START..<PlayerScreenHandler.INVENTORY_END) { | ||
| val itemStack = screenHandler.getSlot(i).stack | ||
| if (itemStack.item !== Items.FIREWORK_ROCKET) continue | ||
| return i | ||
| } | ||
| return -1 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have utils to find and swap items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find any utils that tell me what inventory index the found items are in. We looked at this like 3 weeks ago. You couldn't find any either.
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
cfc96c2 to
c1b167e
Compare
|
@Edouard127 so we merge? |
beanbag44
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just small things. Also, for single line if blocks, its often cleaner to omit the braces and keep them on the same line or at least the action after the check. Like this:
if (something) doSomething()
else if (something else) doSomethingElse()
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Firework Interact", true, "Automatically start flying when right clicking fireworks") | ||
| private var fireworkInteractCancel by setting("Firework Interact Cancel", false, "Cancel block interactions while holding fireworks") { fireworkInteract } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its annoying sometimes when you fly into a wall and try to use a firework for it to spam it on a block. Maybe this could be a general setting rather than an extension of fireworkInteract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just enable the Module
| description = "Automatic takeoff with fireworks", | ||
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Firework Interact", true, "Automatically start flying when right clicking fireworks") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used the name "Right Click Fly" instead of "Firework Interact"
| interaction.clickSlot(player.playerScreenHandler.syncId, swap, 0, SlotActionType.SWAP, mc.player) | ||
|
|
||
| if (player.getInventory().selectedSlot != 0) { | ||
| player.networkHandler.sendPacket(UpdateSelectedSlotC2SPacket(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should request the hotbar manager with keep ticks set to 0 for silent swap
| enum class TakeoffState { | ||
| NONE, | ||
| JUMPING, | ||
| START_FLYING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be in camel case
daebacd to
e76fb57
Compare
beanbag44
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one thing, aside from that i think its good
| tag = ModuleTag.MOVEMENT, | ||
| ) { | ||
| private var fireworkInteract by setting("Right Click Fly", true, "Automatically start flying when right clicking fireworks").group(Group.General) | ||
| private var fireworkInteractCancel by setting("Right Click Cancel", false, "Cancel block interactions while holding fireworks") { fireworkInteract }.group(Group.General) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i meant that this shouldn't be dependent on right click fly to be a feature. This should be its own option, separate from firework interact
ec590d4 to
99a3940
Compare
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/lambda/module/modules/movement/BetterFirework.kt
Outdated
Show resolved
Hide resolved
|
@emyfops you approve? |
Set default options that actually work
emyfops
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This Module adds better Fireworks utility. Features include: