65 lines
		
	
	
	
		
			2.3 KiB
			
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
	
		
			2.3 KiB
			
		
	
	
	
		
			Diff
		
	
	
	
	
	
--- a/net/minecraft/network/syncher/DataWatcher.java
 | 
						|
+++ b/net/minecraft/network/syncher/DataWatcher.java
 | 
						|
@@ -24,6 +24,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();
 | 
						|
@@ -142,6 +147,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;
 | 
						|
     }
 | 
						|
@@ -223,7 +235,7 @@
 | 
						|
         if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) {
 | 
						|
             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.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_b.value, datawatcher_b.value.getClass()));
 | 
						|
         } else {
 | 
						|
-            datawatcher_item.setValue(datawatcher_b.value);
 | 
						|
+            datawatcher_item.setValue((T) datawatcher_b.value); // CraftBukkit - decompile error
 | 
						|
         }
 | 
						|
     }
 | 
						|
 
 | 
						|
@@ -231,6 +243,18 @@
 | 
						|
         return this.itemsById.isEmpty();
 | 
						|
     }
 | 
						|
 
 | 
						|
+    // CraftBukkit start
 | 
						|
+    public void refresh(EntityPlayer to) {
 | 
						|
+        if (!this.isEmpty()) {
 | 
						|
+            List<DataWatcher.b<?>> list = this.getNonDefaultValues();
 | 
						|
+
 | 
						|
+            if (list != null) {
 | 
						|
+                to.connection.send(new PacketPlayOutEntityMetadata(this.entity.getId(), list));
 | 
						|
+            }
 | 
						|
+        }
 | 
						|
+    }
 | 
						|
+    // CraftBukkit end
 | 
						|
+
 | 
						|
     public static class Item<T> {
 | 
						|
 
 | 
						|
         final DataWatcherObject<T> accessor;
 | 
						|
@@ -273,7 +297,7 @@
 | 
						|
         }
 | 
						|
     }
 | 
						|
 
 | 
						|
-    public static record b<T> (int id, DataWatcherSerializer<T> serializer, T value) {
 | 
						|
+    public static record b<T>(int id, DataWatcherSerializer<T> serializer, T value) { // CraftBukkit - decompile error
 | 
						|
 
 | 
						|
         public static <T> DataWatcher.b<T> create(DataWatcherObject<T> datawatcherobject, T t0) {
 | 
						|
             DataWatcherSerializer<T> datawatcherserializer = datawatcherobject.getSerializer();
 |