PssbleTrngle / CreateJetpack

Upgrade your backtank and utilize the pressurized air to fly
https://www.curseforge.com/minecraft/mc-mods/create-jetpack
Other
8 stars 15 forks source link

[1.20.1] Disable the jetpack when another mod puts it on item cooldown #81

Closed TelepathicGrunt closed 1 year ago

TelepathicGrunt commented 1 year ago

Describe the feature you have in mind.

If a mod put the Create Jetpack on item cooldown the same way vanilla shields gets a cooldown when hit by axe, the Jetpack should no longer activate until the cooldown is lifted.

Mods can set a cooldown by doing: player.getCooldowns().addCooldown(jetpack.getItem(), 40);

This will send a packet to clients as well so both sides will know about the cooldown.

You can then query to see if the cooldown is active by doing if (player.getCooldowns().isOnCooldown(jetpack.getItem())) {

Does this solve a particular problem?

This allows me, the dev for Bumblezone, to disable the Jetpack when players enters my Heavy Air block. Thus allowing me to stop people from cheesing my endgame events by flying over spikes and mobs as well as adds to the atmosphere of my ancient magical structure that can disable flight technologies.

Since cooldowns is a vanilla thing and is accessible on both sides, adding support for cooldowns should be very quick and painless and allow for other mods to disable the jetpack if they wish to for a certain amount of time.

JaisDK commented 1 year ago

yes please add this

PssbleTrngle commented 1 year ago

definitely, sounds reasonable, will add this as part of the core FlightLib logic

PssbleTrngle commented 1 year ago

I have released a new version that should include a check of the item cooldown