Properly protect chest_boats as vehicles

This commit is contained in:
Joo200 2022-07-07 21:04:44 +02:00
parent 6efdb1089e
commit 0d2ed8205f

View File

@ -101,8 +101,20 @@ public static boolean isRiddenOnUse(Entity entity) {
* @return true if the type is a vehicle type
*/
public static boolean isVehicle(EntityType type) {
return type == EntityType.BOAT
|| isMinecart(type);
return isBoat(type) || isMinecart(type);
}
/**
* Test whether the given entity type is a Boat type.
*
* @param type the type
* @return true if the type is a Boat type
*/
public static boolean isBoat(EntityType type) {
return switch(type) {
case BOAT, CHEST_BOAT -> true;
default -> false;
};
}
/**
@ -112,13 +124,11 @@ public static boolean isVehicle(EntityType type) {
* @return true if the type is a Minecart type
*/
public static boolean isMinecart(EntityType type) {
return type == EntityType.MINECART
|| type == EntityType.MINECART_CHEST
|| type == EntityType.MINECART_COMMAND
|| type == EntityType.MINECART_FURNACE
|| type == EntityType.MINECART_HOPPER
|| type == EntityType.MINECART_MOB_SPAWNER
|| type == EntityType.MINECART_TNT;
return switch(type) {
case MINECART, MINECART_CHEST, MINECART_COMMAND, MINECART_FURNACE,
MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_TNT -> true;
default -> false;
};
}
/**