Skip to content

Commit

Permalink
Merge pull request #297 from skiprocks999/1.21
Browse files Browse the repository at this point in the history
property tweak
  • Loading branch information
skiprocks999 authored Jan 26, 2025
2 parents f2d6174 + 94f809b commit c23cf30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion runs/client/usercache.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"Dev","uuid":"380df991-f603-344c-a090-369bad2a924a","expiresOn":"2025-02-19 16:54:57 -0600"}]
[{"name":"Dev","uuid":"380df991-f603-344c-a090-369bad2a924a","expiresOn":"2025-02-25 14:05:31 -0600"}]
10 changes: 7 additions & 3 deletions src/main/java/electrodynamics/prefab/properties/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ public Property<T> set(Object updated) {
}
manager.setDirty(this);
} else if(shouldUpdateServer) {
CompoundTag data = new CompoundTag();
saveToTag(data, manager.getOwner().getLevel().registryAccess());
PacketDistributor.sendToServer(new PacketSendUpdatePropertiesServer(data, getIndex(), manager.getOwner().getBlockPos()));
updateServer();
}
onChange.accept(this, old);
}
Expand Down Expand Up @@ -231,4 +229,10 @@ public void saveToTag(CompoundTag tag, HolderLookup.Provider registries) {

}

public void updateServer() {
CompoundTag data = new CompoundTag();
saveToTag(data, manager.getOwner().getLevel().registryAccess());
PacketDistributor.sendToServer(new PacketSendUpdatePropertiesServer(data, getIndex(), manager.getOwner().getBlockPos()));
}

}

0 comments on commit c23cf30

Please sign in to comment.