MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / addObject

Method addObject

src/main/java/net/minecraft/entity/DataWatcher.java:40–64  ·  view source on GitHub ↗
(int id, T object)

Source from the content-addressed store, hash-verified

38 }
39
40 public <T> void addObject(int id, T object)
41 {
42 Integer integer = dataTypes.get(object.getClass());
43
44 if (integer == null)
45 {
46 throw new IllegalArgumentException("Unknown data type: " + object.getClass());
47 }
48 else if (id > 31)
49 {
50 throw new IllegalArgumentException("Data value id is too big with " + id + "! (Max is " + 31 + ")");
51 }
52 else if (this.watchedObjects.containsKey(id))
53 {
54 throw new IllegalArgumentException("Duplicate id value for " + id + "!");
55 }
56 else
57 {
58 DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(integer, id, object);
59 this.lock.writeLock().lock();
60 this.watchedObjects.put(id, datawatcher$watchableobject);
61 this.lock.writeLock().unlock();
62 this.isBlank = false;
63 }
64 }
65
66 /**
67 * Add a new object for the DataWatcher to watch, using the specified data type.

Callers 15

entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
EntityMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80
entityInitMethod · 0.80

Calls 5

lockMethod · 0.80
unlockMethod · 0.80
getMethod · 0.65
putMethod · 0.65
containsKeyMethod · 0.45

Tested by

no test coverage detected