Skip to content

Commit 5617f1d

Browse files
committed
BackwardsCompat: WrapperPlayServerSpawnEntity
1 parent f88320f commit 5617f1d

File tree

2 files changed

+152
-116
lines changed

2 files changed

+152
-116
lines changed

PacketWrapper/src/main/java/com/comphenix/packetwrapper/ConversionUtil.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,28 @@ public static int floor(double number) {
3737
final int intNumber;
3838
return number < (double) (intNumber = (int) number) ? intNumber - 1 : intNumber;
3939
}
40+
41+
/**
42+
* Performs a fast flooring operation on a float.
43+
*
44+
* @param number number to floor to int
45+
* @return number floored
46+
*/
47+
public static int floor(float number) {
48+
final int intNumber;
49+
return number < (float) (intNumber = (int) number) ? intNumber - 1 : intNumber;
50+
}
51+
52+
/**
53+
* Fits the specified number between the given bounds.
54+
*
55+
* @param number number to fit between the other two
56+
* @param min minimal allowed number
57+
* @param max maximal allowed number
58+
* @return number fitting between the specified ones
59+
*/
60+
public static double fitBetween(final double number, final double min, final double max) {
61+
final int intNumber;
62+
return number < (double) (intNumber = (int) number) ? intNumber - 1 : intNumber;
63+
}
4064
}

0 commit comments

Comments
 (0)