13
0
geforkt von Mirrors/Paper

API to get a BlockState without a snapshot

This allows you to get a BlockState without creating a snapshot, operating
on the real tile entity.

This is useful for where performance is needed
Dieser Commit ist enthalten in:
Aikar 2017-11-06 21:10:01 -05:00
Ursprung 74e0518b1a
Commit 8306cc5b4f
2 geänderte Dateien mit 24 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -272,6 +272,16 @@ public interface Block extends Metadatable, Translatable {
@NotNull
BlockState getState();
// Paper start
/**
* @see #getState() optionally disables use of snapshot, to operate on real block data
* @param useSnapshot if this block is a TE, should we create a fully copy of the TileEntity
* @return BlockState with the current state of this block
*/
@NotNull
BlockState getState(boolean useSnapshot);
// Paper end
/**
* Returns the biome that this block resides in
*

Datei anzeigen

@ -36,4 +36,18 @@ public interface TileState extends BlockState, PersistentDataHolder {
@NotNull
@Override
PersistentDataContainer getPersistentDataContainer();
// Paper start
/**
* Checks if this TileState is a snapshot or a live
* representation of the underlying tile entity.
* <p>
* NOTE: You may still have to call {@link BlockState#update()} on
* live representations to update any visuals on the block.
*
* @return true if this is a snapshot
* @see Block#getState(boolean)
*/
boolean isSnapshot();
// Paper end
}