RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ObjectType.java
1package com.osroyale.game.world.object;
2
3import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
4import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
5
6import java.util.Map;
7import java.util.Optional;
8
57
58public enum ObjectType {
59
62
65
68
71
74
77
80
83
86
89
92
95
98
101
104
107
110
113
116
119
122
125
131
133 private final int id;
134
136 private final ObjectGroup group;
137
144 ObjectType(int id, ObjectGroup group) {
145 this.id = id;
146 this.group = group;
147 }
148
154 public final int getId() {
155 return id;
156 }
157
163 public final ObjectGroup getGroup() {
164 return group;
165 }
166
167 private static final ObjectType[] values = values();
168
170 private static final Int2ObjectMap<ObjectType> idToType = new Int2ObjectOpenHashMap<>(values.length);
171
172 /* Populates the {@link #values} cache. */
173 static {
174 for (ObjectType type : values) {
175 idToType.put(type.getId(), type);
176 }
177 }
178
186 public static Optional<ObjectType> valueOf(final int id) {
187 return Optional.ofNullable(idToType.get(id));
188 }
189
190}
ObjectType(int id, ObjectGroup group)
static Optional< ObjectType > valueOf(final int id)