mojira.dev
MCPE-177601

damage_multiplier can't reduce damage below 1.0

The bug

The damage_sensor component can modify incoming damage with the damage_multiplier field. It works well. However, if the resulting damage would be less than 1.0, it gets set to 1.0 instead. This is a problem for me, because it makes damage_multiplier ineffective against weak attacks.

damage_multiplier happily and correctly sets damage to fractional values that are greater than 1.0, but not any between 0.0 and 1.0.

How to reproduce

1. Download and open the attached world. It has a sheep with a 0.1 damage multiplier and 3 health

2. Punch the sheep repeatedly

Expected results
The sheep should survive for 30 hits, since each hit should do 0.1 damage.

Observed results
The sheep dies in 3 hits, since each hit couldn't do less than 1 damage.

Sheep behavior, for reference

{
   "format_version": "1.16.0",
   "minecraft:entity": {
      "description": {
         "identifier": "minecraft:sheep",
         "is_spawnable": true,
         "is_summonable": true,
         "is_experimental": false
      },
      "components": {
         "minecraft:collision_box": {
            "width": 0.9,
            "height": 1.3
         },
         "minecraft:nameable": {},
         "minecraft:physics": {},
         "minecraft:pushable": {
            "is_pushable": true,
            "is_pushable_by_piston": true
         },
         "minecraft:health": {
            "value": 3
         },
         "minecraft:damage_sensor": {
            "triggers": {
               "damage_multiplier": 0.1
            }
         }
      }
   }
}

Linked issues

Attachments

Comments 2

The <1.0 damage_multiplier does work as expected when reducing player attacks to values of 1.0 or greater. For example, in the test world, if you give yourself the Strength II effect and attack with a trident or netherite sword your mele damage is 15. The sheep then takes 2 hits to kill, because it has 3 health and each hit is reduced to ( 0.1 * 15 ) = 1.5 damage.

tryashtar

(Unassigned)

1156806

Confirmed

Windows

1.20.50, 1.20.60.23 Preview, 1.20.51 Hotfix, 1.20.70.21 Preview

Retrieved