RuneHive-Game
Loading...
Searching...
No Matches
ObjectGroup.java
Go to the documentation of this file.
1package com.runehive.game.world.object;
2
3import java.util.Arrays;
4import java.util.Optional;
5
6/**
7 * The group of an object, which indicates its general class (e.g. if it's a
8 * wall, or a floor decoration).
9 *
10 * @author Artem Batutin <artembatutin@gmail.com>
11 * @author Major
12 * @author Scu11
13 */
14public enum ObjectGroup {
15
16 /** The wall object group, which may block a tile. */
17 WALL(0),
18
19 /** The wall decoration object group, which never blocks a tile. */
21
22 /**
23 * The interactable object group, for objects that can be clicked and
24 * interacted with.
25 */
27
28 /** The ground decoration object group, which may block a tile. */
30
31 /** The roof parts that disappear on a camera angle. */
33
34 /**
35 * Attempts to find the ObjectGroup with the specified integer value.
36 *
37 * @param value The integer value of the ObjectGroup.
38 * @return The {@link Optional} possibly containing the ObjectGroup, if
39 * found.
40 */
41 public static Optional<ObjectGroup> valueOf(int value) {
42 return Arrays.stream(values()).filter(group -> group.value == value).findAny();
43 }
44
45 /** The integer value of the group. */
46 private final int value;
47
48 /**
49 * Creates the ObjectGroup.
50 *
51 * @param value The integer value of the group. Must be unique.
52 */
54 this.value = value;
55 }
56
57 /**
58 * Gets the value of this ObjectGroup.
59 *
60 * @return The value.
61 */
62 public int getValue() {
63 return value;
64 }
65
66}
ObjectGroup(int value)
Creates the ObjectGroup.
static Optional< ObjectGroup > valueOf(int value)
Attempts to find the ObjectGroup with the specified integer value.
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.
final int value
The integer value of the group.
WALL
The wall object group, which may block a tile.
int getValue()
Gets the value of this ObjectGroup.