diff --git a/src/projectzombie/items/ItemAbstractTool.java b/src/projectzombie/items/ItemAbstractTool.java index 3e40710..c12cef9 100644 --- a/src/projectzombie/items/ItemAbstractTool.java +++ b/src/projectzombie/items/ItemAbstractTool.java @@ -1,7 +1,13 @@ package projectzombie.items; +import gl_engine.vec.Vec2d; +import projectzombie.entity.Entity; +import projectzombie.entity.EntityAlive; +import projectzombie.entity.player.EntityPlayer; +import projectzombie.items.modifier.ItemModifierClickCooldown; import projectzombie.items.modifier.ItemModifierDamage; import projectzombie.util.ItemStack; +import projectzombie.world.layer.Layer; public abstract class ItemAbstractTool extends Item implements ItemTool { @@ -10,6 +16,8 @@ public abstract class ItemAbstractTool extends Item implements ItemTool } protected abstract int getMaxDamage(); + protected abstract double getEntityDamage(); + protected abstract int getEntityHitDelay(); @Override public void toolOnUse(ItemStack stack) @@ -27,4 +35,44 @@ public abstract class ItemAbstractTool extends Item implements ItemTool stack.count = 0; } } + + @Override + public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos) + { + boolean usedOnEntity = false; + + ItemModifierClickCooldown cooldown = (ItemModifierClickCooldown)stack.getModifier(ItemModifierClickCooldown.class); + + if(cooldown != null && !cooldown.canClick()) { + return false; + } + + for(Entity entity : layer.getNearbyEntities(place_pos, 0.5)) + { + if(entity instanceof EntityAlive && entity != player) + { + usedOnEntity = true; + + ((EntityAlive)entity).addDamage(getEntityDamage()); + } + } + + if(usedOnEntity) + { + toolOnUse(stack); + + if(cooldown == null) { + cooldown = new ItemModifierClickCooldown(getEntityHitDelay()); + stack.addModifier(cooldown); + } + + else { + cooldown.click(); + } + + return true; + } + + return super.onPlayerRightClick(stack, layer, player, place_pos); + } } diff --git a/src/projectzombie/items/ItemFlintHatchet.java b/src/projectzombie/items/ItemFlintHatchet.java index d0a8ad9..abc832c 100644 --- a/src/projectzombie/items/ItemFlintHatchet.java +++ b/src/projectzombie/items/ItemFlintHatchet.java @@ -39,4 +39,14 @@ public class ItemFlintHatchet extends ItemAbstractTool return Models.ITEM_FLINT_HATCHET; } + @Override + protected double getEntityDamage() { + return 10; + } + + @Override + protected int getEntityHitDelay() { + return 100; + } + } diff --git a/src/projectzombie/items/ItemStoneHatchet.java b/src/projectzombie/items/ItemStoneHatchet.java index 2ded1e0..21d224c 100644 --- a/src/projectzombie/items/ItemStoneHatchet.java +++ b/src/projectzombie/items/ItemStoneHatchet.java @@ -36,5 +36,15 @@ public class ItemStoneHatchet extends ItemAbstractTool public String getName(ItemStack stack) { return "Stone Hatchet"; } + + @Override + protected double getEntityDamage() { + return 12; + } + + @Override + protected int getEntityHitDelay() { + return 88; + } } diff --git a/src/projectzombie/items/ItemStonePick.java b/src/projectzombie/items/ItemStonePick.java index 19b72f7..11b6369 100644 --- a/src/projectzombie/items/ItemStonePick.java +++ b/src/projectzombie/items/ItemStonePick.java @@ -36,5 +36,15 @@ public class ItemStonePick extends ItemAbstractTool public String getName(ItemStack stack) { return "Stone Pick"; } + + @Override + protected double getEntityDamage() { + return 6; + } + + @Override + protected int getEntityHitDelay() { + return 60; + } } diff --git a/src/projectzombie/items/ItemStoneShovel.java b/src/projectzombie/items/ItemStoneShovel.java index a2bc284..bc09a9e 100644 --- a/src/projectzombie/items/ItemStoneShovel.java +++ b/src/projectzombie/items/ItemStoneShovel.java @@ -36,5 +36,15 @@ public class ItemStoneShovel extends ItemAbstractTool public String getName(ItemStack stack) { return "Stone Shovel"; } + + @Override + protected double getEntityDamage() { + return 8; + } + + @Override + protected int getEntityHitDelay() { + return 100; + } } diff --git a/src/projectzombie/tiles/TileCoal.java b/src/projectzombie/tiles/TileCoal.java index d623597..e663f3b 100644 --- a/src/projectzombie/tiles/TileCoal.java +++ b/src/projectzombie/tiles/TileCoal.java @@ -1,5 +1,6 @@ package projectzombie.tiles; +import projectzombie.init.Items; import projectzombie.init.Models; import projectzombie.items.ItemTool; import projectzombie.items.ItemToolType; @@ -25,6 +26,11 @@ public class TileCoal extends Tile public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) { return canTileBreak(state, stack, tool); } + + @Override + public ItemStack[] getTileDrops(TileState state) { + return new ItemStack[] {new ItemStack(Items.COAL, 1)}; + } @Override public Model getModel(byte meta) { diff --git a/src/projectzombie/tiles/TileTallGrass.java b/src/projectzombie/tiles/TileTallGrass.java index 79c4f06..6b6a5c9 100644 --- a/src/projectzombie/tiles/TileTallGrass.java +++ b/src/projectzombie/tiles/TileTallGrass.java @@ -26,7 +26,7 @@ public class TileTallGrass extends Tile @Override public ItemStack[] getTileDrops(TileState state) { return new ItemStack[] { - new ItemStack(Items.PLANT_FIBRE, Math.random() > 0.6 ? 1 : 0), + new ItemStack(Items.PLANT_FIBRE, 1), }; } diff --git a/src/resources/texture/item/ash.png b/src/resources/texture/item/ash.png new file mode 100644 index 0000000..a3945b2 Binary files /dev/null and b/src/resources/texture/item/ash.png differ diff --git a/src/resources/texture/item/charcoal.png b/src/resources/texture/item/charcoal.png new file mode 100644 index 0000000..3f47a8e Binary files /dev/null and b/src/resources/texture/item/charcoal.png differ diff --git a/src/resources/texture/item/iron_hatchet.png b/src/resources/texture/item/iron_hatchet.png new file mode 100644 index 0000000..c4ccee0 Binary files /dev/null and b/src/resources/texture/item/iron_hatchet.png differ diff --git a/src/resources/texture/item/iron_pick.png b/src/resources/texture/item/iron_pick.png new file mode 100644 index 0000000..83bd92e Binary files /dev/null and b/src/resources/texture/item/iron_pick.png differ diff --git a/src/resources/texture/item/iron_shovel.png b/src/resources/texture/item/iron_shovel.png new file mode 100644 index 0000000..f1d9a5e Binary files /dev/null and b/src/resources/texture/item/iron_shovel.png differ diff --git a/src/resources/texture/list.txt b/src/resources/texture/list.txt index dbd6e72..927d3a5 100644 --- a/src/resources/texture/list.txt +++ b/src/resources/texture/list.txt @@ -1,257 +1,259 @@ -./tile/hemp6.png -./tile/rock_gold.png -./tile/hemp7.png -./tile/hemp1.png -./tile/rock.png -./tile/rock_ice.png -./tile/sapling3.png -./tile/ladder.png -./tile/tree_leaves_snow.png -./tile/ice_wall.png -./tile/water.png -./tile/sandstone_wall.png -./tile/ladder_up.png -./tile/rock_copper.png -./tile/cactus4.png -./tile/tall_grass.png -./tile/cactus2.png -./tile/grass_infested.png -./tile/tree_branch_leaves.png -./tile/dirt.png -./tile/wall.png -./tile/rock_tin.png -./tile/tree_base.png -./tile/cactus1.png -./tile/sapling4.png -./tile/hemp3.png -./tile/cactus_top.png -./tile/tunnel_down.png -./tile/stone.png -./tile/snow.png -./tile/boss_portal.png -./tile/rock_coal.png -./tile/hemp4.png -./tile/sand.png -./tile/rock_iron.png -./tile/lantern.png -./tile/ice.png -./tile/rock_uranium.png -./tile/sapling1.png -./tile/campfire_lit.png -./tile/grass_burnt.png -./tile/chest.png -./tile/hemp2.png -./tile/hemp8.png -./tile/cactus3.png -./tile/lava.png -./tile/tree_leaves.png -./tile/hemp5.png -./tile/campfire_unlit.png -./tile/lava_flow.png -./tile/grass.png -./tile/tree_branch.png -./tile/sandstone.png -./tile/tree_branch_leaves_snow.png -./tile/rock_sandstone.png -./tile/sapling2.png +./text/char_question.png +./text/char_l_a.png +./text/char_u_j.png +./text/char_l_u.png +./text/char_u_s.png +./text/char_l_s.png +./text/char_apostrophe.png +./text/char_plus.png +./text/char_l_e.png +./text/char_7.png +./text/char_minus.png +./text/char_u_r.png +./text/char_u_l.png +./text/char_obracket.png +./text/char_pow.png +./text/char_u_m.png +./text/char_l_t.png +./text/char_percent.png +./text/char_l_y.png +./text/char_0.png +./text/char_4.png +./text/char_l_r.png +./text/char_l_m.png +./text/char_cbracket.png +./text/char_u_g.png +./text/char_u_q.png +./text/char_u_i.png +./text/char_tilde.png +./text/char_l_w.png +./text/char_l_v.png +./text/char_fslash.png +./text/char_u_p.png +./text/char_gthan.png +./text/char_8.png +./text/char_unknown.png +./text/char_and.png +./text/char_osbracket.png +./text/char_u_n.png +./text/char_l_i.png +./text/char_u_y.png +./text/char_l_p.png +./text/char_lthan.png +./text/char_l_g.png +./text/char_bslash.png +./text/char_1.png +./text/char_u_z.png +./text/char_l_f.png +./text/char_u_w.png +./text/char_9.png +./text/char_l_x.png +./text/char_ccbracket.png +./text/char_l_o.png +./text/char_equals.png +./text/char_l_d.png +./text/char_dollar.png +./text/char_hashtag.png +./text/char_l_q.png +./text/char_u_o.png +./text/char_6.png +./text/char_u_d.png +./text/char_u_e.png +./text/char_exclamation.png +./text/char_vertical.png +./text/char_ocbracket.png +./text/char_u_k.png +./text/char_u_c.png +./text/char_l_n.png +./text/char_semicolon.png +./text/char_u_b.png +./text/char_u_f.png +./text/char_l_h.png +./text/char_l_k.png +./text/char_u_t.png +./text/char_3.png +./text/char_u_v.png +./text/char_u_h.png +./text/char_quotation.png +./text/char_u_a.png +./text/char_l_b.png +./text/char_underscore.png +./text/char_u_x.png +./text/char_comma.png +./text/char_csbracket.png +./text/char_l_l.png +./text/char_5.png +./text/char_star.png +./text/char_colon.png +./text/char_l_z.png +./text/char_space.png +./text/char_2.png +./text/char_at.png +./text/char_grave.png +./text/char_l_j.png +./text/char_fullstop.png +./text/char_l_c.png +./text/char_u_u.png ./list.txt -./item/rock_gold.png -./item/log.png -./item/rock.png -./item/stone_shovel.png -./item/coal.png -./item/rock_copper.png -./item/acorn.png -./item/clay.png -./item/stone_pick.png -./item/rock_tin.png -./item/ammo_box.png -./item/plant_fibre.png -./item/torch_lit.png -./item/rock_iron.png -./item/stone_hatchet.png -./item/flint_hatchet.png -./item/rock_uranium.png -./item/hemp_seed.png -./item/shield_upgrade.png -./item/grappling_hook.png -./item/log_snow.png -./item/health_potion.png -./item/snow_pile.png -./item/torch_unlit.png -./item/gun_upgrade.png -./item/sandstone.png -./item/flint.png +./player/player_white_front_moving.png +./player/player_white_back_moving.png +./player/player_black_back_moving.png +./player/player_black_back_still.png ./player/player_white_back_still.png ./player/player_white_front_still.png ./player/player_black_front_moving.png ./player/player_black_front_still.png -./player/player_black_back_moving.png -./player/player_black_back_still.png -./player/player_white_back_moving.png -./player/player_white_front_moving.png -./gui/selection_box_wide.png -./gui/item_slot_storage.png -./gui/text_box.png -./gui/pixel_white.png -./gui/water.png -./gui/gun.png -./gui/selection_box_storage.png -./gui/button_delete.png -./gui/button_delete_hover.png -./gui/slot_armor_chest.png -./gui/pixel_black.png -./gui/slot_clothing_shirt.png -./gui/button_play.png -./gui/slot_armor_legs.png -./gui/inventory.png -./gui/label.png -./gui/slot_clothing_pants.png -./gui/health_empty.png -./gui/label_recipe.png -./gui/hotbar_selected.png -./gui/health_full.png +./particle/smoke_trail.png +./particle/water.png +./particle/smoke_0.png +./particle/smoke_1.png +./particle/blood.png +./particle/lava.png +./particle/bullet.png +./particle/smoke_2.png +./particle/snow.png +./particle/rain.png +./particle/smoke_4.png +./particle/smoke_3.png +./particle/smoke_5.png ./gui/temperature.png -./gui/button_play_hover.png -./gui/text_cursor.png +./gui/slot_armor_chest.png +./gui/health_empty.png +./gui/button_hover.png +./gui/item_slot_storage.png +./gui/water.png +./gui/slot_armor_legs.png +./gui/button_normal.png +./gui/label.png +./gui/hotbar.png ./gui/slot_armor_helmet.png ./gui/selection_box_crafting.png -./gui/slot_clothing_boots.png -./gui/hotbar.png -./gui/button_normal.png +./gui/button_delete.png +./gui/text_cursor.png +./gui/inventory.png +./gui/button_delete_hover.png +./gui/button_play_hover.png +./gui/health_full.png +./gui/hotbar_selected.png +./gui/slot_clothing_shirt.png +./gui/selection_box_storage.png +./gui/pixel_white.png +./gui/pixel_black.png +./gui/slot_clothing_pants.png +./gui/text_box.png ./gui/shield.png -./gui/button_hover.png -./text/char_bslash.png -./text/char_dollar.png -./text/char_l_w.png -./text/char_u_d.png -./text/char_u_t.png -./text/char_space.png -./text/char_l_x.png -./text/char_l_k.png -./text/char_6.png -./text/char_unknown.png -./text/char_comma.png -./text/char_obracket.png -./text/char_u_w.png -./text/char_7.png -./text/char_l_f.png -./text/char_vertical.png -./text/char_plus.png -./text/char_u_a.png -./text/char_star.png -./text/char_9.png -./text/char_u_k.png -./text/char_grave.png -./text/char_u_n.png -./text/char_percent.png -./text/char_u_m.png -./text/char_exclamation.png -./text/char_1.png -./text/char_l_q.png -./text/char_l_z.png -./text/char_l_h.png -./text/char_u_c.png -./text/char_l_g.png -./text/char_l_s.png -./text/char_fullstop.png -./text/char_u_j.png -./text/char_l_m.png -./text/char_l_t.png -./text/char_u_v.png -./text/char_colon.png -./text/char_l_i.png -./text/char_l_y.png -./text/char_semicolon.png -./text/char_u_l.png -./text/char_apostrophe.png -./text/char_u_e.png -./text/char_5.png -./text/char_2.png -./text/char_3.png -./text/char_l_p.png -./text/char_and.png -./text/char_fslash.png -./text/char_l_u.png -./text/char_u_f.png -./text/char_u_u.png -./text/char_at.png -./text/char_l_e.png -./text/char_l_l.png -./text/char_u_g.png -./text/char_u_q.png -./text/char_u_b.png -./text/char_l_o.png -./text/char_csbracket.png -./text/char_osbracket.png -./text/char_minus.png -./text/char_l_v.png -./text/char_lthan.png -./text/char_u_s.png -./text/char_equals.png -./text/char_8.png -./text/char_ccbracket.png -./text/char_underscore.png -./text/char_u_x.png -./text/char_0.png -./text/char_l_d.png -./text/char_l_c.png -./text/char_l_j.png -./text/char_u_z.png -./text/char_u_h.png -./text/char_pow.png -./text/char_hashtag.png -./text/char_gthan.png -./text/char_cbracket.png -./text/char_u_i.png -./text/char_question.png -./text/char_u_o.png -./text/char_u_y.png -./text/char_l_r.png -./text/char_l_b.png -./text/char_ocbracket.png -./text/char_l_a.png -./text/char_quotation.png -./text/char_l_n.png -./text/char_u_p.png -./text/char_tilde.png -./text/char_u_r.png -./text/char_4.png -./entity/armored_zombie_back_moving.png -./entity/zombie_front_still.png -./entity/tnt.png +./gui/label_recipe.png +./gui/slot_clothing_boots.png +./gui/selection_box_wide.png +./gui/gun.png +./gui/button_play.png +./tile/cactus4.png +./tile/hemp1.png +./tile/campfire_lit.png +./tile/dirt.png +./tile/lantern.png +./tile/hemp8.png +./tile/campfire_unlit.png +./tile/rock_gold.png +./tile/wall.png +./tile/cactus_top.png +./tile/cactus2.png +./tile/rock.png +./tile/water.png +./tile/hemp4.png +./tile/stone.png +./tile/tree_leaves.png +./tile/sapling2.png +./tile/ladder_up.png +./tile/sapling3.png +./tile/lava_flow.png +./tile/ice_wall.png +./tile/rock_iron.png +./tile/grass.png +./tile/chest.png +./tile/sapling4.png +./tile/lava.png +./tile/rock_coal.png +./tile/tall_grass.png +./tile/rock_uranium.png +./tile/rock_tin.png +./tile/hemp5.png +./tile/sapling1.png +./tile/snow.png +./tile/sandstone_wall.png +./tile/rock_sandstone.png +./tile/hemp6.png +./tile/cactus1.png +./tile/tree_branch_leaves.png +./tile/tunnel_down.png +./tile/tree_branch_leaves_snow.png +./tile/tree_leaves_snow.png +./tile/rock_ice.png +./tile/boss_portal.png +./tile/ladder.png +./tile/grass_burnt.png +./tile/hemp7.png +./tile/grass_infested.png +./tile/tree_branch.png +./tile/sand.png +./tile/tree_base.png +./tile/cactus3.png +./tile/sandstone.png +./tile/rock_copper.png +./tile/hemp3.png +./tile/hemp2.png +./tile/ice.png ./entity/flare.png -./entity/boss1/boss_walking.png +./entity/grappling_hook.png +./entity/zombie_back_moving.png +./entity/tnt.png +./entity/armored_zombie_back_moving.png +./entity/armored_zombie_front_moving.png +./entity/player/hair_side.png +./entity/player/head_top.png +./entity/player/head_side.png +./entity/player/head_back.png +./entity/player/head_bottom.png +./entity/player/hair_front.png +./entity/player/head_front.png +./entity/player/hair_back.png +./entity/player/hair_top.png +./entity/dummy.png +./entity/armored_zombie_front_still.png +./entity/armored_zombie_back_still.png +./entity/zombie_front_moving.png +./entity/boss1/boss_walking_firing.png ./entity/boss1/boss_firing.png ./entity/boss1/boss_still.png -./entity/boss1/boss_walking_firing.png -./entity/armored_zombie_back_still.png -./entity/armored_zombie_front_moving.png -./entity/player/head_back.png -./entity/player/hair_top.png -./entity/player/head_front.png -./entity/player/head_top.png -./entity/player/hair_side.png -./entity/player/head_side.png -./entity/player/hair_back.png -./entity/player/hair_front.png -./entity/player/head_bottom.png -./entity/grappling_hook.png +./entity/boss1/boss_walking.png ./entity/zombie_back_still.png -./entity/dummy.png -./entity/zombie_back_moving.png -./entity/armored_zombie_front_still.png -./entity/zombie_front_moving.png -./particle/smoke_1.png -./particle/water.png -./particle/rain.png -./particle/blood.png -./particle/snow.png -./particle/smoke_3.png -./particle/smoke_4.png -./particle/smoke_2.png -./particle/smoke_0.png -./particle/bullet.png -./particle/lava.png -./particle/smoke_trail.png -./particle/smoke_5.png +./entity/zombie_front_still.png +./item/acorn.png +./item/clay.png +./item/stone_hatchet.png +./item/grappling_hook.png +./item/gun_upgrade.png +./item/shield_upgrade.png +./item/rock_gold.png +./item/rock.png +./item/flint_hatchet.png +./item/rock_iron.png +./item/log.png +./item/ash.png +./item/charcoal.png +./item/torch_unlit.png +./item/log_snow.png +./item/hemp_seed.png +./item/stone_shovel.png +./item/rock_uranium.png +./item/rock_tin.png +./item/ammo_box.png +./item/plant_fibre.png +./item/health_potion.png +./item/snow_pile.png +./item/coal.png +./item/flint.png +./item/sandstone.png +./item/rock_copper.png +./item/stone_pick.png +./item/torch_lit.png