From: fred-boy Date: Sun, 30 Sep 2018 14:28:47 +0000 (+0700) Subject: Rename Items -> GameItems X-Git-Tag: alpha0.4~80 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=5fd3c5a7647fbf36de84ff184f58fad5e0e30644;p=cavedroid.git Rename Items -> GameItems Make items and blocks private --- diff --git a/core/src/ru/deadsoftware/cavecraft/GameScreen.java b/core/src/ru/deadsoftware/cavecraft/GameScreen.java index 541bc8e..545ee3f 100644 --- a/core/src/ru/deadsoftware/cavecraft/GameScreen.java +++ b/core/src/ru/deadsoftware/cavecraft/GameScreen.java @@ -2,9 +2,9 @@ package ru.deadsoftware.cavecraft; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; +import ru.deadsoftware.cavecraft.game.GameItems; import ru.deadsoftware.cavecraft.game.GameProc; import ru.deadsoftware.cavecraft.game.GameSaver; -import ru.deadsoftware.cavecraft.game.Items; import ru.deadsoftware.cavecraft.menu.MenuRenderer; import ru.deadsoftware.cavecraft.misc.*; @@ -19,7 +19,7 @@ public class GameScreen implements Screen { public GameScreen() { Assets.load(); - Items.load(); + GameItems.load(); menuRenderer = new MenuRenderer(CaveGame.TOUCH ? 320 : 480); renderer = menuRenderer; Gdx.input.setInputProcessor(new InputHandlerMenu(menuRenderer)); diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java index 608ed9f..76e4505 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java @@ -17,7 +17,7 @@ public class GameInput { } private boolean checkSwim() { - return (Items.isFluid(gp.world.getForeMap((int) (gp.player.position.x + gp.player.width / 2) / 16, + return (GameItems.isFluid(gp.world.getForeMap((int) (gp.player.position.x + gp.player.width / 2) / 16, (int) (gp.player.position.y + gp.player.height / 4 * 3) / 16))); } @@ -147,7 +147,7 @@ public class GameInput { int iy = (int) (screenY - (gp.renderer.getHeight() / 2 - Assets.creativeInv.getRegionHeight() / 2 + 18)) / 18; int item = gp.creativeScroll * 8 + (ix + iy * 8); if (ix >= 8 || ix < 0 || iy < 0 || iy >= 5) item = -1; - if (item >= 0 && item < Items.items.size()) { + if (item >= 0 && item < GameItems.getItemsSize()) { for (int i = 8; i > 0; i--) { gp.player.inventory[i] = gp.player.inventory[i - 1]; } diff --git a/core/src/ru/deadsoftware/cavecraft/game/Items.java b/core/src/ru/deadsoftware/cavecraft/game/GameItems.java similarity index 94% rename from core/src/ru/deadsoftware/cavecraft/game/Items.java rename to core/src/ru/deadsoftware/cavecraft/game/GameItems.java index 2853b7b..6a39f05 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/Items.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameItems.java @@ -6,10 +6,10 @@ import ru.deadsoftware.cavecraft.game.objects.Item; import java.util.ArrayList; -public class Items { +public class GameItems { - public static ArrayMap blocks = new ArrayMap(); - public static ArrayList items = new ArrayList(); + private static ArrayMap blocks = new ArrayMap(); + private static ArrayList items = new ArrayList(); public static boolean isFluid(int bl) { return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65 || bl == 66 || bl == 67); @@ -27,6 +27,26 @@ public class Items { return (bl == 51 || bl == 53 || bl == 54 || bl == 55 || bl == 56 || bl == 58); } + public static String getBlockKey(int id) { + return blocks.getKeyAt(id); + } + + public static Block getBlock(int id) { + return blocks.getValueAt(id); + } + + public static Item getItem(int id) { + return items.get(id); + } + + public static int getBlocksSize() { + return blocks.size; + } + + public static int getItemsSize() { + return items.size(); + } + public static void loadItems() { //0 items.add(null); diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java index fe0765a..d78d319 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java @@ -38,8 +38,8 @@ public class GamePhysics { default: bl = 0; } - return (bl > 0 && Items.blocks.getValueAt(bl).toJump() && - (rect.y + rect.height) - Items.blocks.getValueAt(bl).getRect((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16)).y > 8); + return (bl > 0 && GameItems.getBlock(bl).toJump() && + (rect.y + rect.height) - GameItems.getBlock(bl).getRect((int) ((rect.x - 8) / 16), (int) ((rect.y + rect.height - 8) / 16)).y > 8); } private boolean checkColl(Rectangle rect) { @@ -53,8 +53,8 @@ public class GamePhysics { for (int y = minY; y < maxY; y++) { for (int x = minX; x < maxX; x++) { bl = gp.world.getForeMap(x, y); - if (bl > 0 && Items.blocks.getValueAt(bl).coll) { - if (Intersector.overlaps(rect, Items.blocks.getValueAt(bl).getRect(x, y))) { + if (bl > 0 && GameItems.getBlock(bl).coll) { + if (Intersector.overlaps(rect, GameItems.getBlock(bl).getRect(x, y))) { return true; } } @@ -93,7 +93,7 @@ public class GamePhysics { pl.canJump = false; } - if (Items.isFluid(getBlock(pl.getRect()))) { + if (GameItems.isFluid(getBlock(pl.getRect()))) { if (CaveGame.TOUCH && pl.move.x != 0 && !gp.swim && !pl.flyMode) gp.swim = true; if (!gp.swim) { if (!pl.flyMode && pl.move.y < 4.5f) pl.move.add(gravity.x / 4, gravity.y / 4); @@ -148,7 +148,7 @@ public class GamePhysics { mob.canJump = false; } - if (mob.getType() == 0 && Items.isFluid(getBlock(mob.getRect()))) { + if (mob.getType() == 0 && GameItems.isFluid(getBlock(mob.getRect()))) { if (mob.move.y > 9) mob.move.add(0, -.9f); mob.move.add(0, -.5f); if (mob.move.y < -3) mob.move.y = -3; diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index f79694f..e091494 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -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,7 +78,7 @@ 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() { @@ -122,14 +122,14 @@ public class GameProc implements Serializable { } 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; } diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java index cbcaeb8..28a7c56 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java @@ -33,7 +33,7 @@ public class GameRenderer extends Renderer { if (gp.blockDmg > 0) { spriter.draw(Assets.wreck[ 10 * gp.blockDmg / - Items.blocks.getValueAt(gp.world.getForeMap(gp.curX, gp.curY)).getHp()], + GameItems.getBlock(gp.world.getForeMap(gp.curX, gp.curY)).getHp()], gp.curX * 16 - getCamX(), gp.curY * 16 - getCamY()); } @@ -48,18 +48,18 @@ public class GameRenderer extends Renderer { if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight(); for (int y = minY; y < maxY; y++) { for (int x = minX; x < maxX; x++) { - if ((gp.world.getForeMap(x, y) == 0 || Items.blocks.getValueAt(gp.world.getForeMap(x, y)).tp) + if ((gp.world.getForeMap(x, y) == 0 || GameItems.getBlock(gp.world.getForeMap(x, y)).tp) && gp.world.getBackMap(x, y) > 0) { spriter.draw( - Assets.blockTex[Items.blocks.getValueAt(gp.world.getBackMap(x, y)).getTex()], + Assets.blockTex[GameItems.getBlock(gp.world.getBackMap(x, y)).getTex()], drawX(x), drawY(y)); if (gp.world.getForeMap(x, y) == 0) drawWreck(); Assets.shade.setPosition(drawX(x), drawY(y)); Assets.shade.draw(spriter); } - if (gp.world.getForeMap(x, y) > 0 && Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) { + if (gp.world.getForeMap(x, y) > 0 && GameItems.getBlock(gp.world.getForeMap(x, y)).bg) { spriter.draw( - Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()], + Assets.blockTex[GameItems.getBlock(gp.world.getForeMap(x, y)).getTex()], drawX(x), drawY(y)); drawWreck(); } @@ -76,9 +76,9 @@ public class GameRenderer extends Renderer { if (maxY > gp.world.getHeight()) maxY = gp.world.getHeight(); for (int y = minY; y < maxY; y++) { for (int x = minX; x < maxX; x++) { - if (gp.world.getForeMap(x, y) > 0 && !Items.blocks.getValueAt(gp.world.getForeMap(x, y)).bg) { + if (gp.world.getForeMap(x, y) > 0 && !GameItems.getBlock(gp.world.getForeMap(x, y)).bg) { spriter.draw( - Assets.blockTex[Items.blocks.getValueAt(gp.world.getForeMap(x, y)).getTex()], + Assets.blockTex[GameItems.getBlock(gp.world.getForeMap(x, y)).getTex()], drawX(x), drawY(y)); drawWreck(); } @@ -96,14 +96,14 @@ public class GameRenderer extends Renderer { } private void drawDrop(Drop drop) { - switch (Items.items.get(drop.getId()).getType()) { + switch (GameItems.getItem(drop.getId()).getType()) { case 0: - Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() - gp.world.getWidth() * 16, drop.position.y - getCamY()); - Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter); - Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX(), drop.position.y - getCamY()); - Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter); - Assets.blockTex[Items.items.get(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() + gp.world.getWidth() * 16, drop.position.y - getCamY()); - Assets.blockTex[Items.items.get(drop.getId()).getTex()].draw(spriter); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() - gp.world.getWidth() * 16, drop.position.y - getCamY()); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX(), drop.position.y - getCamY()); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].setPosition(drop.position.x - getCamX() + gp.world.getWidth() * 16, drop.position.y - getCamY()); + Assets.blockTex[GameItems.getItem(drop.getId()).getTex()].draw(spriter); } } @@ -146,22 +146,22 @@ public class GameRenderer extends Renderer { pl.position.x - getCamX() - 2, pl.position.y - getCamY() + 8); //item in hand if (pl.inventory[gp.invSlot] > 0) - switch (Items.items.get(pl.inventory[gp.invSlot]).getType()) { + switch (GameItems.getItem(pl.inventory[gp.invSlot]).getType()) { case 0: - Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition( + Assets.blockTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setPosition( pl.position.x - getCamX() - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()), pl.position.y - getCamY() + 6 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation())); - Assets.blockTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter); + Assets.blockTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].draw(spriter); break; default: - Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false); - Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setRotation( + Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false); + Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setRotation( -45 + pl.dir * 90 + Assets.plSprite[0][2].getRotation()); - Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].setPosition( + Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].setPosition( pl.position.x - getCamX() - 10 + (12 * pl.dir) - 8 * MathUtils.sin(MathUtils.degRad * Assets.plSprite[0][2].getRotation()), pl.position.y - getCamY() + 2 + 8 * MathUtils.cos(MathUtils.degRad * Assets.plSprite[0][2].getRotation())); - Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].draw(spriter); - Assets.itemTex[Items.items.get(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false); + Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].draw(spriter); + Assets.itemTex[GameItems.getItem(pl.inventory[gp.invSlot]).getTex()].flip((pl.dir == 0), false); break; } //front hand @@ -178,15 +178,15 @@ public class GameRenderer extends Renderer { spriter.draw(Assets.creativeScr, x + 156, y + 18 + (gp.creativeScroll * (72 / gp.maxCreativeScroll))); for (int i = gp.creativeScroll * 8; i < gp.creativeScroll * 8 + 40; i++) { - if (i > 0 && i < Items.items.size()) - switch (Items.items.get(i).getType()) { + if (i > 0 && i < GameItems.getItemsSize()) + switch (GameItems.getItem(i).getType()) { case 0: - spriter.draw(Assets.blockTex[Items.items.get(i).getTex()], + spriter.draw(Assets.blockTex[GameItems.getItem(i).getTex()], x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18, y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18); break; case 1: - spriter.draw(Assets.itemTex[Items.items.get(i).getTex()], + spriter.draw(Assets.itemTex[GameItems.getItem(i).getTex()], x + 8 + ((i - gp.creativeScroll * 8) % 8) * 18, y + 18 + ((i - gp.creativeScroll * 8) / 8) * 18); break; @@ -194,13 +194,13 @@ public class GameRenderer extends Renderer { } for (int i = 0; i < 9; i++) { if (gp.player.inventory[i] > 0) - switch (Items.items.get(gp.player.inventory[i]).getType()) { + switch (GameItems.getItem(gp.player.inventory[i]).getType()) { case 0: - spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()], + spriter.draw(Assets.blockTex[GameItems.getItem(gp.player.inventory[i]).getTex()], x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24); break; case 1: - spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()], + spriter.draw(Assets.itemTex[GameItems.getItem(gp.player.inventory[i]).getTex()], x + 8 + i * 18, y + Assets.creativeInv.getRegionHeight() - 24); break; } @@ -218,14 +218,14 @@ public class GameRenderer extends Renderer { spriter.draw(Assets.invBar, getWidth() / 2 - Assets.invBar.getRegionWidth() / 2, 0); for (int i = 0; i < 9; i++) { if (gp.player.inventory[i] > 0) { - switch (Items.items.get(gp.player.inventory[i]).getType()) { + switch (GameItems.getItem(gp.player.inventory[i]).getType()) { case 0: - spriter.draw(Assets.blockTex[Items.items.get(gp.player.inventory[i]).getTex()], + spriter.draw(Assets.blockTex[GameItems.getItem(gp.player.inventory[i]).getTex()], getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20, 3); break; case 1: - spriter.draw(Assets.itemTex[Items.items.get(gp.player.inventory[i]).getTex()], + spriter.draw(Assets.itemTex[GameItems.getItem(gp.player.inventory[i]).getTex()], getWidth() / 2 - Assets.invBar.getRegionWidth() / 2 + 3 + i * 20, 3); break; @@ -283,7 +283,7 @@ public class GameRenderer extends Renderer { drawString("Y: " + (int) (gp.player.position.y / 16), 0, 20); drawString("Mobs: " + gp.mobs.size(), 0, 30); drawString("Drops: " + gp.drops.size(), 0, 40); - drawString("Block: " + Items.blocks.getKeyAt(gp.world.getForeMap(gp.curX, gp.curY)), 0, 50); + drawString("Block: " + GameItems.getBlockKey(gp.world.getForeMap(gp.curX, gp.curY)), 0, 50); } spriter.end(); diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java index 6adac2d..073c3d5 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java @@ -94,9 +94,9 @@ public class GameWorld { } public void placeToForeground(int x, int y, int value) { - if (getForeMap(x, y) == 0 || value == 0 || !Items.blocks.getValueAt(getForeMap(x, y)).coll) { + if (getForeMap(x, y) == 0 || value == 0 || !GameItems.getBlock(getForeMap(x, y)).coll) { setForeMap(x, y, value); - } else if (Items.isSlab(value) && getForeMap(x, y) == value) { + } else if (GameItems.isSlab(value) && getForeMap(x, y) == value) { placeSlab(x, y, value); } GameProc.UPD_X = x - 8; @@ -105,8 +105,8 @@ public class GameWorld { } public void placeToBackground(int x, int y, int value) { - if (value == 0 || (getBackMap(x, y) == 0 && Items.blocks.getValueAt(value).coll) && - (!Items.blocks.getValueAt(value).tp || value == 18)) { + if (value == 0 || (getBackMap(x, y) == 0 && GameItems.getBlock(value).coll) && + (!GameItems.getBlock(value).tp || value == 18)) { setBackMap(x, y, value); } } @@ -115,7 +115,7 @@ public class GameWorld { int x = 0, y = 0; while (true) { y++; - if (getForeMap(x, y) > 0 && Items.blocks.getValueAt(getForeMap(x, y)).coll) break; + if (getForeMap(x, y) > 0 && GameItems.getBlock(getForeMap(x, y)).coll) break; } x = x * 16 + 4; y = y * 16 - 32; diff --git a/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingGravel.java b/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingGravel.java index de84119..21b8dd8 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingGravel.java +++ b/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingGravel.java @@ -3,7 +3,7 @@ package ru.deadsoftware.cavecraft.game.mobs; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; -import ru.deadsoftware.cavecraft.game.Items; +import ru.deadsoftware.cavecraft.game.GameItems; import ru.deadsoftware.cavecraft.misc.Assets; public class FallingGravel extends Mob { @@ -28,7 +28,7 @@ public class FallingGravel extends Mob { @Override public void draw(SpriteBatch spriteBatch, float x, float y) { - spriteBatch.draw(Assets.blockTex[Items.blocks.get("gravel").getTex()], x, y); + spriteBatch.draw(Assets.blockTex[GameItems.getBlock(11).getTex()], x, y); } @Override diff --git a/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingSand.java b/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingSand.java index 8c76619..b491af5 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingSand.java +++ b/core/src/ru/deadsoftware/cavecraft/game/mobs/FallingSand.java @@ -3,7 +3,7 @@ package ru.deadsoftware.cavecraft.game.mobs; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; -import ru.deadsoftware.cavecraft.game.Items; +import ru.deadsoftware.cavecraft.game.GameItems; import ru.deadsoftware.cavecraft.misc.Assets; public class FallingSand extends Mob { @@ -28,7 +28,7 @@ public class FallingSand extends Mob { @Override public void draw(SpriteBatch spriteBatch, float x, float y) { - spriteBatch.draw(Assets.blockTex[Items.blocks.get("sand").getTex()], x, y); + spriteBatch.draw(Assets.blockTex[GameItems.getBlock(10).getTex()], x, y); } @Override diff --git a/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java b/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java index a1f50e6..aab04d9 100644 --- a/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java +++ b/core/src/ru/deadsoftware/cavecraft/menu/MenuRenderer.java @@ -4,8 +4,8 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Array; import ru.deadsoftware.cavecraft.CaveGame; import ru.deadsoftware.cavecraft.GameScreen; +import ru.deadsoftware.cavecraft.game.GameItems; import ru.deadsoftware.cavecraft.game.GameSaver; -import ru.deadsoftware.cavecraft.game.Items; import ru.deadsoftware.cavecraft.menu.objects.Button; import ru.deadsoftware.cavecraft.misc.AppState; import ru.deadsoftware.cavecraft.misc.Assets; @@ -62,7 +62,7 @@ public class MenuRenderer extends Renderer { spriter.begin(); for (int x = 0; x <= getWidth() / 16; x++) for (int y = 0; y <= getHeight() / 16; y++) { - spriter.draw(Assets.blockTex[Items.blocks.get("dirt").getTex()], x * 16, y * 16); + spriter.draw(Assets.blockTex[GameItems.getBlock(3).getTex()], x * 16, y * 16); spriter.draw(Assets.shade, x * 16, y * 16); } spriter.draw(Assets.gameLogo, getWidth() / 2 - Assets.gameLogo.getWidth() / 2, 0);