mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 22:02:17 +00:00
More Item Attribute Things
This commit is contained in:
1 parent
9b7af03de3
commit
50977543c0
13 files changed
+312
-162
No files matched your search
@@ -29,11 +29,11 @@ public class AttributeController {
|
||||
}
|
||||
|
||||
|
||||
public static AttributeDefinition registerAttribute(String key, String displayName, AttributeValueType valueType) {
|
||||
public static AttributeDefinition registerAttribute(String key, String displayName, AttributeValueType valueType, AttributeDefinition.AttributeSection section) {
|
||||
if (definitions.containsKey(key)) {
|
||||
throw new IllegalArgumentException("Attribute already registered with key: " + key);
|
||||
}
|
||||
AttributeDefinition def = new AttributeDefinition(key, displayName, valueType);
|
||||
AttributeDefinition def = new AttributeDefinition(key, displayName, valueType, section);
|
||||
definitions.put(key, def);
|
||||
return def;
|
||||
}
|
||||
@@ -46,8 +46,8 @@ public class AttributeController {
|
||||
return definitions.values();
|
||||
}
|
||||
|
||||
public static PlayerAttributeTracker getTracker(UUID playerId) {
|
||||
return trackers.computeIfAbsent(playerId, id -> new PlayerAttributeTracker(id));
|
||||
public static PlayerAttributeTracker getTracker(EntityPlayer player) {
|
||||
return trackers.computeIfAbsent(player.getUniqueID(), id -> new PlayerAttributeTracker(id));
|
||||
}
|
||||
|
||||
public static void removeTracker(UUID playerId) {
|
||||
@@ -59,7 +59,7 @@ public class AttributeController {
|
||||
*/
|
||||
public static void updateAllTrackers(Iterable<EntityPlayer> players) {
|
||||
for (EntityPlayer player : players) {
|
||||
PlayerAttributeTracker tracker = getTracker(player.getUniqueID());
|
||||
PlayerAttributeTracker tracker = getTracker(player);
|
||||
tracker.updateIfChanged(player);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user