forked from virt-mirrors/Sit
clamp sitting height values to -1 - 2
This commit is contained in:
parent
512cfcacb4
commit
85c8589808
1 changed files with 5 additions and 1 deletions
|
@ -8,8 +8,12 @@ public class SittingBlock extends CustomBlock {
|
||||||
@SerializedName("sitting-height")
|
@SerializedName("sitting-height")
|
||||||
private Double sittingHeight = 0.5;
|
private Double sittingHeight = 0.5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the sitting height of a block, limiting the size from -1 - 2
|
||||||
|
* @return the sitting height, clamped
|
||||||
|
*/
|
||||||
public Double getSittingHeight() {
|
public Double getSittingHeight() {
|
||||||
return sittingHeight;
|
return Math.max(-1.0f, Math.min(2.0f, sittingHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SittingBlock() {}
|
public SittingBlock() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue