[API-8] Reroute BlockSnapshot#empty into a factory, and add misc missing javadocs (#2150)

* Reroute BlockSnapshot#empty into a Factory

* Add missing javadocs

* Adjust for feedback

* Fix grammar error
This commit is contained in:
Christian Hughes authored and GitHub committed 2021-04-04 16:10:28 +00:00
1 parent 660b7a4041
commit a28e269ff6
11 files changed
+50 -4

No files matched your search

@@ -51,11 +51,11 @@ public interface BlockSnapshot extends LocatableSnapshot<BlockSnapshot> {
/**
* Represents a {@link BlockSnapshot} with the default state of
* {@link BlockTypes#AIR} and a {@link ServerLocation} that cannot be determined.
*
* @return An empty block snapshot
*/
Supplier<BlockSnapshot> NONE = BlockSnapshot::empty;
static BlockSnapshot empty() {
return Sponge.game().builderProvider().provide(Builder.class).empty();
return Sponge.game().factoryProvider().provide(Factory.class).empty();
}
/**
@@ -140,13 +140,16 @@ public interface BlockSnapshot extends LocatableSnapshot<BlockSnapshot> {
* Creates a new {@link BlockEntityArchetype} for use with {@link Schematic}s
* and placing the archetype in multiple locations.
*
* <p>If this blocksnapshot does not contain a block entity then this will
* <p>If this block snapshot does not contain a block entity then this will
* return {@link Optional#empty()}.</p>
*
* @return The created archetype for re-creating this block entity
*/
Optional<BlockEntityArchetype> createArchetype();
/**
* Represents a builder to create {@link BlockSnapshot}s.
*/
interface Builder extends SerializableDataHolderBuilder.Immutable<BlockSnapshot, Builder> {
/**
@@ -205,7 +208,20 @@ public interface BlockSnapshot extends LocatableSnapshot<BlockSnapshot> {
* @return This builder, for chaining
*/
Builder notifier(UUID uuid);
}
/**
* Represents a factory to create {@link BlockSnapshot}s.
*/
interface Factory {
/**
* Represents a {@link BlockSnapshot} with the default state of
* {@link BlockTypes#AIR}, and a default {@link ServerLocation}
* that is decided by the implementation.
*
* @return An empty block snapshot
*/
BlockSnapshot empty();
}
}
@@ -28,6 +28,9 @@ import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.DyeColor;
import org.spongepowered.api.data.value.Value;
/**
* Represents a Bed.
*/
public interface Bed extends BlockEntity {
/**
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity;
/**
* Represents a Bell.
*/
public interface Bell extends BlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity;
/**
* Represents a Conduit.
*/
public interface Conduit extends BlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity;
/**
* Represents a Jigsaw.
*/
public interface Jigsaw extends BlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity.carrier;
/**
* Represents a Barrel.
*/
public interface Barrel extends NameableCarrierBlockEntity {
}
@@ -24,5 +24,8 @@
*/
package org.spongepowered.api.block.entity.carrier;
/**
* Represents a Campfire.
*/
public interface Campfire extends CarrierBlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity.carrier.chest;
/**
* Represents a TrappedChest.
*/
public interface TrappedChest extends Chest {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity.carrier.furnace;
/**
* Represents a BlastFurnace.
*/
public interface BlastFurnace extends FurnaceBlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity.carrier.furnace;
/**
* Represents a Furnace.
*/
public interface Furnace extends FurnaceBlockEntity {
}
@@ -24,6 +24,9 @@
*/
package org.spongepowered.api.block.entity.carrier.furnace;
/**
* Represents a Smoker.
*/
public interface Smoker extends FurnaceBlockEntity {
}