mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
46 lines
1.7 KiB
Diff
46 lines
1.7 KiB
Diff
--- a/net/minecraft/network/syncher/DataWatcher.java
|
|
+++ b/net/minecraft/network/syncher/DataWatcher.java
|
|
@@ -14,6 +14,11 @@
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.slf4j.Logger;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
|
+import net.minecraft.server.level.EntityPlayer;
|
|
+// CraftBukkit end
|
|
+
|
|
public class DataWatcher {
|
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -51,7 +56,7 @@
|
|
}
|
|
|
|
private <T> DataWatcher.Item<T> getItem(DataWatcherObject<T> datawatcherobject) {
|
|
- return this.itemsById[datawatcherobject.id()];
|
|
+ return (DataWatcher.Item<T>) this.itemsById[datawatcherobject.id()]; // CraftBukkit - decompile error
|
|
}
|
|
|
|
public <T> T get(DataWatcherObject<T> datawatcherobject) {
|
|
@@ -74,6 +79,13 @@
|
|
|
|
}
|
|
|
|
+ // CraftBukkit start - add method from above
|
|
+ public <T> void markDirty(DataWatcherObject<T> datawatcherobject) {
|
|
+ this.getItem(datawatcherobject).setDirty(true);
|
|
+ this.isDirty = true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public boolean isDirty() {
|
|
return this.isDirty;
|
|
}
|
|
@@ -140,7 +152,7 @@
|
|
if (!Objects.equals(datawatcher_c.serializer(), datawatcher_item.accessor.serializer())) {
|
|
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.id(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_c.value, datawatcher_c.value.getClass()));
|
|
} else {
|
|
- datawatcher_item.setValue(datawatcher_c.value);
|
|
+ datawatcher_item.setValue((T) datawatcher_c.value); // CraftBukkit - decompile error
|
|
}
|
|
}
|
|
|