Fixed NotSerializableException when sacrificing entities (fixes #666)

This commit is contained in:
Intelli 2024-11-04 14:31:00 -07:00
parent ad4b0ddf24
commit 2780a9af27
2 changed files with 8 additions and 2 deletions

View File

@ -289,7 +289,7 @@ public final class EntityDeathListener extends Queue implements Listener {
if (attributeInstance != null) {
List<Object> attributeData = new ArrayList<>();
List<Object> attributeModifiers = new ArrayList<>();
attributeData.add(attributeInstance.getAttribute());
attributeData.add(BukkitAdapter.ADAPTER.getRegistryKey(attributeInstance.getAttribute()));
attributeData.add(attributeInstance.getBaseValue());
for (AttributeModifier modifier : attributeInstance.getModifiers()) {

View File

@ -166,7 +166,13 @@ public class EntityUtil {
for (Object value : attributes) {
@SuppressWarnings("unchecked")
List<Object> attributeData = (List<Object>) value;
Attribute attribute = (Attribute) attributeData.get(0);
Attribute attribute = null;
if (attributeData.get(0) instanceof Attribute) {
attribute = (Attribute) attributeData.get(0);
}
else {
attribute = (Attribute) BukkitAdapter.ADAPTER.getRegistryValue((String) attributeData.get(0), Attribute.class);
}
Double baseValue = (Double) attributeData.get(1);
@SuppressWarnings("unchecked")
List<Object> attributeModifiers = (List<Object>) attributeData.get(2);