24
24
*/
25
25
package org .spongepowered .api .block .entity ;
26
26
27
- import org .spongepowered .api .data .Keys ;
28
- import org .spongepowered .api .data .value .BoundedValue ;
29
- import org .spongepowered .api .data .value .Value ;
30
- import org .spongepowered .api .data .value .WeightedCollectionValue ;
31
- import org .spongepowered .api .entity .Entity ;
32
- import org .spongepowered .api .entity .EntityArchetype ;
33
- import org .spongepowered .api .entity .living .player .Player ;
34
- import org .spongepowered .api .util .weighted .WeightedSerializableObject ;
35
-
36
- import java .util .Random ;
27
+ import org .spongepowered .api .spawner .Spawner ;
37
28
38
29
/**
39
30
* Represents a Monster Spawner.
40
31
*/
41
- public interface MobSpawner extends BlockEntity {
32
+ public interface MobSpawner extends BlockEntity , Spawner {
42
33
43
34
/**
44
35
* Trigger an immediate spawn of a batch of entities.
@@ -49,109 +40,4 @@ public interface MobSpawner extends BlockEntity {
49
40
* @param force Whether to ignore spawning restrictions
50
41
*/
51
42
void spawnEntityBatchImmediately (boolean force );
52
-
53
- /**
54
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the remaining delay before
55
- * a new attempt at spawning an {@link Entity} is made.
56
- *
57
- * @return The immutable bounded value for the remaining delay
58
- */
59
- default BoundedValue .Mutable <Integer > remainingDelay () {
60
- return getValue (Keys .SPAWNER_REMAINING_DELAY ).get ().asMutable ();
61
- }
62
-
63
- /**
64
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the minimum spawn delay
65
- * required between attempts to spawn an {@link Entity}.
66
- *
67
- * @return The bounded value of the minimum spawn delay
68
- */
69
- default BoundedValue .Mutable <Integer > minimumSpawnDelay () {
70
- return getValue (Keys .SPAWNER_MINIMUM_DELAY ).get ().asMutable ();
71
- }
72
-
73
- /**
74
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the maximum spawn delay
75
- * required between attempts to spawn an {@link Entity}.
76
- *
77
- * @return The bounded value of the maximum spawn delay
78
- */
79
- default BoundedValue .Mutable <Integer > maximumSpawnDelay () {
80
- return getValue (Keys .SPAWNER_MAXIMUM_DELAY ).get ().asMutable ();
81
- }
82
-
83
- /**
84
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the count of successful
85
- * spawns of all {@link Entity} instances from the owning spawner. This
86
- * count is simply a total count, there is no limitation on how many
87
- * attempts are made to spawn an {@link Entity}.
88
- *
89
- * @return The immutable bounded value
90
- */
91
- default BoundedValue .Mutable <Integer > spawnCount () {
92
- return getValue (Keys .SPAWNER_SPAWN_COUNT ).get ().asMutable ();
93
- }
94
-
95
- /**
96
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the limitation on the number
97
- * of nearby {@link Entity} instances can exist near the owning spawner. The
98
- * limitation is that if there are more {@link Entity} instances than the
99
- * provided value, no attempts to spawn a new {@link Entity} will be made.
100
- *
101
- * @return The bounded value of the maximum supported nearby entities
102
- */
103
- default BoundedValue .Mutable <Integer > maximumNearbyEntities () {
104
- return getValue (Keys .SPAWNER_MAXIMUM_NEARBY_ENTITIES ).get ().asMutable ();
105
- }
106
-
107
- /**
108
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the minimum range a
109
- * {@link Player} must remain in proximity of the spawner, such that if a
110
- * {@link Player} is NOT within the provided range, no attempts to spawn an
111
- * {@link Entity} is made.
112
- *
113
- * @return The value of the required player range to spawn entities
114
- */
115
- default BoundedValue .Mutable <Integer > requiredPlayerRange () {
116
- return getValue (Keys .SPAWNER_REQUIRED_PLAYER_RANGE ).get ().asMutable ();
117
- }
118
-
119
- /**
120
- * Gets the {@link org.spongepowered.api.data.value.BoundedValue.Mutable} for the maximum range that an
121
- * {@link Entity} can be spawned from the spawner.
122
- *
123
- * @return The immutable value of the maximum spawn range an entity can be
124
- * spawned
125
- */
126
- default BoundedValue .Mutable <Integer > spawnRange () {
127
- return getValue (Keys .SPAWNER_SPAWN_RANGE ).get ().asMutable ();
128
- }
129
-
130
- /**
131
- * Gets the {@link org.spongepowered.api.data.value.Value.Mutable}
132
- * for the overridden
133
- * {@link WeightedSerializableObject}{@code <EntitySnapshot>} to spawn
134
- * next. If possible, the next entity to spawn may be chosen from the
135
- * already provided {@link #possibleEntitiesToSpawn()}.
136
- *
137
- * @return The next possible entity to spawn
138
- */
139
- default Value .Mutable <WeightedSerializableObject <EntityArchetype >> nextEntityToSpawn () {
140
- return getValue (Keys .SPAWNER_NEXT_ENTITY_TO_SPAWN ).get ().asMutable ();
141
- }
142
-
143
- /**
144
- * Gets the {@link org.spongepowered.api.data.value.WeightedCollectionValue.Mutable} of all possible
145
- * {@link Entity} instances that can be spawned by the spawner. As they
146
- * are all {@link WeightedSerializableObject}{@code <EntitySnapshot>}
147
- * instances, their weight is defined as a {@link Random} to determine
148
- * the next {@link Entity} that will be spawned, unless overriden by
149
- * {@link #nextEntityToSpawn()}.
150
- *
151
- * @return The immutable weighted entity collection value of entities
152
- */
153
- default WeightedCollectionValue .Mutable <EntityArchetype > possibleEntitiesToSpawn () {
154
- return getValue (Keys .SPAWNER_ENTITIES ).get ().asMutable ();
155
- }
156
-
157
43
}
0 commit comments