Fixed NotSerializableException when sacrificing entities (fixes #666)
This commit is contained in:
parent
ad4b0ddf24
commit
2780a9af27
2 changed files with 8 additions and 2 deletions
|
|
@ -289,7 +289,7 @@ public final class EntityDeathListener extends Queue implements Listener {
|
||||||
if (attributeInstance != null) {
|
if (attributeInstance != null) {
|
||||||
List<Object> attributeData = new ArrayList<>();
|
List<Object> attributeData = new ArrayList<>();
|
||||||
List<Object> attributeModifiers = new ArrayList<>();
|
List<Object> attributeModifiers = new ArrayList<>();
|
||||||
attributeData.add(attributeInstance.getAttribute());
|
attributeData.add(BukkitAdapter.ADAPTER.getRegistryKey(attributeInstance.getAttribute()));
|
||||||
attributeData.add(attributeInstance.getBaseValue());
|
attributeData.add(attributeInstance.getBaseValue());
|
||||||
|
|
||||||
for (AttributeModifier modifier : attributeInstance.getModifiers()) {
|
for (AttributeModifier modifier : attributeInstance.getModifiers()) {
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,13 @@ public class EntityUtil {
|
||||||
for (Object value : attributes) {
|
for (Object value : attributes) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Object> attributeData = (List<Object>) value;
|
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);
|
Double baseValue = (Double) attributeData.get(1);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Object> attributeModifiers = (List<Object>) attributeData.get(2);
|
List<Object> attributeModifiers = (List<Object>) attributeData.get(2);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue