public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
   if (item instanceof ToolItem) {
     ToolItem tool = (ToolItem) item;
     if (tool.type == ToolType.pickaxe && tool.level == 4) {
       if (player.payStamina(4 - tool.level)) {
         hurt(level, xt, yt, random.nextInt(10) + (tool.level) * 5 + 10);
         return true;
       }
     }
   }
   return false;
 }
Beispiel #2
0
 public boolean interact(Level level, int x, int y, Player player, Item item, int attackDir) {
   if (item instanceof ToolItem) {
     ToolItem tool = (ToolItem) item;
     if (tool.type == ToolType.shovel) {
       if (player.payStamina(4 - tool.level)) {
         level.add(
             new ItemEntity(
                 new ResourceItem(Resource.flower),
                 x * 16 + random.nextInt(10) + 3,
                 y * 16 + random.nextInt(10) + 3));
         level.add(
             new ItemEntity(
                 new ResourceItem(Resource.flower),
                 x * 16 + random.nextInt(10) + 3,
                 y * 16 + random.nextInt(10) + 3));
         level.setTile(x, y, Tile.grass, 0);
         return true;
       }
     }
   }
   return false;
 }