Skip to content

Commit

Permalink
Better support for modded servers
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Jul 14, 2024
1 parent 59004e6 commit 78e3fdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected void initAttributes(GrimPlayer player) {
}

public Optional<ValuedAttribute> getAttribute(Attribute attribute) {
if (attribute == null) return Optional.empty();
return Optional.ofNullable(attributeMap.get(attribute));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public void updateAttributes(int entityID, List<WrapperPlayServerUpdateAttribute

if (entity instanceof PacketEntityHorse) {
for (WrapperPlayServerUpdateAttributes.Property snapshotWrapper : objects) {
if (snapshotWrapper.getAttribute() == null) continue;
if (snapshotWrapper.getKey().toUpperCase().contains("MOVEMENT")) {
entity.getAttribute(Attributes.GENERIC_MOVEMENT_SPEED).get().with(snapshotWrapper);
}
Expand All @@ -168,6 +169,7 @@ public void updateAttributes(int entityID, List<WrapperPlayServerUpdateAttribute

if (entity instanceof PacketEntityRideable) {
for (WrapperPlayServerUpdateAttributes.Property snapshotWrapper : objects) {
if (snapshotWrapper.getAttribute() == null) continue;
if (snapshotWrapper.getKey().toUpperCase().contains("MOVEMENT")) {
entity.getAttribute(Attributes.GENERIC_MOVEMENT_SPEED).get().with(snapshotWrapper);
}
Expand Down

0 comments on commit 78e3fdb

Please sign in to comment.