Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-09 01:50:05 +01:00
Implement axiom:modify logic for tag merging
Dieser Commit ist enthalten in:
Ursprung
8cd2930fa2
Commit
b694a0515b
@ -176,6 +176,11 @@ public class ManipulateEntityPacketListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static CompoundTag merge(CompoundTag left, CompoundTag right) {
|
private static CompoundTag merge(CompoundTag left, CompoundTag right) {
|
||||||
|
if (right.contains("axiom:modify")) {
|
||||||
|
right.remove("axiom:modify");
|
||||||
|
return right;
|
||||||
|
}
|
||||||
|
|
||||||
for (String key : right.getAllKeys()) {
|
for (String key : right.getAllKeys()) {
|
||||||
Tag tag = right.get(key);
|
Tag tag = right.get(key);
|
||||||
if (tag instanceof CompoundTag compound) {
|
if (tag instanceof CompoundTag compound) {
|
||||||
@ -183,9 +188,14 @@ public class ManipulateEntityPacketListener implements PluginMessageListener {
|
|||||||
left.remove(key);
|
left.remove(key);
|
||||||
} else if (left.contains(key, Tag.TAG_COMPOUND)) {
|
} else if (left.contains(key, Tag.TAG_COMPOUND)) {
|
||||||
CompoundTag child = left.getCompound(key);
|
CompoundTag child = left.getCompound(key);
|
||||||
merge(child, compound);
|
child = merge(child, compound);
|
||||||
|
left.put(key, child);
|
||||||
} else {
|
} else {
|
||||||
left.put(key, tag.copy());
|
CompoundTag copied = compound.copy();
|
||||||
|
if (copied.contains("axiom:modify")) {
|
||||||
|
copied.remove("axiom:modify");
|
||||||
|
}
|
||||||
|
left.put(key, copied);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
left.put(key, tag.copy());
|
left.put(key, tag.copy());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren