mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Add hasCollision methods to various places
This commit is contained in:
parent
450f5fe793
commit
1de93777a5
4 changed files with 40 additions and 0 deletions
|
@ -4877,6 +4877,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
|||
}
|
||||
// Paper end - item default attributes API
|
||||
|
||||
// Paper start - isCollidable API
|
||||
/**
|
||||
* Checks if this material is collidable.
|
||||
*
|
||||
* @return true if collidable
|
||||
* @throws IllegalArgumentException if {@link #isBlock()} is false
|
||||
*/
|
||||
public boolean isCollidable() {
|
||||
if (this.isBlock()) {
|
||||
return this.asBlockType().hasCollision();
|
||||
}
|
||||
throw new IllegalArgumentException(this + " isn't a block type");
|
||||
}
|
||||
// Paper end - isCollidable API
|
||||
|
||||
/**
|
||||
* Do not use for any reason.
|
||||
*
|
||||
|
|
|
@ -486,6 +486,13 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
|||
* @return true if block is solid
|
||||
*/
|
||||
boolean isSolid();
|
||||
|
||||
/**
|
||||
* Checks if this block is collidable.
|
||||
*
|
||||
* @return true if collidable
|
||||
*/
|
||||
boolean isCollidable();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
|
|
|
@ -245,4 +245,13 @@ public interface BlockState extends Metadatable {
|
|||
* or 'virtual' (e.g. on an itemstack)
|
||||
*/
|
||||
boolean isPlaced();
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Checks if this block state is collidable.
|
||||
*
|
||||
* @return true if collidable
|
||||
*/
|
||||
boolean isCollidable();
|
||||
// Paper end
|
||||
}
|
||||
|
|
|
@ -3625,4 +3625,13 @@ public interface BlockType extends Keyed, Translatable, net.kyori.adventure.tran
|
|||
@Override
|
||||
@NotNull String getTranslationKey();
|
||||
// Paper end - add Translatable
|
||||
|
||||
// Paper start - hasCollision API
|
||||
/**
|
||||
* Checks if this block type has collision.
|
||||
* <p>
|
||||
* @return false if this block never has collision, true if it <b>might</b> have collision
|
||||
*/
|
||||
boolean hasCollision();
|
||||
// Paper end - hasCollision API
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue