DashAPI
⚪ Last updated 2024Preview

🔍 Analysis
- 🏆 #45 of 313 game-mechanics mods in this game by downloads
📋 About This Mod
# DashAPI DashAPI adds "dash()": set the velocity of entities in terms of blocks instead of a vector. (https://img.shields.io/github/downloads/lichenaut/DashAPI/total.svg)]() ## Walkthrough First, include DashAPI in your project. Then, add this as a dependency in your "plugin.yml" file. `depend: ` To get an instance of this API for use, define a "DashFunctions" object with "DashAPI.getInstance()": ``` DashAPI api; @Override public void onEnable() { api = DashAPI.getInstance(); } ``` Example #1 (base function): ``` @EventHandler public void onClick(PlayerInteractEntityEvent event) { api.dash(event.getRightClicked(), 10, 10, -10); } ``` When a player interacts with an entity, the entity will be dashed 10 blocks forward, 10 blocks up, and 10 blocks left on Minecraft's x, y, and z axes, respectively. Example #2 (adjustments): ``` @EventHandler public void onCrouch(PlayerToggleSneakEvent event) { api.dash(event.getPlayer(), 10, 100, 0, true, true, true); } ``` When a player crouches or uncrouches, they will be dashed forward relative to their looking direction due to "adjustHorizontal" being true, and the player's current velocity will be added to the dash due to "additive" being true. Additionally, as the maximum number of blocks an entity can be dashed vertically is 60 (43 horizontally), the plugin reduces the value 100 to 60 and dashes the player up 60 blocks, assuming no gravity (ex. player in flight). Finally, because "adjustVertical" is set to true, the player's looking up or down affects the y of the dash. Example #3 (int and Double inputs): ``` @EventHandler public void bounceClick(PlayerInteractEntityEvent event) { api.dash(event.getPlayer(), 0, event.getPlayer().getLocation().getDirection().getY() * -4, 0); } ``` Int values for block distance and Double values for velocity can be used in any combination, and in this example it is (int, Double, int). In this example, when a player interacts with an entity, the y value of that player's looking direction is multiplied by -4, which means that if a player looks down to click an entity, they will be dashed with a high positive y velocity. Example #4 (multipliers): ``` @EventHandler public void pushAndPull(PlayerInteractEntityEvent event) { api.dash(event.getRightClicked(), event.getPlayer().getLocation().getDirection()); api.dash(event.getPlayer(), event.getRightClicked().getVelocity(), 0.5, 0.5, 0.5); } ``` The first dash is applied to the entity interacted by the player, based off of the direction the player is facing, creating a knockback effect. The second dash is applied to the player, based off of the velocity of the clicked entity, creating a pull effect. Additionally, the pull effect is halved with the x, y, and z multiplers, meaning that, if repeated, the interacted entity will eventually be too far away for the player to interact with.
DashAPI adds "dash()": set the velocity of entities in terms of blocks instead of a vector.
[!(https://img.shields.io/github/downloads/lichenaut/DashAPI/total.svg)]()
## Walkthrough
First, include DashAPI in your project. Then, add this as a dependency in your "plugin.yml" file.
To get an instance of this API for use, define a "DashFunctions" object with "DashAPI.getInstance()":
``` DashAPI api;
@Override public void onEnable() { api = DashAPI.getInstance(); } ```
Example #1 (base function):
``` @EventHandler public void onClick(PlayerInteractEntityEvent event) { api.dash(event.getRightClicked(), 10, 10, -10); } ```
When a player interacts with an entity, the entity will be dashed 10 blocks forward, 10 blocks up, and 10 blocks left on Minecraft's x, y, and z axes, respectively.
Example #2 (adjustments):
``` @EventHandler public void onCrouch(PlayerToggleSneakEvent event) { api.dash(event.getPlayer(), 10, 100, 0, true, true, true); } ```
When a player crouches or uncrouches, they will be dashed forward relative to their looking direction due to "adjustHorizontal" being true, and the player's current velocity will be added to the dash due to "additive" being true. Additionally, as the maximum number of blocks an entity can be dashed vertically is 60 (43 horizontally), the plugin reduces the value 100 to 60 and dashes the player up 60 blocks, assuming no gravity (ex. player in flight). Finally, because "adjustVertical" is set to true, the player's looking up or down affects the y of the dash.
Example #3 (int and Double inputs):
``` @EventHandler public void bounceClick(PlayerInteractEntityEvent event) { api.dash(event.getPlayer(), 0, event.getPlayer().getLocation().getDirection().getY() * -4, 0); } ```
Int values for block distance and Double values for velocity can be used in any combination, and in this example it is (int, Double, int). In this example, when a player interacts with an entity, the y value of that player's looking direction is multiplied by -4, which means that if a player looks down to click an entity, they will be dashed with a high positive y velocity.
Example #4 (multipliers):
``` @EventHandler public void pushAndPull(PlayerInteractEntityEvent event) { api.dash(event.getRightClicked(), event.getPlayer().getLocation().getDirection()); api.dash(event.getPlayer(), event.getRightClicked().getVelocity(), 0. 5, 0. 5, 0. 5); } ```
The first dash is applied to the entity interacted by the player, based off of the direction the player is facing, creating a knockback effect. The second dash is applied to the player, based off of the velocity of the clicked entity, creating a pull effect. Additionally, the pull effect is halved with the x, y, and z multiplers, meaning that, if repeated, the interacted entity will eventually be too far away for the player to interact with.
📊 Mod Details
- Game
- Minecraft Plugins
- Author
- lichenaut
- Version
- 1.1.0
- Downloads
- 312
- Endorsements
- 1
- Category
- game-mechanics
- Created
- 2/28/2024
- Updated
- 6/25/2024
- Game Versions
- 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4
- Tags
- game-mechanics, library
🔧 How to Install Minecraft Plugins Mods
Download from Modrinth. Use Prism Launcher or drop into your mods folder.
📖 Full step-by-step install guide for Minecraft Plugins →
Visit the official mod page for specific installation instructions for this mod.
🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Plugins commands, item IDs, and more.
❓ Frequently Asked Questions
Which Minecraft Plugins versions does DashAPI support?
The author lists 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5. Other versions may work but are untested by the author.
What is the latest version of DashAPI?
Version 1.1.0, published 2024-06-25 with 312 downloads recorded at the source.
Keep browsing — more Minecraft Plugins mods await