Description
Introduction:
-
The Collision Damage Mod introduces a new potion effect: Collision Damage. This effect allows entities to deal damage and apply horizontal knockback to collision targets when moving at high speeds, making it convenient for integration pack or addon authors to use.
-
Potion effect command:
/effect @s collisiondamage:collision_damage <duration> <level>
Key Features:
-
Speed Threshold: When the speed exceeds 10 m/s, colliding with other entities inflicts damage proportional to the speed.
Damage formula: Damage = Speed × Potion Level × 0.1 -
Speed Display: When the player has the Collision Damage effect, their real-time vector speed is displayed in the upper-right corner of the inventory screen.

Working Principle:
-
Speed Calculation:
When an entity has the Collision Damage effect, the mod calculates the change in the entity's x, y, and z coordinates for each tick. Using the Euclidean formula, it determines the distance between the entity's position at the start and end of the tick. Dividing this distance by the tick duration (default 0.02 seconds) yields the average speed for that tick. -
Collision Detection:
While calculating speed, the mod checks once per tick for other entities within a 1-block radius of the entity with the Collision Damage effect. If another entity is detected and the user's speed exceeds 10 m/s, the detected entity takes damage based on the formula:
Damage = Speed × Potion Level × 0.1.


