This update brings new settings for modifying the trajectory, notably related to gravity.
Due to Minecraft's physics, this is not straightforward. A dependent drag is applied to entities in the air, which prevents creating simple settings.
Several options are present with this update.
- Max Living Ticks: This new setting allows to drop/return to inventory weapon after the defined number of ticks. This can be used to prevent weapons from staying in the air with the other new settings, or simply to prevent weapons from going too far.
- Straight Trajectory: Throwing Weapons now allows to make the weapons follow a straight trajectory. This will ignore Minecraft's physics and thus ignore the next two options. This is a simple workaround that most other similar plugins employ. This should be used with Max Living Ticks enabled, or the weapon could stay in the air indefinitely!
- Maximum Y Velocity: This allows for setting the maximum vertical (negative) velocity. If you set 0.1, then the weapon will never fall faster than -0.1 block/tick. This allows slowing down the fall of weapons and make them reach a longer range. Minecraft applies drag to entities in the air, which makes them slow down also along x and y. If you set this to 0.0, the weapon could stay in the air indefinitely! Please use cautiously and/or with max living ticks.
- Anti-Gravity: This can be used with the setting above or without. This will apply a vertical counter-acceleration (upwards), so instead of setting a maximum fall velocity, you simply apply a counter velocity. This will slow down gravity but again, use cautiously.
These features are
experimental, they have been tested thoroughly but please report any issue on the Discord server.
To use these settings, add this snippet to the end of your yml weapon files, then edit and reload.
Code (YAML):
# This setting overrides all the others.
# If enabled, the weapon keeps a constant
# speed along a straight trajectory.
# The speed is the one set in the speed
# setting above multiplied by this factor.
#
# This SHOULD be used with
# max-living-ticks enabled!!
straight-trajectory:
enabled
: false
multiplier
: 0.3
# Max living ticks for the weapon.
# 1 tick = 0.05 seconds.
# 20 ticks = 1 second
max-living-ticks:
enabled
: true
value
: 50
# These settings allow for affecting the
# gravity and can make the weapon
# fall slower (have a longer range)
# without requiring a very high speed.
#
# Warning, these settings can make the
# weapon act weirdly and stay
# in the air for a long time.
# Preferably use with max-living-ticks
# enabled, or use straight-trajectory
# with max-living-ticks.
gravity-modifiers
:
# Maximum Y velocity for the weapon.
# if velocity y <= -value, the weapon
# will not accelerate more downward.
max-y-velocity:
enabled
: false
value
: 0.1
# At each tick, this value is added
# to the weapon's velocity y (upward).
anti-gravity:
enabled
: false
value
: 0.1