@@ -56,8 +56,8 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable<Wrap
56
56
private static final Class <?> HANDLE_TYPE = MinecraftReflection .getDataWatcherClass ();
57
57
58
58
private static MethodAccessor GETTER = null ;
59
- public static MethodAccessor SETTER = null ;
60
- public static MethodAccessor REGISTER = null ;
59
+ private static MethodAccessor SETTER = null ;
60
+ private static MethodAccessor REGISTER = null ;
61
61
62
62
private static FieldAccessor ENTITY_DATA_FIELD = null ;
63
63
private static FieldAccessor ENTITY_FIELD = null ;
@@ -389,17 +389,20 @@ public Object getObject(WrappedDataWatcherObject object) {
389
389
// ---- Object Setters
390
390
391
391
/**
392
- * Sets the DataWatcher Item at a given index to a new value.
392
+ * Sets the DataWatcher Item at a given index to a new value. In 1.9 and up,
393
+ * you cannot register objects without a watcher object.
393
394
*
394
395
* @param index Index of the object to set
395
396
* @param value New value
396
397
* @param update Whether or not to inform the client
397
398
*
398
399
* @see {@link #setObject(WrappedDataWatcherObject, Object, boolean)}
400
+ * @throws IllegalArgumentException in 1.9 and up if there isn't already an
401
+ * object at this index
399
402
*/
400
403
public void setObject (int index , Object value , boolean update ) {
401
404
if (MinecraftReflection .watcherObjectExists () && !hasIndex (index )) {
402
- throw new IllegalArgumentException ("You cannot register objects without the watcher object!" );
405
+ throw new IllegalArgumentException ("You cannot register objects without a watcher object!" );
403
406
}
404
407
405
408
setObject (WrappedDataWatcherObject .fromIndex (index ), value , update );
@@ -427,10 +430,30 @@ public void setObject(int index, Serializer serializer, Object value, boolean up
427
430
}
428
431
429
432
/**
430
- * Shortcut for {@link #setObject(int, Serializer, Object, boolean)}
433
+ * Alias for {@link #setObject(int, Serializer, Object, boolean)}
431
434
*/
432
435
public void setObject (int index , Serializer serializer , Object value ) {
433
- setObject (index , serializer , value , false );
436
+ setObject (new WrappedDataWatcherObject (index , serializer ), value , false );
437
+ }
438
+
439
+ /**
440
+ * Sets the DataWatcher Item at a given index to a new value.
441
+ *
442
+ * @param index Index of the object to set
443
+ * @param value New value
444
+ * @param update Whether or not to inform the client
445
+ *
446
+ * @see {@link #setObject(int, Object, boolean)}
447
+ */
448
+ public void setObject (int index , WrappedWatchableObject value , boolean update ) {
449
+ setObject (index , value .getRawValue (), update );
450
+ }
451
+
452
+ /**
453
+ * Alias for {@link #setObject(int, WrappedWatchableObject, boolean)}
454
+ */
455
+ public void setObject (int index , WrappedWatchableObject value ) {
456
+ setObject (index , value .getRawValue (), false );
434
457
}
435
458
436
459
/**
@@ -450,7 +473,7 @@ public void setObject(WrappedDataWatcherObject object, WrappedWatchableObject va
450
473
* Shortcut for {@link #setObject(WrappedDataWatcherObject, WrappedWatchableObject, boolean)}
451
474
*/
452
475
public void setObject (WrappedDataWatcherObject object , WrappedWatchableObject value ) {
453
- setObject (object , value , false );
476
+ setObject (object , value . getRawValue () , false );
454
477
}
455
478
456
479
/**
0 commit comments