[SPIGOT-7547] Damageable.setAbsorptionAmount(double amount) issue Created: 17/Dec/23  Updated: 25/Dec/24

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ssomar Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

This server is running CraftBukkit version 3976-Spigot-06d602e-b3b43a6 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT)


Attachments: File Test.jar     PNG File image-2023-12-17-17-02-06-666.png    
Version: 3976 Spigot 1.20.4
Guidelines Read: Yes

 Description   

The method Damageable.setAbsorptionAmount(double amount)

doesn't set anymore the Absorption.

 

I created a small plugin to test it with an event that should set 20 absroption when the player sneak :

 

@EventHandler()
public void onPlayerToggleSneakEvent(PlayerToggleSneakEvent e) {
    Bukkit.broadcastMessage("PlayerToggleSneakEvent");
    if (e.isSneaking()) {
        Bukkit.broadcastMessage("Sneaking I will set abso to 20");
        e.getPlayer().setAbsorptionAmount(20);
        Bukkit.broadcastMessage("Abso set");
        Bukkit.broadcastMessage("The player has " + e.getPlayer().getAbsorptionAmount() + " abso");
    } else Bukkit.broadcastMessage("Not Sneaking");
} 

Here is the output :

The Absroption didn't change.



 Comments   
Comment by Joel Strasser [ 28/Dec/23 ]

Created a new Pull Request which fixes the underlying behaviour.

Comment by Joel Strasser [ 24/Dec/23 ]

Created a Pull Request for that.

Comment by Black Hole [ 18/Dec/23 ]

So at least the JavaDoc could be improved.

Comment by Jake Potrebic [ 18/Dec/23 ]

Intentional. You need to set the `generic.max_absorbtion` attribute now. It's new for 1.20.2. Its default is 0, so your value in setAbsorbtionAmount gets clamped to 0.

Generated at Tue Apr 22 07:16:07 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.