geforkt von Mirrors/Paper
Add hasCollision methods to various places
Dieser Commit ist enthalten in:
Ursprung
450f5fe793
Commit
1de93777a5
@ -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
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren