From: fred-boy Date: Fri, 27 Sep 2019 13:16:21 +0000 (+0700) Subject: Return tools X-Git-Tag: alpha0.4~47 X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=7646ac0833becd8f9424908ee8bc142b7b3999f8;p=cavedroid.git Return tools --- diff --git a/android/assets/game_items.json b/android/assets/game_items.json index 0bc31cc..b539082 100644 --- a/android/assets/game_items.json +++ b/android/assets/game_items.json @@ -550,6 +550,58 @@ "obsidian": { "name": "Obsidian", "type": "block" + }, + "wood_sword": { + "name": "Wooden Sword", + "type": "tool" + }, + "stone_sword": { + "name": "Stone Sword", + "type": "tool" + }, + "iron_sword": { + "name": "Iron Sword", + "type": "tool" + }, + "diamond_sword": { + "name": "Diamond Sword", + "type": "tool" + }, + "gold_sword": { + "name": "Golden Sword", + "type": "tool" + }, + "wood_shovel": { + "name": "Wooden Shovel", + "type": "tool" + }, + "stone_shovel": { + "name": "Stone Shovel", + "type": "tool" + }, + "iron_shovel": { + "name": "Iron Shovel", + "type": "tool" + }, + "diamond_shovel": { + "name": "Diamond Shovel", + "type": "tool" + }, + "gold_shovel": { + "name": "Golden Shovel", + "type": "tool" + }, + "bucket_empty": { + "name": "Empty Bucket", + "type": "tool" + }, + "bucket_water": { + "name": "Water Bucket", + "type": "tool" + }, + "bucket_lava": { + "name": "Lava Bucket", + "type": "tool" } } } \ No newline at end of file diff --git a/android/assets/textures/bed_l.png b/android/assets/textures/blocks/bed_l.png similarity index 100% rename from android/assets/textures/bed_l.png rename to android/assets/textures/blocks/bed_l.png diff --git a/android/assets/textures/bed_r.png b/android/assets/textures/blocks/bed_r.png similarity index 100% rename from android/assets/textures/bed_r.png rename to android/assets/textures/blocks/bed_r.png diff --git a/android/assets/textures/bedrock.png b/android/assets/textures/blocks/bedrock.png similarity index 100% rename from android/assets/textures/bedrock.png rename to android/assets/textures/blocks/bedrock.png diff --git a/android/assets/textures/bookshelf.png b/android/assets/textures/blocks/bookshelf.png similarity index 100% rename from android/assets/textures/bookshelf.png rename to android/assets/textures/blocks/bookshelf.png diff --git a/android/assets/textures/brick_slab.png b/android/assets/textures/blocks/brick_slab.png similarity index 100% rename from android/assets/textures/brick_slab.png rename to android/assets/textures/blocks/brick_slab.png diff --git a/android/assets/textures/bricks.png b/android/assets/textures/blocks/bricks.png similarity index 100% rename from android/assets/textures/bricks.png rename to android/assets/textures/blocks/bricks.png diff --git a/android/assets/textures/cactus.png b/android/assets/textures/blocks/cactus.png similarity index 100% rename from android/assets/textures/cactus.png rename to android/assets/textures/blocks/cactus.png diff --git a/android/assets/textures/cake.png b/android/assets/textures/blocks/cake.png similarity index 100% rename from android/assets/textures/cake.png rename to android/assets/textures/blocks/cake.png diff --git a/android/assets/textures/clay.png b/android/assets/textures/blocks/clay.png similarity index 100% rename from android/assets/textures/clay.png rename to android/assets/textures/blocks/clay.png diff --git a/android/assets/textures/coal_block.png b/android/assets/textures/blocks/coal_block.png similarity index 100% rename from android/assets/textures/coal_block.png rename to android/assets/textures/blocks/coal_block.png diff --git a/android/assets/textures/coal_ore.png b/android/assets/textures/blocks/coal_ore.png similarity index 100% rename from android/assets/textures/coal_ore.png rename to android/assets/textures/blocks/coal_ore.png diff --git a/android/assets/textures/cobblestone.png b/android/assets/textures/blocks/cobblestone.png similarity index 100% rename from android/assets/textures/cobblestone.png rename to android/assets/textures/blocks/cobblestone.png diff --git a/android/assets/textures/cobblestone_mossy.png b/android/assets/textures/blocks/cobblestone_mossy.png similarity index 100% rename from android/assets/textures/cobblestone_mossy.png rename to android/assets/textures/blocks/cobblestone_mossy.png diff --git a/android/assets/textures/cobblestone_slab.png b/android/assets/textures/blocks/cobblestone_slab.png similarity index 100% rename from android/assets/textures/cobblestone_slab.png rename to android/assets/textures/blocks/cobblestone_slab.png diff --git a/android/assets/textures/crafting_table.png b/android/assets/textures/blocks/crafting_table.png similarity index 100% rename from android/assets/textures/crafting_table.png rename to android/assets/textures/blocks/crafting_table.png diff --git a/android/assets/textures/dandelion.png b/android/assets/textures/blocks/dandelion.png similarity index 100% rename from android/assets/textures/dandelion.png rename to android/assets/textures/blocks/dandelion.png diff --git a/android/assets/textures/deadbush.png b/android/assets/textures/blocks/deadbush.png similarity index 100% rename from android/assets/textures/deadbush.png rename to android/assets/textures/blocks/deadbush.png diff --git a/android/assets/textures/diamond_block.png b/android/assets/textures/blocks/diamond_block.png similarity index 100% rename from android/assets/textures/diamond_block.png rename to android/assets/textures/blocks/diamond_block.png diff --git a/android/assets/textures/diamond_ore.png b/android/assets/textures/blocks/diamond_ore.png similarity index 100% rename from android/assets/textures/diamond_ore.png rename to android/assets/textures/blocks/diamond_ore.png diff --git a/android/assets/textures/dirt.png b/android/assets/textures/blocks/dirt.png similarity index 100% rename from android/assets/textures/dirt.png rename to android/assets/textures/blocks/dirt.png diff --git a/android/assets/textures/double_stone_slab.png b/android/assets/textures/blocks/double_stone_slab.png similarity index 100% rename from android/assets/textures/double_stone_slab.png rename to android/assets/textures/blocks/double_stone_slab.png diff --git a/android/assets/textures/furnace_off.png b/android/assets/textures/blocks/furnace_off.png similarity index 100% rename from android/assets/textures/furnace_off.png rename to android/assets/textures/blocks/furnace_off.png diff --git a/android/assets/textures/furnace_on.png b/android/assets/textures/blocks/furnace_on.png similarity index 100% rename from android/assets/textures/furnace_on.png rename to android/assets/textures/blocks/furnace_on.png diff --git a/android/assets/textures/glass.png b/android/assets/textures/blocks/glass.png similarity index 100% rename from android/assets/textures/glass.png rename to android/assets/textures/blocks/glass.png diff --git a/android/assets/textures/gold_block.png b/android/assets/textures/blocks/gold_block.png similarity index 100% rename from android/assets/textures/gold_block.png rename to android/assets/textures/blocks/gold_block.png diff --git a/android/assets/textures/gold_ore.png b/android/assets/textures/blocks/gold_ore.png similarity index 100% rename from android/assets/textures/gold_ore.png rename to android/assets/textures/blocks/gold_ore.png diff --git a/android/assets/textures/grass.png b/android/assets/textures/blocks/grass.png similarity index 100% rename from android/assets/textures/grass.png rename to android/assets/textures/blocks/grass.png diff --git a/android/assets/textures/gravel.png b/android/assets/textures/blocks/gravel.png similarity index 100% rename from android/assets/textures/gravel.png rename to android/assets/textures/blocks/gravel.png diff --git a/android/assets/textures/iron_bars.png b/android/assets/textures/blocks/iron_bars.png similarity index 100% rename from android/assets/textures/iron_bars.png rename to android/assets/textures/blocks/iron_bars.png diff --git a/android/assets/textures/iron_block.png b/android/assets/textures/blocks/iron_block.png similarity index 100% rename from android/assets/textures/iron_block.png rename to android/assets/textures/blocks/iron_block.png diff --git a/android/assets/textures/iron_ore.png b/android/assets/textures/blocks/iron_ore.png similarity index 100% rename from android/assets/textures/iron_ore.png rename to android/assets/textures/blocks/iron_ore.png diff --git a/android/assets/textures/ladder.png b/android/assets/textures/blocks/ladder.png similarity index 100% rename from android/assets/textures/ladder.png rename to android/assets/textures/blocks/ladder.png diff --git a/android/assets/textures/lapis_block.png b/android/assets/textures/blocks/lapis_block.png similarity index 100% rename from android/assets/textures/lapis_block.png rename to android/assets/textures/blocks/lapis_block.png diff --git a/android/assets/textures/lapis_ore.png b/android/assets/textures/blocks/lapis_ore.png similarity index 100% rename from android/assets/textures/lapis_ore.png rename to android/assets/textures/blocks/lapis_ore.png diff --git a/android/assets/textures/lava.png b/android/assets/textures/blocks/lava.png similarity index 100% rename from android/assets/textures/lava.png rename to android/assets/textures/blocks/lava.png diff --git a/android/assets/textures/lava_12.png b/android/assets/textures/blocks/lava_12.png similarity index 100% rename from android/assets/textures/lava_12.png rename to android/assets/textures/blocks/lava_12.png diff --git a/android/assets/textures/lava_16.png b/android/assets/textures/blocks/lava_16.png similarity index 100% rename from android/assets/textures/lava_16.png rename to android/assets/textures/blocks/lava_16.png diff --git a/android/assets/textures/lava_4.png b/android/assets/textures/blocks/lava_4.png similarity index 100% rename from android/assets/textures/lava_4.png rename to android/assets/textures/blocks/lava_4.png diff --git a/android/assets/textures/lava_8.png b/android/assets/textures/blocks/lava_8.png similarity index 100% rename from android/assets/textures/lava_8.png rename to android/assets/textures/blocks/lava_8.png diff --git a/android/assets/textures/leaves.png b/android/assets/textures/blocks/leaves.png similarity index 100% rename from android/assets/textures/leaves.png rename to android/assets/textures/blocks/leaves.png diff --git a/android/assets/textures/log.png b/android/assets/textures/blocks/log.png similarity index 100% rename from android/assets/textures/log.png rename to android/assets/textures/blocks/log.png diff --git a/android/assets/textures/mushroom_brown.png b/android/assets/textures/blocks/mushroom_brown.png similarity index 100% rename from android/assets/textures/mushroom_brown.png rename to android/assets/textures/blocks/mushroom_brown.png diff --git a/android/assets/textures/mushroom_red.png b/android/assets/textures/blocks/mushroom_red.png similarity index 100% rename from android/assets/textures/mushroom_red.png rename to android/assets/textures/blocks/mushroom_red.png diff --git a/android/assets/textures/noteblock.png b/android/assets/textures/blocks/noteblock.png similarity index 100% rename from android/assets/textures/noteblock.png rename to android/assets/textures/blocks/noteblock.png diff --git a/android/assets/textures/obsidian.png b/android/assets/textures/blocks/obsidian.png similarity index 100% rename from android/assets/textures/obsidian.png rename to android/assets/textures/blocks/obsidian.png diff --git a/android/assets/textures/planks.png b/android/assets/textures/blocks/planks.png similarity index 100% rename from android/assets/textures/planks.png rename to android/assets/textures/blocks/planks.png diff --git a/android/assets/textures/rose.png b/android/assets/textures/blocks/rose.png similarity index 100% rename from android/assets/textures/rose.png rename to android/assets/textures/blocks/rose.png diff --git a/android/assets/textures/sand.png b/android/assets/textures/blocks/sand.png similarity index 100% rename from android/assets/textures/sand.png rename to android/assets/textures/blocks/sand.png diff --git a/android/assets/textures/sandstone.png b/android/assets/textures/blocks/sandstone.png similarity index 100% rename from android/assets/textures/sandstone.png rename to android/assets/textures/blocks/sandstone.png diff --git a/android/assets/textures/sandstone_slab.png b/android/assets/textures/blocks/sandstone_slab.png similarity index 100% rename from android/assets/textures/sandstone_slab.png rename to android/assets/textures/blocks/sandstone_slab.png diff --git a/android/assets/textures/sapling.png b/android/assets/textures/blocks/sapling.png similarity index 100% rename from android/assets/textures/sapling.png rename to android/assets/textures/blocks/sapling.png diff --git a/android/assets/textures/sponge.png b/android/assets/textures/blocks/sponge.png similarity index 100% rename from android/assets/textures/sponge.png rename to android/assets/textures/blocks/sponge.png diff --git a/android/assets/textures/sponge_wet.png b/android/assets/textures/blocks/sponge_wet.png similarity index 100% rename from android/assets/textures/sponge_wet.png rename to android/assets/textures/blocks/sponge_wet.png diff --git a/android/assets/textures/stone.png b/android/assets/textures/blocks/stone.png similarity index 100% rename from android/assets/textures/stone.png rename to android/assets/textures/blocks/stone.png diff --git a/android/assets/textures/stone_slab.png b/android/assets/textures/blocks/stone_slab.png similarity index 100% rename from android/assets/textures/stone_slab.png rename to android/assets/textures/blocks/stone_slab.png diff --git a/android/assets/textures/stonebrick.png b/android/assets/textures/blocks/stonebrick.png similarity index 100% rename from android/assets/textures/stonebrick.png rename to android/assets/textures/blocks/stonebrick.png diff --git a/android/assets/textures/stonebrick_slab.png b/android/assets/textures/blocks/stonebrick_slab.png similarity index 100% rename from android/assets/textures/stonebrick_slab.png rename to android/assets/textures/blocks/stonebrick_slab.png diff --git a/android/assets/textures/tallgrass.png b/android/assets/textures/blocks/tallgrass.png similarity index 100% rename from android/assets/textures/tallgrass.png rename to android/assets/textures/blocks/tallgrass.png diff --git a/android/assets/textures/water.png b/android/assets/textures/blocks/water.png similarity index 100% rename from android/assets/textures/water.png rename to android/assets/textures/blocks/water.png diff --git a/android/assets/textures/water_12.png b/android/assets/textures/blocks/water_12.png similarity index 100% rename from android/assets/textures/water_12.png rename to android/assets/textures/blocks/water_12.png diff --git a/android/assets/textures/water_16.png b/android/assets/textures/blocks/water_16.png similarity index 100% rename from android/assets/textures/water_16.png rename to android/assets/textures/blocks/water_16.png diff --git a/android/assets/textures/water_4.png b/android/assets/textures/blocks/water_4.png similarity index 100% rename from android/assets/textures/water_4.png rename to android/assets/textures/blocks/water_4.png diff --git a/android/assets/textures/water_8.png b/android/assets/textures/blocks/water_8.png similarity index 100% rename from android/assets/textures/water_8.png rename to android/assets/textures/blocks/water_8.png diff --git a/android/assets/textures/web.png b/android/assets/textures/blocks/web.png similarity index 100% rename from android/assets/textures/web.png rename to android/assets/textures/blocks/web.png diff --git a/android/assets/textures/wooden_slab.png b/android/assets/textures/blocks/wooden_slab.png similarity index 100% rename from android/assets/textures/wooden_slab.png rename to android/assets/textures/blocks/wooden_slab.png diff --git a/android/assets/textures/wool.png b/android/assets/textures/blocks/wool.png similarity index 100% rename from android/assets/textures/wool.png rename to android/assets/textures/blocks/wool.png diff --git a/android/assets/textures/wool_black.png b/android/assets/textures/blocks/wool_black.png similarity index 100% rename from android/assets/textures/wool_black.png rename to android/assets/textures/blocks/wool_black.png diff --git a/android/assets/textures/wool_blue.png b/android/assets/textures/blocks/wool_blue.png similarity index 100% rename from android/assets/textures/wool_blue.png rename to android/assets/textures/blocks/wool_blue.png diff --git a/android/assets/textures/wool_brown.png b/android/assets/textures/blocks/wool_brown.png similarity index 100% rename from android/assets/textures/wool_brown.png rename to android/assets/textures/blocks/wool_brown.png diff --git a/android/assets/textures/wool_cyan.png b/android/assets/textures/blocks/wool_cyan.png similarity index 100% rename from android/assets/textures/wool_cyan.png rename to android/assets/textures/blocks/wool_cyan.png diff --git a/android/assets/textures/wool_gray.png b/android/assets/textures/blocks/wool_gray.png similarity index 100% rename from android/assets/textures/wool_gray.png rename to android/assets/textures/blocks/wool_gray.png diff --git a/android/assets/textures/wool_green.png b/android/assets/textures/blocks/wool_green.png similarity index 100% rename from android/assets/textures/wool_green.png rename to android/assets/textures/blocks/wool_green.png diff --git a/android/assets/textures/wool_lightblue.png b/android/assets/textures/blocks/wool_lightblue.png similarity index 100% rename from android/assets/textures/wool_lightblue.png rename to android/assets/textures/blocks/wool_lightblue.png diff --git a/android/assets/textures/wool_lightgray.png b/android/assets/textures/blocks/wool_lightgray.png similarity index 100% rename from android/assets/textures/wool_lightgray.png rename to android/assets/textures/blocks/wool_lightgray.png diff --git a/android/assets/textures/wool_lime.png b/android/assets/textures/blocks/wool_lime.png similarity index 100% rename from android/assets/textures/wool_lime.png rename to android/assets/textures/blocks/wool_lime.png diff --git a/android/assets/textures/wool_magenta.png b/android/assets/textures/blocks/wool_magenta.png similarity index 100% rename from android/assets/textures/wool_magenta.png rename to android/assets/textures/blocks/wool_magenta.png diff --git a/android/assets/textures/wool_orange.png b/android/assets/textures/blocks/wool_orange.png similarity index 100% rename from android/assets/textures/wool_orange.png rename to android/assets/textures/blocks/wool_orange.png diff --git a/android/assets/textures/wool_pink.png b/android/assets/textures/blocks/wool_pink.png similarity index 100% rename from android/assets/textures/wool_pink.png rename to android/assets/textures/blocks/wool_pink.png diff --git a/android/assets/textures/wool_purple.png b/android/assets/textures/blocks/wool_purple.png similarity index 100% rename from android/assets/textures/wool_purple.png rename to android/assets/textures/blocks/wool_purple.png diff --git a/android/assets/textures/wool_red.png b/android/assets/textures/blocks/wool_red.png similarity index 100% rename from android/assets/textures/wool_red.png rename to android/assets/textures/blocks/wool_red.png diff --git a/android/assets/textures/wool_yellow.png b/android/assets/textures/blocks/wool_yellow.png similarity index 100% rename from android/assets/textures/wool_yellow.png rename to android/assets/textures/blocks/wool_yellow.png diff --git a/android/assets/textures/items/bucket_empty.png b/android/assets/textures/items/bucket_empty.png new file mode 100644 index 0000000..5afe77b Binary files /dev/null and b/android/assets/textures/items/bucket_empty.png differ diff --git a/android/assets/textures/items/bucket_lava.png b/android/assets/textures/items/bucket_lava.png new file mode 100644 index 0000000..97b84f8 Binary files /dev/null and b/android/assets/textures/items/bucket_lava.png differ diff --git a/android/assets/textures/items/bucket_milk.png b/android/assets/textures/items/bucket_milk.png new file mode 100644 index 0000000..4208fb6 Binary files /dev/null and b/android/assets/textures/items/bucket_milk.png differ diff --git a/android/assets/textures/items/bucket_water.png b/android/assets/textures/items/bucket_water.png new file mode 100644 index 0000000..d6cb934 Binary files /dev/null and b/android/assets/textures/items/bucket_water.png differ diff --git a/android/assets/textures/items/diamond_shovel.png b/android/assets/textures/items/diamond_shovel.png new file mode 100644 index 0000000..7d50c0c Binary files /dev/null and b/android/assets/textures/items/diamond_shovel.png differ diff --git a/android/assets/textures/items/diamond_sword.png b/android/assets/textures/items/diamond_sword.png new file mode 100644 index 0000000..344ed9c Binary files /dev/null and b/android/assets/textures/items/diamond_sword.png differ diff --git a/android/assets/textures/items/gold_shovel.png b/android/assets/textures/items/gold_shovel.png new file mode 100644 index 0000000..e9afbd0 Binary files /dev/null and b/android/assets/textures/items/gold_shovel.png differ diff --git a/android/assets/textures/items/gold_sword.png b/android/assets/textures/items/gold_sword.png new file mode 100644 index 0000000..e6176ec Binary files /dev/null and b/android/assets/textures/items/gold_sword.png differ diff --git a/android/assets/textures/items/iron_shovel.png b/android/assets/textures/items/iron_shovel.png new file mode 100644 index 0000000..ed1d44b Binary files /dev/null and b/android/assets/textures/items/iron_shovel.png differ diff --git a/android/assets/textures/items/iron_sword.png b/android/assets/textures/items/iron_sword.png new file mode 100644 index 0000000..6473327 Binary files /dev/null and b/android/assets/textures/items/iron_sword.png differ diff --git a/android/assets/textures/items/stone_shovel.png b/android/assets/textures/items/stone_shovel.png new file mode 100644 index 0000000..78cf790 Binary files /dev/null and b/android/assets/textures/items/stone_shovel.png differ diff --git a/android/assets/textures/items/stone_sword.png b/android/assets/textures/items/stone_sword.png new file mode 100644 index 0000000..c20ed6e Binary files /dev/null and b/android/assets/textures/items/stone_sword.png differ diff --git a/android/assets/textures/items/wood_shovel.png b/android/assets/textures/items/wood_shovel.png new file mode 100644 index 0000000..32cb69a Binary files /dev/null and b/android/assets/textures/items/wood_shovel.png differ diff --git a/android/assets/textures/items/wood_sword.png b/android/assets/textures/items/wood_sword.png new file mode 100644 index 0000000..8fcabc1 Binary files /dev/null and b/android/assets/textures/items/wood_sword.png differ diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java index 87bb3d6..61b3af7 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java @@ -113,11 +113,26 @@ public class GameItems { boolean fluid = (block.has("fluid") && block.getBoolean("fluid")); String meta = (block.has("meta") ? block.getString("meta") : ""); String texture = (block.has("texture") ? block.getString("texture") : key); + Sprite sprite = key.equals("none") ? null : + new Sprite(new Texture(Gdx.files.internal("textures/blocks/" + texture + ".png"))); + Block newBlock = new Block( + left, + top, + right, + bottom, + hp, + drop, + collision, + background, + transparent, + blockRequired, + fluid, + meta, + sprite + ); + blocksIds.put(key, blocks.size); - blocks.put(key, new Block(left, top, right, bottom, hp, drop, collision, - background, transparent, blockRequired, fluid, meta, - key.equals("none") ? null : - new Sprite(new Texture(Gdx.files.internal("textures/" + texture + ".png"))))); + blocks.put(key, newBlock); block = block.next(); } while (item != null) { @@ -125,9 +140,10 @@ public class GameItems { String name = (item.has("name") ? item.getString("name") : key); String type = (item.has("type") ? item.getString("type") : "item"); String texture = (item.has("texture") ? item.getString("texture") : key); + Sprite sprite = type.equals("block") ? null : + new Sprite(new Texture(Gdx.files.internal("textures/items/" + texture + ".png"))); itemsIds.put(key, items.size); - items.put(key, new Item(name, type, type.equals("block") ? null : - new Sprite(new Texture(Gdx.files.internal("textures/" + texture + ".png"))))); + items.put(key, new Item(name, type, sprite)); item = item.next(); } } diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java index 9e54c9a..252e77f 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java @@ -241,7 +241,8 @@ public class GameRenderer extends Renderer { drawString("Mobs: " + GP.mobs.size(), 0, 50); drawString("Drops: " + GP.drops.size(), 0, 60); drawString("Block: " + GameItems.getBlockKey(GP.world.getForeMap(GP.curX, GP.curY)), 0, 70); - drawString("Game mode: " + GP.player.gameMode, 0, 80); + drawString("Hand: " + GameItems.getItemKey(GP.player.inv[GP.player.invSlot]), 0, 80); + drawString("Game mode: " + GP.player.gameMode, 0, 90); } spriter.end();