Skip to content

Commit cc4bcf4

Browse files
committed
Merge branch 'api-8' into api-9
2 parents 34c84ec + 44f1788 commit cc4bcf4

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

src/main/java/org/spongepowered/api/ResourceKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static Builder builder() {
120120
* @return A new resource key
121121
*/
122122
static ResourceKey of(final String namespace, final String value) {
123-
return Sponge.game().factoryProvider().provide(Factory.class).of(Objects.requireNonNull(namespace, "mamespace"), Objects.requireNonNull(value, "value"));
123+
return Sponge.game().factoryProvider().provide(Factory.class).of(Objects.requireNonNull(namespace, "namespace"), Objects.requireNonNull(value, "value"));
124124
}
125125

126126
/**

src/main/java/org/spongepowered/api/block/BlockState.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@ default BlockState mirror(final Supplier<? extends Mirror> mirror) {
157157
return this.mirror(mirror.get());
158158
}
159159

160+
/**
161+
* Gets a string representation of this block state, including the block type and the properties.
162+
* Do not confuse with {@link #toString} which is implementation specific.
163+
*
164+
* @return A string representation of this block state.
165+
*/
166+
String asString();
167+
160168
/**
161169
* An {@link org.spongepowered.api.data.DataHolderBuilder.Immutable} for a {@link BlockState}. Just like the
162170
* {@link org.spongepowered.api.data.DataHolderBuilder.Immutable}, the {@link Value}s passed in to

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,28 @@ public final class Keys {
764764
*/
765765
public static final Key<Value<Ticks>> END_GATEWAY_AGE = Keys.key(ResourceKey.sponge("end_gateway_age"), Ticks.class);
766766

767+
/**
768+
* The {@link EntityType entity type} of a spawn egg, which may be one of
769+
* several based on {@link ItemTypes#ZOMBIE_SPAWN_EGG}, etc. It is not
770+
* guaranteed that the type of entity is the same as the one that will be
771+
* spawned when used. It is likely unable to change the type of entity on
772+
* an {@link ItemStack}, but it is possible to change the
773+
* {@link EntityArchetype archetype} by using {@link #ENTITY_TO_SPAWN}.
774+
*
775+
* @see #ENTITY_TO_SPAWN
776+
*/
777+
@SuppressWarnings("unchecked")
778+
public static final Key<Value<EntityType<?>>> ENTITY_TYPE = Keys.key(ResourceKey.sponge("entity_type"), (Class) EntityType.class);
779+
780+
/**
781+
* The {@link EntityArchetype} to spawn from any spawn egg, such as a
782+
* {@link ItemTypes#ZOMBIE_SPAWN_EGG} or {@link ItemTypes#CREEPER_SPAWN_EGG}.
783+
* <p>The {@link #ENTITY_TYPE} is not guaranteed to be the same as the
784+
* {@link EntityArchetype#type()} returned, but the spawned entity will be
785+
* based on the {@link EntityArchetype} returned here.
786+
*/
787+
public static final Key<Value<EntityArchetype>> ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("entity_to_spawn"), EntityArchetype.class);
788+
767789
/**
768790
* The {@link EquipmentType} that the target inventory supports. This usually applies to {@link EquipmentSlot}s.
769791
* or

src/main/java/org/spongepowered/api/item/inventory/Container.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*/
2525
package org.spongepowered.api.item.inventory;
2626

27-
import org.spongepowered.api.entity.living.player.Player;
2827
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
28+
import org.spongepowered.api.item.inventory.menu.InventoryMenu;
2929

3030
import java.util.List;
3131
import java.util.Optional;
@@ -98,4 +98,11 @@ public interface Container extends Inventory {
9898
*/
9999
ContainerType type();
100100

101+
/**
102+
* Returns the {@link InventoryMenu} if this container has been opened by one.
103+
*
104+
* @return the current InventoryMenu if present
105+
*/
106+
Optional<InventoryMenu> currentMenu();
107+
101108
}

src/main/java/org/spongepowered/api/item/inventory/menu/InventoryMenu.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ static InventoryMenu of(ViewableInventory inventory) {
7878
*/
7979
void setTitle(Component title);
8080

81+
/**
82+
* Returns the title of this menu if set.
83+
*
84+
* @return the title of this menu if set.
85+
*/
86+
Optional<Component> title();
87+
8188
/**
8289
* Registers click callbacks. Unregisters previously registered handler of the same type.
8390
* <p>Return false in the handler to prevent changes.</p>

0 commit comments

Comments
 (0)