Skip to content

Commit a17e5be

Browse files
committed
Merge remote-tracking branch 'origin/api-12' into api-13
2 parents d4641e1 + f695db1 commit a17e5be

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
import org.spongepowered.api.world.weather.Weather;
290290
import org.spongepowered.api.world.weather.WeatherType;
291291
import org.spongepowered.api.world.weather.WeatherTypes;
292+
import org.spongepowered.math.matrix.Matrix4d;
292293
import org.spongepowered.math.vector.Vector2i;
293294
import org.spongepowered.math.vector.Vector3d;
294295
import org.spongepowered.math.vector.Vector3i;
@@ -576,6 +577,24 @@ public final class Keys {
576577
*/
577578
public static final Key<Value<BossBar>> BOSS_BAR = Keys.key(ResourceKey.sponge("boss_bar"), BossBar.class);
578579

580+
/**
581+
* The width of the interactable form of an {@link Entity}.
582+
*
583+
* <p>Together with {@link #BOUNDING_BOX_HEIGHT} this defines
584+
* the size of the {@link Entity}'s bounding box.</p>
585+
* Readonly(Entity.class) expect Interaction
586+
*/
587+
public static final Key<Value<Double>> BOUNDING_BOX_BASE_SIZE = Keys.key(ResourceKey.sponge("bounding_box_base_size"), Double.class);
588+
589+
/**
590+
* The height of the interactable form of an {@link Entity}.
591+
*
592+
* <p>Together with {@link #BOUNDING_BOX_BASE_SIZE} this defines
593+
* the size of the {@link Entity}'s bounding box.</p>
594+
* Readonly(Entity.class) expect Interaction
595+
*/
596+
public static final Key<Value<Double>> BOUNDING_BOX_HEIGHT = Keys.key(ResourceKey.sponge("bounding_box_height"), Double.class);
597+
579598
/**
580599
* The {@link BlockType}s able to be broken by an {@link ItemStack}.
581600
*/
@@ -2323,6 +2342,11 @@ public final class Keys {
23232342
*/
23242343
public static final Key<Value<ResourceKey>> MAP_WORLD = Keys.key(ResourceKey.sponge("map_world"), ResourceKey.class);
23252344

2345+
/**
2346+
* The {@link Matrix4d} of a {@link DisplayEntity}
2347+
*/
2348+
public static final Key<Value<Matrix4d>> MATRIX = Keys.key(ResourceKey.sponge("matrix"), Matrix4d.class);
2349+
23262350
/**
23272351
* The matter state of a {@link BlockState}
23282352
* Readonly

src/main/java/org/spongepowered/api/entity/Entity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,4 +659,22 @@ default Optional<Value.Mutable<Double>> swiftness() {
659659

660660
@Override
661661
HoverEvent<HoverEvent.ShowEntity> asHoverEvent(final UnaryOperator<HoverEvent.ShowEntity> op);
662+
663+
/**
664+
* {@link Keys#BOUNDING_BOX_BASE_SIZE}
665+
*
666+
* @return The bounding box base size of the entity
667+
*/
668+
default Value.Mutable<Double> boundingBoxBaseSize() {
669+
return this.requireValue(Keys.BOUNDING_BOX_BASE_SIZE).asMutable();
670+
}
671+
672+
/**
673+
* {@link Keys#BOUNDING_BOX_HEIGHT}
674+
*
675+
* @return The bounding box height of the entity
676+
*/
677+
default Value.Mutable<Double> boundingBoxHeight() {
678+
return this.requireValue(Keys.BOUNDING_BOX_HEIGHT).asMutable();
679+
}
662680
}

src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.spongepowered.api.entity.Entity;
2929
import org.spongepowered.api.util.Ticks;
3030
import org.spongepowered.api.util.Transform;
31+
import org.spongepowered.math.matrix.Matrix4d;
3132

3233
import java.util.Optional;
3334

@@ -125,6 +126,15 @@ default Double viewRange() {
125126
return this.require(Keys.VIEW_RANGE);
126127
}
127128

129+
/**
130+
* Returns the matrix.
131+
*
132+
* @return the matrix.
133+
*/
134+
default Matrix4d matrix() {
135+
return this.require(Keys.MATRIX);
136+
}
137+
128138
// TODO bounding box (maybe BASE_SIZE if this is not smth. else in the entity)
129139
// TODO glow_color_override -1 = use team color
130140

0 commit comments

Comments
 (0)