diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java
index 1bbb03cf1997384679f975411c7b958515b834e4..c3e020791570a456bf906f41165d8a76cb654171 100644 (file)
public class GameItems {
- private static HashMap<String, Integer> blocksIds = new HashMap<String, Integer>();
- private static HashMap<String, Integer> itemsIds = new HashMap<String, Integer>();
+ private static HashMap<String, Integer> blocksIds = new HashMap<>();
+ private static HashMap<String, Integer> itemsIds = new HashMap<>();
- private static ArrayMap<String, Block> blocks = new ArrayMap<String, Block>();
- private static ArrayMap<String, Item> items = new ArrayMap<String, Item>();
+ private static ArrayMap<String, Block> blocks = new ArrayMap<>();
+ private static ArrayMap<String, Item> items = new ArrayMap<>();
public static boolean isFluid(int id) {
return getBlock(id).isFluid();
return getBlock(id).getMeta().equals("slab");
}
+ public static boolean fluidCanFlowThere(int thisId, int thatId) {
+ return thatId == 0 || (!getBlock(thatId).hasCollision() && !isFluid(thatId)) ||
+ (isWater(thisId) && isWater(thatId) && thatId >= thisId) ||
+ (isLava(thisId) && isLava(thatId) && thatId >= thisId);
+ }
+
public static Block getBlock(int id) {
return blocks.getValueAt(id);
}