RuneHive-Game
Loading...
Searching...
No Matches
ObjectType.java
Go to the documentation of this file.
1package com.runehive.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
9/**
10 * The enumerated type whose elements represent all of the object types.
11 *
12 * @author Ryley Kimmel <ryley.kimmel@live.com>
13 * @author Maxi <http://www.rune-server.org/members/maxi/>
14 * @author lare96 <http://github.com/lare96>
15 * @author Artem batutin <artembatutin@gmail.com>
16 */
17public enum ObjectType {
18
19 /** Represents straight walls, fences etc. */
21
22 /** Represents diagonal walls corner, fences etc connectors. */
24
25 /** Represents entire walls, fences etc corners. */
27
28 /** Represents straight wall corners, fences etc connectors. */
30
31 /** Represents straight inside wall decorations. */
33
34 /** Represents straight outside wall decorations. */
36
37 /** Represents diagonal outside wall decorations. */
39
40 /** Represents diagonal inside wall decorations. */
42
43 /** Represents diagonal in wall decorations. */
45
46 /** Represents diagonal walls, fences etc. */
48
49 /** Represents all kinds of objects, trees, statues, signs, fountains etc. */
51
52 /** Represents ground objects like daisies etc. */
54
55 /** Represents straight sloped roofs. */
57
58 /** Represents diagonal sloped roofs. */
60
61 /** Represents diagonal slope connecting roofs. */
63
64 /** Represents straight sloped corner connecting roofs. */
66
67 /** Represents straight sloped corner roofs. */
69
70 /** Represents straight flat top roofs. */
72
73 /** Represents straight bottom edge roofs. */
75
76 /** Represents diagonal bottom edge connecting roofs. */
78
79 /** Represents straight bottom edge connecting roofs. */
81
82 /** Represents straight bottom edge connecting corner roofs. */
84
85 /**
86 * Represents ground decoration + map signs (quests, water fountains, shops,
87 * etc)
88 */
90
91 /** The identification of this type. */
92 private final int id;
93
94 /** The {@link ObjectGroup} this type is associated to. */
95 private final ObjectGroup group;
96
97 /**
98 * Creates a new {@link ObjectType}.
99 *
100 * @param id the identification of this type
101 * @param group the group of this type.
102 */
104 this.id = id;
105 this.group = group;
106 }
107
108 /**
109 * Gets the identification of this type.
110 *
111 * @return the identification of this type.
112 */
113 public final int getId() {
114 return id;
115 }
116
117 /**
118 * Gets the group of this type.
119 *
120 * @return the group of this type.
121 */
122 public final ObjectGroup getGroup() {
123 return group;
124 }
125
126 private static final ObjectType[] values = values();
127
128 /** A mutable {@link Map} of {@code int} keys to {@link ObjectType} values. */
129 private static final Int2ObjectMap<ObjectType> idToType = new Int2ObjectOpenHashMap<>(values.length);
130
131 /* Populates the {@link #values} cache. */
132 static {
133 for (ObjectType type : values) {
134 idToType.put(type.getId(), type);
135 }
136 }
137
138 /**
139 * Returns a {@link ObjectType} wrapped in an {@link Optional} for the
140 * specified {@code id}.
141 *
142 * @param id The game object type id.
143 * @return The optional game object type.
144 */
145 public static Optional<ObjectType> valueOf(final int id) {
146 return Optional.ofNullable(idToType.get(id));
147 }
148
149}
The group of an object, which indicates its general class (e.g.
GROUND_DECORATION
The ground decoration object group, which may block a tile.
WALL_DECORATION
The wall decoration object group, which never blocks a tile.
ROOFING
The roof parts that disappear on a camera angle.
INTERACTABLE_OBJECT
The interactable object group, for objects that can be clicked and interacted with.
WALL
The wall object group, which may block a tile.
DIAGONAL_BOTTOM_EDGE_CONNECTING_ROOF
Represents diagonal bottom edge connecting roofs.
static final Int2ObjectMap< ObjectType > idToType
A mutable Map of int keys to ObjectType values.
final ObjectGroup group
The ObjectGroup this type is associated to.
STRAIGHT_OUTSIDE_WALL_DECORATION
Represents straight outside wall decorations.
STRAIGHT_BOTTOM_EDGE_ROOF
Represents straight bottom edge roofs.
final int id
The identification of this type.
final int getId()
Gets the identification of this type.
STRAIGHT_BOTTOM_EDGE_CONNECTING_CORNER_ROOF
Represents straight bottom edge connecting corner roofs.
DIAGONAL_OUTSIDE_WALL_DECORATION
Represents diagonal outside wall decorations.
DIAGONAL_INSIDE_WALL_DECORATION
Represents diagonal inside wall decorations.
STRAIGHT_SLOPED_ROOF
Represents straight sloped roofs.
DIAGONAL_INTERIOR_WALL_DECORATION
Represents diagonal in wall decorations.
STRAIGHT_INSIDE_WALL_DECORATION
Represents straight inside wall decorations.
DIAGONAL_WALL
Represents diagonal walls, fences etc.
STRAIGHT_WALL
Represents straight walls, fences etc.
static Optional< ObjectType > valueOf(final int id)
Returns a ObjectType wrapped in an Optional for the specified id.
GENERAL_PROP
Represents all kinds of objects, trees, statues, signs, fountains etc.
WALKABLE_PROP
Represents ground objects like daisies etc.
DIAGONAL_SLOPED_CONNECTING_ROOF
Represents diagonal slope connecting roofs.
final ObjectGroup getGroup()
Gets the group of this type.
DIAGONAL_CORNER_WALL
Represents diagonal walls corner, fences etc connectors.
STRAIGHT_BOTTOM_EDGE_CONNECTING_ROOF
Represents straight bottom edge connecting roofs.
ENTIRE_WALL
Represents entire walls, fences etc corners.
GROUND_PROP
Represents ground decoration + map signs (quests, water fountains, shops, etc)
STRAIGHT_SLOPED_CORNER_CONNECTING_ROOF
Represents straight sloped corner connecting roofs.
STRAIGHT_FLAT_TOP_ROOF
Represents straight flat top roofs.
ObjectType(int id, ObjectGroup group)
Creates a new ObjectType.
WALL_CORNER
Represents straight wall corners, fences etc connectors.
STRAIGHT_SLOPED_CORNER_ROOF
Represents straight sloped corner roofs.
DIAGONAL_SLOPED_ROOF
Represents diagonal sloped roofs.