X-Git-Url: https://deadsoftware.ru/gitweb?p=cavedroid.git;a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGameProc.java;h=08f44251f6ed20bdca7fa9d38cbcab54c799a647;hp=f79694f713159318b9fb19b5ad2c634d70dc03f4;hb=be2690f1dee10f68a5ce6d576ace13c825ac5d15;hpb=feb58daa2c3e8126871e9d4f26e978d2fc1fb01c diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index f79694f..08f4425 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -34,7 +34,7 @@ public class GameProc implements Serializable { public transient GamePhysics physics; public int curX, curY; - public int invSlot; + public int slot; public int ctrlMode; public int creativeScroll, maxCreativeScroll; public int blockDmg = 0; @@ -62,7 +62,7 @@ public class GameProc implements Serializable { renderer = new GameRenderer(this, 480, 480 * ((float) GameScreen.getHeight() / GameScreen.getWidth())); } - maxCreativeScroll = Items.items.size() / 8; + maxCreativeScroll = GameItems.getItemsSize() / 8; GameSaver.save(this); } @@ -78,16 +78,16 @@ public class GameProc implements Serializable { private boolean isAutoselectable(int x, int y) { return (world.getForeMap(x, y) > 0 && - Items.blocks.getValueAt(world.getForeMap(x, y)).coll); + GameItems.getBlock(world.getForeMap(x, y)).coll); } private void moveCursor() { int pastX = curX, pastY = curY; if (ctrlMode == 0 && CaveGame.TOUCH) { - curX = (int) (player.position.x + player.texWidth / 2) / 16; + curX = (int) (player.pos.x + player.texWidth / 2) / 16; if (player.dir == 0) curX--; else curX++; - curY = (int) (player.position.y + player.texWidth) / 16; + curY = (int) (player.pos.y + player.texWidth) / 16; if (!isAutoselectable(curX, curY)) { curY++; } @@ -114,22 +114,22 @@ public class GameProc implements Serializable { if (curY < 0) curY = 0; if (curY >= world.getHeight()) curY = world.getHeight() - 1; if (ctrlMode == 1) { - if (curX * 16 + 8 < player.position.x + player.texWidth / 2) + if (curX * 16 + 8 < player.pos.x + player.texWidth / 2) player.dir = 0; - if (curX * 16 + 8 > player.position.x + player.texWidth / 2) + if (curX * 16 + 8 > player.pos.x + player.texWidth / 2) player.dir = 1; } } private void updateFluids(int x, int y) { - if (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y) != 8) { + if (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y) != 8) { if (world.getForeMap(x, y) == 60) { - if (!Items.isWater(world.getForeMap(x, y - 1))) + if (!GameItems.isWater(world.getForeMap(x, y - 1))) world.setForeMap(x, y, world.getForeMap(x, y) + 1); - } else if ((!Items.isWater(world.getForeMap(x - 1, y)) || - (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) && - (!Items.isWater(world.getForeMap(x + 1, y)) || - (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) { + } else if ((!GameItems.isWater(world.getForeMap(x - 1, y)) || + (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) && + (!GameItems.isWater(world.getForeMap(x + 1, y)) || + (GameItems.isWater(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) { world.setForeMap(x, y, world.getForeMap(x, y) + 1); } if (world.getForeMap(x, y) > 63) world.setForeMap(x, y, 0); @@ -137,30 +137,30 @@ public class GameProc implements Serializable { if (world.getForeMap(x, y) == 8 || world.getForeMap(x, y) == 60) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 60); updateBlock(x, y + 2); - } else if (Items.isLava(world.getForeMap(x, y + 1))) { + } else if (GameItems.isLava(world.getForeMap(x, y + 1))) { if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4); else world.setForeMap(x, y + 1, 68); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) || - (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) || + (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 61)) { world.setForeMap(x + 1, y, 61); updateBlock(x + 1, y + 1); - } else if (Items.isLava(world.getForeMap(x + 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x + 1, y))) { if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4); else world.setForeMap(x + 1, y, 68); } else if (world.getForeMap(x + 1, y) == 61 && (world.getForeMap(x + 2, y) == 8 || world.getForeMap(x + 2, y) == 60)) world.setForeMap(x + 1, y, 8); if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) || - (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) || + (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 61)) { world.setForeMap(x - 1, y, 61); updateBlock(x - 1, y + 1); - } else if (Items.isLava(world.getForeMap(x - 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x - 1, y))) { if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4); else world.setForeMap(x - 1, y, 68); } else if (world.getForeMap(x - 1, y) == 61 && (world.getForeMap(x - 2, y) == 8 || world.getForeMap(x - 2, y) == 60)) @@ -170,29 +170,29 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 61) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 60); updateBlock(x, y + 2); - } else if (Items.isLava(world.getForeMap(x, y + 1))) { + } else if (GameItems.isLava(world.getForeMap(x, y + 1))) { if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4); else world.setForeMap(x, y + 1, 68); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) || - (Items.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) || + (GameItems.isWater(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 62)) { world.setForeMap(x + 1, y, 62); updateBlock(x + 1, y + 1); - } else if (Items.isLava(world.getForeMap(x + 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x + 1, y))) { if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4); else world.setForeMap(x + 1, y, 68); } if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) || - (Items.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) || + (GameItems.isWater(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 62)) { world.setForeMap(x - 1, y, 62); updateBlock(x - 1, y + 1); - } else if (Items.isLava(world.getForeMap(x - 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x - 1, y))) { if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4); else world.setForeMap(x - 1, y, 68); } @@ -201,27 +201,27 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 62) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 60); updateBlock(x, y + 2); - } else if (Items.isLava(world.getForeMap(x, y + 1))) { + } else if (GameItems.isLava(world.getForeMap(x, y + 1))) { if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4); else world.setForeMap(x, y + 1, 68); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y)))) { world.setForeMap(x + 1, y, 63); updateBlock(x + 1, y + 1); - } else if (Items.isLava(world.getForeMap(x + 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x + 1, y))) { if (world.getForeMap(x + 1, y) > 9) world.setForeMap(x + 1, y, 4); else world.setForeMap(x + 1, y, 68); } if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y)))) { world.setForeMap(x - 1, y, 63); updateBlock(x - 1, y + 1); - } else if (Items.isLava(world.getForeMap(x - 1, y))) { + } else if (GameItems.isLava(world.getForeMap(x - 1, y))) { if (world.getForeMap(x - 1, y) > 9) world.setForeMap(x - 1, y, 4); else world.setForeMap(x - 1, y, 68); } @@ -230,25 +230,25 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 63) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 61 && world.getForeMap(x, y + 1) <= 63) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 60); updateBlock(x, y + 2); - } else if (Items.isLava(world.getForeMap(x, y + 1))) { + } else if (GameItems.isLava(world.getForeMap(x, y + 1))) { if (world.getForeMap(x, y + 1) > 9) world.setForeMap(x, y + 1, 4); else world.setForeMap(x, y + 1, 68); } return; } - if (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y) != 9) { + if (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y) != 9) { if (world.getForeMap(x, y) == 64) { - if (!Items.isLava(world.getForeMap(x, y - 1))) + if (!GameItems.isLava(world.getForeMap(x, y - 1))) world.setForeMap(x, y, world.getForeMap(x, y) + 1); - } else if ((!Items.isLava(world.getForeMap(x, y - 1))) && - (!Items.isLava(world.getForeMap(x - 1, y)) || - (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) && - (!Items.isLava(world.getForeMap(x + 1, y)) || - (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) { + } else if ((!GameItems.isLava(world.getForeMap(x, y - 1))) && + (!GameItems.isLava(world.getForeMap(x - 1, y)) || + (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x - 1, y) >= world.getForeMap(x, y))) && + (!GameItems.isLava(world.getForeMap(x + 1, y)) || + (GameItems.isLava(world.getForeMap(x, y)) && world.getForeMap(x + 1, y) >= world.getForeMap(x, y)))) { world.setForeMap(x, y, world.getForeMap(x, y) + 1); } if (world.getForeMap(x, y) > 67) world.setForeMap(x, y, 0); @@ -256,27 +256,27 @@ public class GameProc implements Serializable { if (world.getForeMap(x, y) == 9 || world.getForeMap(x, y) == 64) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 64); updateBlock(x, y + 2); - } else if (Items.isWater(world.getForeMap(x, y + 1))) { + } else if (GameItems.isWater(world.getForeMap(x, y + 1))) { world.setForeMap(x, y + 1, 1); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) || - (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) || + (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 65)) { world.setForeMap(x + 1, y, 65); updateBlock(x + 1, y + 1); - } else if (Items.isWater(world.getForeMap(x + 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x + 1, y))) { world.setForeMap(x + 1, y, 1); } if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) || - (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) || + (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 65)) { world.setForeMap(x - 1, y, 65); updateBlock(x - 1, y + 1); - } else if (Items.isWater(world.getForeMap(x - 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x - 1, y))) { world.setForeMap(x - 1, y, 1); } } @@ -284,27 +284,27 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 65) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 64); updateBlock(x, y + 2); - } else if (Items.isWater(world.getForeMap(x, y + 1))) { + } else if (GameItems.isWater(world.getForeMap(x, y + 1))) { world.setForeMap(x, y + 1, 1); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y))) || - (Items.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y))) || + (GameItems.isLava(world.getForeMap(x + 1, y)) && world.getForeMap(x + 1, y) > 66)) { world.setForeMap(x + 1, y, 66); updateBlock(x + 1, y + 1); - } else if (Items.isWater(world.getForeMap(x + 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x + 1, y))) { world.setForeMap(x + 1, y, 1); } if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y))) || - (Items.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y))) || + (GameItems.isLava(world.getForeMap(x - 1, y)) && world.getForeMap(x - 1, y) > 66)) { world.setForeMap(x - 1, y, 66); updateBlock(x - 1, y + 1); - } else if (Items.isWater(world.getForeMap(x - 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x - 1, y))) { world.setForeMap(x - 1, y, 1); } } @@ -312,25 +312,25 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 66) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 64); updateBlock(x, y + 2); - } else if (Items.isWater(world.getForeMap(x, y + 1))) { + } else if (GameItems.isWater(world.getForeMap(x, y + 1))) { world.setForeMap(x, y + 1, 1); - } else if (Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + } else if (GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { if (world.getForeMap(x + 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x + 1, y)).coll && !Items.isFluid(world.getForeMap(x + 1, y)))) { + (!GameItems.getBlock(world.getForeMap(x + 1, y)).coll && !GameItems.isFluid(world.getForeMap(x + 1, y)))) { world.setForeMap(x + 1, y, 67); updateBlock(x + 1, y + 1); - } else if (Items.isWater(world.getForeMap(x + 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x + 1, y))) { world.setForeMap(x + 1, y, 1); } if (world.getForeMap(x - 1, y) == 0 || - (!Items.blocks.getValueAt(world.getForeMap(x - 1, y)).coll && !Items.isFluid(world.getForeMap(x - 1, y)))) { + (!GameItems.getBlock(world.getForeMap(x - 1, y)).coll && !GameItems.isFluid(world.getForeMap(x - 1, y)))) { world.setForeMap(x - 1, y, 67); updateBlock(x - 1, y + 1); - } else if (Items.isWater(world.getForeMap(x - 1, y))) { + } else if (GameItems.isWater(world.getForeMap(x - 1, y))) { world.setForeMap(x - 1, y, 1); } } @@ -338,10 +338,10 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 67) { if (world.getForeMap(x, y + 1) == 0 || (world.getForeMap(x, y + 1) >= 65 && world.getForeMap(x, y + 1) <= 67) || - (!Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll && !Items.isFluid(world.getForeMap(x, y + 1)))) { + (!GameItems.getBlock(world.getForeMap(x, y + 1)).coll && !GameItems.isFluid(world.getForeMap(x, y + 1)))) { world.setForeMap(x, y + 1, 64); updateBlock(x, y + 2); - } else if (Items.isWater(world.getForeMap(x, y + 1))) { + } else if (GameItems.isWater(world.getForeMap(x, y + 1))) { world.setForeMap(x, y + 1, 1); } return; @@ -350,7 +350,7 @@ public class GameProc implements Serializable { private void updateBlock(int x, int y) { if (world.getForeMap(x, y) == 10) { - if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { world.setForeMap(x, y, 0); mobs.add(new FallingSand(x * 16, y * 16)); updateBlock(x, y - 1); @@ -358,7 +358,7 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 11) { - if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { world.setForeMap(x, y, 0); mobs.add(new FallingGravel(x * 16, y * 16)); updateBlock(x, y - 1); @@ -366,24 +366,24 @@ public class GameProc implements Serializable { } if (world.getForeMap(x, y) == 59) { - if (world.getForeMap(x, y + 1) == 0 || !Items.blocks.getValueAt(world.getForeMap(x, y + 1)).coll) { + if (world.getForeMap(x, y + 1) == 0 || !GameItems.getBlock(world.getForeMap(x, y + 1)).coll) { world.setForeMap(x, y, 0); updateBlock(x, y - 1); } } if (world.getForeMap(x, y) == 2) { - if (world.getForeMap(x, y - 1) > 0 && (Items.blocks.getValueAt(world.getForeMap(x, y - 1)).coll || - Items.isFluid(world.getForeMap(x, y - 1)))) { + if (world.getForeMap(x, y - 1) > 0 && (GameItems.getBlock(world.getForeMap(x, y - 1)).coll || + GameItems.isFluid(world.getForeMap(x, y - 1)))) { world.setForeMap(x, y, 3); } } } public void useItem(int x, int y, int id, boolean bg) { - if (id > 0 && Items.items.get(id).getType() == 0) { - if (!bg) world.placeToForeground(x, y, Items.items.get(id).getBlock()); - else world.placeToBackground(x, y, Items.items.get(id).getBlock()); + if (id > 0 && GameItems.getItem(id).getType() == 0) { + if (!bg) world.placeToForeground(x, y, GameItems.getItem(id).getBlock()); + else world.placeToBackground(x, y, GameItems.getItem(id).getBlock()); } } @@ -410,11 +410,11 @@ public class GameProc implements Serializable { if (isTouchDown && touchDownBtn == Input.Buttons.LEFT) { if (world.getForeMap(curX, curY) > 0 && - Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp() >= 0) {// || world.getBackMap(curX, curY) > 0) { + GameItems.getBlock(world.getForeMap(curX, curY)).getHp() >= 0) {// || world.getBackMap(curX, curY) > 0) { blockDmg++; - if (blockDmg >= Items.blocks.getValueAt(world.getForeMap(curX, curY)).getHp()) { - if (Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop() > 0) - drops.add(new Drop(curX * 16 + 4, curY * 16 + 4, Items.blocks.getValueAt(world.getForeMap(curX, curY)).getDrop())); + if (blockDmg >= GameItems.getBlock(world.getForeMap(curX, curY)).getHp()) { + if (GameItems.getBlock(world.getForeMap(curX, curY)).getDrop() > 0) + drops.add(new Drop(curX * 16 + 4, curY * 16 + 4, GameItems.getBlock(world.getForeMap(curX, curY)).getDrop())); world.placeToForeground(curX, curY, 0); blockDmg = 0; } @@ -423,7 +423,7 @@ public class GameProc implements Serializable { if (isTouchDown && TimeUtils.timeSinceMillis(touchDownTime) > 500) { if (touchDownBtn == Input.Buttons.RIGHT) { - useItem(curX, curY, player.inventory[invSlot], true); + useItem(curX, curY, player.inv[slot], true); isTouchDown = false; } else if (touchDownY < Assets.invBar.getRegionHeight() && touchDownX > renderer.getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 &&